Batch lock for cmd
Author: nuke
Someone in a group issued a batch of cmd locks last night, saying that adding a lock to cmd can prevent many intrusion problems.
So I looked at how he defended against the black.
First, you need to import a Registry File code as follows:
---------------------------------
REGEDIT4
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftCommand Processor]
"AutoRun" = "lock. bat"
-------------------------------------
Oh, image hijacking ......
The lock. bat code is as follows (name lock. bat is saved under drive C win)
--------------------------- Split line ----------------------------
@ Echo off
Title unlocked
SETLOCAL
Set pass = 0
Set times = 2
Echo ~~~~~~~~~~~~~~~~~~
Echo for security, CMD. EXE has been locked by me.
Do not mess up the echo password if you don't know it !! Your IP address has been recorded by me
Echo ~~~~~~~~~~~~~~~~~~
Ipconfig> c: jilu.txt
Netstat-an> c: jilu.txt
Echo operation: password verification time: % time % date: % date %> c: log.txt
Echo status: Waiting For Password Input> c: log.txt
Echo.> c: log.txt
: Start
Set/p pass = password:
If % pass % = cnwyc goto OK
The echo password is incorrect. Try again (you don't know what it is !)~~~ You still have % times % chance
If % times % = 0 goto end
Echo status: User Failed to enter password verification contact me recognition time: % time %> c: log.txt
Set/A times = % times %-1
Goto start
: End
Echo status: the user entered the password three times. The program lock time is % time %> c: log.txt
Title Verification Failed?
Cls
Echo Three verification failures. You are locked and cannot continue. You can close this window.
Echo ~~~~~~~~~~~~~~~~~~
Echo, you can also leave a message to my
Echo ~~~~~~~~~~~~~~~~~~
Pause
Echo * = ====================================
Echo input rumors press enter to submit
Echo ~~~~~~~~~~~~~~~~~~
The title fails three times.
: M
Set/p m = enter your message
Echo date: % date % time: % time %> c: message.txt
Echo message content:> c: message.txt
Echo % m %> c: message.txt
Echo.> c: message.txt
Echo your message: % m % has been recorded. You can close this window or continue to leave a message.
Echo operation: User rumor time: % time %> c: log.txt
Goto m
: OK
Echo status: the password is correct. The unlock time is % time %> c: log.txt
Title cmd.exe
ENDLOCAL
Cls
Ver
The prompt characters are enough to explain the meaning of the Code.
......
Set/p pass = password:
If % pass % = cnwyc goto OK '==== password here
......
========================================================== ==============================
It's interesting and simple,
However, it is easier to bypass verification.
Enter the password & this symbol to be OK.
==============================================
The author modified it again.
Solve special character skipping and cmd/d
Remove a PAUSE
Solve ctrl + c
However, adding a quotation mark to bypass the symbol is a little simple.
When you enter the password, you only need to add a quotation mark, for example "&"
There are a lot of code for online character filtering. I will not post it here.
@ Echo off
Title unlocked
SETLOCAL
Set pass = 0
Set times = 2
Echo ~~~~~~~~~~~~~~~~~~
Echo for security, CMD. EXE has been locked by me.
Do not mess up the echo password if you don't know it !! Your IP address has been recorded by me
Echo ~~~~~~~~~~~~~~~~~~
Echo ===================================================== ==============================================>> c: jilu.txt
Echo ===================================================== ==============================================>> c: jilu.txt
Echo date: % date % time: % time %> c: jilu.txt
Ipconfig> c: jilu.txt
Netstat-an> c: jilu.txt
Echo ===================================================== ==============================================>> c: log.txt
Echo ===================================================== ==============================================>> c: log.txt
Echo operation: password verification time: % time % date: % date %> c: log.txt
Echo status: Waiting For Password Input> c: log.txt
Echo.> c: log.txt
: Start
Set/p pass = password:
If "% pass %" = "daanwb" goto OK
The echo password is incorrect. Try again (you don't know what it is !)~~~ You still have % times % chance
If % times % = 0 goto end
Echo status: User Failed to enter password verification contact me recognition time: % time %> c: log.txt
Set/A times-= 1
Goto start
: End
Echo status: the user entered the password three times. The program lock time is % time %> c: log.txt
Title Verification Failed?
Cls
Echo Three verification failures. You are locked and cannot continue. You can close this window.
Echo ~~~~~~~~~~~~~~~~~~
Echo, you can also leave a message to my
Echo ~~~~~~~~~~~~~~~~~~
Echo * = ====================================
Echo input rumors press enter to submit
Echo ~~~~~~~~~~~~~~~~~~
The title fails three times.
: M
Set/p m = enter your message
Echo date: % date % time: % time %> c: message.txt
Echo message content:> c: message.txt
Echo % m %> c: message.txt
Echo ....................................... ........................................> c: message.txt
Echo.> c: message.txt
Echo.> c: message.txt
Echo your message: % m % has been recorded. You can close this window or continue to leave a message.
Echo operation: User rumor time: % time %> c: log.txt
Goto m
: OK
Echo status: the password is correct. The unlock time is % time %> c: log.txt
Title cmd.exe
ENDLOCAL
Cls
Ver
As allyesno mentioned
In fact, we can solve the filtering problem.