· 7 years ago · Aug 21, 2018, 12:40 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
12
13url = "http://fdwocbsnity6vzwd.onion/"
14tested = 0
15success = 0
16usernames = []
17
18with open('usernames.txt', 'r') as f:
19 for line in f.readlines():
20 usernames.append(line.strip())
21
22def random_string(string_length=10):
23 """Returns a random string of length string_length."""
24 random = str(uuid.uuid4()) # Convert UUID format to a Python string.
25 random = random.upper() # Make all characters uppercase.
26 random = random.replace("-","") # Remove the UUID '-'.
27 return random[0:string_length] # Return the random string.
28
29headers = {
30 'User-agent': "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
31 'Referer': "http://fdwocbsnity6vzwd.onion/register.php?agree=J%27accepte"
32}
33
34while True:
35
36 try:
37
38 response = requests.get(url + "plugins/phpcaptcha/captcha.php?rand=" + str(random.randint(99999, 9999999)), headers=headers)
39 image = PIL.Image.open(BytesIO(response.content))
40
41 image.save("out.png")
42
43 cmd = "convert out.png -fuzz 10% -fill white -opaque black -morphology dilate rectangle out_fdw.png"
44
45 subprocess.call(cmd, shell=False)
46
47 captcha_str = subprocess.run(['tesseract', 'out_fdw.png', 'stdout', '--oem', '0', '-l', 'eng', '--psm', '6', '-c', 'tessedit_char_whitelist=APFGHKMNBDRTYUPVCXW'], stdout=subprocess.PIPE).stdout.decode('utf-8')
48 captcha_str = captcha_str.replace("\n", "").replace(" ", "").strip()
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