mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-07-01 18:56:40 +00:00
Started refactoring 9
This commit is contained in:
parent
a2409ac83e
commit
7e6b75ec9d
2 changed files with 81 additions and 11 deletions
|
@ -469,6 +469,23 @@ def remove_duplications(df):
|
|||
|
||||
return df
|
||||
|
||||
def remove_cross_dataframe_replications(main_df, sub_df):
|
||||
try:
|
||||
|
||||
main_df = remove_duplications(main_df)
|
||||
sub_df = remove_duplications(sub_df)
|
||||
|
||||
mask = sub_df['URL'].isin(main_fd['URL']) | df_a['Name'].isin(df_b['Name'])
|
||||
|
||||
sub_df = sub_df[~mask]
|
||||
|
||||
return sub_df
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
return main_df, sub_df
|
||||
|
||||
###TODO: can later remove the inputs and have a "global" local verified and unverified or a class of the local(lantern host) participant
|
||||
def save_local_verified_and_unverified(verified_df, unverified_df):
|
||||
"""
|
||||
|
@ -521,6 +538,39 @@ def generate_local_participant_dir(participant):
|
|||
|
||||
return f'{conf.PARTICIPANT_DIR}{participant}/'
|
||||
|
||||
def get_participant_local_verified_and_unverified(participant):
|
||||
"""
|
||||
reads the local verified csv and the local unverified csv of a participant
|
||||
|
||||
Parameters:
|
||||
participant (str): participant's onion address/instance
|
||||
|
||||
Returns:
|
||||
verified_df(Dataframe): verified.csv as dataframe
|
||||
unverified_df(Dataframe): unverified.csv as dataframe
|
||||
"""
|
||||
|
||||
try:
|
||||
current_instance = get_current_instance() + '/'
|
||||
try:
|
||||
verified_df = pd.read_csv(f'{participant}verified.csv')
|
||||
|
||||
except FileNotFoundError:
|
||||
print_colors("[-] File not found: verified.csv", is_error=True)
|
||||
|
||||
try:
|
||||
unverified_df = pd.read_csv(f'{participant}unverified.csv')
|
||||
|
||||
except FileNotFoundError:
|
||||
print_colors("[-] Participant File not found: unverified.csv", is_error=True)
|
||||
|
||||
return verified_df, unverified_df
|
||||
|
||||
except Exception:
|
||||
print_colors('[-] Failed reading the verified and unverified files',is_error=True)
|
||||
|
||||
return pd.DataFrame(), pd.DataFrame()
|
||||
|
||||
def get_official_participants():
|
||||
"""
|
||||
reads all the official webring participants
|
||||
|
@ -548,22 +598,32 @@ def get_local_blacklist_and_sensitive():
|
|||
"""
|
||||
try:
|
||||
current_instance = get_current_instance() + '/'
|
||||
try:
|
||||
blacklist_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}blacklist.csv')
|
||||
blacklist = blacklist_df.iloc[:, 0].tolist()
|
||||
|
||||
blacklist_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}blacklist.csv')
|
||||
blacklist = blacklist_df.iloc[:, 0].tolist()
|
||||
except FileNotFoundError:
|
||||
print_colors("[-] File not found: blacklist.csv", is_error=True)
|
||||
|
||||
try:
|
||||
sensitive_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}sensitive.csv')
|
||||
sensitive_list = sensitive_df.iloc[:, 0].tolist()
|
||||
|
||||
except FileNotFoundError:
|
||||
print_colors("[-] File not found: sensitive.csv", is_error=True)
|
||||
|
||||
sensitive_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}sensitive.csv')
|
||||
sensitive_list = sensitive_df.iloc[:, 0].tolist()
|
||||
|
||||
return blacklist, sensitive_list
|
||||
|
||||
|
||||
except Exception:
|
||||
print_colors('[-] Failed reading the blacklist and sensitive words file',is_error=True )
|
||||
return [], []
|
||||
print_colors('[-] Failed reading the blacklist and sensitive words file',is_error=True)
|
||||
|
||||
return [], []
|
||||
|
||||
def get_local_verified_and_unverified():
|
||||
"""
|
||||
reads the local verified csv and the local unverified csv
|
||||
reads the local verified csv and the local unverified csv of the instance
|
||||
|
||||
Returns:
|
||||
verified_df(Dataframe): verified.csv as dataframe
|
||||
|
@ -572,16 +632,24 @@ def get_local_verified_and_unverified():
|
|||
|
||||
try:
|
||||
current_instance = get_current_instance() + '/'
|
||||
try:
|
||||
verified_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}verified.csv')
|
||||
|
||||
except FileNotFoundError:
|
||||
print_colors("[-] File not found: verified.csv", is_error=True)
|
||||
|
||||
verified_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}verified.csv')
|
||||
try:
|
||||
unverified_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}unverified.csv')
|
||||
|
||||
unverified_df = pd.read_csv(f'{conf.PARTICIPANT_DIR}{current_instance}unverified.csv')
|
||||
except FileNotFoundError:
|
||||
print_colors("[-] File not found: unverified.csv", is_error=True)
|
||||
|
||||
return verified_df, unverified_df
|
||||
|
||||
except Exception:
|
||||
print_colors('[-] Failed reading the verified and unverified files',is_error=True )
|
||||
return pd.DataFrame(), pd.DataFrame()
|
||||
print_colors('[-] Failed reading the verified and unverified files',is_error=True)
|
||||
|
||||
return pd.DataFrame(), pd.DataFrame()
|
||||
|
||||
def get_local_webring_participants():
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue