· 8 years ago · Feb 25, 2018, 10:24 PM
1import re
2import requests
3import smtplib
4import time
5import imaplib
6import email
7import subprocess
8
9ORG_EMAIL = "@gmail.com"
10FROM_EMAIL = "" + ORG_EMAIL # YOUR USERNAME HERE
11FROM_PWD = "" # YOUR PASSWD HERE
12SMTP_SERVER = "imap.gmail.com"
13SMTP_PORT = 993
14
15class IptvToperson(object):
16 """docstring"""
17 def __init__(self):
18 super(IptvToperson, self).__init__()
19 self.email = FROM_EMAIL
20 self.url = 'https://www.cspmanager.com/cineiptv/acao.php'
21 self.data = {'Acao':1,
22 'usuario':'Virgulino Ferreira da Saiva',
23 'email':'iptvqwera.s.d@gmail.com',
24 'local':'m3u_plus',
25 'pacote':'_SD_HD_VOD'}
26 self.headers = {'Host': 'www.cspmanager.com',
27 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0',
28 'Accept': 'text/html, */*; q=0.01',
29 'Accept-Language': 'en-US,en;q=0.5',
30 'Referer': 'https://www.cspmanager.com/cineiptv/acao.php',
31 'Host': 'www.cspmanager.com',
32 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0',
33 'Accept': 'text/html, */*; q=0.01',
34 'Accept-Language': 'en-US,en;q=0.5',
35 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
36 'X-Requested-With': 'XMLHttpRequest',
37 'Cookie': 'visid_incap_698230=JR508QYqSZyzzHb8FaTDCntGj1oAAAAAQUIPAAAAAADHYlnnDAWMCqbRpDQuRR56; incap_ses_801_698230=YXFNeosy/jdYrMbPdLkdC12QkFoAAAAAWK+3cXsnl4eXpxfQbzmqYA==',
38 'Connection': 'keep-alive'}
39
40 def request_new_trial(self):
41 return requests.post(self.url, data=self.data, headers=self.headers)
42
43 def generate(self):
44 return self.__generate__(self.email)
45
46 def __generate__(self, username, domain):
47 emails = list()
48 username, domain = email.split('@')
49 username_length = len(username)
50 combinations = pow(2, username_length - 1)
51 padding = "{0:0" + str(username_length - 1) + "b}"
52 for i in range(0, combinations):
53 bin = padding.format(i)
54 full_email = ""
55
56 for j in range(0, username_length - 1):
57 full_email += (username[j]);
58 if bin[j] == "1":
59 full_email += "."
60 full_email += (username[j + 1])
61 emails.append(full_email + "@" + domain)
62 return emails
63
64 def get_new_list_url_from_email(self):
65 try:
66 mail = imaplib.IMAP4_SSL(SMTP_SERVER)
67 mail.login(FROM_EMAIL,FROM_PWD)
68 mail.select('inbox')
69 type, data = mail.search(None, '(FROM "CINE IPTV")')
70 mail_ids = data[0]
71
72 id_list = mail_ids.split()
73 first_email_id = int(id_list[0])
74 latest_email_id = int(id_list[-1])
75
76 for i in range(latest_email_id,first_email_id, -1):
77 typ, data = mail.fetch(i, '(RFC822)' )
78
79 for response_part in data:
80 if isinstance(response_part, tuple):
81 msg = email.message_from_string(response_part[1])
82 all_urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', msg.as_string())
83 list_url = [item for item in all_urls if 'http://bit.ly' in item][0].replace('</td>','')
84 print list_url
85 return list_url
86 except Exception, e:
87 print str(e)
88
89 # def openVLC(self, list_url):
90 # return subprocess.call(["vlc", "-vvv", list_url])
91
92topzera = IptvToperson()
93list_url = topzera.get_new_list_url_from_email()
94# topzera.openVLC(list_url)