![]() |
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-08-04 19:42 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » [Closed] How to generate a purely numeric password dictionary |
| Printable Version 3,984 / 9 |
| Floor1 HAT | Posted 2007-08-29 14:10 |
| 版主 Posts 5,017 Credits 9,023 | |
|
I want to use batch processing to generate a password dictionary. The user enters the password length, and an automatic dictionary file dictionary.txt is generated. If 3 is entered, the content of dictionary.txt is as follows:
000 If 4 is entered, the content of dictionary.txt is as follows: 0000 Hope an expert can give guidance. [ Last edited by HAT on 2008-11-12 at 21:39 ] |
|
| Floor2 wudixin96 | Posted 2007-08-29 16:42 |
| 银牌会员 Posts 931 Credits 1,928 | |
|
```@echo off
set /p num=input a number: for /l %%i in (1,1,%num%) do call set max=%%max%%9 call set max=%%max:~0,%num%%% for /l %%i in (0,1,%max%) do set out=000000000000000000000000%%i&&call echo %%out:~-%num%%%>>dictionary.txt pause``` |
|
| Floor3 HAT | Posted 2007-08-29 22:18 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Thanks, Brother wudixin96.
I will think about pure alphabet passwords and alphanumeric mixed passwords based on this. I will come to ask for advice if there is any problem. |
|
| Floor4 HAT | Posted 2007-08-29 22:18 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Almost forgot to add points
Guilty, guilty Added it up |
|
| Floor5 rockdong | Posted 2007-08-30 17:01 |
| 初级用户 Posts 25 Credits 48 | |
|
Learning from this.
|
|
| Floor6 523066680 | Posted 2008-12-19 10:32 |
| 银牌会员 Posts 1,133 Credits 2,362 | |
|
Also made one, only supports below 9 digits, just for fun嘛
|
|
| Floor7 netbenton | Posted 2009-01-04 02:47 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
(六) The building speed is so fast, I can't understand.
I practice with a stupid way: @echo off cd.>dictionary.txt set /p in=key a number: set b=%in% :ex1 if %b% gtr 0 set /a b-=1&set max=9%max%&goto :ex1 set ba=%max:9=0% :ex2 if %b% leq %max% set ok=%ba%%b%&call echo %%ok:~-%in%%%>>dictionary.txt&set /a b+=1&goto ex2 type dictionary.txt&pause&goto :eof |
|
| Floor8 linee | Posted 2009-01-04 16:11 |
| 初级用户 Posts 49 Credits 94 | |
|
In terms of efficiency, it should be the simple n loops on the 6th floor that are the fastest. For the 7th floor, if each number has to go through an if check, the efficiency can be imagined. Inspired by the zero padding on the 7th floor, I also came to practice, and the efficiency should be very close to the 6th floor.
[ Last edited by linee on 2009-1-4 at 18:59 ] |
|
| Floor9 523066680 | Posted 2009-08-04 08:48 |
| 银牌会员 Posts 1,133 Credits 2,362 | |
|
Ha. What the 6th floor said is that two variables are used respectively to record the number of layers of for and the number of closing parentheses.
The characters represented by the %var% expression are then executed as commands. I regard this as an advantage of batch processing. 1. When the number of embedded sentences is unknown, temporary embedding can be carried out by string processing. 2. A lot of characters are saved, just like above, where multi-layer For sentences are all put in variables. Refer to an article that has been posted. http://www.cn-dos.net/forum/viewthread.php?tid=45240 [ Last edited by 523066680 on 2009-8-4 at 08:52 ] |
|
| Floor10 ficn | Posted 2009-08-04 23:25 |
| 初级用户 Posts 15 Credits 30 | |
|
```batch
@echo off&setlocal enabledelayedexpansion&set y=9999999999 set/p n=input a number: for /l %%i in (1,1,!y:~-%n%!) do (set qq=0000000000%%i echo !qq:~-%n%!) pause ``` |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |