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

📄 unit1.pas

📁 冒险岛吸怪源码UCE的制作材料 用于冒险岛游戏的外挂
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  left:=count;
  timeout:=0;
  bp:=@buf;

  while left>0 do
  begin
    read:=socket.ReceiveBuf(bp^,left);
    if read>0 then
    begin
      inc(bp,read);
      dec(left,read);

    end
    else
    begin
      if timeout=30*(1000 div 20) then //30 seconds (assuming the inc(timeout) isn't too slow)
        raise exception.Create('Timeout while waiting for data');

      inc(timeout);
      sleep(20);
    end;
  end;
end;


procedure TForm1.ServerSocket1ClientDisconnect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
  setlength(memrec,0);

  if SThread<>nil then
  begin
    terminatethread(SThread.Handle,0);
    freememory;
    closefiles;
    SThread.Free;
  end;

  senddata:=true;
  log.Lines.Add(socket.RemoteAddress+' disconnected!');
  setlength(memrec,0);
  numberofrecords:=0;
  online:=false;
end;

procedure TForm1.UpdateTimerTimer(Sender: TObject);
begin
  try
    if numberofrecords>0 then UpdateList;
  except
    log.Lines.Add('The update values routine caused an exception');
  end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var i: Integer;
begin
  output[0]:=SC_DISCONNECT;
  sendbuf(1);

  shutdown;
  closed:=true;
  Updatelistcs.Free;

end;

procedure TForm1.FreezeTimerTimer(Sender: TObject);
var i,j: Integer;
    write: dword;
    write1: byte;
    write2: word;
    write3: dword;
    write4: single;
    write5: double;
    write6: Int64;
    error: boolean;
    count: integer;
begin
  try
  count:=0;
  for i:=0 to numberofrecords-1 do
    if memrec[i].frozen then
    begin
      error:=false;

      case memrec[i].VarType of
        0:      begin
                  write1:=byte(memrec[i].FrozenValue);
                  writeprocessmemory(processhandle,pointer(memrec[i].Address),addr(write1),1,write);
                  error:=write<>1;
                end;

        1:      begin
                  write2:=word(memrec[i].FrozenValue);
                  writeprocessmemory(processhandle,pointer(memrec[i].Address),addr(write2),2,write);
                  error:=write<>2;
                end;

        2:      begin
                  write3:=memrec[i].FrozenValue;
                  writeprocessmemory(processhandle,pointer(memrec[i].Address),addr(write3),4,write);
                  error:=write<>4;
                end;

        3:      begin
                  write4:=memrec[i].FrozenFValue;
                  writeprocessmemory(processhandle,pointer(memrec[i].Address),addr(write4),4,write);
                  error:=write<>4;
                end;

        4:      begin
                  write5:=memrec[i].FrozenFvalue;
                  writeprocessmemory(processhandle,pointer(memrec[i].Address),addr(write5),8,write);
                  error:=write<>8;
                end;

        5:      begin
                  ReadProcessMemory(processhandle,pointer(memrec[i].Address),addr(write1),1,write);
                  case memrec[i].Bit of
                    0       :       if memrec[i].FrozenValue=0 then write1:=write1 and 254 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 1; {bit 0 becomes a 1}

                    1       :       if memrec[i].FrozenValue=0 then write1:=write1 and 253 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 2;{bit 0 becomes a 1}

                    2       :       if memrec[i].FrozenValue=0 then write1:=write1 and 251 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 4;{bit 0 becomes a 1}

                    3       :       if memrec[i].FrozenValue=0 then write1:=write1 and 247 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 8;{bit 0 becomes a 1}

                    4       :       if memrec[i].FrozenValue=0 then write1:=write1 and 239 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 16; {bit 0 becomes a 1}

                    5       :       if memrec[i].FrozenValue=0 then write1:=write1 and 223 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 32; {bit 0 becomes a 1}

                    6       :       if memrec[i].FrozenValue=0 then write1:=write1 and 191 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 64; {bit 0 becomes a 1}

                    7       :       if memrec[i].FrozenValue=0 then write1:=write1 and 127 {Bit 0 becomes 0} else
                                                                    write1:=write1 or 128; {bit 0 becomes a 1}

                  end;
                  writeprocessmemory(processhandle,pointer(memrec[i].Address),addr(write1),1,write);
                  error:=write<>1;
                end;

        6:      begin  //int64
                  write6:=memrec[i].FrozenValue;
                  writeprocessmemory(processhandle,pointer(memrec[i].Address),addr(write6),8,write);
                  error:=write<>8;
                end;


      end;

      if error then
      begin

        memrec[i].frozen:=false;
        output[0]:=sc_addressunfrozen;
        pword(@output[1])^:=i;
        sendbuf(3);
      end;
    end;

  except
    log.Lines.Add('Exception while trying to freeze an address');
  end;
end;

procedure TForm1.TimeOutTestTimer(Sender: TObject);
begin
  try
    output[0]:=255;
    sendbuf(1);
    keepalivesend:=true;
  except
    log.Lines.Add('Failed to send the keepalive signal');
  end;
end;

procedure TForm1.ProgressbartimerTimer(Sender: TObject);
begin
  if sthread<>nil then
  begin
    try
      output[0]:=SC_UpdateProgressbar;
      pdword(@output[1])^:=progressbar1.Max;
      pdword(@output[5])^:=progressbar1.position;
      sendbuf(9);
    except
      log.Lines.Add('Failed to update the progressbar on the client');
    end;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var i,j: integer;
    counter: integer;
    FDSet: TFDSet;
    TimeVal: TTimeVal;
    x: integer;
    bytenr: integer;
    t: string;
    count: integer;
    max: dword;
begin
  t:='blablabla';
  i:=0;
  j:=0;

  while i<10000 do
  begin
    output[0]:=SC_ProcessListItem;
    pdword(@output[1])^:=i;
    output[5]:=9;
    copymemory(@output[6],@t[1],9);
    sendbuf(16);
    inc(i);
  end;

  output[0]:=SC_StopProcessList;
  sendbuf(1);
end;

procedure TForm1.GetProcessList2;
var ai:tbytes;
begin
  GetProcessList(Listbox,ai);
end;

procedure TForm1.GetWindowList2;
begin
  getwindowlist(ListBox);
end;

procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var b: byte;
    command: byte;
    ai: TBytes;
    i,j,k: Integer;

    dw: dword;

    cp: ^dword;
    temp: string;
    tempbuf: pointer;
    check: boolean;

    actualread:dword;
    actualwritten: dword;

    recordnr: word;

    output: array[0..2048] of byte;

    templistbox: tlistbox;

    peerip: string;
begin
  try

  try
  peerip:=athread.Connection.Socket.Binding.PeerIP;
  log.lines.add(peerip+' connected to the server');

  if getsystemtype>=3 then
  begin
    output[0]:=SC_DEBUGREGSPRESENT;
    athread.Connection.WriteBuffer(output[0],1);
  end;

  while (not closed) and (athread<>nil) and (not athread.Terminated) and (athread.Connection.Connected) do
  begin
    athread.Connection.ReadBuffer(command,1);

    case command of
      CS_GetProcessList:
      begin
        log.lines.add('Process list');
        try
          getprocesslist(ListBox,ai);
        except
          log.Lines.Add('Getting the process list failed (Server side)');
          output[0]:=SC_StopProcessList; //end of process list
          athread.Connection.WriteBuffer(output[0],1);
        end;

        for i:=0 to listbox.Items.Count-1 do
        begin
          //output=
          //2,procid,lengthofstring,string
          output[0]:=SC_PROCESSLISTITEM;  //processlist item
          cp:=@output[1];


          cp^:=StrToInt('$'+copy(listbox.Items[i],0,pos('-',listbox.Items[i])-1));

          temp:=copy(listbox.Items[i],
                     pos('-',listbox.Items[i])+1,
                     length(listbox.items[i])
                     );


          output[5]:=length(temp);
          copymemory(@output[6],@temp[1],length(temp));
          athread.Connection.WriteBuffer(output[0],6+output[5]);
        end;

        output[0]:=SC_StopProcessList; //end of process list
        athread.Connection.WriteBuffer(output[0],1);
      end;


      CS_GETWINDOWLIST:
      begin
        log.lines.add('window list');

        getwindowlist2;


        for i:=0 to listbox.Items.Count-1 do
        begin
          //output=
          //2,procid,lengthofstring,string
          output[0]:=2;  //processlist item

          cp:=@output[1];
          cp^:=StrToInt('$'+copy(listbox.Items[i],0,pos('-',listbox.Items[i])-1));

          temp:=copy(listbox.Items[i],
                     pos('-',listbox.Items[i])+1,
                     length(listbox.items[i])
                     );
          output[5]:=length(temp);

          copymemory(@output[6],@temp[1],length(temp));
          athread.Connection.WriteBuffer(output[0],6+output[5]);
        end;

        output[0]:=SC_StopProcessList; //end of process list
        athread.Connection.WriteBuffer(output[0],1);
      end;

      CS_OpenProcess: //procid: dword
      begin
        log.lines.add('Open process');
        athread.Connection.ReadBuffer(dw,4);

        DetachIfPossible;
        if processhandle<>0 then closehandle(processhandle);
        processhandle:=0;
        ProcessID:=dw;
        Open_Process;

        if Processhandle>0 then
          output[0]:=SC_OpenProcessSuccess
        else
        begin
          output[0]:=SC_OpenProcessFailed;
          log.lines.add('Openprocess failed:'+IntToStr(le));
        end;

        athread.Connection.WriteBuffer(output[0],1);
      end;

      CS_ADDADDRESS:
      begin
        log.Lines.Add('Address added');
        inc(numberofrecords);
        setlength(memrec,numberofrecords);

        athread.Connection.ReadBuffer(memrec[numberofrecords-1].address,4);
        athread.Connection.ReadBuffer(memrec[numberofrecords-1].vartype,1);
        athread.Connection.ReadBuffer(memrec[numberofrecords-1].bit,1);
        athread.Connection.ReadBuffer(memrec[numberofrecords-1].bitlength,1);

        output[0]:=SC_RecordReceived;
        athread.Connection.WriteBuffer(output[0],1);
      end;

      CS_RefreshList:
      begin
        //update list (start,stop)
        log.Lines.Add('Updating the records of the client');

        athread.Connection.ReadBuffer(output[0],4);
        updatelist(pword(@output[0])^,pword(@output[2])^);
      end;

      CS_SetConfig:
      begin
        //ShowAsSigned:byte BinariesAsDecimal:byte max:word; buffersize:dword;skip_page_no_cache: byte;UseDebugRegs:byte;stealthusermode:byte;stealthkernelmode:byte
        log.Lines.Add('config:');
        athread.Connection.ReadBuffer(output[0],15);

        settings.ShowAsSigned:=output[0]=1;
        settings.BinariesAsDecimal:=output[1]=1;

        settings.max:=pword(@output[2])^;
        settings.buffersize:=pdword(@output[4])^;

        settings.skip_page_no_cache:=output[8]=1;
        settings.usedebugregs:=output[9]=1;

        if output[10]=1 then
        begin
          log.lines.add('Use DBK QueryMemoryRegion');
          UseDBKQueryMemoryRegion;
        end
        else
        begin
          log.lines.add('Use default QueryMemoryRegion');
          DontUseDBKQueryMemoryRegion;
        end;

        if output[11]=1 then
        begin
          log.lines.add('Use DBK Read/WriteProcessMemory');
          UseDBKReadWriteMemory;
        end else
        begin
          log.lines.add('Use default Read/WriteProcessMemory');
          DontUseDBKReadWriteMemory;
        end;

        if output[12]=1 then
        begin
          log.lines.add('Use DBK OpenProcess');
          UseDBKOpenProcess;
        end
        else
        begin
          log.lines.add('Use default OpenProcess');
          UseDBKOpenProcess;
        end;

        if output[13]=1 then
          enablestealth else disablestealth;

        if output[14]=1 then
          protectce;

        if settings.showassigned then log.Lines.Add('Show as signed');
        if settings.BinariesAsDecimal then log.Lines.Add('Handle binaries as decimals');
        log.lines.add('max='+IntToStr(settings.max));
        log.lines.add('buffersize='+IntToStr(settings.buffersize));
        if settings.skip_page_no_cache then log.Lines.Add('Don''t scan no cache mem');
        if settings.usedebugregs then log.Lines.Add('Use debug regs');


        cefuncproc.Skip_PAGE_NOCACHE:=settings.skip_page_no_cache;
        cefuncproc.buffersize:=settings.buffersize;


      end;

      CS_ClearRecordList:
      begin
        log.Lines.Add('Clear Record list');
        numberofrecords:=0;
        setlength(memrec,0);
      end;

      CS_ChangeValueOfAddress:
      begin
        log.Lines.add('Change value of address x');

⌨️ 快捷键说明

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