Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 318 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can I implement a kill switch into a .bat fork bomb?

#1
I want to show a friend how big the impact of a fork bomb can be on performance, but without needing to restart the computer afterwards.

Assuming the following fork bomb:

%0|%0

Is there a way to add a kill switch to this which, with one button press, will stop all running copies of this file, stop any new from being created and hopefully save the machine? I'm not really familiar with the command prompt syntax, so I'm not sure.
Reply

#2
Two ideas:

a) limit the depth your "bomb" is going to fork:

@echo off
set args=%*
if "%args%" EQU "" (set args=0) else set /a args=%args%+1
if %args% LSS 8 start /min thisfile.bat

(this will produce 2^9 -1 command windows, but only your main window is open.)

b) kill the cmd.exe process in the main batch file

@echo off
SET args=%*
:repeat
start /min thisfile.bat.bat some_arg
if "%args%" NEQ "" goto repeat
pause
taskkill /im cmd.exe

pressing any key in the initial batch file will instamntly kill all cmd windows currently open.

These solutions were tested with some restrictions, so if they work in a "hot" forkbomb, please let me know.

hope this helps.

**EDIT:**

c)implement a time switch in the original bat:
(still stops even if you can't get past `pause`)

@echo off
set args=%*
:repeat
start /min thisfile.bat some_arg
if "%args%" NEQ "" goto repeat
timeout /T 10
taskkill /im cmd.exe

or, using the smaller "bomb":

@echo off
set args=%*
if "%args%" NEQ "" (%0 some_arg|%0 some_arg) else start /min thisfile.bat some_arg
timeout /T 10
taskkill /im cmd.exe
Reply

#3
If you're out to just show your friend fork bombs why not go for a silent but deadly approach? The fork bomb is in vbs, the cleanup is in batch.
Do note, the vbs fork bomb does nothing turning your pc off/on wont fix, it just floods your session proccess's.

The fork bomb:

Do until true = false
CreateObject("Wscript.Shell").Run Wscript.ScriptName
Loop
[Source](

[To see links please register here]

)

Cleanup:


title=dontkillme
FOR /F "tokens=2 delims= " %%A IN ('TASKLIST /FI ^"WINDOWTITLE eq
dontkillme^" /NH') DO SET tid=%%A
echo %tid%
taskkill /F /IM cmd.exe /FI ^"PID ne %tid%^"

[Source](

[To see links please register here]

)
Reply

#4
If it runs in an accessible directory, you could try

IF EXIST kill.txt (exit /b) ELSE (%0|%0)
and make a file called kill.txt in the directory to stop the bomb.
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through