· 7 years ago · Aug 21, 2018, 01:14 AM
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4from io import BytesIO
5import PIL.Image
6import sys
7import requests
8import random
9import argparse
10import os
11import uuid
12import pytesseract
13
14url = "http://fdwocbsnity6vzwd.onion/"
15tested = 0
16success = 0
17usernames = []
18
19with open('usernames.txt', 'r') as f:
20 for line in f.readlines():
21 usernames.append(line.strip())
22
23def random_string(string_length=10):
24 """Returns a random string of length string_length."""
25 random = str(uuid.uuid4()) # Convert UUID format to a Python string.
26 random = random.upper() # Make all characters uppercase.
27 random = random.replace("-","") # Remove the UUID '-'.
28 return random[0:string_length] # Return the random string.
29
30headers = {
31 'User-agent': "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
32 'Referer': "http://fdwocbsnity6vzwd.onion/register.php?agree=J%27accepte"
33}
34
35while True:
36
37 try:
38
39 response = requests.get(url + "plugins/phpcaptcha/captcha.php?rand=" + str(random.randint(99999, 9999999)), headers=headers)
40 image = PIL.Image.open(BytesIO(response.content))
41
42 image.save("out.png")
43
44 os.system("convert out.png -fuzz 10% -fill white -opaque black -morphology dilate rectangle out_fdw.png")
45
46 image = PIL.Image.open("out_fdw.png")
47
48 captcha_str = pytesseract.image_to_string(image)
49
50 username = ""
51
52 while len(username) < 3:
53 username = random.choice(usernames) + str(random.randint(0, 9999))
54
55 data = {
56 'form_sent': '1',
57 'req_user': username,
58 'req_password1': username,
59 'req_password2': username,
60 'req_email1': username + "@gmail.com",
61 'time_zone': '1',
62 'language': 'French',
63 'email_setting': '2',
64 'captcha_code': captcha_str,
65 'register': '',
66
67 }
68
69 r = requests.post(url + "register.php?action=register", headers=headers, cookies=response.cookies, data=data)
70
71 if "The confirmation code you entered was incorrect!" in r.text:
72 print ("FAIL: " + captcha_str)
73 else:
74 success = success + 1
75 print ("SUCCESS: " + captcha_str)
76 with open("accounts.txt", "a") as f:
77 f.write(username + "\n")
78
79 tested = tested + 1
80
81 print ("% of success : {0:.3f}".format((success / tested) * 100))
82 except Exception as e:
83 continue