![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-09 11:30 |
47,812 topics / 349,914 posts / today 0 new / 48,268 members |
| DOS批处理 & 脚本技术(批处理室) » How to store passwords in an encrypted manner for batch processing to call? |
| Printable Version 3,859 / 11 |
| Floor1 uiopuiop | Posted 2011-01-10 23:57 |
| 中级用户 Posts 211 Credits 400 | |
|
How to store passwords encrypted for calling during batch processing?
[ Last edited by uiopuiop on 2011-1-10 at 23:58 ] |
|
| Floor2 Hanyeguxing | Posted 2011-01-11 00:35 |
| 银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂 | |
|
What are the password rules? Pure numbers? Numbers plus letters? Or common characters? What are the requirements for the encryption algorithm? Where is the storage location specified? In the registry or a file?
|
|
| Floor3 Hanyeguxing | Posted 2011-01-11 01:13 |
| 银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂 | |
|
I wrote a simple one, the password requirement is pure numbers, saved in the registry:
[ Last edited by Hanyeguxing on 2011-1-11 at 01:54 ] |
|
| Floor4 uiopuiop | Posted 2011-01-11 19:27 |
| 中级用户 Posts 211 Credits 400 | |
Originally posted by Hanyeguxing at 2011-1-11 12:35 AM: re: What are the password rules? - A mix of letters and numbers (of course, it would be better if special symbols can be included) re: What are the requirements for the encryption algorithm? - Generally, it should be not easy to crack. Of course, if a more advanced encryption can be used (MD5, DSA, RSA, etc.) re; Where is the storage location specified? It is best to store it in a file. Batch processing can call third-party command-line tools. PS. Can you explain the encryption principle of the code on the third floor, thank you! |
|
| Floor5 slore | Posted 2011-01-12 13:43 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
Add more, remove the if...
The written bat code, most of the core operations rely on the password. Then encrypt the password with MD5 and compare it in the bat. If correct, execute... So if you see your bat source code, if there is no comparison, a random password is not acceptable. set password= if md5(password)=fde3494783dfd854 The core part of the operation is all related to %password%, some character in the middle, some character is re-operated and deformed... Only when there is no correct password and skip the judgment and execute next can it not work. |
|
| Floor6 uiopuiop | Posted 2011-01-12 23:37 |
| 中级用户 Posts 211 Credits 400 | |
Originally posted by slore at 2011-1-12 01:43 PM: Generally, automated scripts run automatically without manual intervention, so there can be no manual input of the password. After you encrypt with MD5, how do you decrypt it? The password must be in plain text when the batch processing runs. When running, it must be decrypted and then passed to the corresponding command. MD5 cannot recognize it. |
|
| Floor7 then0011 | Posted 2011-01-12 23:53 |
| 新手上路 Posts 9 Credits 5 | |
|
Great! I'm a newbie! So I can only watch and can't contribute much.
|
|
| Floor8 slore | Posted 2011-01-13 09:54 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
Originally posted by uiopuiop at 2011-1-12 23:37: You don't set a password if you want no intervention... Here, plain text is entered using set /p pw= Then calculate MD5 and compare it with the MD5... There is a relationship with the password you entered through the following operations, so an incorrect password cannot be used. If you simply set a password and just read it automatically? Automatically judge... If you comment out the judgment, what encryption do you have? |
|
| Floor9 acaigg | Posted 2011-01-13 21:34 |
| 初级用户 Posts 92 Credits 115 | |
|
I'm quite green, not very familiar with code. But I can see that slore's thinking is relatively rigorous.
|
|
| Floor10 uiopuiop | Posted 2011-01-16 19:50 |
| 中级用户 Posts 211 Credits 400 | |
|
Do you all have any new ideas?
|
|
| Floor11 cyn01livecn | Posted 2011-01-18 12:18 |
| 初级用户 Posts 23 Credits 28 | |
|
Simple, just replace the text. For example, replace "1" with "X" to make it unreadable, and then replace it back when calling.
|
|
| Floor12 goltaxhs | Posted 2017-08-26 21:48 |
| 新手上路 Posts 8 Credits 8 | |
|
1、Write the simplest int main(int argc, char * argv[]) program in C. char * argv[] is the first parameter. The program will check the first parameter (which is the password). If successful, return T; if failed, return F.
2、In batch processing, make a SE /P PWD= to require entering the password, and then pass the input value to the program in the first step as the parameter, which is the password, and make a judgment. 3、The batch processing judges whether the input password is correct according to the %errorlevel% return value T/F. If correct, handle the next step; if incorrect, prompt to enter again. 4、In this way, the password is saved in the compiled exe file, generally not visible, unless cracked. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |