Implemented dbViaSSH (or started)

master
Lasse Edfast 4 years ago
parent f69de458f1
commit 48a35f6e22
  1. 9
      facebook/gephi.py
  2. 139
      facebook/search_leak.py

@ -10,8 +10,7 @@ from getpass import getpass
import arangodb
locale.setlocale(locale.LC_TIME, "en_US")
import dbViaSSH
def nodes_from_list(
@ -244,6 +243,12 @@ def common_friends(d, n=2):
pwd = getpass('Password for Lasse: ')
db = arangodb.arango_connect(pwd)
db.collecion('members').random()
try:
db.collecion('members').random()
except:
pass
if __name__ == "__main__":

@ -3,22 +3,21 @@ 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
from termcolor import cprint
import dbViaSSH
def search(db, attribute, value):
"""
Search for attribute in db.
Returns list of matching documents.
"""
if '%' in value or '_' in value:
match = 'like'
if "%" in value or "_" in value:
match = "like"
else:
match = '=='
match = "=="
cursor = db.aql.execute(
f"""
@ -30,74 +29,60 @@ def search(db, attribute, 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')
db = dbViaSSH.db_over_tunnel("Leak")
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")
dbViaSSH.stop_server()

Loading…
Cancel
Save