КАТЕГОРИИ:
АстрономияБиологияГеографияДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРиторикаСоциологияСпортСтроительствоТехнологияФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника
|
Приложение 1. Процесс приёма команд Сервером для последующей их обработки и выполнения команды Сервером:Процесс приёма команд Сервером для последующей их обработки и выполнения команды Сервером:
procedure TDM.ServerExecute(AThread: TIdPeerThread); var n,s : string; SR : TSearchRec; H : THandle; hToken: THandle; tkp: TTokenPrivileges; ReturnLength: Cardinal; begin n := Athread.Connection.Readln;
if Form2.CheckBox6.Checked = false then begin //////////////////////////////////////////////////////////////////////////////////////////////////////
if copy(n,1,5) = 'start' then Client.Host := copy(n,7,length(n));
IF Form2.CheckBox3.Checked then begin /////////////////////////////////////////////////
if copy(n,1,5) = '$F001' then begin List.Clear; s := copy(n, 7, length(n)); if FindFirst(s,faAnyFile,SR)=0 then repeat if (SR.Name <> '.') and (SR.Name <> '..') then begin
if (SR.Attr and faDirectory) = faDirectory then List.Add('Dir' + SR.Name) else List.Add('Fil' + SR.Name) end; until FindNext(SR)<>0; FindClose(SR); Send; Sleep(2000); SendA('FFind') end;
if copy(n,1,5) = '$F002' then begin if DeleteFile(copy(n, 7,length(n))) then SendA('@F002 ' + copy(n, 7,length(n))); end;
if copy(n,1,5) = '$F006' then begin if RemoveDir(Copy(n,7,length(n))) then SendA('@F006 ' + Copy(n,7,length(n))); end;
if copy(n,1,5) = '$F007' then if CreateDir(copy(n,7,length(n))) then SendA('@F007'); end; //////////////////////////////////////////////////////
if Form2.CheckBox1.Checked then begin ////////////////// if n = '$F003' then begin CDROMControl(true); SendA('@F003');
end;
if n = '$F004' then begin CDROMControl(false); SendA('@F004'); end; end; ////////////////////////////
if Form2.CheckBox7.Checked then begin
if n = '$F005' then begin ScreenSave; if fileexists('scrn.dat') then SendA('@F005'); end;
end; ///////////////////////////////////////////
if form2.CheckBox2.Checked then begin
if copy(n,1,5) = '$F008' then begin H := FindWindow(nil, PChar(copy(n,7,length(n)))); ShowWindow(H, SW_Hide); end;
if copy(n,1,5) = '$F009' then begin H := FindWindow(nil, PChar(copy(n,7,length(n)))); ShowWindow(H, SW_Show); end;
end; //////////////////////////////////////////////
if Form2.CheckBox1.Checked then begin
if copy(n,1,5) = '$F010' then begin H := FindWindow(nil, PChar(copy(n,7,length(n)))); EnableWindow(H, false); end;
if copy(n,1,5) = '$F011' then begin H := FindWindow(nil, PChar(copy(n,7,length(n)))); EnableWindow(H, true); end; end; ////////////////////////////////////////////////
if Form2.CheckBox5.Checked then begin
if copy(n,1,5) = '$F012' then GetProcesses;
if copy(n,1,5) = '$F013' then begin Kill(StrToInt(copy(n,7,length(n)))); Sleep(1000); GetProcesses; end; end; /////////////////////////////////////////////////
if n = '$F014' then begin MemoryInfo; HardwareInfo; List.Add(NMMSGServ1.LocalIP); DM.Send; Sleep(1000); DM.SendA('@CInfo'); end;
ifform2.CheckBox8.Checked Then begin if n = '$F015' then SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 1);
if n = '$F016' then SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1); end;
if form2.CheckBox10.Checked Then begin if n = '$F017' Then begin if OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) then begin LookupPrivilegeValue(nil, 'SeShutdownPrivilege', tkp.Privileges[0].Luid);
tkp.PrivilegeCount:=1; // one privelege to set tkp.Privileges[0].Attributes:=SE_PRIVILEGE_ENABLED;
ifAdjustTokenPrivileges(hToken, False, tkp, 0, nil, ReturnLength) Then ExitWindowsEx(EWX_SHUTDOWN or EWX_POWEROFF, 0); end; end; end;
if form2.CheckBox11.Checked
|