mirror of
https://github.com/snltty/linker.git
synced 2025-10-31 04:26:45 +08:00
暂且去掉好64
This commit is contained in:
@@ -3,4 +3,9 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_LastSelectedProfileId>D:\desktop\cmonitor\cmonitor.install.win\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
<_LastSelectedProfileId>D:\desktop\cmonitor\cmonitor.install.win\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="MainForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -9,6 +9,12 @@
|
|||||||
#define IOCTL_REGISTER_PROCESS 0x80002010
|
#define IOCTL_REGISTER_PROCESS 0x80002010
|
||||||
#define IOCTL_TERMINATE_PROCESS 0x80002048
|
#define IOCTL_TERMINATE_PROCESS 0x80002048
|
||||||
|
|
||||||
|
struct FileDeleteArgs {
|
||||||
|
wchar_t file_path[256];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FILE_DELETE_IOCTL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x1337, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||||
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) int LoadDriver(char* g_serviceName,char* driverPath)
|
extern "C" __declspec(dllexport) int LoadDriver(char* g_serviceName,char* driverPath)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,2 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="MainForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -20,15 +20,3 @@ export const screenDisplay = (names, state) => {
|
|||||||
names, state
|
names, state
|
||||||
}, false, 1000);
|
}, false, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const screenShare = (name, names) => {
|
|
||||||
return sendWebsocketMsg('screen/share', {
|
|
||||||
names, name
|
|
||||||
}, false, 1000);
|
|
||||||
}
|
|
||||||
export const screenCloseShare = (name) => {
|
|
||||||
return sendWebsocketMsg('screen/closeShare', name, false, 1000);
|
|
||||||
}
|
|
||||||
export const screenGetShare = () => {
|
|
||||||
return sendWebsocketMsg('screen/getshare', {}, false, 1000);
|
|
||||||
}
|
|
||||||
@@ -51,12 +51,16 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const excludeArr = ['Microsoft Text Input Application', 'DragFileWindowTitle', 'TrafficMonitor', '安装', 'Program Manager'];
|
const excludeArr = ['CTF 加载程序', 'COM Surrogate', 'Windows 登录应用程序', 'Runtime Broker', 'Windows 模块安装程序',
|
||||||
|
'Windows 主进程 (Rundll32)', '控制台窗口主机', 'Host Process for Windows Services', 'Windows 音频设备图形隔离',
|
||||||
|
'后台处理程序子系统应用', '桌面窗口管理器', 'Local Security Authority Process', 'Windows 任务的主机进程',
|
||||||
|
'Microsoft Text Input Application', 'DragFileWindowTitle', 'TrafficMonitor', '安装', 'Program Manager',
|
||||||
|
'Windows 服务主进程'];
|
||||||
const getData = () => {
|
const getData = () => {
|
||||||
getActiveWindows(pluginState.value.activeWindow.devices[0].MachineName).then((res) => {
|
getActiveWindows(pluginState.value.activeWindow.devices[0].MachineName).then((res) => {
|
||||||
const arr = Object.keys(res).map(c => {
|
const arr = Object.keys(res).map(c => {
|
||||||
return {
|
return {
|
||||||
pid: c,
|
pid: +c,
|
||||||
title: res[c]
|
title: res[c]
|
||||||
}
|
}
|
||||||
}).filter(c => excludeArr.indexOf(c.title) == -1);
|
}).filter(c => excludeArr.indexOf(c.title) == -1);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { injectPluginState } from '../../provide'
|
import { injectPluginState } from '../../provide'
|
||||||
import { screenDisplay, screenShare } from '../../../../apis/screen'
|
import { screenDisplay } from '../../../../apis/screen'
|
||||||
import { injectGlobalData } from '@/views/provide';
|
import { injectGlobalData } from '@/views/provide';
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
@@ -54,14 +54,7 @@ export default {
|
|||||||
pluginState.value.screen.showShare = false;
|
pluginState.value.screen.showShare = false;
|
||||||
}
|
}
|
||||||
const handleConfirm = () => {
|
const handleConfirm = () => {
|
||||||
screenShare(pluginState.value.screen.device, pluginState.value.command.devices.map(c => c.MachineName)).then(() => {
|
|
||||||
handleCancel();
|
|
||||||
ElMessage.success('操作成功');
|
ElMessage.success('操作成功');
|
||||||
pluginState.value.screen.shareUpdateFlag = Date.now();
|
|
||||||
}).catch((e) => {
|
|
||||||
console.log(e);
|
|
||||||
ElMessage.error('操作失败');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { pluginState, globalState, handleDisplay, handleShare, handleCancel, handleConfirm }
|
return { pluginState, globalState, handleDisplay, handleShare, handleCancel, handleConfirm }
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMounted, watch } from 'vue';
|
import { onMounted, watch } from 'vue';
|
||||||
import { injectPluginState } from '../../provide'
|
import { injectPluginState } from '../../provide'
|
||||||
import { screenGetShare } from '@/apis/screen';
|
|
||||||
import { injectGlobalData } from '@/views/provide';
|
import { injectGlobalData } from '@/views/provide';
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
components: {},
|
||||||
@@ -14,24 +13,9 @@ export default {
|
|||||||
|
|
||||||
const pluginState = injectPluginState();
|
const pluginState = injectPluginState();
|
||||||
const globalState = injectGlobalData();
|
const globalState = injectGlobalData();
|
||||||
watch(() => pluginState.value.screen.shareUpdateFlag, () => {
|
watch(() => pluginState.value.screen.shareUpdateFlag, () => { });
|
||||||
getShareNames();
|
|
||||||
|
|
||||||
});
|
onMounted(() => { })
|
||||||
const getShareNames = () => {
|
|
||||||
screenGetShare().then((names) => {
|
|
||||||
globalState.value.devices.filter(c => names.indexOf(c.MachineName) >= 0).map(c => {
|
|
||||||
c.Screen.share = true;
|
|
||||||
});
|
|
||||||
globalState.value.devices.filter(c => names.indexOf(c.MachineName) < 0).map(c => {
|
|
||||||
c.Screen.share = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
getShareNames();
|
|
||||||
})
|
|
||||||
|
|
||||||
return { pluginState }
|
return { pluginState }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { screenCloseShare } from '@/apis/screen'
|
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { injectPluginState } from '../../provide';
|
import { injectPluginState } from '../../provide';
|
||||||
export default {
|
export default {
|
||||||
@@ -29,18 +28,7 @@ export default {
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
console.log(props.data);
|
const handleConfirm = () => { }
|
||||||
const handleConfirm = () => {
|
|
||||||
|
|
||||||
state.loading = true;
|
|
||||||
screenCloseShare(props.data.MachineName).then((res) => {
|
|
||||||
state.loading = false;
|
|
||||||
pluginState.value.screen.shareUpdateFlag = Date.now();
|
|
||||||
}).catch(() => {
|
|
||||||
state.loading = false;
|
|
||||||
ElMessage.error('操作失败!');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: props.data, state, handleConfirm
|
data: props.data, state, handleConfirm
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ export default {
|
|||||||
pluginState.value.shareSnatch.answers = answers;
|
pluginState.value.shareSnatch.answers = answers;
|
||||||
timer = setTimeout(loadQuestion, 1000);
|
timer = setTimeout(loadQuestion, 1000);
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e);
|
|
||||||
timer = setTimeout(loadQuestion, 1000);
|
timer = setTimeout(loadQuestion, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,14 +22,12 @@ export default {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setVolumeMute([props.data.MachineName], !props.data.Volume.Mute).then((res) => {
|
setVolumeMute([props.data.MachineName], !props.data.Volume.Mute).then((res) => {
|
||||||
console.log(res);
|
|
||||||
if (res) {
|
if (res) {
|
||||||
ElMessage.success('操作成功');
|
ElMessage.success('操作成功');
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('操作失败');
|
ElMessage.error('操作失败');
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e);
|
|
||||||
ElMessage.error('操作失败');
|
ElMessage.error('操作失败');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,12 @@ namespace cmonitor
|
|||||||
//日志输出
|
//日志输出
|
||||||
LoggerConsole();
|
LoggerConsole();
|
||||||
|
|
||||||
|
/*
|
||||||
|
foreach (var arg in Dns.GetHostByName(Dns.GetHostName()).AddressList)
|
||||||
|
{
|
||||||
|
Console.WriteLine(arg.Address.ToString());
|
||||||
|
}*/
|
||||||
|
|
||||||
//读取参数
|
//读取参数
|
||||||
Dictionary<string, string> dic = ArgumentParser.Parse(args, out string error);
|
Dictionary<string, string> dic = ArgumentParser.Parse(args, out string error);
|
||||||
#if RELEASE
|
#if RELEASE
|
||||||
@@ -193,7 +199,6 @@ namespace cmonitor
|
|||||||
else if (OperatingSystem.IsMacOS()) serviceCollection.AddSingleton<INotify, NotifyMacOS>();
|
else if (OperatingSystem.IsMacOS()) serviceCollection.AddSingleton<INotify, NotifyMacOS>();
|
||||||
|
|
||||||
serviceCollection.AddSingleton<ScreenReport>();
|
serviceCollection.AddSingleton<ScreenReport>();
|
||||||
serviceCollection.AddSingleton<ScreenShare>();
|
|
||||||
if (OperatingSystem.IsWindows()) serviceCollection.AddSingleton<IScreen, ScreenWindows>();
|
if (OperatingSystem.IsWindows()) serviceCollection.AddSingleton<IScreen, ScreenWindows>();
|
||||||
else if (OperatingSystem.IsLinux()) serviceCollection.AddSingleton<IScreen, ScreenLinux>();
|
else if (OperatingSystem.IsLinux()) serviceCollection.AddSingleton<IScreen, ScreenLinux>();
|
||||||
else if (OperatingSystem.IsMacOS()) serviceCollection.AddSingleton<IScreen, ScreenMacOS>();
|
else if (OperatingSystem.IsMacOS()) serviceCollection.AddSingleton<IScreen, ScreenMacOS>();
|
||||||
@@ -353,7 +358,7 @@ namespace cmonitor
|
|||||||
public int WebPort { get; set; } = 1800;
|
public int WebPort { get; set; } = 1800;
|
||||||
public int ApiPort { get; set; } = 1801;
|
public int ApiPort { get; set; } = 1801;
|
||||||
public int ServicePort { get; set; } = 1802;
|
public int ServicePort { get; set; } = 1802;
|
||||||
public IPAddress Server { get; set; } = IPAddress.Parse("192.168.1.18");
|
public IPAddress Server { get; set; } = IPAddress.Loopback;
|
||||||
public string WebRoot { get; set; } = "./web/";
|
public string WebRoot { get; set; } = "./web/";
|
||||||
public string Name { get; set; } = Dns.GetHostName();
|
public string Name { get; set; } = Dns.GetHostName();
|
||||||
|
|
||||||
@@ -363,7 +368,7 @@ namespace cmonitor
|
|||||||
public int ScreenDelay { get; set; } = 30;
|
public int ScreenDelay { get; set; } = 30;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 0项保留给各个功能的状态信息,每个一个字节为状态信息,看ShareMemoryState
|
/// 0项保留
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ShareMemoryKey { get; set; } = "cmonitor/share";
|
public string ShareMemoryKey { get; set; } = "cmonitor/share";
|
||||||
public int ShareMemoryLength { get; set; } = 10;
|
public int ShareMemoryLength { get; set; } = 10;
|
||||||
@@ -400,6 +405,7 @@ namespace cmonitor
|
|||||||
public const int ShareSnatchQuestionIndex = 5;
|
public const int ShareSnatchQuestionIndex = 5;
|
||||||
public const int ShareSnatchAnswerIndex = 6;
|
public const int ShareSnatchAnswerIndex = 6;
|
||||||
|
|
||||||
|
public const int ShareScreenShareIndex = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ArgumentParser
|
public class ArgumentParser
|
||||||
@@ -457,7 +463,7 @@ namespace cmonitor
|
|||||||
//服务器地址
|
//服务器地址
|
||||||
if (dic.ContainsKey("server") == false || string.IsNullOrWhiteSpace(dic["server"]))
|
if (dic.ContainsKey("server") == false || string.IsNullOrWhiteSpace(dic["server"]))
|
||||||
{
|
{
|
||||||
dic["server"] = "192.168.1.35";
|
dic["server"] = IPAddress.Loopback.ToString();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -549,6 +555,5 @@ namespace cmonitor
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,13 +12,11 @@ namespace cmonitor.api.services
|
|||||||
private readonly MessengerSender messengerSender;
|
private readonly MessengerSender messengerSender;
|
||||||
private readonly SignCaching signCaching;
|
private readonly SignCaching signCaching;
|
||||||
private readonly Config config;
|
private readonly Config config;
|
||||||
private readonly ScreenShare screenShare;
|
public ScreenClientService(MessengerSender messengerSender, SignCaching signCaching, Config config)
|
||||||
public ScreenClientService(MessengerSender messengerSender, SignCaching signCaching, Config config, ScreenShare screenShare)
|
|
||||||
{
|
{
|
||||||
this.messengerSender = messengerSender;
|
this.messengerSender = messengerSender;
|
||||||
this.signCaching = signCaching;
|
this.signCaching = signCaching;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.screenShare = screenShare;
|
|
||||||
}
|
}
|
||||||
public bool Full(ClientServiceParamsInfo param)
|
public bool Full(ClientServiceParamsInfo param)
|
||||||
{
|
{
|
||||||
@@ -113,21 +111,6 @@ namespace cmonitor.api.services
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public async Task<bool> Share(ClientServiceParamsInfo param)
|
|
||||||
{
|
|
||||||
ScreenShareParamInfo share = param.Content.DeJson<ScreenShareParamInfo>();
|
|
||||||
await screenShare.Start(share.Name, share.Names);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public async Task<bool> CloseShare(ClientServiceParamsInfo param)
|
|
||||||
{
|
|
||||||
await screenShare.Close(param.Content);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public string[] GetShare(ClientServiceParamsInfo param)
|
|
||||||
{
|
|
||||||
return screenShare.GetHostNames();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ScreenShareParamInfo
|
public sealed class ScreenShareParamInfo
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace cmonitor.client
|
|||||||
WindowNames = clientConfig.WindowNames;
|
WindowNames = clientConfig.WindowNames;
|
||||||
WindowIds = clientConfig.WindowIds;
|
WindowIds = clientConfig.WindowIds;
|
||||||
UserSid = clientConfig.UserSid;
|
UserSid = clientConfig.UserSid;
|
||||||
|
Wlan = clientConfig.Wlan;
|
||||||
SaveTask();
|
SaveTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,6 +137,17 @@ namespace cmonitor.client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string _wlan = string.Empty;
|
||||||
|
public string Wlan
|
||||||
|
{
|
||||||
|
get => _wlan; set
|
||||||
|
{
|
||||||
|
_wlan = value;
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
configDataProvider.Save(this).Wait();
|
configDataProvider.Save(this).Wait();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace cmonitor.client
|
|||||||
public bool Connected => Connection != null && Connection.Connected;
|
public bool Connected => Connection != null && Connection.Connected;
|
||||||
|
|
||||||
private int networdkEnabledTimes = 0;
|
private int networdkEnabledTimes = 0;
|
||||||
|
public Action NetworkDisabledHandle { get; set; }
|
||||||
public Action<int> NetworkEnabledHandle { get; set; }
|
public Action<int> NetworkEnabledHandle { get; set; }
|
||||||
public Action NetworkFirstEnabledHandle { get; set; }
|
public Action NetworkFirstEnabledHandle { get; set; }
|
||||||
public bool NetworkEnabled => Connected;
|
public bool NetworkEnabled => Connected;
|
||||||
@@ -20,5 +21,9 @@ namespace cmonitor.client
|
|||||||
NetworkEnabledHandle?.Invoke(networdkEnabledTimes);
|
NetworkEnabledHandle?.Invoke(networdkEnabledTimes);
|
||||||
networdkEnabledTimes++;
|
networdkEnabledTimes++;
|
||||||
}
|
}
|
||||||
|
public void PushNetworkDisabled()
|
||||||
|
{
|
||||||
|
NetworkDisabledHandle?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ namespace cmonitor.client
|
|||||||
if (config.IsCLient)
|
if (config.IsCLient)
|
||||||
{
|
{
|
||||||
SignInTask();
|
SignInTask();
|
||||||
|
tcpServer.OnDisconnected += (hashcode) =>
|
||||||
|
{
|
||||||
|
clientSignInState.PushNetworkDisabled();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +107,5 @@ namespace cmonitor.client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ namespace cmonitor.client.reports.active
|
|||||||
CommandHelper.Windows(string.Empty, new string[] { "gpupdate /force" });
|
CommandHelper.Windows(string.Empty, new string[] { "gpupdate /force" });
|
||||||
});
|
});
|
||||||
InitDriver();
|
InitDriver();
|
||||||
|
|
||||||
|
AppDomain.CurrentDomain.ProcessExit += (s, e) =>
|
||||||
|
{
|
||||||
|
CommandHelper.Windows(string.Empty, new string[] { "sc stop cmonitor.killer & sc delete cmonitor.killer" }, true);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,14 +247,39 @@ namespace cmonitor.client.reports.active
|
|||||||
return true;
|
return true;
|
||||||
}, IntPtr.Zero);
|
}, IntPtr.Zero);
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var processs = Process.GetProcesses();
|
||||||
|
foreach (var item in processs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(item.MainModule.FileVersionInfo.FileDescription) == false)
|
||||||
|
{
|
||||||
|
dic[(uint)item.Id] = item.MainModule.FileVersionInfo.FileDescription;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
return dic;
|
return dic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitDriver()
|
private void InitDriver()
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//#if RELEASE
|
||||||
LoadDriver("cmonitor.killer", Path.GetFullPath(Path.Join("./", "killer.sys")));
|
LoadDriver("cmonitor.killer", Path.GetFullPath(Path.Join("./", "killer.sys")));
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -260,7 +290,11 @@ namespace cmonitor.client.reports.active
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProcessKiller((uint)pid);
|
int res = ProcessKiller((uint)pid);
|
||||||
|
if (res == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,151 +0,0 @@
|
|||||||
using cmonitor.libs;
|
|
||||||
using cmonitor.service;
|
|
||||||
using cmonitor.service.messengers.screen;
|
|
||||||
using cmonitor.service.messengers.setting;
|
|
||||||
using cmonitor.service.messengers.sign;
|
|
||||||
using common.libs;
|
|
||||||
using MemoryPack;
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
|
|
||||||
namespace cmonitor.client.reports.screen
|
|
||||||
{
|
|
||||||
public sealed class ScreenShare
|
|
||||||
{
|
|
||||||
private readonly Config config;
|
|
||||||
private readonly SignCaching signCaching;
|
|
||||||
private readonly MessengerSender messengerSender;
|
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<string, string[]> shareMap = new ConcurrentDictionary<string, string[]>();
|
|
||||||
|
|
||||||
public ScreenShare(Config config, SignCaching signCaching, MessengerSender messengerSender)
|
|
||||||
{
|
|
||||||
this.config = config;
|
|
||||||
this.signCaching = signCaching;
|
|
||||||
this.messengerSender = messengerSender;
|
|
||||||
|
|
||||||
if (config.IsCLient)
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ShareMemory shareMemory;
|
|
||||||
private void Init()
|
|
||||||
{
|
|
||||||
shareMemory = new ShareMemory($"{config.ShareMemoryKey}/screen", 1, 2 * 1024 * 1024);
|
|
||||||
shareMemory.InitLocal();
|
|
||||||
}
|
|
||||||
public async Task Start(string machineName, string[] names)
|
|
||||||
{
|
|
||||||
if (config.IsCLient)
|
|
||||||
{
|
|
||||||
_ = Task.Run(() =>
|
|
||||||
{
|
|
||||||
CommandHelper.Windows(string.Empty, new string[] {
|
|
||||||
$"start cmonitor.share.win.exe {config.ShareMemoryKey}/screen {2 * 1024 * 1024}"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (names.Length > 0)
|
|
||||||
{
|
|
||||||
shareMap.AddOrUpdate(machineName, names, (a, b) => names);
|
|
||||||
|
|
||||||
if (signCaching.Get(machineName, out SignCacheInfo sign) && sign.Connected)
|
|
||||||
{
|
|
||||||
await messengerSender.SendOnly(new MessageRequestWrap
|
|
||||||
{
|
|
||||||
Connection = sign.Connection,
|
|
||||||
MessengerId = (ushort)SettingMessengerIds.Share,
|
|
||||||
Payload = MemoryPackSerializer.Serialize(new SettingShareInfo { ScreenDelay = 30, ScreenScale = 1f })
|
|
||||||
});
|
|
||||||
}
|
|
||||||
foreach (string name in names)
|
|
||||||
{
|
|
||||||
if (signCaching.Get(name, out sign) && sign.Connected)
|
|
||||||
{
|
|
||||||
await messengerSender.SendOnly(new MessageRequestWrap
|
|
||||||
{
|
|
||||||
Connection = sign.Connection,
|
|
||||||
MessengerId = (ushort)ScreenMessengerIds.ShareStart
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public async Task Close(string machineName)
|
|
||||||
{
|
|
||||||
if (config.IsCLient)
|
|
||||||
{
|
|
||||||
shareMemory.AddAttribute(0, ShareMemoryAttribute.Closed);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(machineName))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (shareMap.TryRemove(machineName, out string[] names))
|
|
||||||
{
|
|
||||||
if (signCaching.Get(machineName, out SignCacheInfo sign) && sign.Connected)
|
|
||||||
{
|
|
||||||
await messengerSender.SendOnly(new MessageRequestWrap
|
|
||||||
{
|
|
||||||
Connection = sign.Connection,
|
|
||||||
MessengerId = (ushort)SettingMessengerIds.Share,
|
|
||||||
Payload = MemoryPackSerializer.Serialize(new SettingShareInfo { ScreenDelay = config.ScreenDelay, ScreenScale = config.ScreenScale })
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string name in names)
|
|
||||||
{
|
|
||||||
if (signCaching.Get(name, out sign) && sign.Connected)
|
|
||||||
{
|
|
||||||
await messengerSender.SendOnly(new MessageRequestWrap
|
|
||||||
{
|
|
||||||
Connection = sign.Connection,
|
|
||||||
MessengerId = (ushort)ScreenMessengerIds.ShareClose
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string[] GetHostNames()
|
|
||||||
{
|
|
||||||
return shareMap.Keys.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetData(Memory<byte> data)
|
|
||||||
{
|
|
||||||
shareMemory.Update(0, Helper.EmptyArray, data.Span);
|
|
||||||
if (shareMemory.ReadAttributeEqual(0, ShareMemoryAttribute.Running) == false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public async ValueTask<bool> ShareData(string machineName, Memory<byte> data)
|
|
||||||
{
|
|
||||||
if (shareMap.TryGetValue(machineName, out string[] names))
|
|
||||||
{
|
|
||||||
foreach (string name in names)
|
|
||||||
{
|
|
||||||
if (signCaching.Get(name, out SignCacheInfo sign) && sign.Connected)
|
|
||||||
{
|
|
||||||
await messengerSender.SendOnly(new MessageRequestWrap
|
|
||||||
{
|
|
||||||
Connection = sign.Connection,
|
|
||||||
MessengerId = (ushort)ScreenMessengerIds.ShareData,
|
|
||||||
Payload = data,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -49,9 +49,9 @@ namespace cmonitor.client.reports.screen
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
FFmpegHelper.Initialize();
|
//FFmpegHelper.Initialize();
|
||||||
InitCapture();
|
InitCapture();
|
||||||
InitEncoder();
|
//InitEncoder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ namespace cmonitor.client.reports.screen
|
|||||||
{
|
{
|
||||||
fullImageBytes = new byte[length];
|
fullImageBytes = new byte[length];
|
||||||
}
|
}
|
||||||
Console.WriteLine($"image {length}");
|
//Console.WriteLine($"image {length}");
|
||||||
ms.Read(fullImageBytes.AsSpan(0, length));
|
ms.Read(fullImageBytes.AsSpan(0, length));
|
||||||
frame.FullImage = fullImageBytes.AsMemory(0, length);
|
frame.FullImage = fullImageBytes.AsMemory(0, length);
|
||||||
}
|
}
|
||||||
|
|||||||
158
cmonitor/client/reports/wlan/WlanReport.cs
Normal file
158
cmonitor/client/reports/wlan/WlanReport.cs
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
using common.libs;
|
||||||
|
using common.libs.winapis;
|
||||||
|
using SharpDX;
|
||||||
|
using System.Numerics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace cmonitor.client.reports.volume
|
||||||
|
{
|
||||||
|
public sealed class WlanReport : IReport
|
||||||
|
{
|
||||||
|
public string Name => "Wlan";
|
||||||
|
|
||||||
|
|
||||||
|
Dictionary<string, Wlanapi.WLAN_AVAILABLE_NETWORK> wlans = new Dictionary<string, Wlanapi.WLAN_AVAILABLE_NETWORK>();
|
||||||
|
|
||||||
|
private readonly Config config;
|
||||||
|
private readonly ClientConfig clientConfig;
|
||||||
|
public WlanReport(Config config, ClientConfig clientConfig)
|
||||||
|
{
|
||||||
|
this.config = config;
|
||||||
|
this.clientConfig = clientConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object GetReports(ReportType reportType)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WlanEnums(nint wlanHandle)
|
||||||
|
{
|
||||||
|
IntPtr hClientHandle;
|
||||||
|
uint negotiatedVersion;
|
||||||
|
uint result = Wlanapi.WlanOpenHandle(2, IntPtr.Zero, out negotiatedVersion, out hClientHandle);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntPtr pInterfaceList;
|
||||||
|
result = Wlanapi.WlanEnumInterfaces(wlanHandle, IntPtr.Zero, out pInterfaceList);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
Wlanapi.WlanCloseHandle(wlanHandle, IntPtr.Zero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Wlanapi.WLAN_INTERFACE_INFO_LIST interfaceList = (Wlanapi.WLAN_INTERFACE_INFO_LIST)Marshal.PtrToStructure(pInterfaceList, typeof(Wlanapi.WLAN_INTERFACE_INFO_LIST));
|
||||||
|
|
||||||
|
if (interfaceList.dwNumberOfItems > 0)
|
||||||
|
{
|
||||||
|
Guid interfaceGuid = interfaceList.InterfaceInfo[0].InterfaceGuid;
|
||||||
|
|
||||||
|
IntPtr pAvailableNetworkList;
|
||||||
|
result = Wlanapi.WlanGetAvailableNetworkList(wlanHandle, ref interfaceGuid, 0, IntPtr.Zero, out pAvailableNetworkList);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
Wlanapi.WlanFreeMemory(pInterfaceList);
|
||||||
|
Wlanapi.WlanCloseHandle(wlanHandle, IntPtr.Zero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Wlanapi.WLAN_AVAILABLE_NETWORK_LIST availableNetworkList = (Wlanapi.WLAN_AVAILABLE_NETWORK_LIST)Marshal.PtrToStructure(pAvailableNetworkList, typeof(Wlanapi.WLAN_AVAILABLE_NETWORK_LIST));
|
||||||
|
foreach (Wlanapi.WLAN_AVAILABLE_NETWORK network in availableNetworkList.Network)
|
||||||
|
{
|
||||||
|
// 这里可以根据需要修改要连接的网络名称和密码
|
||||||
|
if (network.dot11Ssid.uSSIDLength == 6)
|
||||||
|
{
|
||||||
|
wlans[Encoding.ASCII.GetString(network.dot11Ssid.ucSSID, 0, (int)network.dot11Ssid.uSSIDLength)] = network;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Wlanapi.WlanFreeMemory(pAvailableNetworkList);
|
||||||
|
}
|
||||||
|
|
||||||
|
Wlanapi.WlanFreeMemory(pInterfaceList);
|
||||||
|
Wlanapi.WlanCloseHandle(wlanHandle, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WlanConnect(string name)
|
||||||
|
{
|
||||||
|
IntPtr hClientHandle;
|
||||||
|
uint negotiatedVersion;
|
||||||
|
uint result = Wlanapi.WlanOpenHandle(2, IntPtr.Zero, out negotiatedVersion, out hClientHandle);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntPtr pInterfaceList;
|
||||||
|
result = Wlanapi.WlanEnumInterfaces(hClientHandle, IntPtr.Zero, out pInterfaceList);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
Wlanapi.WlanCloseHandle(hClientHandle, IntPtr.Zero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Wlanapi.WLAN_INTERFACE_INFO_LIST interfaceList = (Wlanapi.WLAN_INTERFACE_INFO_LIST)Marshal.PtrToStructure(pInterfaceList, typeof(Wlanapi.WLAN_INTERFACE_INFO_LIST));
|
||||||
|
if (interfaceList.dwNumberOfItems > 0)
|
||||||
|
{
|
||||||
|
Guid interfaceGuid = interfaceList.InterfaceInfo[0].InterfaceGuid;
|
||||||
|
|
||||||
|
IntPtr pAvailableNetworkList;
|
||||||
|
result = Wlanapi.WlanGetAvailableNetworkList(hClientHandle, ref interfaceGuid, 0, IntPtr.Zero, out pAvailableNetworkList);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
Wlanapi.WlanFreeMemory(pInterfaceList);
|
||||||
|
Wlanapi.WlanCloseHandle(hClientHandle, IntPtr.Zero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Wlanapi.WLAN_AVAILABLE_NETWORK_LIST availableNetworkList = (Wlanapi.WLAN_AVAILABLE_NETWORK_LIST)Marshal.PtrToStructure(pAvailableNetworkList, typeof(Wlanapi.WLAN_AVAILABLE_NETWORK_LIST));
|
||||||
|
foreach (Wlanapi.WLAN_AVAILABLE_NETWORK network in availableNetworkList.Network)
|
||||||
|
{
|
||||||
|
// 这里可以根据需要修改要连接的网络名称和密码
|
||||||
|
if (network.dot11Ssid.uSSIDLength == 6 && Encoding.ASCII.GetString(network.dot11Ssid.ucSSID, 0, (int)network.dot11Ssid.uSSIDLength) == name)
|
||||||
|
{
|
||||||
|
Wlanapi.WLAN_CONNECTION_PARAMETERS connectionParams = new Wlanapi.WLAN_CONNECTION_PARAMETERS();
|
||||||
|
connectionParams.wlanConnectionMode = Wlanapi.WLAN_CONNECTION_MODE.wlan_connection_mode_profile;
|
||||||
|
connectionParams.strProfile = network.strProfileName;
|
||||||
|
connectionParams.pDot11Ssid = network.dot11Ssid;
|
||||||
|
//connectionParams.pDesiredBssidList = null;
|
||||||
|
connectionParams.dot11BssType = network.dot11BssType;
|
||||||
|
connectionParams.dwFlags = 0;
|
||||||
|
|
||||||
|
result = Wlanapi.WlanConnect(hClientHandle, ref interfaceGuid, ref connectionParams, IntPtr.Zero);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
Logger.Instance.Error("WlanConnect failed with error: " + result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clientConfig.Wlan = name;
|
||||||
|
Logger.Instance.Info("Successfully connected to the network.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Wlanapi.WlanFreeMemory(pAvailableNetworkList);
|
||||||
|
}
|
||||||
|
|
||||||
|
Wlanapi.WlanFreeMemory(pInterfaceList);
|
||||||
|
Wlanapi.WlanCloseHandle(hClientHandle, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class WlanReportInfo
|
||||||
|
{
|
||||||
|
public float Value { get; set; }
|
||||||
|
public bool Mute { get; set; }
|
||||||
|
public float MasterPeak { get; set; }
|
||||||
|
|
||||||
|
public int HashCode()
|
||||||
|
{
|
||||||
|
return Value.GetHashCode() ^ Mute.GetHashCode() ^ MasterPeak.GetHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,6 +12,7 @@ namespace cmonitor.service
|
|||||||
private UdpClient socketUdp;
|
private UdpClient socketUdp;
|
||||||
private CancellationTokenSource cancellationTokenSource;
|
private CancellationTokenSource cancellationTokenSource;
|
||||||
public Func<IConnection, Task> OnPacket { get; set; } = async (connection) => { await Task.CompletedTask; };
|
public Func<IConnection, Task> OnPacket { get; set; } = async (connection) => { await Task.CompletedTask; };
|
||||||
|
public Action<int> OnDisconnected { get; set; }
|
||||||
|
|
||||||
private readonly Config config;
|
private readonly Config config;
|
||||||
public TcpServer(Config config)
|
public TcpServer(Config config)
|
||||||
@@ -91,9 +92,6 @@ namespace cmonitor.service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void StartAccept(SocketAsyncEventArgs acceptEventArg)
|
private void StartAccept(SocketAsyncEventArgs acceptEventArg)
|
||||||
{
|
{
|
||||||
acceptEventArg.AcceptSocket = null;
|
acceptEventArg.AcceptSocket = null;
|
||||||
@@ -262,6 +260,7 @@ namespace cmonitor.service
|
|||||||
token.Clear();
|
token.Clear();
|
||||||
e.Dispose();
|
e.Dispose();
|
||||||
}
|
}
|
||||||
|
OnDisconnected?.Invoke(token.Socket.GetHashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConnection CreateConnection(Socket socket)
|
public IConnection CreateConnection(Socket socket)
|
||||||
|
|||||||
@@ -11,16 +11,14 @@ namespace cmonitor.service.messengers.screen
|
|||||||
private readonly IClientServer clientServer;
|
private readonly IClientServer clientServer;
|
||||||
private readonly Config config;
|
private readonly Config config;
|
||||||
private readonly SignCaching signCaching;
|
private readonly SignCaching signCaching;
|
||||||
private readonly ScreenShare screenShare;
|
|
||||||
|
|
||||||
|
|
||||||
public ScreenMessenger(ScreenReport screenReport, IClientServer clientServer, Config config, SignCaching signCaching, ScreenShare screenShare)
|
public ScreenMessenger(ScreenReport screenReport, IClientServer clientServer, Config config, SignCaching signCaching)
|
||||||
{
|
{
|
||||||
this.screenReport = screenReport;
|
this.screenReport = screenReport;
|
||||||
this.clientServer = clientServer;
|
this.clientServer = clientServer;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.signCaching = signCaching;
|
this.signCaching = signCaching;
|
||||||
this.screenShare = screenShare;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MessengerId((ushort)ScreenMessengerIds.CaptureFull)]
|
[MessengerId((ushort)ScreenMessengerIds.CaptureFull)]
|
||||||
@@ -35,11 +33,8 @@ namespace cmonitor.service.messengers.screen
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MessengerId((ushort)ScreenMessengerIds.CaptureFullReport)]
|
[MessengerId((ushort)ScreenMessengerIds.CaptureFullReport)]
|
||||||
public async Task CaptureFullReport(IConnection connection)
|
public void CaptureFullReport(IConnection connection)
|
||||||
{
|
{
|
||||||
bool shared = await screenShare.ShareData(connection.Name, connection.ReceiveRequestWrap.Payload);
|
|
||||||
if (shared) return;
|
|
||||||
|
|
||||||
if (signCaching.Get(connection.Name, out SignCacheInfo cache))
|
if (signCaching.Get(connection.Name, out SignCacheInfo cache))
|
||||||
{
|
{
|
||||||
if (cache.Version == config.Version)
|
if (cache.Version == config.Version)
|
||||||
@@ -89,30 +84,6 @@ namespace cmonitor.service.messengers.screen
|
|||||||
screenReport.SetDisplayState(state == 1);
|
screenReport.SetDisplayState(state == 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MessengerId((ushort)ScreenMessengerIds.ShareData)]
|
|
||||||
public void ShareData(IConnection connection)
|
|
||||||
{
|
|
||||||
screenShare.SetData(connection.ReceiveRequestWrap.Payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MessengerId((ushort)ScreenMessengerIds.ShareStart)]
|
|
||||||
public async Task ShareStart(IConnection connection)
|
|
||||||
{
|
|
||||||
string[] names = Array.Empty<string>();
|
|
||||||
if (connection.ReceiveRequestWrap.Payload.Length > 0)
|
|
||||||
{
|
|
||||||
names = MemoryPackSerializer.Deserialize<string[]>(connection.ReceiveRequestWrap.Payload.Span);
|
|
||||||
}
|
|
||||||
await screenShare.Start(connection.Name, names);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MessengerId((ushort)ScreenMessengerIds.ShareClose)]
|
|
||||||
public async Task ShareClose(IConnection connection)
|
|
||||||
{
|
|
||||||
await screenShare.Close(connection.Name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
DisplayState = 806,
|
DisplayState = 806,
|
||||||
|
|
||||||
ShareStart = 807,
|
|
||||||
ShareData = 808,
|
|
||||||
ShareClose = 809,
|
|
||||||
|
|
||||||
None = 899
|
None = 899
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -456,6 +456,7 @@ namespace common.libs.winapis
|
|||||||
};
|
};
|
||||||
Kernel32.SetSystemTime(ref st);
|
Kernel32.SetSystemTime(ref st);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -484,4 +485,6 @@ namespace common.libs.winapis
|
|||||||
public int LastLogon;
|
public int LastLogon;
|
||||||
public string Sid;
|
public string Sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
184
common.libs/winapis/Wlanapi.cs
Normal file
184
common.libs/winapis/Wlanapi.cs
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace common.libs.winapis
|
||||||
|
{
|
||||||
|
public static class Wlanapi
|
||||||
|
{
|
||||||
|
[DllImport("Wlanapi.dll", SetLastError = true)]
|
||||||
|
public static extern uint WlanOpenHandle(uint dwClientVersion, IntPtr pReserved, out uint pdwNegotiatedVersion, out IntPtr phClientHandle);
|
||||||
|
|
||||||
|
[DllImport("Wlanapi.dll", SetLastError = true)]
|
||||||
|
public static extern uint WlanCloseHandle(IntPtr hClientHandle, IntPtr pReserved);
|
||||||
|
|
||||||
|
[DllImport("Wlanapi.dll", SetLastError = true)]
|
||||||
|
public static extern uint WlanEnumInterfaces(IntPtr hClientHandle, IntPtr pReserved, out IntPtr ppInterfaceList);
|
||||||
|
|
||||||
|
[DllImport("Wlanapi.dll", SetLastError = true)]
|
||||||
|
public static extern uint WlanGetAvailableNetworkList(IntPtr hClientHandle, ref Guid pInterfaceGuid, uint dwFlags, IntPtr pReserved, out IntPtr ppAvailableNetworkList);
|
||||||
|
|
||||||
|
[DllImport("Wlanapi.dll", SetLastError = true)]
|
||||||
|
public static extern uint WlanFreeMemory(IntPtr pMemory);
|
||||||
|
|
||||||
|
[DllImport("Wlanapi.dll", SetLastError = true)]
|
||||||
|
public static extern uint WlanConnect(IntPtr hClientHandle, ref Guid pInterfaceGuid, ref WLAN_CONNECTION_PARAMETERS pConnectionParameters, IntPtr pReserved);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
public struct WLAN_INTERFACE_INFO_LIST
|
||||||
|
{
|
||||||
|
public uint dwNumberOfItems;
|
||||||
|
public uint dwIndex;
|
||||||
|
public WLAN_INTERFACE_INFO[] InterfaceInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
public struct WLAN_INTERFACE_INFO
|
||||||
|
{
|
||||||
|
public Guid InterfaceGuid;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
|
public string strInterfaceDescription;
|
||||||
|
public WLAN_INTERFACE_STATE isState;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
public struct WLAN_AVAILABLE_NETWORK_LIST
|
||||||
|
{
|
||||||
|
public uint dwNumberOfItems;
|
||||||
|
public uint dwIndex;
|
||||||
|
public WLAN_AVAILABLE_NETWORK[] Network;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
public struct WLAN_AVAILABLE_NETWORK
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
|
public string strProfileName;
|
||||||
|
public DOT11_SSID dot11Ssid;
|
||||||
|
public DOT11_BSS_TYPE dot11BssType;
|
||||||
|
public uint uNumberOfBssids;
|
||||||
|
public bool bNetworkConnectable;
|
||||||
|
public uint wlanNotConnectableReason;
|
||||||
|
public uint uNumberOfPhyTypes;
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||||
|
public DOT11_PHY_TYPE[] dot11PhyTypes;
|
||||||
|
public bool bMorePhyTypes;
|
||||||
|
public int wlanSignalQuality;
|
||||||
|
public bool bSecurityEnabled;
|
||||||
|
public DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm;
|
||||||
|
public DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm;
|
||||||
|
public uint dwFlags;
|
||||||
|
public uint dwReserved;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
public struct DOT11_SSID
|
||||||
|
{
|
||||||
|
public uint uSSIDLength;
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||||
|
public byte[] ucSSID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum WLAN_INTERFACE_STATE
|
||||||
|
{
|
||||||
|
wlan_interface_state_not_ready,
|
||||||
|
wlan_interface_state_connected,
|
||||||
|
wlan_interface_state_ad_hoc_network_formed,
|
||||||
|
wlan_interface_state_disconnecting,
|
||||||
|
wlan_interface_state_disconnected,
|
||||||
|
wlan_interface_state_associating,
|
||||||
|
wlan_interface_state_discovering,
|
||||||
|
wlan_interface_state_authenticating
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DOT11_BSS_TYPE
|
||||||
|
{
|
||||||
|
dot11_BSS_type_infrastructure = 1,
|
||||||
|
dot11_BSS_type_independent = 2,
|
||||||
|
dot11_BSS_type_any = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DOT11_PHY_TYPE
|
||||||
|
{
|
||||||
|
dot11_phy_type_unknown,
|
||||||
|
dot11_phy_type_any,
|
||||||
|
dot11_phy_type_fhss,
|
||||||
|
dot11_phy_type_dsss,
|
||||||
|
dot11_phy_type_irbaseband,
|
||||||
|
dot11_phy_type_ofdm,
|
||||||
|
dot11_phy_type_hrdsss,
|
||||||
|
dot11_phy_type_erp,
|
||||||
|
dot11_phy_type_ht,
|
||||||
|
dot11_phy_type_IHV_start,
|
||||||
|
dot11_phy_type_IHV_end
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DOT11_AUTH_ALGORITHM
|
||||||
|
{
|
||||||
|
DOT11_AUTH_ALGO_80211_OPEN = 1,
|
||||||
|
DOT11_AUTH_ALGO_80211_SHARED_KEY = 2,
|
||||||
|
DOT11_AUTH_ALGO_WPA = 3,
|
||||||
|
DOT11_AUTH_ALGO_WPA_PSK = 4,
|
||||||
|
DOT11_AUTH_ALGO_WPA_NONE = 5,
|
||||||
|
DOT11_AUTH_ALGO_RSNA = 6,
|
||||||
|
DOT11_AUTH_ALGO_RSNA_PSK = 7,
|
||||||
|
DOT11_AUTH_ALGO_IHV_START = -2147483648,
|
||||||
|
DOT11_AUTH_ALGO_IHV_END = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DOT11_CIPHER_ALGORITHM:uint
|
||||||
|
{
|
||||||
|
DOT11_CIPHER_ALGO_NONE = 0x00,
|
||||||
|
DOT11_CIPHER_ALGO_WEP40 = 0x01,
|
||||||
|
DOT11_CIPHER_ALGO_TKIP = 0x02,
|
||||||
|
DOT11_CIPHER_ALGO_CCMP = 0x04,
|
||||||
|
DOT11_CIPHER_ALGO_WEP104 = 0x05,
|
||||||
|
DOT11_CIPHER_ALGO_WPA_USE_GROUP = 0x100,
|
||||||
|
DOT11_CIPHER_ALGO_RSN_USE_GROUP = 0x100,
|
||||||
|
DOT11_CIPHER_ALGO_WEP = 0x101,
|
||||||
|
DOT11_CIPHER_ALGO_IHV_START = 0x80000000,
|
||||||
|
DOT11_CIPHER_ALGO_IHV_END = 0xffffffff
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct WLAN_CONNECTION_PARAMETERS
|
||||||
|
{
|
||||||
|
public WLAN_CONNECTION_MODE wlanConnectionMode;
|
||||||
|
public string strProfile;
|
||||||
|
public DOT11_SSID pDot11Ssid;
|
||||||
|
public DOT11_BSSID_LIST pDesiredBssidList;
|
||||||
|
public DOT11_BSS_TYPE dot11BssType;
|
||||||
|
public uint dwFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum WLAN_CONNECTION_MODE
|
||||||
|
{
|
||||||
|
wlan_connection_mode_profile,
|
||||||
|
wlan_connection_mode_temporary_profile,
|
||||||
|
wlan_connection_mode_discovery_secure,
|
||||||
|
wlan_connection_mode_discovery_unsecure,
|
||||||
|
wlan_connection_mode_auto,
|
||||||
|
wlan_connection_mode_invalid
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DOT11_BSSID_LIST
|
||||||
|
{
|
||||||
|
public uint uNumOfEntries;
|
||||||
|
public uint uTotalNumOfEntries;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
||||||
|
public DOT11_MAC_ADDRESS[] BSSIDs;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DOT11_MAC_ADDRESS
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||||
|
public byte[] ucMacAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ for %%r in (win-x64,win-x64-any) do (
|
|||||||
|
|
||||||
for %%r in (linux-x64,linux-x64-any) do (
|
for %%r in (linux-x64,linux-x64-any) do (
|
||||||
echo F|xcopy "public\\extends\\web\\*" "public\\publish\\%%r\\web\\*" /s /f /h /y
|
echo F|xcopy "public\\extends\\web\\*" "public\\publish\\%%r\\web\\*" /s /f /h /y
|
||||||
for %%f in (nfapi.dll,nfdriver.sys,ntrights.exe,ffmpeg,killer.sys,cmonitor.killer.dll) do (
|
for %%f in (nfapi.dll,nfdriver.sys,ntrights.exe,killer.sys,cmonitor.killer.dll) do (
|
||||||
echo F|del "public\\publish\\%%r\\%%f"
|
echo F|del "public\\publish\\%%r\\%%f"
|
||||||
rd /s /q "public\\publish\\%%r\\%%f"
|
rd /s /q "public\\publish\\%%r\\%%f"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user