mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-17 04:36:57 +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:
|
while True:
|
||||||
match choice:
|
match choice:
|
||||||
case 1:
|
case 1:
|
||||||
|
# 1) Trust an existing website
|
||||||
print_colors(f"{uvdf[['Name','URL']]}")
|
print_colors(f"{uvdf[['Name','URL']]}")
|
||||||
while(IsNameValid(name) is not True):
|
while(IsNameValid(name) is not True):
|
||||||
name = input("What is the Website name you want to Trust ? (ex: Nowhere)")
|
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!")
|
print_colors("[+] Link is now moved to verified.csv!")
|
||||||
break
|
break
|
||||||
case 2:
|
case 2:
|
||||||
|
# 2) Untrust an existing website
|
||||||
print_colors(f"{vdf[['Name','URL']]}")
|
print_colors(f"{vdf[['Name','URL']]}")
|
||||||
while(IsNameValid(name) is not True):
|
while(IsNameValid(name) is not True):
|
||||||
name = input("What is the Website name you want to Untrust ? (ex: BreachForums)")
|
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!")
|
print_colors("[+] Link is now moved to unverified.csv!")
|
||||||
break
|
break
|
||||||
case 3:
|
case 3:
|
||||||
#TODO: 3) Blacklist an existing website
|
# 3) Blacklist an existing website
|
||||||
print_colors("[+] Blacklisting link!")
|
print_colors(f"{vdf[['Name','URL']]}")
|
||||||
while(IsNameValid(name) is not True):
|
while(IsNameValid(name) is not True):
|
||||||
name = input("What is the Website name you want to Blacklist ? (ex: BreachForums)")
|
name = input("What is the Website name you want to Blacklist ? (ex: BreachForums)")
|
||||||
filter_uvdf = uvdf[uvdf.Name.str.contains(name)]
|
filter_uvdf = uvdf[uvdf.Name.str.contains(name)]
|
||||||
filter_vdf = vdf[vdf.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)
|
print_colors("ERROR no results, skipping.",is_error=True)
|
||||||
else:
|
else:
|
||||||
# Each of the rows has an index,
|
# Each of the rows has an index,
|
||||||
index=-1
|
index=-1
|
||||||
#TODO: ask the user to pick between 1) verified.csv or 2) unverified.csv
|
|
||||||
### CHECKING IN VERIFIED.CSV ###
|
### CHECKING IN VERIFIED.CSV ###
|
||||||
#TODO: if website name exists in verified.csv, ask the user what index should be blacklisted
|
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):
|
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) "))
|
index = int(input("What is the index of the entry in verified.csv that you want to blacklist ? (ex: 3) "))
|
||||||
#TODO: drop the rows that contain that URL in your verified.csv and unverified.csv files
|
# add the URL of the website in your blacklist.csv file
|
||||||
#TODO: add the URL of the website in your blacklist.csv file
|
url2blacklist=filter_vdf.at[index,"URL"]
|
||||||
#TODO: update unverified filter csv :
|
elif filter_uvdf.size != 0:
|
||||||
### CHECKING IN UNVERIFIED.CSV ###
|
print_colors(f"{filter_uvdf[['Name','URL']]}")
|
||||||
#TODO: if website name still exists in unverified.csv, ask the user what index should be blacklisted
|
# check if website name exists in verified.csv, if yes 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
|
while (index not in filter_uvdf.index):
|
||||||
#TODO: add the URL of the website in your blacklist.csv file
|
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
|
break
|
||||||
choice=input("\n[+] Want to Trust/Untrust/Blacklist another existing entry ? (y/n) ")
|
choice=input("\n[+] Want to Trust/Untrust/Blacklist another existing entry ? (y/n) ")
|
||||||
|
@ -356,28 +393,110 @@ Maintenance:
|
||||||
break
|
break
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
# ask the user to select between 1) verified.csv and 2) unverified.csv
|
||||||
|
while True:
|
||||||
print_colors("[+] Edit link attributes (WIP)")
|
print_colors("[+] Edit link attributes (WIP)")
|
||||||
#TODO: while true
|
choice = int(input("Do you want to edit link attributes in 1) verified.csv or 2) unverified.csv ? (-1 to exit)").strip())
|
||||||
#TODO: ask the user to select between 1) verified.csv and 2) unverified.csv
|
index=-1
|
||||||
#TODO: IF unverified.csv:
|
name=''
|
||||||
#TODO: ask the user to select a valid website name
|
value=''
|
||||||
#TODO: ask the user to select a valid index in either csv files
|
#newrow=[instance,category,name,url,sensi,desc,'YES','100']
|
||||||
#TODO: ask the user to write a valid name (enter to skip)
|
match choice:
|
||||||
#TODO: ask the user to write a valid category (enter to skip)
|
case 1:
|
||||||
#TODO: ask the user to write a valid url (enter to skip)
|
#IF verified.csv:
|
||||||
#TODO: ask the user to write a valid description (enter to skip)
|
#ask the user to select a valid website name
|
||||||
#TODO: if the description is not empty, move it to verified.csv
|
print_colors(f"{vdf[['Name','URL']]}")
|
||||||
#TODO: IF verified.csv:
|
while(IsNameValid(name) is not True):
|
||||||
#TODO: ask the user to select a valid website name
|
name = input("What is the Website name you want to edit ? (ex: BreachForums)")
|
||||||
#TODO: ask the user to select a valid index in either csv files
|
filter_vdf = vdf[vdf.Name.str.contains(name)]
|
||||||
#TODO: ask the user to write a valid name (enter to skip)
|
if filter_vdf.size != 0 :
|
||||||
#TODO: ask the user to write a valid category (enter to skip)
|
print_colors(f"{filter_vdf[['Name','URL']]}")
|
||||||
#TODO: ask the user to write a valid url (enter to skip)
|
# check if website name exists in verified.csv, if yes ask the user what index should be blacklisted
|
||||||
#TODO: ask the user to write a valid description (enter to skip)
|
# ask the user to write a valid name (enter to skip)
|
||||||
#TODO: ask the user if they are done editing links (y/n)
|
while (index not in filter_vdf.index):
|
||||||
#TODO: if choice == y then break
|
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
|
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 ###########
|
####### MANAGING WEBRING PARTICIPANTS ###########
|
||||||
# 4) Synchronize new links from webring participants, into your unverified.csv file
|
# 4) Synchronize new links from webring participants, into your unverified.csv file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue