Add a password to cmd.exe (using a perl script)

Source: Internet
Author: User
Tags perl script

Recently, perl has been re-consolidated, and the previous beginner's code has been changed, so that win's cmd can use the linux method to add password verification to cmd.
The following describes how to automatically execute linux. bat when you set cmd.exe to run:
Open Registry Editor,
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftCommand Processor]
Set "AutoRun" = "linux. bat"

Next is the content of linux. bat.
@ Echo off
@ Titel: Specifies the cmd.exe
@ Color c
@ Prompt [fire @ flame linux $ p]
@ Doskey pwd = cd $ *
@ Doskey mkdir = md $ *
@ Doskey rmdir = rd $ *
@ Doskey mv = move $ *
@ Doskey clear = cls
@ Doskey uname = ver
@ Doskey cp = copy
@ D: perlinperl D: perlhello1.pl
Rem above is the command line for executing the perl code I edited. The personal path varies depending on your situation.
@ D: perl1.vbs
Rem is a vbs script to execute a pop-up window.

@ Cls
@ Echo welcome to the "Flame" System
Then, an installation tool is ActivePerl, the perl code tool to be run.
This program is used to run perl code.


Now, write the perl code.
Edit hello1.pl
Content:
#! /User/bin/perl-w
Use Term: ReadKey;
Use Digest: MD5 qw (md5_base64); # create a function
$ Pass1 = 'av8oud8b3tzcfdl2 + 3OynQ '; # encrypted code
# Print 'enter your name :';
# $ A = <STDIN>; # The input content is similar to the read in shell.
# Chomp $ a; # assign a value to
ReadMode ('noecho '); # disable echo
Print "enter pass (cmd is automatically disabled if the input is incorrect ):";
$ Password = ReadLine (0 );
Chomp $ password;
Print "";
Print "your password length is: [". length ($ password). "]";
ReadMode ('restore ');
$ Pass = md5_base64 ($ password); # use the above function to calculate the encryption code for the pass value
If ($ pass eq $ pass1 ){
Print "the password is correct ";

# Print "************************************* **";
Sleep 1; # comment out the delay time if you decide not to delay it.
# Verify whether the request is correct and the input is delayed and cleared
} Else {
Print "Incorrect password ";
Sleep 0;
Exec 'taskkill', '/F','/im', 'cmd.exe '; #,'/im', 'wscript.exe '; # if an error occurs, call the system command to kill the cmd.exe process.
}
Exit;

Then edit a tool to obtain the encrypted password string above.
Pass. pl to run this script as long as it enters the directory of the perl execution tool (you can also add a directory to the environment variable, so you do not need to add a directory to run it)
Perl pass. pl will allow you to enter the password and generate a string to replace the string with the string. # The encrypted string's line "" is enough.

The content of pass. pl is as follows:
#! /Usr/bin/perl-w
Use Digest: MD5 qw (md5_base64 );
Print "Enter the string to be encrypted :";
$ Pass = <STDIN>;
Chomp $ pass;
$ Pass1 = md5_base64 ($ pass );
Print "encrypted string: $ pass1 ";
The rest is the 1.vbs content. Do you want this? I just want to look good !!
The content is as follows:
DIM WSH
Set wsh = WSCRIPT. CreateObject ("WSCRIPT. SHELL ")
WSH. POPUP ("Welcome to ☆flame ☆system ")
This will pop out a window showing the above text content
Haha !!!
A Simple Method for encrypting cmd.exe becomes
Of course, this method requires user permissions, so only the ntfs format is required.
During running, the title bar at the top of the cmd window will display the correct path of the read linux. bat.
Even if the registry is disabled, users just need to delete the linux. bat file, which is useless for the method used by cmd.exe.
Therefore, the title command is added to hide the window output path.
You just need to put linux. bat in any path displayed by the path command!
In fact, there are no technical things. I just want to learn for myself. Please don't throw me a brick !! If you throw fruit
I am very welcome !!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.