A lot but will update with accs

pull/5/head
Lasse Edfast 5 years ago
parent 9f27a1b403
commit 4f1f00f3ce
  1. 123
      facebook/profile_create.py

@ -1,16 +1,21 @@
import random import random
import subprocess import subprocess
from getopt import getopt from getopt import getopt
from os import chdir
from os.path import abspath, dirname
from sys import argv from sys import argv
from time import sleep from time import sleep
from os import chdir
from os.path import dirname
from arangodb import db, get_profile, remove_profile # Gör fb-scraper till arbetsmapp
chdir(dirname(dirname(abspath(__file__))))
from arangodb import arango_connect, used_servers
from config import *
from helpers import now from helpers import now
def profile_generator(db, n):
def profile_generator(db, n=1, bulk=False):
cursor = db.aql.execute( cursor = db.aql.execute(
""" """
@ -33,29 +38,36 @@ def profile_generator(db, n):
with open("data/passwords.txt") as f: with open("data/passwords.txt") as f:
words = [word for word in f.readlines()] words = [word for word in f.readlines()]
servers_used = used_servers()
with open("data/servers.txt") as f: with open("data/servers.txt") as f:
servers = [] servers = []
for line in f.readlines(): while len(servers) < n:
if "@" in line: for line in f.readlines():
line = line.strip() if "@" in line:
city = line[: line.find("@")].strip() line = line.strip()
city = line[: line.find("@")].strip()
if "WireGuard" in line and line.strip()[:2] in [
"gb", if "WireGuard" in line and line.strip()[:2] in [
"us", "gb",
]: # "au", "ca" #För senare när det behövs "us",
line = line.strip() ]: # "au", "ca" #För senare när det behövs
country_short = line[:2] line = line.strip()
server = line[: line.find("-")] country_short = line[:2]
city_short = city[city.find("(") + 1 : city.find(")")] server = line[: line.find("-")]
server_name = [country_short, city_short, server + "-wireguard"]
servers.append( # Kolla så att servern inte redan används av profil i databasen
{ # eller finns i listan som skapas nu.
"server_city": city, if server not in servers_used and server not in servers:
"server": server + "-wg.socks5.mullvad.net:1080", city_short = city[city.find("(") + 1 : city.find(")")]
"server_connect": server_name, server_name = [country_short, city_short, server + "-wireguard"]
} servers.append(
) {
"server_city": city,
"server": server + "-wg.socks5.mullvad.net:1080",
"server_connect": server_name,
}
)
count = 0 count = 0
for i in range(0, n - 1): for i in range(0, n - 1):
@ -79,6 +91,8 @@ def profile_generator(db, n):
server = server_info["server"].strip() server = server_info["server"].strip()
birthday = f"{year}-{random.randrange(1, 13)}-{random.randrange(1, 30)}" birthday = f"{year}-{random.randrange(1, 13)}-{random.randrange(1, 30)}"
_key = server[: server.find("-")] _key = server[: server.find("-")]
doc = { doc = {
"_id": "profiles/" + _key, "_id": "profiles/" + _key,
"_key": _key, "_key": _key,
@ -92,17 +106,23 @@ def profile_generator(db, n):
"in_use": False, "in_use": False,
} }
# Skriv till databasen (skriver inte profiler med servarar som redan används) # Skriv till databasen (skriver inte profiler med servarar som redan används)
try:
db.insert_document("profiles", doc)
count += 1
except:
pass
print(f"Skrev {count} profiler till databasen. ") if bulk == True:
try:
db.insert_document("profiles", doc)
count += 1
except:
pass
print(f"Skrev {count} profiler till databasen. ")
else:
return doc
def mullvad(server): def mullvad(server):
""" Anslut till Mullvad-server. """ """ Anslut till Mullvad-server. """
sleep(2)
subprocess.run( subprocess.run(
[ [
"mullvad", "mullvad",
@ -118,6 +138,9 @@ def mullvad(server):
connect_to_mullvad.wait() connect_to_mullvad.wait()
sleep(3) sleep(3)
def close_browser():
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"'])
subprocess.run(["osascript", "-e", 'quit app "Opera"'])
def create_profile(): def create_profile():
""" Supports during the creation of a profile """ """ Supports during the creation of a profile """
@ -125,9 +148,10 @@ def create_profile():
while True: while True:
mullvad(arango_server) mullvad(arango_server)
sleep(2)
# Hämta profil # Hämta profil
profile = get_profile(created=False) db = arango_connect(pwd)
profile = profile_generator(db)
# Asnlut till profilens VPN-server # Asnlut till profilens VPN-server
mullvad(profile["server_connect"]) mullvad(profile["server_connect"])
@ -142,7 +166,6 @@ def create_profile():
print(profile["birthday"]) print(profile["birthday"])
print(profile["name"]) print(profile["name"])
print()
print() print()
print(profile["name"]) print(profile["name"])
print(profile["email"]) print(profile["email"])
@ -153,38 +176,45 @@ def create_profile():
user_input = user_input.lower() user_input = user_input.lower()
if user_input in ["done", "d", ""]: if user_input in ["done", "d", ""]:
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"']) close_browser()
sleep(1) sleep(1)
profile["created"] = True profile["created"] = True
mullvad(arango_server) mullvad(arango_server)
sleep(3) sleep(3)
db.update_document(profile) db = arango_connect(pwd)
db.update_document('profiles', profile)
elif user_input in ["delete", "d"]: elif user_input in ["delete", "d"]:
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"']) close_browser()
sleep(1)
mullvad(arango_server) mullvad(arango_server)
blocked = remove_profile(profile) db = arango_connect(pwd)
blocked = db.collection("profiles").delete(profile['_key'])
blocked['_id'] = 'block_created/' + now() blocked['_id'] = 'block_created/' + now()
blocked['key'] = now() blocked['key'] = now()
sleep(2)
db = arango_connect(pwd)
db.insert_document("block_created", blocked) db.insert_document("block_created", blocked)
elif user_input in ["quit", "q"]: elif user_input in ["quit", "q"]:
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"']) close_browser()
sleep(1) close_browser()
mullvad(arango_server) mullvad(arango_server)
sleep(3)
exit() exit()
else: else:
sleep(3)
db = arango_connect(pwd)
continue continue
if __name__ == "__main__": if __name__ == "__main__":
print(__file__) print(__file__)
# Säkerställ att arbetsmappen är samma som den där scriptet ligger # Det här ska köras lokalt så löseordet finns i fil
chdir(dirname(__file__)) with open('password_arango.txt') as f:
subprocess.run(['cd', '..']) pwd = f.readline()
db = arango_connect(pwd)
argv = argv[1:] argv = argv[1:]
opts, args = getopt(argv, "cg:", ["create", "generate"]) opts, args = getopt(argv, "cg:", ["create", "generate"])
@ -193,3 +223,6 @@ if __name__ == "__main__":
profile_generator(db, a) profile_generator(db, a)
if o in ['-c', '--create']: if o in ['-c', '--create']:
create_profile() create_profile()
[{'domain': '.facebook.com', 'httpOnly': False, 'name': 'x-referer', 'path': '/', 'sameSite': 'None', 'secure': True, 'value': 'eyJyIjoiL2NvbmZpcm1lbWFpbC5waHA%2Fc29mdD1oamsiLCJoIjoiL2NvbmZpcm1lbWFpbC5waHA%2Fc29mdD1oamsiLCJzIjoibSJ9'}, {'domain': '.facebook.com', 'expiry': 1649728634, 'httpOnly': True, 'name': 'xs', 'path': '/', 'secure': True, 'value': '2%3AZrCj3xPTmzApJw%3A2%3A1618192633%3A-1%3A-1'}, {'domain': '.facebook.com', 'expiry': 1649728634, 'httpOnly': False, 'name': 'c_user', 'path': '/', 'secure': True, 'value': '100066462633263'}, {'domain': '.facebook.com', 'expiry': 1618797592, 'httpOnly': False, 'name': 'wd', 'path': '/', 'sameSite': 'None', 'secure': True, 'value': '994x534'}, {'domain': '.facebook.com', 'httpOnly': False, 'name': 'm_pixel_ratio', 'path': '/', 'secure': True, 'value': '1.25'}, {'domain': '.facebook.com', 'expiry': 1625968625, 'httpOnly': True, 'name': 'fr', 'path': '/', 'secure': True, 'value': '16Qhs4a4NEktNwlhZ.AWXIpZOVbupyu5pAidanfvTaWIc.Bgc6jD.C2.AAA.0.0.Bgc6jy.AWXCdEVJ7k4'}, {'domain': '.facebook.com', 'expiry': 1681264643, 'httpOnly': True, 'name': 'sb', 'path': '/', 'secure': True, 'value': 'w6hzYAXTtE1avdx0LoFIrHox'}, {'domain': '.facebook.com', 'expiry': 1681264587, 'httpOnly': True, 'name': 'datr', 'path': '/', 'secure': True, 'value': 'w6hzYONZsuS635di6pHBZV7D'}]
Loading…
Cancel
Save