From d53e7a081bd20ae1632befa456a2878d479b62e2 Mon Sep 17 00:00:00 2001 From: Lasse Date: Fri, 2 Jul 2021 06:10:55 +0200 Subject: [PATCH 1/4] =?UTF-8?q?La=20till=20defaultv=C3=A4rde=20f=C3=B6r=20?= =?UTF-8?q?container=20("container")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- facebook/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/facebook/__main__.py b/facebook/__main__.py index 13ab25d..e1faa43 100644 --- a/facebook/__main__.py +++ b/facebook/__main__.py @@ -21,6 +21,7 @@ if __name__ == "__main__": mode = 'all' pwd = None proxieservers = 'mullvad' + container = 'container' # Todo ska den här bort? argv = argv[1:] From 0d45c22d864e81319cf81d9f5526916397dfa4da Mon Sep 17 00:00:00 2001 From: Lasse Date: Fri, 27 Aug 2021 19:06:46 +0200 Subject: [PATCH 2/4] =?UTF-8?q?allt=20m=C3=B6jligt...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- facebook/__main__.py | 13 +++-- facebook/arangodb.py | 63 +++++++++++++----------- facebook/classes.py | 4 +- facebook/config.py | 5 +- facebook/gephi.py | 7 ++- facebook/proxytest.py | 24 ++++++++++ facebook/scrapers.py | 2 +- facebook/search_leak.py | 104 ++++++++++++++++++++++++++++++++++++++++ facebook/stats.py | 2 +- 9 files changed, 184 insertions(+), 40 deletions(-) create mode 100644 facebook/proxytest.py create mode 100644 facebook/search_leak.py diff --git a/facebook/__main__.py b/facebook/__main__.py index e1faa43..6904fdd 100644 --- a/facebook/__main__.py +++ b/facebook/__main__.py @@ -18,7 +18,7 @@ if __name__ == "__main__": url_other_pictures = [] # Fylls eventuellt på test = False write = True - mode = 'all' + mode = 'few' pwd = None proxieservers = 'mullvad' container = 'container' # Todo ska den här bort? @@ -107,6 +107,7 @@ if __name__ == "__main__": print('Write:', write) # Hämta en användare att kolla upp + print('userdoc[_key]', userdoc['_key']) user = User(str(userdoc['_key']).strip(), mode, other_pictures=url_other_pictures) if "url_other_pictures" in globals(): @@ -126,9 +127,12 @@ if __name__ == "__main__": if lookups == "leak_lookups": id = user.username - check_profile_status(profile, user) - if profile.blocked: - profile = blocked_profile(profile, proxieservers=proxieservers) + while True: + check_profile_status(profile, user) + if profile.blocked: + profile = blocked_profile(profile, proxieservers=proxieservers) + else: + break profile.open(url_bas + "/" + user.username) url = profile.browser.state.url.strip("/").strip("?_rdr") if "php?" not in url: @@ -145,6 +149,7 @@ if __name__ == "__main__": profile.users_checked += 1 # Hämta reaktioner för den första användaren + print(user.username) if any([not check_for_user(user.username, mode=mode), mode == "force"]): try: while True: diff --git a/facebook/arangodb.py b/facebook/arangodb.py index e1fa92a..77d6735 100644 --- a/facebook/arangodb.py +++ b/facebook/arangodb.py @@ -9,30 +9,38 @@ from arango import ArangoClient from config import * +if __name__ == '__main__.py': + for i in range(0, 6, 1): + if i == 5: + exit() + try: + # Om scriptet körs på Macbook finns lösenordet i en fil + with open("../password_arango.txt") as f: + pwd = f.readline() + except FileNotFoundError: + if 'pwd' not in globals(): + pwd = getpass(f'Lösenord för {user_arango}: ') -for i in range(0, 6, 1): - if i == 5: - exit() - try: - # Om scriptet körs på Macbook finns lösenordet i en fil - with open("../password_arango.txt") as f: - pwd = f.readline() - except FileNotFoundError: - if 'pwd' not in globals(): - pwd = getpass(f'Lösenord för {user_arango}: ') - - try: - db = ArangoClient(hosts=host_arango).db(db_arango, username=user_arango, password=pwd) - db.collection('members').random() # För att testa löseordet/kopplingen. - break - except: - print("Fel lösenord.") - sleep(1) + try: + db = ArangoClient(hosts=host_arango).db(db_arango, username=user_arango, password=pwd) + db.collection('members').random() # För att testa löseordet/kopplingen. + break + except: + print("Fel lösenord.") + sleep(1) +else: + db = None # Om db importeras separat. from helpers import now, _print, nowstamp, sleep_ from classes import Profile +def arango_connect(pwd, username='Lasse', db_arango = 'facebook', host_arango='http://192.168.1.20', port_arango='8529'): + return ArangoClient(hosts=f'{host_arango}:{port_arango}').db( + db_arango, username=username, password=pwd, + ) + + def checked_members(): cursor = db.aql.execute( """ @@ -78,6 +86,7 @@ def report_blocked(profile): def get_profile(db=db, collection='mullvad'): """ Hämtar profil från profiles """ + collection = f'profiles_{collection}' while True: cursor = db.aql.execute( @@ -86,7 +95,7 @@ def get_profile(db=db, collection='mullvad'): FILTER doc.in_use < @inuse RETURN doc """, - bind_vars={"inuse": nowstamp() - 1200, '@col': f'profiles_{collection}'} + bind_vars={"inuse": nowstamp() - 1200, '@col': collection} ) profiles = [profile for profile in cursor] @@ -114,7 +123,9 @@ def remove_profile(profile, proxieservers='mullvad'): """ Tar bort en blockerad profil från databasen. """ _print(profile, None, f"Tar bort {profile.name}.") - db.collection(f'profiles_{proxieservers}').delete( + collection = f'profiles_{proxieservers}' + + db.collection(collection).delete( profile.doc["_key"], silent=True, ignore_missing=True ) _print(profile, profile.container, f"{profile.name} blockerad och borttagen {now()}.") @@ -122,13 +133,9 @@ def remove_profile(profile, proxieservers='mullvad'): # TODO #2 Bättre funktion för backup av databasen -def arango_connect(pwd): - return ArangoClient(hosts=host_arango).db( - db_arango, username=user_arango, password=pwd - ) - def check_for_user(username, mode=''): + print(username) """ Checks if a user exist in db and if it's checked """ checked = False if db.collection("members").has(username): @@ -229,7 +236,7 @@ def write_stats(continuous=False): # Hur många konton per säljare som finns kvar cursor = db.aql.execute( ''' - for doc in profiles + for doc in profiles_mullvad filter has(doc, "vendor") COLLECT vendor = doc.vendor WITH COUNT INTO length RETURN { @@ -268,7 +275,7 @@ def blocked_profile(profile, proxieservers): def new_profile(container, proxieservers): """ Hämtar en ny profil. """ - profile = Profile(get_profile(proxieservers=proxieservers), container, proxieservers) + profile = Profile(get_profile(collection=proxieservers), container, proxieservers) _print(profile, None, f'Hämtade profilen {profile.name}. Login = {profile.logged_in}.') if profile.logged_in == False: profile.accept_cookies() @@ -312,4 +319,4 @@ def find_id(): -db = ArangoClient(hosts=host_arango).db(db_arango, username=user_arango, password=pwd) +#db = ArangoClient(hosts=host_arango).db(db_arango, username=user_arango, password=pwd) diff --git a/facebook/classes.py b/facebook/classes.py index fddc632..4b64e5a 100644 --- a/facebook/classes.py +++ b/facebook/classes.py @@ -135,8 +135,8 @@ class Profile: # Starta browser user_agent = self.useragent self.browser = RoboBrowser( - session=session, user_agent=user_agent, history=False, parser="lxml" - ) + session=session, user_agent=user_agent, history=False, parser="lxml", timeout=20 + ) #TODO Kolla timeout på den här # TODO Ta bort gamla metoden om nya (hämta från doc) fungerar # try: diff --git a/facebook/config.py b/facebook/config.py index c84e19e..faadfca 100644 --- a/facebook/config.py +++ b/facebook/config.py @@ -7,10 +7,9 @@ def set_pwd(_pwd=None): # Info för arangodb user_arango = "Lasse" -pwd_arango = "4c071768bedc259288361c07aafd8535fca546086fada4e7b5de4e2bb26b0e70fa8d348c998b90d032a5b8f3fdbae1881b843021e3475198e6fb45f58d8dc450bd52f77d" db_arango = "facebook" -host_arango = 'http://192.168.0.4:8529' -#host_arango = "http://arango.lasseedfast.se" +host_arango = 'http://192.168.1.20' +port_arango = '8529' # Andra uppgifter url_bas = "https://mbasic.facebook.com" diff --git a/facebook/gephi.py b/facebook/gephi.py index 1b0c704..05803f4 100644 --- a/facebook/gephi.py +++ b/facebook/gephi.py @@ -6,10 +6,12 @@ from sys import argv import networkx as nx import pandas as pd from numpy.core.numeric import NaN +from getpass import getpass +import arangodb locale.setlocale(locale.LC_TIME, "en_US") -from arangodb import db + def nodes_from_list( @@ -240,6 +242,9 @@ def common_friends(d, n=2): return l +pwd = getpass('Password for Lasse: ') +db = arangodb.arango_connect(pwd) + if __name__ == "__main__": diff --git a/facebook/proxytest.py b/facebook/proxytest.py new file mode 100644 index 0000000..cc94728 --- /dev/null +++ b/facebook/proxytest.py @@ -0,0 +1,24 @@ +import re +from time import sleep +from getpass import getpass + +from bs4 import BeautifulSoup +from arango import ArangoClient +import requests +from urllib.parse import urlencode + + + +def check_ip(): + """ + Checks the current IP. + """ + url = f'https://mrkoll.se/resultat?n={46706111785}' + proxies = {'https': 'http://sgz2bkt7:TtLyyPGKMmjabg7R_country-Sweden@proxy.proxy-cheap.com:31112'} + ip = requests.get(url, proxies=proxies).text + + return ip + +print(check_ip()) + + diff --git a/facebook/scrapers.py b/facebook/scrapers.py index 0f46bfc..5260666 100644 --- a/facebook/scrapers.py +++ b/facebook/scrapers.py @@ -157,7 +157,7 @@ def profile_picture_reactions(profile, user, first_user=False, mode="all"): if first_user == False: if mode == "single" and user.reactions > 30: break - elif all([any[mode == "few", mode == "solo"], user.reactions > 80, pic != url_pics[-1]]): + elif all([any([mode == "few", mode == "solo"]), user.reactions > 80, pic != url_pics[-1]]): # Kolla den sista bilder check_picture(url_bas + url_pics[-1], user, profile) user.checked_pictures.append(url_bas + pic) diff --git a/facebook/search_leak.py b/facebook/search_leak.py new file mode 100644 index 0000000..314820f --- /dev/null +++ b/facebook/search_leak.py @@ -0,0 +1,104 @@ +""" +Skript för att söka i FB-läckan. +""" + +import re +import paramiko +import arangodb +from getpass import getpass +from sshtunnel import open_tunnel +import paramiko +from termcolor import cprint + +def search(db, attribute, value): + """ + Search for attribute in db. + Returns list of matching documents. + """ + + if '%' in value or '_' in value: + match = 'like' + else: + match = '==' + + cursor = db.aql.execute( + f""" + FOR doc IN leak + FILTER doc.@attribute {match} @value + RETURN doc + """, + bind_vars={"attribute": attribute, "value": value}, + ) + return [doc for doc in cursor] + +pwd_key = getpass(f"Password key: ") + +with open_tunnel( + ("studio-garda.asuscomm.com", 2200), + ssh_username="Lasse", + ssh_pkey=paramiko.RSAKey.from_private_key_file( + "/Users/Lasse/.ssh/id_rsa", password=pwd_key + ), + ssh_private_key_password=pwd_key, + remote_bind_address=("127.0.0.1", 8529), +) as server: + # server.start() + port_arango = server.local_bind_port + + db = arangodb.arango_connect( + "gruel-ADOBE-foolish-winy-borax", + username="Leak", + host_arango="http://127.0.0.1", + port_arango=port_arango, + ) + + cprint("\n\nVad vill du söka efter?", attrs=['bold']) + print("1 - Telefonnummer") + print("2 - Facebook-ID") + print('3 - Namn') + print("4 - Arbete") + print('5 - Bostadsort') + print("6 - Födelseort") + print("7 - Epost") + + # Få input för attribut + attribute = input("\n>>> ") + attributes = { + "1": ("telefonnummer", "phone"), + "2": ("Facebook-ID", "_key"), + "3": ("namn", "full_name"), + "4": ("arbete", "work"), + "5": ('bostadsort', "lives_in"), + "6": ('födelseort', 'from'), + "7": ('epost', 'email') + } + + # Bestäm n- eller t-form och få input för värde. + if attribute in ['5', '6', '7']: + genus = 'n' + else: + genus = 't' + + cprint(f"\nVilke{genus} {attributes[attribute][0]}? ", attrs=['bold']) + cprint('Använd % för att ersätta flera okända tecken, _ för att ersätta ett.', attrs=['dark']) + value = input('\n>>> ') + + if attribute == '1': # telefonnummer + value = ''.join(re.findall(r'\d+', value)) + if value[0] == '0': + value = f'46{value[1:]}' + elif attribute == '3': # namn + value = value.upper() + + # Sök i databasen. + result = search(db, attributes[attribute][1], value) + + # Presentera reultaten #TODO hur vill man få dem? Spara ner? + for i in result: + print('\n', i['full_name']) + for key, value in i.items(): + print(f'{key}: {value}') + print(f'https://facebook.com/{i["_key"]}') + + print(f'\nAntal träffar: {len(result)}\n') + diff --git a/facebook/stats.py b/facebook/stats.py index bcf653f..60764f2 100644 --- a/facebook/stats.py +++ b/facebook/stats.py @@ -59,7 +59,7 @@ def write_stats(db, continuous=False): break # Info för arangodb -user_arango = "Lasse" +user_arango = "Stats" db_arango = "facebook" host_arango = "http://192.168.0.4:8529" From 2788d8842c8f7749eaa27fdba094e172ab3928e6 Mon Sep 17 00:00:00 2001 From: Lasse Date: Fri, 27 Aug 2021 19:29:22 +0200 Subject: [PATCH 3/4] --- facebook/socks5free.csv | 557 ---------------------------------------- 1 file changed, 557 deletions(-) delete mode 100644 facebook/socks5free.csv diff --git a/facebook/socks5free.csv b/facebook/socks5free.csv deleted file mode 100644 index 30c2e18..0000000 --- a/facebook/socks5free.csv +++ /dev/null @@ -1,557 +0,0 @@ -DE;91.198.137.31:3552;FAIL; -FR;54.36.4.70:61432;188.165.211.29;0:00:00.601284 -DE;138.68.82.88:1080;138.68.82.88;0:00:05.222863 -DE;172.104.142.154:35819;172.104.142.154;0:00:02.972221 -MD;185.14.31.113:443;FAIL; -NL;146.185.132.87:31284;146.185.132.87;0:00:00.541678 -UA;46.151.197.254:8080;46.151.197.254;0:00:02.210311 -FI;135.181.184.170:54048;135.181.184.170;0:00:00.720659 -FR;151.106.34.139:1080;FAIL; -NL;88.202.177.242:1090;FAIL; -UA;95.67.99.99:33871;FAIL; -DE;138.201.5.46:1080;138.201.5.46;0:00:07.487491 -DE;159.69.106.103:1080;159.69.106.103;0:00:00.630095 -NL;51.15.78.50:1080;51.15.78.50;0:00:00.564266 -NL;88.202.177.242:1080;FAIL; -SG;113.77.85.215:1081;149.129.48.241;0:00:03.688375 -RU;95.107.37.109:1105;FAIL; -KZ;109.229.161.151:1225;FAIL; -RU;84.22.137.26:9025;84.22.137.26;0:00:09.468929 -US;149.28.126.83:1081;149.28.126.83;0:00:01.023434 -AR;181.3.58.168:1080;FAIL; -US;67.227.193.162:34496;67.227.193.162;0:00:01.318698 -NL;146.185.132.87:44795;146.185.132.87;0:00:02.952634 -US;198.58.119.187:50398;69.164.194.35;0:00:01.449008 -AR;186.126.79.171:1080;FAIL; -CA;192.252.211.197:14921;FAIL; -CA;192.252.209.155:14455;FAIL; -CZ;89.187.144.153:1080;89.187.144.153;0:00:01.096993 -US;209.141.53.246:1080;FAIL; -US;192.111.137.37:18762;FAIL; -CA;192.252.208.67:14287;FAIL; -US;67.55.185.240:1888;FAIL; -NL;142.93.137.235:54866;142.93.137.235;0:00:04.162599 -US;192.111.135.18:18301;FAIL; -US;192.111.138.29:4145;FAIL; -SG;45.77.36.30:24574;45.77.36.30;0:00:02.664875 -US;70.185.68.133:4145;FAIL; -FR;51.68.134.242:25623;51.68.134.240;0:00:05.998615 -FR;193.70.45.126:32821;193.70.45.126;0:00:03.586748 -US;98.162.25.7:31653;FAIL; -US;72.223.168.86:57481;FAIL; -DE;213.136.89.190:18461;213.136.89.190;0:00:03.407266 -DE;101.53.158.48:9051;FAIL; -PL;5.226.69.12:50477;5.226.69.12;0:00:08.327345 -US;98.162.25.29:31679;FAIL; -IN;103.209.64.19:6667;FAIL; -AR;186.126.42.65:1080;200.73.130.62;0:00:11.137412 -US;72.221.196.157:35904;FAIL; -US;72.206.181.105:64935;FAIL; -SG;113.77.86.73:1081;149.129.55.120;0:00:02.697133 -CA;192.252.214.20:15864;FAIL; -RU;109.72.231.37:1080;109.72.231.37;0:00:01.095943 -TR;188.132.179.124:60088;188.132.179.124;0:00:01.228944 -AR;181.3.72.8:1080;200.73.132.176;0:00:17.562909 -GB;157.245.34.127:32215;157.245.34.127;0:00:06.500380 -RU;31.7.232.178:1080;31.7.232.178;0:00:08.192440 -US;72.223.168.73:57494;FAIL; -AR;186.126.135.164:1080;200.73.130.62;0:00:14.713391 -IN;165.22.220.151:36362;165.22.220.151;0:00:05.533314 -US;192.111.137.35:4145;FAIL; -BR;186.126.143.88:1080;FAIL; -BR;181.3.51.12:1080;209.14.2.12;0:00:08.158021 -US;104.238.215.49:1080;104.238.215.49;0:00:04.300450 -AR;186.126.163.43:1080;FAIL; -BR;181.6.94.90:1080;FAIL; -AR;181.3.23.13:1080;FAIL; -VN;113.160.188.21:1080;113.160.188.21;0:00:05.010119 -FI;135.181.184.170:22497;135.181.184.170;0:00:09.929478 -FR;51.68.134.247:30204;FAIL; -AR;181.101.2.92:1080;200.73.132.106;0:00:03.141000 -BR;181.101.26.136:1080;FAIL; -BR;181.3.71.184:1080;191.252.103.251;0:00:03.371414 -AR;181.102.21.228:1080;FAIL; -AR;181.3.37.59:1080;FAIL; -AR;186.126.177.123:1080;FAIL; -AR;186.126.151.29:1080;45.235.98.221;0:00:05.725761 -AR;181.3.61.217:1080;FAIL; -AR;181.5.222.133:1080;FAIL; -FR;51.68.134.241:30204;FAIL; -HK;1.65.196.134:1080;1.65.196.134;0:00:04.107338 -BR;181.3.8.101:1080;54.232.66.92;0:00:25.527846 -UA;91.229.123.191:1080;94.153.23.177;0:00:07.271681 -AR;181.3.62.188:1080;FAIL; -KR;222.99.47.68:8888;FAIL; -KR;119.28.73.113:22225;158.247.225.109;0:00:02.975846 -AR;181.102.5.177:1080;45.235.99.87;0:00:04.846713 -AR;181.101.16.232:1080;FAIL; -AR;181.101.12.108:1080;FAIL; -AR;181.101.38.248:1080;45.235.99.87;0:00:12.370835 -AR;181.3.59.102:1080;FAIL; -FR;195.154.178.247:20152;FAIL; -DE;46.101.218.6:24040;46.101.218.6;0:00:02.524995 -US;173.236.188.154:7595;173.236.184.102;0:00:07.522997 -AR;181.3.4.18:1080;200.69.236.22;0:00:03.333511 -CA;181.101.14.230:1080;FAIL; -DK;142.93.245.247:30588;FAIL; -FR;54.36.4.69:61432;188.165.211.29;0:00:00.679880 -AR;186.152.120.155:1080;45.235.99.88;0:00:13.682541 -IN;27.116.51.181:6667;FAIL; -AR;181.7.201.154:1080;45.235.99.83;0:00:03.619538 -FR;51.68.134.245:25623;51.68.134.240;0:00:03.046891 -US;192.111.139.165:19402;FAIL; -AR;186.126.140.70:1080;FAIL; -US;184.178.172.5:15303;FAIL; -AR;186.126.25.102:1080;200.73.134.139;0:00:18.534001 -US;181.3.66.118:1080;FAIL; -BR;186.126.141.239:1080;177.67.82.171;0:00:20.168977 -DE;78.46.200.13:22039;78.46.200.13;0:00:03.381044 -BR;186.152.119.220:1080;FAIL; -AR;186.152.33.185:10808;FAIL; -US;181.102.84.53:1080;FAIL; -AR;186.152.31.215:1080;FAIL; -BR;186.152.194.140:1080;FAIL; -US;173.236.184.154:22960;173.236.184.139;0:00:02.895083 -FR;137.74.153.106:1080;137.74.153.106;0:00:03.010125 -AR;186.126.32.22:1080;138.99.7.145;0:00:07.475672 -BR;181.101.11.43:1080;FAIL; -US;72.210.252.134:46164;FAIL; -BR;181.3.56.124:1080;FAIL; -AR;181.101.47.84:1080;FAIL; -CA;181.6.141.73:1080;FAIL; -MD;178.175.139.202:57772;178.175.139.202;0:00:01.611892 -PH;210.16.73.82:1080;124.107.231.80;0:00:03.173570 -AR;186.126.44.155:1080;200.89.175.133;0:00:08.703594 -BR;181.101.60.197:1080;104.41.41.29;0:00:07.245720 -KR;125.135.221.94:54557;FAIL; -US;186.126.62.200:1080;FAIL; -GB;178.62.79.115:35580;178.62.79.115;0:00:05.262268 -FI;95.216.176.163:1089;95.216.176.163;0:00:09.142730 -CA;186.126.21.113:1080;FAIL; -AR;181.3.38.147:1080;181.117.241.51;0:00:04.966959 -US;70.166.167.38:57728;FAIL; -AR;181.3.78.111:1080;200.73.131.75;0:00:09.585425 -BR;181.5.244.219:1080;FAIL; -FR;51.68.134.240:25623;51.68.134.240;0:00:08.593545 -US;181.102.16.72:1080;FAIL; -FR;178.32.47.218:50939;178.32.47.218;0:00:06.439677 -US;173.236.189.175:22960;FAIL; -AR;181.7.208.112:1080;FAIL; -IN;103.241.227.110:6667;FAIL; -US;147.135.116.172:53079;147.135.116.172;0:00:02.112520 -AR;186.126.64.146:1080;FAIL; -CA;181.0.12.116:1080;FAIL; -US;198.8.94.170:39074;FAIL; -AR;181.3.76.4:1080;FAIL; -AR;181.7.204.60:1080;FAIL; -AR;181.3.28.148:1080;FAIL; -BR;181.3.74.230:1080;45.162.231.55;0:00:13.378087 -US;113.73.72.183:1080;FAIL; -US;141.98.134.2:1080;141.98.134.2;0:00:03.583016 -CA;192.111.130.5:17002;FAIL; -RU;185.233.202.27:1080;185.233.202.27;0:00:11.702264 -DE;173.212.201.250:47492;173.212.201.250;0:00:07.449093 -SG;206.189.158.28:7905;206.189.158.28;0:00:08.228267 -US;173.236.190.7:7595;173.236.184.102;0:00:05.519787 -US;173.236.188.46:22960;173.236.184.139;0:00:05.490614 -US;173.236.185.99:22960;173.236.184.139;0:00:09.586001 -AR;186.126.73.156:1080;200.73.130.62;0:00:03.150311 -GB;157.245.34.127:61851;157.245.34.127;0:00:04.082666 -TW;60.169.205.61:1080;FAIL; -BR;181.101.47.97:1080;191.233.232.45;0:00:03.439772 -FR;51.68.134.253:25623;51.68.134.240;0:00:08.526576 -AR;181.3.16.106:10808;FAIL; -US;173.236.190.93:22960;FAIL; -US;186.126.99.163:10808;FAIL; -AR;186.152.130.181:1080;200.73.138.194;0:00:10.460878 -AR;186.152.15.200:1080;FAIL; -AR;181.5.232.149:1080;FAIL; -DE;165.22.17.195:5110;165.22.17.195;0:00:04.337353 -FR;51.68.134.244:25623;51.68.134.240;0:00:05.794034 -AR;186.126.80.182:1080;FAIL; -SG;206.189.158.28:53176;206.189.158.28;0:00:04.394778 -AR;186.126.3.27:1080;FAIL; -AR;186.126.17.42:1080;FAIL; -BR;186.126.159.136:1080;FAIL; -BR;186.126.70.165:1080;54.207.134.244;0:00:07.969362 -CL;181.5.217.57:1080;FAIL; -US;66.42.224.229:41679;FAIL; -BR;181.3.2.188:1080;FAIL; -FR;51.68.134.252:25623;51.68.134.240;0:00:03.820479 -BR;181.83.226.81:1080;209.14.2.204;0:00:10.407002 -US;104.238.212.43:1081;104.238.212.43;0:00:03.010979 -BR;186.126.109.207:1080;FAIL; -BR;181.3.39.114:1080;FAIL; -FR;51.68.134.255:22308;51.68.134.240;0:00:05.837994 -US;184.178.172.18:15280;FAIL; -FR;51.68.134.247:25623;51.68.134.240;0:00:05.294231 -AR;181.3.84.123:1080;45.235.99.87;0:00:07.781855 -AR;186.126.51.206:1080;FAIL; -BR;181.83.228.198:1080;FAIL; -AR;186.126.40.168:1080;FAIL; -US;181.0.8.189:1080;FAIL; -AR;181.101.35.11:1080;FAIL; -US;104.238.111.218:57978;104.238.111.218;0:00:06.871360 -CA;181.3.20.113:10808;FAIL; -FR;51.75.42.95:25623;51.68.134.240;0:00:04.044253 -US;173.236.187.212:22960;173.236.184.139;0:00:03.293691 -BR;181.3.65.241:1080;FAIL; -US;173.236.186.231:22960;173.236.184.139;0:00:03.276001 -US;165.227.177.113:24586;165.227.177.113;0:00:05.401278 -CA;186.126.58.189:10808;51.222.141.137;0:00:04.245833 -DE;176.9.160.118:22836;FAIL; -US;74.208.101.185:31200;FAIL; -US;186.126.166.22:1080;FAIL; -AR;181.101.33.157:1080;45.235.99.83;0:00:05.120106 -AR;186.126.110.76:1080;FAIL; -US;186.126.170.254:1080;FAIL; -FR;51.68.134.251:25623;51.68.134.240;0:00:06.095322 -BR;186.126.74.124:1080;FAIL; -IN;43.224.10.32:6667;FAIL; -US;95.217.132.133:3178;FAIL; -US;157.230.154.211:28030;157.230.154.211;0:00:03.840172 -IN;140.238.250.54:1080;140.238.250.54;0:00:04.823383 -AR;181.102.134.167:1080;FAIL; -AR;186.126.101.52:1080;FAIL; -CO;181.129.7.202:6699;181.129.7.202;0:00:02.020779 -US;186.126.15.241:10808;FAIL; -AR;181.101.8.41:1080;FAIL; -AR;181.0.0.18:1080;FAIL; -SG;181.3.58.52:1080;FAIL; -AR;181.101.9.46:1080;FAIL; -SG;129.226.196.49:41789;129.226.196.49;0:00:02.896387 -CA;192.111.129.145:16894;FAIL; -AR;181.3.51.132:1080;FAIL; -AR;181.3.10.74:1080;FAIL; -BR;181.3.9.61:1080;FAIL; -AR;181.3.49.78:1080;FAIL; -GB;181.101.52.44:1080;FAIL; -US;69.61.200.104:36181;FAIL; -BR;186.126.177.239:1080;FAIL; -BR;186.152.122.42:1080;FAIL; -CL;186.126.71.210:1080;170.239.87.87;0:00:10.699452 -US;184.178.172.13:15311;FAIL; -BD;103.85.232.146:1080;FAIL; -US;161.35.137.49:28005;FAIL; -AR;181.101.45.131:1080;FAIL; -US;70.166.167.55:57745;FAIL; -AR;181.3.57.187:1080;FAIL; -NL;188.166.104.152:6683;FAIL; -US;95.217.132.133:3038;FAIL; -IN;103.241.227.98:6667;FAIL; -AR;181.102.47.46:1080;FAIL; -PL;5.226.69.12:41284;5.226.69.12;0:00:05.842418 -AR;186.126.139.224:10808;FAIL; -AR;181.7.197.13:1080;FAIL; -AR;186.152.16.246:1080;FAIL; -US;113.73.72.177:1080;FAIL; -US;72.221.164.34:60671;FAIL; -BR;181.3.68.127:1080;FAIL; -US;173.236.186.236:22960;173.236.184.139;0:00:03.567567 -AR;186.126.167.68:1080;FAIL; -IN;103.240.168.138:6667;FAIL; -US;104.248.0.141:17074;FAIL; -AR;181.5.219.126:1080;FAIL; -CA;186.152.115.63:1080;FAIL; -US;132.148.129.108:34289;132.148.129.108;0:00:06.245162 -AR;186.126.138.242:1080;FAIL; -AR;181.102.16.55:1080;FAIL; -US;104.238.215.49:1081;104.238.212.43;0:00:07.598953 -US;147.135.116.172:26522;147.135.116.172;0:00:03.047146 -GB;178.62.79.49:51591;178.62.79.49;0:00:04.168867 -AR;181.3.39.27:1080;FAIL; -BR;181.6.149.14:1080;201.76.56.248;0:00:10.817129 -IN;27.116.51.85:6667;FAIL; -IN;103.216.82.22:6667;FAIL; -SG;206.189.158.28:44880;206.189.158.28;0:00:10.378409 -SK;109.74.144.149:22743;109.74.144.149;0:00:07.030135 -FR;51.68.134.241:25623;51.68.134.240;0:00:08.225295 -AR;181.6.8.208:10808;200.73.132.2;0:00:14.850405 -AR;186.152.4.160:1080;FAIL; -AR;181.3.46.25:1080;FAIL; -US;208.102.51.6:58208;FAIL; -AR;181.101.53.240:1080;200.73.132.115;0:00:09.802936 -IN;103.251.225.16:6667;FAIL; -US;173.236.185.19:22960;FAIL; -FR;51.68.134.250:25623;FAIL; -US;50.62.35.16:41644;50.62.35.16;0:00:02.304961 -BR;186.126.129.193:1080;FAIL; -US;166.62.85.224:13954;166.62.85.224;0:00:05.123121 -US;47.100.88.171:20900;FAIL; -US;104.238.111.167:14416;FAIL; -US;64.34.217.33:40741;FAIL; -CA;192.252.215.5:16137;FAIL; -US;173.236.184.139:22960;173.236.184.139;0:00:04.575732 -DE;46.101.218.6:39749;46.101.218.6;0:00:06.758081 -AR;181.101.2.18:1080;FAIL; -US;66.228.36.18:61852;FAIL; -DE;173.212.201.250:23686;FAIL; -IN;43.224.10.35:6667;FAIL; -US;173.236.185.96:22960;FAIL; -AR;181.3.37.213:1080;200.73.130.62;0:00:08.508165 -AR;181.3.49.28:1080;FAIL; -US;173.236.191.119:22960;173.236.184.139;0:00:08.729647 -BR;181.3.67.154:1080;FAIL; -US;104.248.0.141:57391;104.248.0.141;0:00:03.865643 -AR;186.152.149.227:1080;200.73.130.62;0:00:03.071001 -CA;186.126.82.88:1080;FAIL; -AR;186.126.151.73:1080;200.73.130.62;0:00:05.884195 -DE;173.212.201.250:54349;FAIL; -AR;181.0.5.196:1080;FAIL; -NL;142.93.137.235:6191;142.93.137.235;0:00:04.257492 -SG;206.189.158.28:4454;FAIL; -US;157.230.154.211:32381;157.230.154.211;0:00:10.416110 -AR;186.126.49.178:1080;FAIL; -CA;181.3.40.39:1080;FAIL; -US;95.217.132.133:3598;FAIL; -FR;51.68.134.249:30204;FAIL; -US;104.238.111.167:53308;FAIL; -DE;171.221.35.24:1080;FAIL; -NL;188.166.104.152:44924;FAIL; -SG;129.226.196.49:13181;129.226.196.49;0:00:13.210261 -AR;181.3.55.161:1080;FAIL; -HK;101.132.120.74:1080;FAIL; -SE;95.217.132.133:3508;FAIL; -CA;186.126.129.149:1080;51.79.52.142;0:00:08.184306 -AR;181.101.19.224:1080;FAIL; -AR;181.3.7.234:1080;FAIL; -AR;181.6.28.131:1080;FAIL; -BR;181.6.114.165:1080;209.14.2.57;0:00:18.254419 -DE;173.212.201.250:33464;FAIL; -NL;146.185.132.87:55158;FAIL; -HK;150.109.148.234:1234;FAIL; -HU;85.90.161.117:2021;85.90.161.117;0:00:02.127226 -AR;181.5.201.229:1080;200.73.132.119;0:00:15.974410 -US;72.49.49.11:31034;FAIL; -US;97.74.6.64:45683;FAIL; -US;186.126.95.145:10808;FAIL; -DE;54.38.157.22:9999;54.38.157.22;0:00:08.000757 -FR;51.68.134.250:30204;FAIL; -BR;186.126.89.33:1080;FAIL; -FR;51.68.134.242:30204;FAIL; -US;166.62.85.184:42828;166.62.85.184;0:00:04.136324 -US;173.236.186.172:22960;173.236.184.139;0:00:04.403408 -BR;181.83.228.40:1080;FAIL; -US;165.22.13.68:15576;165.22.13.68;0:00:04.907470 -US;104.248.48.169:30588;FAIL; -SG;206.189.92.74:38888;FAIL; -AR;181.3.63.142:1080;FAIL; -AR;186.126.87.224:1080;FAIL; -BR;181.3.46.205:1080;FAIL; -CA;181.3.16.31:1080;FAIL; -SG;45.76.187.35:36600;FAIL; -US;173.236.186.230:22960;173.236.184.139;0:00:03.272663 -RU;171.221.44.248:1080;FAIL; -US;181.7.201.96:1080;FAIL; -US;147.135.116.172:55546;147.135.116.172;0:00:05.626279 -AR;181.3.29.244:1080;FAIL; -BR;186.152.147.113:1080;FAIL; -AR;181.102.81.144:1080;FAIL; -US;104.248.0.141:30247;104.248.0.141;0:00:01.176155 -US;104.238.212.43:1080;104.238.215.49;0:00:05.161615 -BR;186.152.26.161:1080;191.252.102.212;0:00:09.528139 -US;143.110.153.171:3240;FAIL; -PS;213.6.61.150:9999;FAIL; -IN;43.224.10.30:6667;FAIL; -AR;181.101.4.206:1080;FAIL; -SG;206.189.158.28:48500;FAIL; -FR;54.36.246.232:11380;54.36.246.232;0:00:07.263434 -DE;213.136.89.190:4374;FAIL; -SG;206.189.158.28:64028;FAIL; -CL;186.126.131.207:1080;FAIL; -IN;43.224.10.36:6667;43.224.10.36;0:00:08.870324 -CA;181.3.93.39:1080;FAIL; -NL;142.93.138.78:63421;142.93.138.78;0:00:02.779517 -NL;146.185.132.87:49041;146.185.132.87;0:00:08.279986 -DE;95.217.132.133:3008;FAIL; -BR;181.101.52.45:1080;FAIL; -US;192.169.201.24:51100;FAIL; -BR;181.3.24.19:1080;FAIL; -AR;186.126.15.57:1080;FAIL; -PL;5.226.69.12:42717;FAIL; -DE;213.136.89.190:13492;FAIL; -BR;181.102.141.53:1080;FAIL; -US;74.208.102.54:31200;74.208.102.54;0:00:10.078336 -GB;95.217.132.133:3273;FAIL; -CA;159.203.42.128:28393;159.203.42.128;0:00:04.454060 -BR;181.101.29.81:1080;FAIL; -CA;181.3.84.102:1080;FAIL; -US;173.236.189.156:7595;173.236.184.102;0:00:06.332096 -FR;51.68.134.246:30204;FAIL; -BR;181.6.24.228:1080;FAIL; -US;95.217.132.133:3503;FAIL; -AR;186.126.54.106:1080;FAIL; -SG;206.189.158.28:48751;FAIL; -NL;178.62.136.189:51423;178.62.136.189;0:00:06.756095 -US;173.236.187.42:22960;173.236.184.139;0:00:07.256691 -IN;43.224.10.46:6667;FAIL; -US;206.189.231.206:2106;FAIL; -SG;95.217.132.133:3286;FAIL; -SG;129.226.196.49:22157;129.226.196.49;0:00:09.336891 -US;173.236.186.241:22960;173.236.184.139;0:00:02.345419 -HK;119.28.81.177:20412;FAIL; -RU;31.25.243.40:9432;FAIL; -CA;181.3.65.57:1080;51.222.13.156;0:00:06.097943 -AR;181.0.16.160:1080;FAIL; -UA;31.128.248.2:1080;FAIL; -HK;36.150.108.65:1080;FAIL; -RU;31.25.243.40:9159;FAIL; -US;181.0.26.16:1080;FAIL; -CA;181.6.61.241:1080;FAIL; -FR;51.68.134.243:25623;51.68.134.240;0:00:02.797034 -BR;181.3.56.31:1080;20.195.214.142;0:00:05.865545 -US;147.135.116.172:47283;147.135.116.172;0:00:07.138716 -SG;113.77.87.43:1081;FAIL; -FR;51.68.134.255:25623;51.68.134.240;0:00:02.196854 -IN;103.216.82.37:6667;103.216.82.37;0:00:04.271719 -HK;223.199.179.145:1080;FAIL; -US;104.238.111.167:29182;104.238.111.167;0:00:07.471943 -GB;46.101.56.138:33232;FAIL; -DE;213.136.89.190:51808;213.136.89.190;0:00:01.532093 -NL;142.93.137.235:1429;142.93.137.235;0:00:04.408165 -BR;181.5.210.85:1080;FAIL; -US;67.227.193.162:24595;67.227.193.162;0:00:07.794617 -FR;51.68.134.248:25623;51.68.134.240;0:00:07.714408 -HK;153.37.113.125:1080;42.3.24.58;0:00:03.530263 -US;104.248.0.141:23668;104.248.0.141;0:00:01.404311 -AR;186.126.84.156:1080;200.73.128.105;0:00:15.717142 -PH;210.16.73.81:1080;FAIL; -FR;51.68.134.252:30204;FAIL; -CA;181.5.242.212:1080;FAIL; -AR;181.6.14.34:1080;FAIL; -NL;146.185.132.87:59746;FAIL; -SG;206.189.158.28:15615;FAIL; -GB;159.65.26.54:34787;159.65.26.54;0:00:07.312364 -FR;51.68.134.254:25623;51.68.134.240;0:00:09.785792 -SG;206.189.158.28:11007;FAIL; -AR;186.152.26.173:1080;FAIL; -US;206.189.231.206:53323;FAIL; -US;192.169.201.24:7495;FAIL; -AR;181.101.57.210:1080;FAIL; -US;173.236.184.50:7595;FAIL; -US;181.7.211.6:1080;FAIL; -AR;186.126.80.109:1080;FAIL; -CA;181.3.67.17:1080;FAIL; -US;165.22.13.68:25327;165.22.13.68;0:00:06.029895 -CA;159.203.42.128:47524;159.203.42.128;0:00:09.931594 -AR;181.101.57.64:1080;200.73.133.154;0:00:12.503640 -BR;181.6.134.15:1080;FAIL; -AR;181.6.35.81:1080;FAIL; -US;173.236.186.228:22960;FAIL; -CA;181.102.111.148:1080;FAIL; -US;181.3.39.201:1080;FAIL; -DE;95.217.132.133:3412;FAIL; -US;206.189.231.206:50825;206.189.231.206;0:00:01.618712 -SG;206.189.158.28:47419;FAIL; -DE;45.149.76.184:9051;FAIL; -GB;159.65.26.54:2975;FAIL; -US;64.34.216.68:40741;64.34.205.58;0:00:13.192013 -US;173.236.188.107:7595;173.236.184.102;0:00:03.604567 -US;166.62.85.224:42790;FAIL; -DE;181.101.10.10:1080;78.47.73.135;0:00:20.253722 -RU;95.107.37.109:3109;85.26.186.44;0:00:04.610048 -AR;181.3.29.168:1080;FAIL; -AR;181.6.128.215:1080;FAIL; -US;95.217.132.133:3132;FAIL; -AR;186.126.120.70:1080;FAIL; -UA;80.73.9.238:1080;FAIL; -IN;43.224.10.42:6667;43.224.10.42;0:00:12.005869 -US;206.189.180.62:7934;FAIL; -AR;181.3.52.116:1080;FAIL; -AR;181.3.91.214:1080;FAIL; -DE;213.136.89.190:56844;FAIL; -BR;181.7.198.151:1080;191.252.113.106;0:00:15.269279 -US;104.248.0.141:54251;FAIL; -GB;176.58.100.26:27016;FAIL; -HK;113.240.216.243:1080;FAIL; -AR;186.126.66.41:1080;FAIL; -US;173.236.189.250:7595;FAIL; -BR;181.5.230.16:1080;191.252.113.106;0:00:19.073131 -US;50.62.35.16:29643;FAIL; -IN;103.21.163.76:6667;103.21.163.76;0:00:08.463147 -DK;65.21.49.222:9174;FAIL; -US;104.238.97.215:7772;FAIL; -AR;181.3.68.52:1080;FAIL; -AR;186.126.92.77:1080;FAIL; -US;95.217.132.133:3141;FAIL; -BR;186.126.168.161:1080;FAIL; -DE;46.4.156.212:18588;FAIL; -SG;206.189.158.28:7476;FAIL; -AR;181.6.114.157:1080;200.73.132.187;0:00:13.969104 -US;181.102.141.210:1080;FAIL; -BR;181.5.212.118:1080;FAIL; -SG;45.76.187.35:44560;45.76.187.35;0:00:09.819446 -AR;186.152.150.124:1080;FAIL; -AR;186.126.141.216:1080;FAIL; -CA;186.152.114.192:1080;FAIL; -US;173.236.191.150:22960;173.236.184.139;0:00:09.824398 -AR;181.7.207.196:1080;FAIL; -JP;138.91.19.96:1953;138.91.19.96;0:00:12.281648 -CL;186.126.48.110:1080;FAIL; -US;74.208.101.185:44614;74.208.102.54;0:00:10.538888 -AR;181.101.53.210:1080;FAIL; -US;65.21.49.222:9270;FAIL; -US;173.236.189.19:22960;FAIL; -US;95.217.132.133:3137;FAIL; -AR;186.126.42.157:1080;FAIL; -US;173.236.189.188:22960;173.236.184.139;0:00:05.774545 -US;8.210.163.246:50001;FAIL; -DE;213.136.89.190:5136;FAIL; -US;173.236.186.235:22960;173.236.184.139;0:00:04.093197 -AR;186.126.176.41:1080;FAIL; -US;173.236.189.191:22960;173.236.184.139;0:00:02.491511 -US;173.236.188.227:7595;FAIL; -SG;206.189.158.28:21471;206.189.158.28;0:00:07.368676 -US;95.217.132.133:3463;FAIL; -US;173.236.186.1:22960;FAIL; -BR;186.126.101.194:1080;FAIL; -AR;181.101.48.228:1080;FAIL; -US;95.217.132.133:3443;FAIL; -HK;119.28.81.177:59430;FAIL; -AR;181.3.27.242:10808;FAIL; -AR;181.0.30.128:1080;FAIL; -US;173.236.186.167:22960;173.236.184.139;0:00:06.491244 -PL;5.226.69.12:46975;5.226.69.12;0:00:07.836800 -NL;142.93.137.235:38902;142.93.137.235;0:00:02.734874 -US;173.236.188.12:7595;FAIL; -DE;213.136.89.190:52010;FAIL; -US;173.236.188.156:7595;FAIL; -BR;181.3.36.182:1080;FAIL; -FR;51.75.42.92:25623;51.68.134.240;0:00:09.193243 -US;173.236.189.132:22960;173.236.184.139;0:00:03.395630 -US;173.236.185.29:22960;FAIL; -AR;186.126.50.32:1080;FAIL; -RU;31.25.243.40:9261;FAIL; -IR;5.56.134.237:45698;5.56.134.237;0:00:02.117181 -ID;103.224.103.116:1080;FAIL; -CN;110.90.223.72:57114;FAIL; -CN;59.61.160.63:16790;FAIL; -CN;119.187.146.163:1080;119.187.146.163;0:00:03.103184 -CN;59.61.160.179:16790;59.61.160.179;0:00:02.662718 -CN;113.123.0.217:1080;FAIL; -CN;111.1.36.135:9053;115.238.101.42;0:00:02.840302 -CN;111.1.36.132:9053;115.238.101.39;0:00:04.400966 -CN;3.131.207.170:11098;FAIL; -CN;117.174.160.105:1080;117.174.160.105;0:00:05.121497 -CN;36.27.223.80:35880;120.33.231.36;0:00:05.118523 -CN;60.168.25.143:4216;FAIL; -CN;47.104.16.8:6667;FAIL; -CN;114.236.90.5:1080;FAIL; -ID;139.255.89.4:1080;139.255.89.2;0:00:03.779929 -CN;111.225.153.226:57114;FAIL; -CN;134.175.90.111:8889;FAIL; -CN;111.1.36.132:9055;FAIL; -CN;121.206.250.10:57114;121.206.250.10;0:00:02.844775 -CN;42.193.148.214:1080;FAIL; -CN;111.1.36.134:9053;115.238.101.41;0:00:03.048803 -CN;39.96.175.55:1080;FAIL; -CN;47.92.252.178:3129;FAIL; -CN;122.152.219.54:57164;122.152.219.54;0:00:06.862155 -ID;36.89.86.49:56845;36.89.86.49;0:00:03.790392 -CN;36.27.223.80:35101;FAIL; -CN;36.27.223.80:34638;106.114.146.84;0:00:05.630091 -CN;218.64.122.99:7302;218.64.122.99;0:00:09.361461 -ID;36.94.126.50:1080;36.94.126.50;0:00:05.162022 -CN;47.100.19.147:3129;47.100.19.147;0:00:11.339600 -CN;122.152.219.54:1749;FAIL; -CN;59.61.160.153:16790;59.61.160.153;0:00:08.683302 From 5afe839eb797274b2439843d3c01a53f7787f3b9 Mon Sep 17 00:00:00 2001 From: Lasse Date: Fri, 27 Aug 2021 19:31:09 +0200 Subject: [PATCH 4/4] removed some --- .gitignore | 2 - facebook/accs.py | 290 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+), 2 deletions(-) create mode 100644 facebook/accs.py diff --git a/.gitignore b/.gitignore index ccc1003..79155be 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,3 @@ facebook/mrkoll.py *.pyc facebook/tortest.py facebook/phone.py -facebook/accs.py -facebook/gephi.py diff --git a/facebook/accs.py b/facebook/accs.py new file mode 100644 index 0000000..68a3b2a --- /dev/null +++ b/facebook/accs.py @@ -0,0 +1,290 @@ +""" Import profiles from accsmarket """ + +from os import chdir +from getpass import getpass +from os.path import abspath, dirname +from random import randint +from time import sleep +import base64 +import json +import requests + +# Gör fb-scraper till arbetsmapp +chdir(dirname(dirname(abspath(__file__)))) + +from arangodb import arango_connect +import config +from helpers import now, nowstamp + +def mullvad_servers_to_db(db): + """ Läser fil med servarar och exporterar till db. Används bara om servarna skulle uppdateras hos Mullvad. """ + with open("data/servers.txt") as f: + for line in f.readlines(): + if "@" in line: + line = line.strip() + city = line[: line.find("@")].strip() + + if ("WireGuard" in line): # "au", "ca" #För senare när det behövs + line = line.strip() + country_short = line[:2] + server_id = line[: line.find("-")] + + # Kolla så att servern inte redan används av profil i databasen + # eller finns i listan som skapas nu. + city_short = city[city.find("(") + 1 : city.find(")")] + server_name = [country_short, city_short, server_id + "-wireguard"] + server = { + '_key': server_id, + 'country': country_short, + "city": city, + "id": server_id, + "server": server_id + "-wg.socks5.mullvad.net:1080", + "server_connect": server_name,} + db.insert_document('servers', server) + sleep(0.1) + + + +def servers_to_db(db, server_collection, socks='socks5'): + """ Läser fil med servarar och exporterar till db. """ + with open("socks5free.csv") as f: + for line in f.readlines(): + server = line.split(';')[1] + db.insert_document(server_collection, {'_key':server, 'proxies': {"https": f"{socks}://{server}", + "http": f"{socks}://{server}"}, 'country': False}) + sleep(0.1) + + + +def used_emails(db, collection): + cursor = db.aql.execute( + """ + FOR doc IN @@col + RETURN doc.email + """, + bind_vars={'@col': collection}) + return [email for email in cursor] + +def get_server(db, country, test=False, servers='servers', profiles='profiles'): + """ Hämtar en server åt profilen """ + if country == 'any': + cursor = db.aql.execute( + """ + FOR doc IN @@col + FILTER doc.country not in ['us', 'se'] + RETURN {proxies: doc.proxies, country: doc.country, id: doc.id, _key:doc._key, city:doc.city, server:doc.server, server_connect:doc.server_connect} + """, bind_vars={'@col': servers}) + else: + cursor = db.aql.execute( + """ + FOR doc IN @@servers + FILTER doc.country == @country + RETURN {proxies: doc.proxies, country: doc.country, id: doc.id, _key:doc._key, city:doc.city, server:doc.server, server_connect:doc.server_connect} + """, + bind_vars={'country': country, '@servers': servers} + ) + + servers = [] + used = used_servers(test, profiles) + for server in cursor: + if server['_key'] not in used: + servers.append(server) + if servers != []: + server = servers[randint(0, len(servers)-1)] + return server + + +def to_accs(db, vendors, accs, profiles): + """ + Ta profiles från köpt fil och lägg i accs + """ + + file = input('Lägg filen här ').strip("'").strip() + vendor = str(file[file.rfind('-')+1:file.rfind('.')]) + sep = vendors[vendor]['sep'] + info = vendors[vendor]['info'].split(':') + + used_accs = used_emails(db, accs) + used_profiles = used_emails(db, profiles) + + + with open(file) as f: + for line in f: + line = line.replace("https:", "https;") + l = line.split(sep) + # c = 0 + # for i in l: + # c += 1 + # print(c) + # print(i) + # print() + doc = {} + doc["vendor"] = vendor + doc["created"] = now() + if 'email' in info: + doc['email'] = l[info.index('email')] + elif 'login' in info: + doc['email'] = l[info.index('login')] + if doc['email'] in used_accs or doc['email'] in used_profiles: + continue + doc['name'] = doc['email'] + if 'pwd' in info: + doc["pwd"] = l[info.index('pwd')] + else: + doc["pwd"] = '' + if 'url' in info: + doc['id'] = l[info.index('url')].replace("https;", "https:") + if "useragent" in info: + doc["useragent"] = l[info.index('useragent')].strip() + else: + doc["useragent"] = config.user_agent + if 'cookie' in info: + cookies = l[info.index('cookie')] + + if 'c_user=' in cookies: + cookie = {} + for c in cookies.split(';'): + cookie[c[:c.find('=')].strip()] = c[c.find('=') + 1:].strip() + else: + cookies_base64 = cookies.strip()#.strip('=') + # print() + # print(cookies_base64) + # print() + cookies64_bytes = cookies_base64.encode("ascii") + cookies_bytes = base64.b64decode(cookies64_bytes) + #exit() + cookies_str = ( + cookies_bytes.decode("ascii") + .replace("'", '"') + .replace("False", "false") + .replace("True", "true") + ) + cookies = json.loads(cookies_str) + cookie = {} + if vendor == '159': + for c in cookies['cookies']: + cookie[c['name']] = c['value'] + else: + for c in cookies: + name = c["name"] + del c["name"] + cookie[name] = c["value"] + doc['cookie'] = cookie + else: + cookie = {} + if 'birthday' in info: + doc["birthday"] = l[info.index('birthday')] + if 'token' in info: + doc['token'] = l[info.index('token')].strip() + db.insert_document(accs, doc) + sleep(0.1) + +def to_profiles(db, test, accs='accs', profiles='profiles', country='us', servers='servers'): + """ Tar en prifil från accs och en server från servers och lägger in i profiles """ + count = 0 + for profile in [i for i in db.collection(accs).all()]: + count +=1 + if profile['email'] in used_emails(db, profiles): + continue + id_acc = profile['_id'] + del profile['_id'] + del profile['_rev'] + server = get_server(db, country, test, servers, profiles) + if server == None: + print(f'Inlagda profiler: {count}\nInga fler lediga servrar.') + break + profile["server"] = server["server"] + profile["server_connect"] = server["server_connect"] + profile["_key"] = server["_key"]#.replace(':', '') + profile["in_use"] = nowstamp() + profile['proxies'] = server['proxies'] + if test: + profile["in_use"] = nowstamp() - 1200 + db.insert_document(profiles, profile) + sleep(0.1) + db.delete_document(id_acc) + print('Inlagda profiler:', count, end='\r') + + +def used_servers(test=False, profiles='profiles'): + cursor = db.aql.execute( + """ + FOR doc IN @@col + RETURN doc._key + """, + bind_vars={'@col': profiles} + ) + servers = [doc for doc in cursor] + return servers + + +def webshare_proxies(): + """Get list of webshare-proxies.""" + + proxielist = requests.get('https://proxy.webshare.io/proxy/list/download/sompzungcbajbeqmxoopddsthzarqlewjgraicog/-/http/port/direct/') + + proxies = {} + count = 0 + + for line in proxielist.text.split('\n'): + count += 1 + proxie = line.replace('\r', '').split(':') + if proxie != ['']: + server = proxie[0] + port = proxie[1] + proxies[count] = {'server': server, 'port': port} + + + for _, proxie in proxies.items(): + proxies={'https':'socks5://xigpxrzr:ezgjcwr8lonj@{server}:{port}'.format(server=proxie['server'], port=proxie['port']), + 'http':'socks5://xigpxrzr:ezgjcwr8lonj@{server}:{port}'.format(server=proxie['server'], port=proxie['port']) + } + + try: + db.insert_document('servers_webshare', {'_key':proxie['server'], 'proxies': proxies, 'country': 'us'}) + except: + pass + +if __name__ == "__main__": + + vendors = { + '1152': {'info': 'login:password:cookie:token', 'sep': '|'}, + '1091': {'info': 'login:password:birthday:url:cookie', 'sep': ':'}, + '1113': {'info': 'login:password:mail:password:birthday:country:useragent:token:cookie', 'sep': '|'}, + '926': {'info': 'login:password:email:email password:birthday:token:cookie', 'sep': '|'} , + #'1113': {'info': 'login:mail:password:emailpassword:birthday:useragent:token:cookie', 'sep': '|'}, + '159': {'info': 'login:password:birthday:id:cookie', 'sep':':'} + } + + + # Det här ska köras lokalt så löseordet finns i fil + try: + with open("password_arango.txt") as f: + pwd = f.readline() + except: + pwd = getpass('Lösenord för Accs: ').strip() + + db = arango_connect(pwd, username='Accs') +§ + ############################### + ### Variabler att ställa in ### + country='us' + test = False + profiles = 'profiles_webshare' # ex profiles_free + servers = 'servers_webshare' + ############################### + + + accs = 'accs' + if test: + profiles='profiles_test' + accs='accs_test' + + #to_accs(db, vendors, accs=accs, profiles=profiles) ## Den här för att lägga in nyköpta profiler + #webshare_proxies() ## Den här för att uppdatera servers hos webshare + + # Kombinera köpt profil med server och lägg i profiles + to_profiles(db, test, accs=accs, profiles=profiles, country=country, servers=servers) + + +