forked from ByamB4/byamb4insta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_accounts.py
130 lines (113 loc) · 4.48 KB
/
create_accounts.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import typing
import signal
from lxml import html
from requests import get, post
from time import sleep
BASE_URL = 'https://api.mrinsta.com/api'
PASSWORD = 'p4$$w0rD!'
class CreateAccounts:
# create new accounts
def __init__(self):
self.EMAIL_URL = 'https://email-fake.com'
self.WORKED_ACCOUNTS, self.ACCOUNTS, self.INDEX = [], [], 0
signal.signal(signal.SIGINT, self.signal_handler)
with open('instagram_usernames.txt', 'r') as f:
for _ in f.readlines():
self.ACCOUNTS.append(_.strip())
# working from behind, coz most of accounts taken by tulgaa
self.ACCOUNTS = self.ACCOUNTS[::-1]
while True:
_, email = self.generate_new_email()
_, user_id, access_token = self.register(email)
_, otp = self.get_otp(access_token, email)
if not _:
print('\t[-] No OTP found')
print(f'\t[-] Last account: {self.ACCOUNTS[self.INDEX]}')
self.WORKED_ACCOUNTS = []
continue
_, data = self.verify_email(email, otp)
_ = self.connect_ig(email, user_id, access_token)
if self.INDEX >= len(self.ACCOUNTS):
print('[+] Well no account left')
break
with open('done', 'w') as f:
f.write('\n'.join(self.WORKED_ACCOUNTS))
def connect_ig(self, email: str, user_id: str, access_token: str):
# storeUpdateUserDetails
resp = post(f'{BASE_URL}/storeUpdateUserDetails', headers={
"Authorization": f"Bearer {access_token}"
}, json={
"user_id": user_id,
"location": "South America",
"gender": "Prefer not to say",
"age": "35-44"
}).json()
# interests
resp = post(f'{BASE_URL}/storeUserWiseInterests', headers={
"Authorization": f"Bearer {access_token}"
}, json={
"id": user_id,
"interests": "22, 21, 20, 19",
}).json()
# connect to instagram account
# NOTE: need proper solution
print(f'\t[*] Trying instagram usernames')
while self.INDEX < len(self.ACCOUNTS):
resp = post(f'{BASE_URL}/addConnectedIGAccount', headers={
"Authorization": f"Bearer {access_token}"
}, json={
"username": self.ACCOUNTS[self.INDEX],
}).json()
if resp['success']:
print(f'[+] Works: {self.ACCOUNTS[self.INDEX]}, {email}')
self.WORKED_ACCOUNTS.append(email)
return True
self.INDEX += 1
def get_otp(self, access_token: str, email: str):
for _ in range(1, 50):
# self.send_verify_email(access_token, email)
sleep(2)
try:
tree = html.fromstring(
get(f'{self.EMAIL_URL}/{email}').content)
otp = tree.xpath(
"//table[@class='content']//h3")[0].text_content()
if len(otp) == 6:
print(f'\t[+] OTP: {otp}')
return True, otp
except Exception as e:
# print(e)
pass
return False, ''
def register(self, email: str) -> typing.Union[bool, str, str]:
resp = post(f'{BASE_URL}/register', json={
"email": email,
"password": PASSWORD,
"confirm_password": PASSWORD,
}).json()
try:
return resp['success'], resp['data']['user_id'], resp['data']['token']['access_token']
except Exception as e:
return False, "", ""
def verify_email(self, email: str, otp: str):
resp = get(f"{BASE_URL}/verify/{otp}/{email}").json()
if resp['success']:
print("\t[+] Account activated")
return resp['success'], resp['message']
return False, resp
def generate_new_email(self) -> typing.Union[bool, str]:
tree = html.fromstring(get(f'{self.EMAIL_URL}').content)
mail = tree.xpath("//span[@id='email_ch_text']")[0].text_content()
print(f'[+] Email: {mail}')
if '@' in mail:
return True, mail
return False, ''
def send_verify_email(self, access_token: str, email: str):
resp = post(f"{BASE_URL}/sendVerifyEmail", headers={
"Authorization": access_token
}, json={
"email": email
}).json()
return resp['success']
if __name__ == '__main__':
CreateAccounts()