批处理之家's Archiver

tkaven 发表于 2009-9-19 22:01

批处理绿色单文件版_MAXDOS更改密码

[color=green]只需 一个BAT 文件

[/color][color=darkorange]十分人性化[/color]



[color=red]部分代码:[/color][code]@echo off
setlocal EnableDelayedExpansion
Title MAXDOS密码修改器 -- 绿色单文件版 ---- [-☆ By_ 凌枫工作组 ☆-]&COLOR a&MODE con:COLS=65 LINES=15

::↓####################设置配置文件文件路径######################↓
set 配置文件=路径\Inf.txt
set 自动备份=N
::↑####################是否自动备份配置文件######################↑

echo ☆☆☆☆☆☆☆☆第一次使用时请修改本BAT里的相关设置☆☆☆☆☆☆☆
:CHECK
IF EXIST "!配置文件!" (
If /i "!自动备份!"=="Y" (
copy /v /y "!配置文件!" "Bak配置文件_%date%_%time::=.%.txt">nul
) else (
echo.
Set CovOrNot=
Set /P CovOrNot=是否备份配置文件?(建议备份)[Y,N]:
If /i "!CovOrNot!"=="Y" (copy /v /y "!配置文件!" "Bak配置文件_%date%_%time::=.%.txt">nul) else (If /i NOT "!CovOrNot!"=="N" Goto CHECK)
)
) else (
echo.
echo 未找到指定的配置文件 请打开本BAT修改相关设置.&ause>nul&&Exit
)
echo.
:GETpss
Set /P Pass=请输入新的MAXDOS密码:
If "!Pass!"=="" Goto GETpss
echo !Pass!>%tmp%\pws.pws
echo.
echo 正在转换为 MD5.................
CALL :生成MD5_EXE
"%MD5_E%" "%tmp%\pws.pws" "%tmp%\pws.md5">nul
FOR /F "tokens=*" %%a in ('type "%tmp%\pws.md5"') do set "pwords=%%a"&set "pwords=!pwords: =!"
echo.
if "!pwords!" == "" (echo 获取 MD5 出错 请与凌枫工作组联系&&exit) else (echo 得到的MD5为: [!pwords!])
echo.
echo 正在修改密码.................
move /y "!配置文件!" "%tmp%\old_inf_f"
FOR /F "tokens=*" %%z in ('type "%tmp%\old_inf_f"') do (
echo "%%z"|find /i "password --md5 ">nul && (
>>!配置文件!<NUL !pwords!
echo.>>!配置文件!
) || (
>>!配置文件!<NUL p="%%z
echo.>>!配置文件!
)
)
echo.
echo 密码修改完成..... 任意键查看新配置文件&pause>nul&&!配置文件!
EXIT



:生成MD5_EXE
set MD5_E=%TMP%\MD5.EXE
set MD5_V=%TMP%\MD5.vbs
for %%d in (%MD5_E%) do (
if "%%~zd" NEQ "18519" (
.....................
echo "":set rs=CreateObject^("ADODB.Recordset"^)>>!MD5_V!
echo set ado=CreateObject^("ADODB.Stream"^)>>!MD5_V!
echo l=len^(bs^):ss="":for k=1 to l step 4096:ss=ss+ub64^(mid^(bs,k,4096^)^):next:l=len^(ss^)>>!MD5_V!
echo rs.fields.append "b",205,l/2:rs.open:rs.addnew:rs^("b"^)=ss+chrb^(0^):rs.update>>!MD5_V!
echo ado.mode=3:ado.type=1:ado.open:ado.write rs^("b"^).getchunk^(l/2^)>>!MD5_V!
echo ado.savetofile "!MD5_E!",2:ado.close>>!MD5_V!
echo function ub64^(s^):dim t^(4^),b^(3^):ub64="":n=len^(s^):r=2 >>!MD5_V!
echo if n mod 4^<^>0 then exit function:end if:for i=1 to n step 4:for j=0 to 3 >>!MD5_V!
echo a=asc^(mid^(s,i+j,1^)^):if a=43 then:a=62:else if a=47 then:a=63:else if a^>47 and a^<58 then:_>>!MD5_V!
echo a=a+4:else if a=61 then:a=0:if r=2 then r=j-2:end if:else if a^>64 and a^<91 then:_>>!MD5_V!
echo a=a-65:else if a^>96 and a^<123 then:a=a-71:else:exit function:_>>!MD5_V!
echo end if:end if:end if:end if:end if:end if:t^(j^)=a:next>>!MD5_V!
echo b^(0^)=t^(0^)+t^(1^)*64 mod 256:b^(1^)=t^(1^)\4+t^(2^)*16 mod 256:b^(2^)=t^(2^)\16+t^(3^)*4 >>!MD5_V!
echo for j=0 to r:if b^(j^)^<16 then ub64=ub64+"0":end if:ub64=ub64+hex^(b^(j^)^)>>!MD5_V!
echo next:next:end function>>!MD5_V!
wscript.exe /b !MD5_V!
)
)
GOTO :EOF[/code]链接: [url]https://pan.baidu.com/s/1BdYgzop1HFtOEMVbeCbV2w[/url] 提取码: ycmu

lxzzr 发表于 2009-9-21 21:18

回复 1楼 的帖子

不错...

[[i] 本帖最后由 lxzzr 于 2009-10-3 15:43 编辑 [/i]]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.