資源簡介
本系統以 C/S 架構采用 Socket 技術開發,可以運用本軟件在局域網中實施監控管理。服務器端可以實時觀察遠程客戶端,并可以對客戶端進行各種操作,例如:關機、注銷賬戶或重新啟動,當然還可以對客戶端輸入設備進行鎖定和解鎖。除了這些,服務器端可以執行更高級的操作:即瀏覽客戶端文件系統,并可以任意拷貝指定的客戶端目錄。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Net;
using?System.Net.Sockets;
using?System.Threading;
using?System.IO;
using?System.Runtime.InteropServices;
using?System.Diagnostics;
using?Microsoft.Win32;
using?System.xml;
namespace?Client
{
????public?partial?class?Form2?:?Form
????{
????????Socket?clientS?=?null;
????????IPEndPoint?endpoint?=?null;
????????bool?flag?=?false;
????????string?xmlFile?=?““;
????????string?ip?=?““;
????????string?remoteIp?=?““;
????????[StructLayout(LayoutKind.Sequential?Pack?=?1)]
????????internal?struct?TokPrivLuid
????????{
????????????public?int?Count;
????????????public?long?Luid;
????????????public?int?Attr;
????????}
????????[DllImport(“user32.dll“)]?//鎖定鍵盤和鼠標
????????private?static?extern?void?BlockInput(bool?Block);
????????[DllImport(“kernel32.dll“?ExactSpelling?=?true)]?//獲取當前進程
????????internal?static?extern?IntPtr?GetCurrentProcess();
????????[DllImport(“advapi32.dll“?ExactSpelling?=?true?SetLastError?=?true)]//打開進程句柄
????????internal?static?extern?bool?OpenProcessToken(IntPtr?h?int?acc?ref?IntPtr?phtok);
????????[DllImport(“advapi32.dll“?SetLastError?=?true)]?//檢查當前操作系統用戶權限
????????internal?static?extern?bool?LookupPrivilegeValue(string?host?string?name?ref?long?pluid);
????????[DllImport(“advapi32.dll“?ExactSpelling?=?true?SetLastError?=?true)]//如果當前用戶沒有權限執行?API?則調整權限
????????internal?static?extern?bool?AdjustTokenPrivileges(IntPtr?htok?bool?disall?ref?TokPrivLuid?newst?int?len?IntPtr?priv?IntPtr?relen);
????????[DllImport(“user32.dll“?ExactSpelling?=?true?SetLastError?=?true)]?//退出系統
????????internal?static?extern?bool?ExitWindowsEx(int?flag?int?reason);
????????internal?const?int?SE_PRIVILEGE_ENABLED?=?0x00000002;
????????internal?const?int?TOKEN_QUERY?=?0x00000008;
????????internal?const?int?TOKEN_ADJUST_PRIVILEGES?=?0x00000020;
????????internal?const?string?SE_SHUTDOWN_NAME?=?“SeShutdownPrivilege“;
????????internal?const?int?EWX_LOGOFF?=?0x00000000;
????????internal?const?int?EWX_SHUTDOWN?=?0x00000001;
????????internal?const?int?EWX_REBOOT?=?0x00000002;
????????internal?const?int?EWX_FORCE?=?0x00000004;
????????internal?const?int?EWX_POWEROFF?=?0x00000008;
????????internal?const?int?EWX_FORCEIFHUNG?=?0x00000010;
????????public?Form2()
????????{
????????????InitializeComponent();
????????}
????????//退出操作系統
????????private?static?void?ExitWindows(int?flg)
????????{
????????????TokPrivLuid?tp;
????????????//獲取當前應用程序進程對象句柄
????????????IntPtr?hproc?=?GetCurrentProcess();
????????????IntPtr?htok?=?IntPtr.Zero;
????????????//打開當前應用處進程句柄
????????????if?(OpenProcessToken(hproc?TOKEN_ADJUST_PRIVILEGES?|?TOKEN_QUERY?ref?htok))
????????????{
????????????????tp.Luid?=?0;
????????????????tp.Count?=?1;
????????????????tp.Attr?=?SE_PRIVILEGE_ENABLED;
????????????????//查看當前操作系統用戶權
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????28672??2010-06-19?15:12??局域網視頻監控\Client\Client\bin\Debug\Client.exe
?????文件??????30208??2010-06-19?15:12??局域網視頻監控\Client\Client\bin\Debug\Client.pdb
?????文件???????5632??2005-11-11?22:25??局域網視頻監控\Client\Client\bin\Debug\Client.vshost.exe
????..A.SH.??????7680??2010-05-27?10:28??局域網視頻監控\Client\Client\bin\Debug\Thumbs.db
?????文件??????28672??2010-06-19?15:01??局域網視頻監控\Client\Client\bin\Release\Client.exe
?????文件??????28160??2010-06-19?15:01??局域網視頻監控\Client\Client\bin\Release\Client.pdb
?????文件???????5632??2005-11-11?22:25??局域網視頻監控\Client\Client\bin\Release\Client.vshost.exe
?????文件???????2603??2010-06-19?13:45??局域網視頻監控\Client\Client\Client.csproj
?????文件??????20317??2010-06-19?15:12??局域網視頻監控\Client\Client\Form2.cs
?????文件???????3960??2010-06-19?14:21??局域網視頻監控\Client\Client\Form2.designer.cs
?????文件???????8622??2010-06-19?14:21??局域網視頻監控\Client\Client\Form2.resx
?????文件???????1078??2010-06-19?13:38??局域網視頻監控\Client\Client\MYCOMP.ICO
?????文件????????438??2010-06-19?16:03??局域網視頻監控\Client\Client\obj\Client.csproj.FileList.txt
?????文件???????1830??2010-05-31?10:52??局域網視頻監控\Client\Client\obj\Client.csproj.FileListAbsolute.txt
?????文件???????1268??2010-06-19?14:21??局域網視頻監控\Client\Client\obj\Debug\Client.csproj.GenerateResource.Cache
?????文件??????28672??2010-06-19?15:12??局域網視頻監控\Client\Client\obj\Debug\Client.exe
?????文件???????1644??2010-06-19?14:21??局域網視頻監控\Client\Client\obj\Debug\Client.Form2.resources
?????文件??????30208??2010-06-19?15:12??局域網視頻監控\Client\Client\obj\Debug\Client.pdb
?????文件???????4608??2010-06-19?13:42??局域網視頻監控\Client\Client\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????769??2010-06-19?14:51??局域網視頻監控\Client\Client\obj\Release\Client.csproj.GenerateResource.Cache
?????文件??????28672??2010-06-19?15:01??局域網視頻監控\Client\Client\obj\Release\Client.exe
?????文件???????1644??2010-06-19?14:51??局域網視頻監控\Client\Client\obj\Release\Client.Form2.resources
?????文件??????28160??2010-06-19?15:01??局域網視頻監控\Client\Client\obj\Release\Client.pdb
?????文件????????465??2010-06-16?10:42??局域網視頻監控\Client\Client\Program.cs
?????文件???????1184??2004-01-30?09:56??局域網視頻監控\Client\Client\Properties\AssemblyInfo.cs
?????文件????????907??2004-01-30?09:56??局域網視頻監控\Client\Client.sln
????..A..H.?????79872??2010-06-19?14:21??局域網視頻監控\Client\Client.suo
?????文件?????344064??2010-06-19?15:06??局域網視頻監控\Server\Server\bin\Debug\Server.exe
?????文件??????58880??2010-06-19?15:06??局域網視頻監控\Server\Server\bin\Debug\Server.pdb
????..A..H.?????10240??2010-06-17?23:10??局域網視頻監控\Server\Server\bin\Debug\Server.suo
............此處省略80個文件信息
評論
共有 條評論