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 subprocess
from getopt import getopt
from os import chdir
from os.path import abspath, dirname
from sys import argv
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
def profile_generator(db, n):
def profile_generator(db, n=1, bulk=False):
cursor = db.aql.execute(
"""
@ -33,29 +38,36 @@ def profile_generator(db, n):
with open("data/passwords.txt") as f:
words = [word for word in f.readlines()]
servers_used = used_servers()
with open("data/servers.txt") as f:
servers = []
for line in f.readlines():
if "@" in line:
line = line.strip()
city = line[: line.find("@")].strip()
if "WireGuard" in line and line.strip()[:2] in [
"gb",
"us",
]: # "au", "ca" #För senare när det behövs
line = line.strip()
country_short = line[:2]
server = line[: line.find("-")]
city_short = city[city.find("(") + 1 : city.find(")")]
server_name = [country_short, city_short, server + "-wireguard"]
servers.append(
{
"server_city": city,
"server": server + "-wg.socks5.mullvad.net:1080",
"server_connect": server_name,
}
)
while len(servers) < n:
for line in f.readlines():
if "@" in line:
line = line.strip()
city = line[: line.find("@")].strip()
if "WireGuard" in line and line.strip()[:2] in [
"gb",
"us",
]: # "au", "ca" #För senare när det behövs
line = line.strip()
country_short = line[:2]
server = line[: line.find("-")]
# Kolla så att servern inte redan används av profil i databasen
# eller finns i listan som skapas nu.
if server not in servers_used and server not in servers:
city_short = city[city.find("(") + 1 : city.find(")")]
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
for i in range(0, n - 1):
@ -79,6 +91,8 @@ def profile_generator(db, n):
server = server_info["server"].strip()
birthday = f"{year}-{random.randrange(1, 13)}-{random.randrange(1, 30)}"
_key = server[: server.find("-")]
doc = {
"_id": "profiles/" + _key,
"_key": _key,
@ -92,17 +106,23 @@ def profile_generator(db, n):
"in_use": False,
}
# Skriv till databasen (skriver inte profiler med servarar som redan används)
try:
db.insert_document("profiles", doc)
count += 1
except:
pass
if bulk == True:
try:
db.insert_document("profiles", doc)
count += 1
except:
pass
print(f"Skrev {count} profiler till databasen. ")
print(f"Skrev {count} profiler till databasen. ")
else:
return doc
def mullvad(server):
""" Anslut till Mullvad-server. """
sleep(2)
subprocess.run(
[
"mullvad",
@ -118,6 +138,9 @@ def mullvad(server):
connect_to_mullvad.wait()
sleep(3)
def close_browser():
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"'])
subprocess.run(["osascript", "-e", 'quit app "Opera"'])
def create_profile():
""" Supports during the creation of a profile """
@ -125,9 +148,10 @@ def create_profile():
while True:
mullvad(arango_server)
sleep(2)
# Hämta profil
profile = get_profile(created=False)
db = arango_connect(pwd)
profile = profile_generator(db)
# Asnlut till profilens VPN-server
mullvad(profile["server_connect"])
@ -142,7 +166,6 @@ def create_profile():
print(profile["birthday"])
print(profile["name"])
print()
print()
print(profile["name"])
print(profile["email"])
@ -153,38 +176,45 @@ def create_profile():
user_input = user_input.lower()
if user_input in ["done", "d", ""]:
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"'])
close_browser()
sleep(1)
profile["created"] = True
mullvad(arango_server)
sleep(3)
db.update_document(profile)
db = arango_connect(pwd)
db.update_document('profiles', profile)
elif user_input in ["delete", "d"]:
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"'])
sleep(1)
close_browser()
mullvad(arango_server)
blocked = remove_profile(profile)
db = arango_connect(pwd)
blocked = db.collection("profiles").delete(profile['_key'])
blocked['_id'] = 'block_created/' + now()
blocked['key'] = now()
sleep(2)
db = arango_connect(pwd)
db.insert_document("block_created", blocked)
elif user_input in ["quit", "q"]:
subprocess.run(["osascript", "-e", 'quit app "Brave Browser"'])
sleep(1)
close_browser()
close_browser()
mullvad(arango_server)
sleep(3)
exit()
else:
sleep(3)
db = arango_connect(pwd)
continue
if __name__ == "__main__":
print(__file__)
# Säkerställ att arbetsmappen är samma som den där scriptet ligger
chdir(dirname(__file__))
subprocess.run(['cd', '..'])
# Det här ska köras lokalt så löseordet finns i fil
with open('password_arango.txt') as f:
pwd = f.readline()
db = arango_connect(pwd)
argv = argv[1:]
opts, args = getopt(argv, "cg:", ["create", "generate"])
@ -193,3 +223,6 @@ if __name__ == "__main__":
profile_generator(db, a)
if o in ['-c', '--create']:
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