From 57f53c95ea1382f13d5c8a7de8267e4e2ef72245 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 25 Mar 2025 08:20:06 +0100 Subject: [PATCH] fix option 4 (when empty filtered dataframe it was failing) --- scripts/lantern.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/lantern.py b/scripts/lantern.py index d36d1c0..eae5256 100644 --- a/scripts/lantern.py +++ b/scripts/lantern.py @@ -253,7 +253,7 @@ Maintenance: print_colors(f"{uvdf[['Name','URL']]}") while(IsNameValid(name) is not True): name = input("What is the Website name you want to Trust ? (ex: Nowhere)") - filter_uvdf = uvdf[uvdf.Name.str.contains(name)] + filter_uvdf = uvdf[uvdf.Name.str.contains(name,na=False)] # display only the matching entries in unverified.csv in an array format (display it in CLI). print_colors(f"{filter_uvdf[['Name','URL']]}") # check if there are no results, dont proceed if there are none! @@ -295,7 +295,7 @@ Maintenance: print_colors(f"{vdf[['Name','URL']]}") while(IsNameValid(name) is not True): name = input("What is the Website name you want to Untrust ? (ex: BreachForums)") - filter_vdf = vdf[vdf.Name.str.contains(name)] + filter_vdf = vdf[vdf.Name.str.contains(name,na=False)] # display only the matching entries in unverified.csv in an array format (display it in CLI). print_colors(f"{filter_vdf[['Name','URL']]}") # check if there are no results, dont proceed if there are none! @@ -331,8 +331,8 @@ Maintenance: print_colors(f"{vdf[['Name','URL']]}") while(IsNameValid(name) is not True): name = input("What is the Website name you want to Blacklist ? (ex: BreachForums)") - filter_uvdf = uvdf[uvdf.Name.str.contains(name)] - filter_vdf = vdf[vdf.Name.str.contains(name)] + filter_uvdf = uvdf[uvdf.Name.str.contains(name,na=False)] + filter_vdf = vdf[vdf.Name.str.contains(name,na=False)] if filter_vdf.size == 0 and filter_uvdf.size == 0 : print_colors("ERROR no results, skipping.",is_error=True) @@ -409,7 +409,7 @@ Maintenance: print_colors(f"{vdf[['Name','URL']]}") while(IsNameValid(name) is not True): name = input("What is the Website name you want to edit ? (ex: BreachForums)") - filter_vdf = vdf[vdf.Name.str.contains(name)] + filter_vdf = vdf[vdf.Name.str.contains(name,na=False)] if filter_vdf.size != 0 : print_colors(f"{filter_vdf[['Name','URL']]}") # check if website name exists in verified.csv, if yes ask the user what index should be blacklisted @@ -455,7 +455,7 @@ Maintenance: print_colors(f"{uvdf[['Name','URL']]}") while(IsNameValid(name) is not True): name = input("What is the Website name you want to edit? (ex: BreachForums)") - filter_uvdf = uvdf[uvdf.Name.str.contains(name)] + filter_uvdf = uvdf[uvdf.Name.str.contains(name,na=False)] if filter_uvdf.size != 0 : print_colors(f"{filter_uvdf[['Name','URL']]}") # check if website name exists in unverified.csv, if yes ask the user what index should be blacklisted @@ -577,7 +577,7 @@ Maintenance: # check if the participant is already listed in webring-participants.csv or not, and add them if not already listed # and display only the matching entries in unverified.csv in an array format (display it in CLI). - filter_wdf = wdf[wdf.URL.str.contains(participant)] + filter_wdf = wdf[wdf.URL.str.contains(participant,na=False)] # check if there are no results, dont proceed if there are none! if filter_wdf.size == 0: #skip if webring participant is already listed, otherwise proceed newrow=[name,participant,desc,trusted,status,score] @@ -597,7 +597,7 @@ Maintenance: rows2delete= [] # it is an empty list at first for i,j in csvdf.iterrows(): row=csvdf.loc[i,:].values.tolist() - #print_colors(f"{row}") + print_colors(f"{row}") @@ -638,8 +638,11 @@ Maintenance: # for each link in the participant's verified/unverified csv files, # check if the link is already listed in your own verified.csv or unverified.csv filterterm=csvdf.at[i, 'URL'] - filter_vdf= vdf[vdf.URL.str.contains(filterterm)] - filter_uvdf= uvdf[uvdf.URL.str.contains(filterterm)] + #print('1)',filterterm) + filter_vdf= vdf[vdf.URL.str.contains(filterterm,na=False)] + #print('2)',filter_vdf) + #print('3)',uvdf[uvdf.URL.str.contains(filterterm,na=False)] ) + filter_uvdf= uvdf[uvdf.URL.str.contains(filterterm,na=False)] if len(filter_uvdf.index) == 0 and len(filter_vdf.index) == 0: newrow=row uvdf.loc[-1] = newrow # adding a row