|
|
|
@ -3,22 +3,21 @@ Skript för att söka i FB-läckan. |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
import re |
|
|
|
import re |
|
|
|
import paramiko |
|
|
|
|
|
|
|
import arangodb |
|
|
|
|
|
|
|
from getpass import getpass |
|
|
|
|
|
|
|
from sshtunnel import open_tunnel |
|
|
|
|
|
|
|
from termcolor import cprint |
|
|
|
from termcolor import cprint |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import dbViaSSH |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def search(db, attribute, value): |
|
|
|
def search(db, attribute, value): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Search for attribute in db. |
|
|
|
Search for attribute in db. |
|
|
|
Returns list of matching documents. |
|
|
|
Returns list of matching documents. |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
if '%' in value or '_' in value: |
|
|
|
if "%" in value or "_" in value: |
|
|
|
match = 'like' |
|
|
|
match = "like" |
|
|
|
else: |
|
|
|
else: |
|
|
|
match = '==' |
|
|
|
match = "==" |
|
|
|
|
|
|
|
|
|
|
|
cursor = db.aql.execute( |
|
|
|
cursor = db.aql.execute( |
|
|
|
f""" |
|
|
|
f""" |
|
|
|
@ -30,33 +29,15 @@ def search(db, attribute, value): |
|
|
|
) |
|
|
|
) |
|
|
|
return [doc for doc in cursor] |
|
|
|
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']) |
|
|
|
db = dbViaSSH.db_over_tunnel("Leak") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cprint("\n\nVad vill du söka efter?", attrs=["bold"]) |
|
|
|
print("1 - Telefonnummer") |
|
|
|
print("1 - Telefonnummer") |
|
|
|
print("2 - Facebook-ID") |
|
|
|
print("2 - Facebook-ID") |
|
|
|
print('3 - Namn') |
|
|
|
print("3 - Namn") |
|
|
|
print("4 - Arbete") |
|
|
|
print("4 - Arbete") |
|
|
|
print('5 - Bostadsort') |
|
|
|
print("5 - Bostadsort") |
|
|
|
print("6 - Födelseort") |
|
|
|
print("6 - Födelseort") |
|
|
|
print("7 - Epost") |
|
|
|
print("7 - Epost") |
|
|
|
|
|
|
|
|
|
|
|
@ -67,26 +48,29 @@ with open_tunnel( |
|
|
|
"2": ("Facebook-ID", "_key"), |
|
|
|
"2": ("Facebook-ID", "_key"), |
|
|
|
"3": ("namn", "full_name"), |
|
|
|
"3": ("namn", "full_name"), |
|
|
|
"4": ("arbete", "work"), |
|
|
|
"4": ("arbete", "work"), |
|
|
|
"5": ('bostadsort', "lives_in"), |
|
|
|
"5": ("bostadsort", "lives_in"), |
|
|
|
"6": ('födelseort', 'from'), |
|
|
|
"6": ("födelseort", "from"), |
|
|
|
"7": ('epost', 'email') |
|
|
|
"7": ("epost", "email"), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Bestäm n- eller t-form och få input för värde. |
|
|
|
# Bestäm n- eller t-form och få input för värde. |
|
|
|
if attribute in ['5', '6', '7']: |
|
|
|
if attribute in ["5", "6", "7"]: |
|
|
|
genus = 'n' |
|
|
|
genus = "n" |
|
|
|
else: |
|
|
|
else: |
|
|
|
genus = 't' |
|
|
|
genus = "t" |
|
|
|
|
|
|
|
|
|
|
|
cprint(f"\nVilke{genus} {attributes[attribute][0]}? ", attrs=['bold']) |
|
|
|
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']) |
|
|
|
cprint( |
|
|
|
value = input('\n>>> ') |
|
|
|
"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 |
|
|
|
if attribute == "1": # telefonnummer |
|
|
|
value = ''.join(re.findall(r'\d+', value)) |
|
|
|
value = "".join(re.findall(r"\d+", value)) |
|
|
|
if value[0] == '0': |
|
|
|
if value[0] == "0": |
|
|
|
value = f'46{value[1:]}' |
|
|
|
value = f"46{value[1:]}" |
|
|
|
elif attribute == '3': # namn |
|
|
|
elif attribute == "3": # namn |
|
|
|
value = value.upper() |
|
|
|
value = value.upper() |
|
|
|
|
|
|
|
|
|
|
|
# Sök i databasen. |
|
|
|
# Sök i databasen. |
|
|
|
@ -94,10 +78,11 @@ with open_tunnel( |
|
|
|
|
|
|
|
|
|
|
|
# Presentera reultaten #TODO hur vill man få dem? Spara ner? |
|
|
|
# Presentera reultaten #TODO hur vill man få dem? Spara ner? |
|
|
|
for i in result: |
|
|
|
for i in result: |
|
|
|
print('\n', i['full_name']) |
|
|
|
print("\n", i["full_name"]) |
|
|
|
for key, value in i.items(): |
|
|
|
for key, value in i.items(): |
|
|
|
print(f'{key}: {value}') |
|
|
|
print(f"{key}: {value}") |
|
|
|
print(f'https://facebook.com/{i["_key"]}') |
|
|
|
print(f'https://facebook.com/{i["_key"]}') |
|
|
|
|
|
|
|
|
|
|
|
print(f'\nAntal träffar: {len(result)}\n') |
|
|
|
print(f"\nAntal träffar: {len(result)}\n") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dbViaSSH.stop_server() |
|
|
|
|