mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 20:26:58 +00:00
finished option 2 and 3
This commit is contained in:
parent
85d6e6947a
commit
1f07e29abc
1 changed files with 154 additions and 35 deletions
|
@ -249,6 +249,7 @@ Maintenance:
|
|||
while True:
|
||||
match choice:
|
||||
case 1:
|
||||
# 1) Trust an existing website
|
||||
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)")
|
||||
|
@ -289,6 +290,7 @@ Maintenance:
|
|||
print_colors("[+] Link is now moved to verified.csv!")
|
||||
break
|
||||
case 2:
|
||||
# 2) Untrust an existing website
|
||||
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)")
|
||||
|
@ -324,30 +326,65 @@ Maintenance:
|
|||
print_colors("[+] Link is now moved to unverified.csv!")
|
||||
break
|
||||
case 3:
|
||||
#TODO: 3) Blacklist an existing website
|
||||
print_colors("[+] Blacklisting link!")
|
||||
# 3) Blacklist an existing website
|
||||
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)]
|
||||
|
||||
if filter_vdf.size == 0 and filter_vdf.size == 0 :
|
||||
if filter_vdf.size == 0 and filter_uvdf.size == 0 :
|
||||
print_colors("ERROR no results, skipping.",is_error=True)
|
||||
else:
|
||||
# Each of the rows has an index,
|
||||
index=-1
|
||||
#TODO: ask the user to pick between 1) verified.csv or 2) unverified.csv
|
||||
### CHECKING IN VERIFIED.CSV ###
|
||||
#TODO: if website name exists in verified.csv, ask the user what index should be blacklisted
|
||||
while (index not in filter_vdf.index):
|
||||
index = int(input("What is the index of the entry that you want to move to Untrust ? (ex: 3) "))
|
||||
#TODO: drop the rows that contain that URL in your verified.csv and unverified.csv files
|
||||
#TODO: add the URL of the website in your blacklist.csv file
|
||||
#TODO: update unverified filter csv :
|
||||
### CHECKING IN UNVERIFIED.CSV ###
|
||||
#TODO: if website name still exists in unverified.csv, ask the user what index should be blacklisted
|
||||
#TODO: drop the rows that contain that secondary URL in your verified.csv and unverified.csv files
|
||||
#TODO: add the URL of the website in your blacklist.csv file
|
||||
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
|
||||
while (index not in filter_vdf.index):
|
||||
index = int(input("What is the index of the entry in verified.csv that you want to blacklist ? (ex: 3) "))
|
||||
# add the URL of the website in your blacklist.csv file
|
||||
url2blacklist=filter_vdf.at[index,"URL"]
|
||||
elif filter_uvdf.size != 0:
|
||||
print_colors(f"{filter_uvdf[['Name','URL']]}")
|
||||
# check if website name exists in verified.csv, if yes ask the user what index should be blacklisted
|
||||
while (index not in filter_uvdf.index):
|
||||
index = int(input("What is the index of the entry in unverified.csv that you want to blacklist ? (ex: 3) "))
|
||||
# add the URL of the website in your blacklist.csv file
|
||||
url2blacklist=filter_uvdf.at[index,"URL"]
|
||||
|
||||
newrow=[url2blacklist]
|
||||
bldf.loc[-1] = newrow # adding a row
|
||||
bldf.index = bldf.index + 1 # shifting index
|
||||
bldf = bldf.sort_index() # sorting by index
|
||||
# drop blacklist.csv's duplicates
|
||||
bldf = bldf.drop_duplicates(subset=['blacklisted-words'])
|
||||
print_colors("[+] New row added! now writing the csv file:")
|
||||
bldf.to_csv(blcsvfile, index=False)
|
||||
#: drop the rows that contain that blacklisted URL in your verified.csv and unverified.csv files
|
||||
for w in ['verified.csv','unverified.csv']:
|
||||
csvfilepath=instancepath+'/'+w
|
||||
print_colors(f"{csvfilepath}")
|
||||
csvdf = pd.read_csv(csvfilepath)
|
||||
rows2delete= [] # it is an empty list at first
|
||||
for i,j in csvdf.iterrows():
|
||||
row=csvdf.loc[i,:].values.tolist()
|
||||
### SANITY CHECK 2: Mark all rows that are not allowed (blacklist) for deletion ###
|
||||
if any(url2blacklist in str(x) for x in row) == True:
|
||||
if i not in rows2delete:
|
||||
print_colors(f"Marking row {i} for deletion, as it matches with the blacklisted word {url2blacklist}")
|
||||
rows2delete.append(i)
|
||||
|
||||
for i in rows2delete:
|
||||
row=csvdf.loc[i,:].values.tolist()
|
||||
print_colors(f'[+] REMOVING ROW : {i} {row}')
|
||||
csvdf.drop(i, inplace= True)
|
||||
csvdf.to_csv(csvfilepath, index=False)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
break
|
||||
choice=input("\n[+] Want to Trust/Untrust/Blacklist another existing entry ? (y/n) ")
|
||||
|
@ -356,27 +393,109 @@ Maintenance:
|
|||
break
|
||||
|
||||
case 3:
|
||||
print_colors("[+] Edit link attributes (WIP)")
|
||||
#TODO: while true
|
||||
#TODO: ask the user to select between 1) verified.csv and 2) unverified.csv
|
||||
#TODO: IF unverified.csv:
|
||||
#TODO: ask the user to select a valid website name
|
||||
#TODO: ask the user to select a valid index in either csv files
|
||||
#TODO: ask the user to write a valid name (enter to skip)
|
||||
#TODO: ask the user to write a valid category (enter to skip)
|
||||
#TODO: ask the user to write a valid url (enter to skip)
|
||||
#TODO: ask the user to write a valid description (enter to skip)
|
||||
#TODO: if the description is not empty, move it to verified.csv
|
||||
#TODO: IF verified.csv:
|
||||
#TODO: ask the user to select a valid website name
|
||||
#TODO: ask the user to select a valid index in either csv files
|
||||
#TODO: ask the user to write a valid name (enter to skip)
|
||||
#TODO: ask the user to write a valid category (enter to skip)
|
||||
#TODO: ask the user to write a valid url (enter to skip)
|
||||
#TODO: ask the user to write a valid description (enter to skip)
|
||||
#TODO: ask the user if they are done editing links (y/n)
|
||||
#TODO: if choice == y then break
|
||||
break
|
||||
# ask the user to select between 1) verified.csv and 2) unverified.csv
|
||||
while True:
|
||||
print_colors("[+] Edit link attributes (WIP)")
|
||||
choice = int(input("Do you want to edit link attributes in 1) verified.csv or 2) unverified.csv ? (-1 to exit)").strip())
|
||||
index=-1
|
||||
name=''
|
||||
value=''
|
||||
#newrow=[instance,category,name,url,sensi,desc,'YES','100']
|
||||
match choice:
|
||||
case 1:
|
||||
#IF verified.csv:
|
||||
#ask the user to select a valid website name
|
||||
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)]
|
||||
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
|
||||
# ask the user to write a valid name (enter to skip)
|
||||
while (index not in filter_vdf.index):
|
||||
index = int(input("What is the index of the entry in verified.csv that you want to edit ? (ex: 3) "))
|
||||
newrow=vdf.iloc[index].values
|
||||
columnnames=vdf.iloc[0].values
|
||||
#for i in range(len(newrow)):
|
||||
for i in [1,2,3,4,5]:
|
||||
print("Do you want to change the value of",filter_vdf.columns[i] ," ? (", newrow[i], ") (y to edit, enter to skip)")
|
||||
choice=input()
|
||||
if choice == "y":
|
||||
if i == 1: # column Category
|
||||
while(IsCategoryValid(value) is not True or value == ''):
|
||||
value = input("What is the new name of the Category? ")
|
||||
vdf.at[index,'Category']=value
|
||||
elif i == 2: # column Name
|
||||
while(IsNameValid(value) is not True or value == ''):
|
||||
value = input("What is the new name of the website? ")
|
||||
vdf.at[index,'Name']=value
|
||||
elif i == 3: # column URL
|
||||
while(IsUrlValid(value) is not True or value == ''):
|
||||
value = input("What is the new URL of the website? ")
|
||||
vdf.at[index,'URL']=value
|
||||
elif i == 4: # column Sensitive
|
||||
while(IsStatusValid(value) is not True or value == ''):
|
||||
value = input("Is this website sensitive? ")
|
||||
vdf.at[index,'Sensitive']=value
|
||||
elif i == 5: # column Description
|
||||
while(IsDescriptionValid(value) is not True or value == ''):
|
||||
value = input("What is the description of the website ? ")
|
||||
vdf.at[index,'Description']=value
|
||||
value=''
|
||||
print(newrow)
|
||||
print("[+] overwriting existing row with new values:")
|
||||
vdf.to_csv(verifiedcsvfile, index=False)
|
||||
break
|
||||
|
||||
case 2:
|
||||
#IF unverified.csv:
|
||||
#ask the user to select a valid website name
|
||||
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)]
|
||||
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
|
||||
#ask the user to select a valid index in either csv files
|
||||
while (index not in filter_uvdf.index):
|
||||
index = int(input("What is the index of the entry in verified.csv that you want to edit ? (ex: 3) "))
|
||||
newrow=uvdf.iloc[index].values
|
||||
columnnames=uvdf.iloc[0].values
|
||||
#for i in range(len(newrow)):
|
||||
for i in [1,2,3,4,5]:
|
||||
print("Do you want to change the value of",filter_uvdf.columns[i] ," ? (", newrow[i], ") (y to edit, enter to skip)")
|
||||
choice=input()
|
||||
if choice == "y":
|
||||
if i == 1: # column Category
|
||||
while(IsCategoryValid(value) is not True or value == ''):
|
||||
value = input("What is the new name of the Category? ")
|
||||
uvdf.at[index,'Category']=value
|
||||
elif i == 2: # column Name
|
||||
while(IsNameValid(value) is not True or value == ''):
|
||||
value = input("What is the new name of the website? ")
|
||||
uvdf.at[index,'Name']=value
|
||||
elif i == 3: # column URL
|
||||
while(IsUrlValid(value) is not True or value == ''):
|
||||
value = input("What is the new URL of the website? ")
|
||||
uvdf.at[index,'URL']=value
|
||||
elif i == 4: # column Sensitive
|
||||
while(IsStatusValid(value) is not True or value == ''):
|
||||
value = input("Is this website sensitive? ")
|
||||
uvdf.at[index,'Sensitive']=value
|
||||
elif i == 5: # column Description
|
||||
while(IsDescriptionValid(value) is not True or value == ''):
|
||||
value = input("What is the description of the website ? ")
|
||||
uvdf.at[index,'Description']=value
|
||||
value=''
|
||||
print(newrow)
|
||||
print("[+] overwriting existing row with new values:")
|
||||
uvdf.to_csv(unverifiedcsvfile, index=False)
|
||||
break
|
||||
case -1:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
####### MANAGING WEBRING PARTICIPANTS ###########
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue