做网站我们更专业,服务我们更用心----厦门优艾网络工作室
建站热线:135~1596~4500

批量修改SERVU用户密码的asp源代码

2/6/2006 1:24:41 PM 来源: 作者: 浏览热度( 次) 字号:T|T
分享到:

由于工作需要自己写的批量修改servu用户密码为8位随机程序代码。md5程序请自己从网上搜索!转载请保留出处,谢谢!

<%set fso=CreateObject("Scripting.FileSystemObject")
Set f1=fso.openTextFile(Server.mappath("111.txt"),1) ''111.txt需要修改的配置文件
Set f2=fso.createTextFile(Server.mappath("222.txt"),true) ''222.txt修改后的配置文件
do while not f1.atEndOfStream
fread=f1.readline
if  instr(fread,"[USER=")>0 then
user=replace(fread,"[USER=","")
user=replace(user,"|1]","")
response.Write("用户名:"&user)

elseif  instr(fread,"Password=")>0 and instr(fread,"LocalSetupPassword")<1  then
pwd=getradpassword()
response.Write("     密码:"&pwd&"<br>")
fread="Password="&SerUPassEnCode(pwd)
end if
f2.WriteLine(fread)
''response.Write(fread&"<br>")
loop

f1.close
f2.close

Function getradpassword()
    Dim i, intNum, intUpper, intLower, intRand, strPartPass, genPassword
    Dim arrBindings(2)
    genPassword = ""
    ''生成随机种子;
    Randomize
    For i = 1 To 8
        intNum = Int(10 * Rnd + 48)
        intUpper = Int(26 * Rnd + 65)
        intLower = Int(26 * Rnd + 97)
        intRand = Int(3 * Rnd + 1)
        Select Case intRand
          Case 1
            strPartPass = Chr(intNum)
          Case 2
            strPartPass = Chr(intUpper)
          Case 3
            strPartPass = Chr(intLower)
        End Select
        genPassword = genPassword & strPartPass
    Next
    getradpassword = genPassword
End Function

Function SerUPassEnCode(strPass)
tmp =gettmp()
SerUPassEnCode=tmp &UCase(MD5(tmp&strPass))
End Function

 

Function gettmp()
Randomize
For i = 1 To 2
intLower = Int(26 * Rnd + 97)
gettmp = gettmp + Chr(intLower)
Next
End Function


%>

返回】 【关闭