|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『楼 主』:
[已结]怎样生成一个纯数字的密码字典
使用 LLM 解释/回答一下
我想用批处理来生成密码字典,用户输入密码长度,自动生成字典文件dictionary.txt
如果输入3,则dictionary.txt的内容如下:
000
001
002
...
998
999
如果输入4,则dictionary.txt的内容如下:
0000
0001
0002
....
9998
9999
望高人指点。
Last edited by HAT on 2008-11-12 at 21:39 ]
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
001
002
...
998
999
If 4 is entered, the content of dictionary.txt is as follows:
0000
0001
0002
....
9998
9999
Hope an expert can give guidance.
Last edited by HAT on 2008-11-12 at 21:39 ]
|
|
2007-8-29 14:10 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
 『第 2 楼』:
使用 LLM 解释/回答一下
@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
```@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```
此帖被 +9 点积分 点击查看详情 评分人:【 HAT 】 | 分数: +4 | 时间:2007-8-29 22:16 | 评分人:【 523066680 】 | 分数: +5 | 时间:2008-12-19 10:30 |
|
|
|
2007-8-29 16:42 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
多谢 wudixin96 兄
我会在此基础上思考一下纯字母密码以及字母数字混合密码
如果有问题的话再来请教
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.
|
|
2007-8-29 22:18 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
差点忘了加分
罪过罪过
补上啦
Almost forgot to add points
Guilty, guilty
Added it up
|
|
2007-8-29 22:18 |
|
|
rockdong
初级用户
 
积分 48
发帖 25
注册 2007-7-30
状态 离线
|
|
2007-8-30 17:01 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
也做了一个,只支持9位以下,重在参与嘛
@echo off &setlocal enabledelayedexpansion
title code by hi.baidu.com/523066680
set /p "n=输入位数,最大为9: "
for /l %%x in (1,1,%n%) do (
set fo="for %%%%x in (0 1 2 3 4 5 6 7 8 9) do (!fo!"
set end="!end!)"
set echo=!echo! %%%%x
)
%fo:"=%
echo %echo%
%end:"=%
pause
Also made one, only supports below 9 digits, just for fun嘛
@echo off &setlocal enabledelayedexpansion
title code by hi.baidu.com/523066680
set /p "n=Enter the number of digits, maximum is 9: "
for /l %%x in (1,1,%n%) do (
set fo="for %%%%x in (0 1 2 3 4 5 6 7 8 9) do (!fo!"
set end="!end!)"
set echo=!echo! %%%%x
)
%fo:"=%
echo %echo%
%end:"=%
pause
|

综合型编程论坛
我的作品索引 |
|
2008-12-19 10:32 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
(六)楼的速度好快,看不懂
我用笨办法练习一下:
@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
(六) 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
|

精简
=> 个人 网志  |
|
2009-1-4 02:47 |
|
|
linee
初级用户
 
积分 94
发帖 49
注册 2008-12-14
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
从效率上看应该是6楼的单纯n个循环最快了,7楼这个如果每个数都要去if一下,效率可想而知。
受7楼补0的启发,我也来练习一下,效率应该跟6楼很接近。 @echo off
setlocal enabledelayedexpansion
set /p n=key a number:
for /l %%i in (%n%,-1,1) do (
set z=&set min=&set max=
for /l %%j in (2,1,%%i) do set z=0!z!
for /l %%j in (%n%,-1,%%i) do (set/a min=max+1&set max=9!max!)
if !max! equ 9 set/a min=0
for /l %%j in (!min!,1,!max!) do echo !z!%%j
)
Last edited by linee on 2009-1-4 at 18:59 ]
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.
@echo off
setlocal enabledelayedexpansion
set /p n=key a number:
for /l %%i in (%n%,-1,1) do (
set z=&set min=&set max=
for /l %%j in (2,1,%%i) do set z=0!z!
for /l %%j in (%n%,-1,%%i) do (set/a min=max+1&set max=9!max!)
if !max! equ 9 set/a min=0
for /l %%j in (!min!,1,!max!) do echo !z!%%j
)
Last edited by linee on 2009-1-4 at 18:59 ]
|
|
2009-1-4 16:11 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
哈 6楼的就是 分别用两个变量 记录了 for的层数 和 结尾的括号数
%var%表达后 所代表的字符就被当成命令执行了。
我将其视为批处理的一优点,
1。 在未知句子镶嵌数量的情况下,可以利用字符串处理进行临时镶嵌。
2。 省了很多字符,就像上面的,多层For句子都放变量里面了
参考一篇发过的文章
http://www.cn-dos.net/forum/viewthread.php?tid=45240
Last edited by 523066680 on 2009-8-4 at 08:52 ]
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 ]
|

综合型编程论坛
我的作品索引 |
|
2009-8-4 08:48 |
|
|
ficn
初级用户
 
积分 30
发帖 15
注册 2008-6-23
状态 离线
|
 『第 10 楼』:
使用 LLM 解释/回答一下
@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
```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
```
|
|
2009-8-4 23:25 |
|