source: trollforge/unsorted/jylam/dlftroll/dlft.py @ 606

Revision 606, 2.8 KB checked in by literalka, 16 months ago (diff)

done..?

Line 
1import os
2import sys
3from http import HTTP
4
5class DLFT(object):
6    sLogin = "void"
7    sMail  = "void"
8
9    # Constructor
10    def __init__(self):
11        print "-> DLFP troll in progress ..."
12
13    # Create templeet account with specified login and email
14    # Uses Pwntcha to crack silly Captcha
15
16    # Templeet works like this :
17    # We get user_new.html, then image.png. image.png GET will send us a PHPSESSID cookie
18    # We crack the captcha using pwntcha, send POST login, mail, and captcha text using
19    #    right PHPSESSID value
20    # That's it!
21   
22    def createAccount(self, AhttpConnection, Alogin, Amail):
23        self.sLogin = Alogin
24        self.sMail  = Amail
25        AhttpConnection.sProxy = AhttpConnection.sProxy.replace('\n', '')
26        print "--> Creating account ", self.sLogin, " with email ", self.sMail, "using proxy",AhttpConnection.sProxy
27
28        captchaImage = AhttpConnection.getPageWithReferer("http://linuxfr.org/image.png", "http://linuxfr.org/user_new.html",{})
29
30        captchaFile = open("linuxfr.png", mode='wb')
31        captchaFile.write(captchaImage);
32        captchaFile.close();
33       
34        captchaValue = "GNAA"
35
36        os.system("pwntcha linuxfr.png > captcha.txt")
37        capFile = file("captcha.txt", "r")
38        captchaValue = capFile.readlines()
39        captchaValue[0] = captchaValue[0].replace('\n', '')
40        capFile.close();
41        print "--> got captcha '",captchaValue[0],"'"
42
43       
44        accountPage = AhttpConnection.getPageWithReferer("http://linuxfr.org/user_new.html", "http://linuxfr.org/user_new.html",{'login' : self.sLogin, 'email' : self.sMail, 'texted' : captchaValue[0]})
45
46
47        if accountPage.rfind("Le compte ne peut pas être cr") != -1:
48            print accountPage
49            print "Error while creating account, login exists OR email already used"
50            sys.exit(-10)
51
52       
53       
54
55
56
57
58
59
60
61
62    # Get password sent to email
63    def getPassword(self, AhttpConnection, ALogin):
64
65        if self.sMail.rfind('2plus2equal5.org') != -1:
66            return get2plus2Pass(AhttpConnection, ALogin)
67
68           
69        elif self.sMail.rfind('gmail.com') != -1:
70            print "Gmail!"
71        else:
72            print "Unknow mailbox for", self.sMail
73
74        return "ERROR!"
75
76
77
78    def get2plus2Pass(AhttpConnection, ALogin):
79        passPage = AhttpConnection.getPageWithReferer("http://2plus2equal5.org/gnaalfr", "LOLOLOLOLOL",{})
80        lindex = passPage.rfind("Login: "+ALogin+"\n")
81
82        if lindex == -1:
83            return "ERROR!"
84       
85        index = passPage.rfind("Passw: ", lindex);
86       
87        mypass = ""
88        i = 0
89        for c in range(index+7, len(passPage)):
90            if passPage[c] == '\n':
91                break
92            mypass = mypass+passPage[c]
93           
94            i = i+1
95           
96        return mypass
Note: See TracBrowser for help on using the repository browser.