Write a bat batch file to start Windows process and delay shutdown code

Posted on

A few days ago, the leader asked us to vote on the website to improve his ranking, but each person only cast more than 100 votes. After a few days, the leader asked me if I would do a swipe ticket program to improve the ranking. I said I could try it. After studying for a day, I finally made it. I was so excited that I didn’t sleep all night. Now take it out and share it.
To put it bluntly, what I do is actually a batch file with the extension of. Bat. In fact, the voting page only uses session to control whether to vote. As we all know, the session variable will automatically disappear after ie is closed, and a new connection will be created when the page is reopened. This page uses Ajax. I find the JS where AJAX is located and put it in Find out the real voting page, pass in the ID through the page, and vote. At present, what we should do is to automatically open the IE connection voting page, and then automatically disconnect and connect again, so as to achieve repeated voting.
This voting website has two fatal points. One is that the voting is not controlled by IP, but controlled by session server, which leads to repeated voting with one IP. The other is that the parameters of the actual voting processing page are transmitted by get, which will lead to the possibility of cheating.
By taking advantage of the above two vulnerabilities, I have also done a batch processing of bat, as follows:

Copy codeThe code is as follows:
@echo off
Echo is shutting down redundant processes, please wait
taskkill /f /im iexplore.exe
Echo ——– program initialization completed, please indicate! ———-
echo. & pause
:openie
Echo is voting, please wait
start “” “C:Program FilesInternet Exploreriexplore.exe”
Echo ie open complete!
ping 127.0.0.1 -n 2
taskkill /f /im iexplore.exe
Echo delay 2 seconds to close, voting completed!
goto openie

echo. & pause

Key point explanation:
taskkill /f /im iexplore.exe The IE process is forced to be shut down. Of course, other processes can be closed. The process name can be found through the task manager.
start “” “C:Program FilesInternet Explorer iexplore.exe “This is to open a Windows program, pay attention to the path, and pay attention to the” “after the start. Do not throw it away.
Ping 127.0.0.1 – N 2 is used to delay. We all know that the delay execution of bat batch processing is too cumbersome. This is a bit more concise. We should pay attention to Ping local 127.0.0.1, otherwise it may lead to different time length. The – N 2 means to repeat twice, which is about 2 seconds. Of course, the time length can be adjusted, just adjust the number.
Emphasis: the infinite loop of bat batch processing. : openie means to set a point, this can be arbitrary, any combination of letters, do not repeat with the keyword. Goto openie means to return to the previous point openie. The set return point must correspond to each other.

Now you can copy the above code into a text document. Be sure to change the extension to. Bat, which is the standard extension for batch processing. Of course, 98 is a very classic program autoexec.bat Believe that many people have heard of it, interested can baidu. Of course, you can also use one or three examples to start or end the process of other programs.
What will not be able to Q myself, QQ number at the bottom of the page on the right, together improve common progress, ha ha
The following procedure is found from the Internet, you can refer to the copy, specifically know what to do, some places have not seen clearly, if your comprehension ability is high, then study it yourself!
Tip: the following program is to monitor whether a process exists. If it does not exist, it will be started. If the process is lost, it will also be started, that is, let the program run forever!

Copy codeThe code is as follows:
@echo off
set _task=notepad.exe
set _svr=c:windowsnotepad.exe
set _des=start.bat
:checkstart
for /f “tokens=5” %%n in (‘qprocess.exe ^| find “%_task%” ‘) do (
if %%n==%_task% (goto checkag) else goto startsvr
)
:startsvr
echo %time%
Echo program starts********
The echo program was restarted at% time%. Please check the system log > > restart_ service.txt
echo start %_svr% > %_des%
echo exit >> %_des%
start %_des%
set/p=.<nul
for /L %%i in (1 1 10) do set /p a=.<nul&ping.exe /n 2 127.0.0.1>nul
echo .
echo Wscript.Sleep WScript.Arguments(0) >%tmp%delay.vbs
cscript //b //nologo %tmp%delay.vbs 10000
del %_des% /Q
Echo ≡ program start completed********
goto checkstart

:checkag
Echo% time% program is running normally, continue checking after 10 seconds
echo Wscript.Sleep WScript.Arguments(0) >%tmp%delay.vbs
cscript //b //nologo %tmp%delay.vbs 10000
goto checkstart

Leave a Reply

Your email address will not be published.