aboutsummaryrefslogtreecommitdiffstats
path: root/pwndb_credentials.py
blob: 24a80bda5e0439738a761dbee1aa91429bdf176f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import requests
from bs4 import BeautifulSoup
import argparse
import re


class FindPasswords():
    def __init__(self, mail, proxy):
        self.url = "http://pwndb2am4tzkvold.onion/"
        # self.url = "https://pwndb2am4tzkvold.tor2web.io/"
        name, service = self.__parse_mail(mail)
        self.session = None
        if name and service:
            self.data = {
                    "domain"    : service,
                    "domainopr" : "0",
                    "luser"     : name,
                    "luseropr"  : "0",
                    "submitform": "em"
                }
            self.session = requests.session()
            self.session.proxie = {}
            # TOR PROXY
            self.session.proxies['http'] = proxy
            self.session.proxies['https'] = proxy

    def __parse_mail(self, mail):
        name = None
        service = None
        try:
            split_mail = mail.split("@")
            name = split_mail[0]
            service = split_mail[1]
        except:
            pass
        return name, service

    def request_data(self):
        result = []
        if self.session is not None:
            response = self.session.post(self.url, data=self.data, timeout=5)
            if response.status_code == 200:
                soup = BeautifulSoup(response.text, features="html.parser")
                try:
                    passwords = soup.find("pre").get_text()
                    for line in re.findall("\[password\] => .*", passwords):
                        result.append(line.split("=> ")[1])
                except Exception as e:
                    print(e)

        return result

if __name__ == "__main__":
    print("Descriptor: execute!")
    print("---------------------")
    parser = argparse.ArgumentParser()
    parser.add_argument("-m", "--mail", help="Email to search passwords", required=True)
    parser.add_argument("-p", "--proxy", help="TOR proxy", default="socks5h://localhost:9050")
    args = parser.parse_args()
    mail = args.mail
    proxy = args.proxy
    match = re.match(
        '^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', mail)
    if match:
        print(f"Looking passwords for {mail}")
        passwords = FindPasswords(mail, proxy)
        data = passwords.request_data()
        print("--------- Passwords list --------")
        print(data)
    else:
        print("Please enter a valid mail")