updated dockerfile + option 2 and 3 merging is WIP

This commit is contained in:
root 2025-02-24 08:55:49 +01:00
parent b772fc454d
commit 97fcc4c8c4
3 changed files with 117 additions and 86 deletions

View file

@ -146,14 +146,13 @@ def main():
print("Perform sanity checks on all csv files for all instances")
option=10
else:
time.sleep(1.5)
print_colors("""
[+] Welcome to your own Darknet Lantern Instance, where you can explore the Darknet and help others do the same.
Managing Websites:
1) Add a new Website entry (into unverified.csv)
2) Trust a Website entry (move an entry from unverified to verified.csv)
3) Untrust a Website entry (move an entry from unverified to verified.csv)
2) Trust/Untrust/ Blacklist(WIP) a Website entry (move an entry from unverified to verified.csv)
3) Edit link attributes (WIP)
Managing Webring Participants:
4) Synchronize new links from existing webring participants, into your unverified.csv file
@ -202,7 +201,7 @@ Maintenance:
# a quick description (optional) + check if its valid
desc='DEFAULT'
while(IsDescriptionValid(desc) is not True):
desc=input("Description for the website ? (Optional) ")
desc=input("Description for the website ? (if not empty = the link will be added to verified.csv directly ) ")
choice=input("Is the website sensitive ? (ex: related to drugs) (y/n) ")
if choice == "n":
sensi = 'NO'
@ -214,12 +213,23 @@ Maintenance:
# (rest is automatic: status, score, instance is = '' because it is your own instance)
# TODO check if the entry doesnt already exist in verified.csv and in unverified.csv
# if it doesnt exist, add it into unverified.csv
uvdf.loc[-1] = newrow # adding a row
uvdf.index = uvdf.index + 1 # shifting index
uvdf = uvdf.sort_index() # sorting by index
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
print_colors("[+] New row added! now writing the csv file")
uvdf.to_csv(unverifiedcsvfile, index=False)
if desc == '': # if the description is empty = it means that it goes in unverified.csv
print("Adding new row in unverified.csv since description is empty")
uvdf.loc[-1] = newrow # adding a row
uvdf.index = uvdf.index + 1 # shifting index
uvdf = uvdf.sort_index() # sorting by index
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
print_colors("[+] New row added! now writing the csv file")
uvdf.to_csv(unverifiedcsvfile, index=False)
else: # if the description isnt empty = it means that it goes in verified.csv
print("Adding new row in verified.csv since description is not empty")
vdf.loc[-1] = newrow # adding a row
vdf.index = vdf.index + 1 # shifting index
vdf = vdf.sort_index() # sorting by index
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
print_colors("[+] New row added! now writing the csv file")
vdf.to_csv(verifiedcsvfile, index=False)
choice=input("\n[+] Want to add another website ? (y/n) ")
if choice == "n":
break
@ -227,87 +237,110 @@ Maintenance:
case 2:
print_colors("[+] Trust a Website entry (move an entry from unverified to verified.csv)")
print_colors("[+] Trust/Untrust/Blacklist a Website entry (move an entry from unverified to verified.csv)")
while True:
vdf = pd.read_csv(verifiedcsvfile)
uvdf = pd.read_csv(unverifiedcsvfile)
# search for a word
print_colors(f"{uvdf[['Name','URL']]}")
name=''
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)]
# NOTE and 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!
if filter_uvdf.size == 0:
print_colors("ERROR no results, skipping.",is_error=True)
else:
# Each of the rows has an index,
index=-1
while (index not in filter_uvdf.index):
index = int(input("What is the index of the entry that you want to move to verified.csv ? (ex: 3) "))
# once selected, it must be able to SAVE and print_colors that row:
print_colors(f"{uvdf.iloc[index].values}")
newrow=uvdf.iloc[index].values
#ask the user if they want to 1) trust, 2) untrust 3) blacklist the selected website
choice = int(input("Do you want to 1) Trust, 2) UnTrust, or 3) Blacklist an existing entry ?").strip())
while True:
match choice:
case 1:
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)]
# 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!
if filter_uvdf.size == 0:
print_colors("ERROR no results, skipping.",is_error=True)
else:
# Each of the rows has an index,
index=-1
while (index not in filter_uvdf.index):
index = int(input("What is the index of the entry that you want to move to Trust ? (ex: 3) "))
# once selected, it must be able to SAVE and print_colors that row:
print_colors(f"{uvdf.iloc[index].values}")
# append it into verified.csv
vdf.loc[-1] = newrow # adding a row
vdf.index = vdf.index + 1 # shifting index
vdf = vdf.sort_index() # sxorting by index
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] New row added to verified.csv! now writing to the csv")
# 1) Trust an existing website (move it from unverified.csv to verified.csv)
newrow=uvdf.iloc[index].values
newdesc=""
#while the description is empty, keep looping
while(newdesc == "" or (IsDescriptionValid(newdesc) is not True)):
newdesc=input("Description for the website ? (it cannot be empty, for the link to be added in verified.csv): ")
# append it into verified.csv
vdf.loc[-1] = newrow # adding a row
vdf.at[-1, 'Description']=newdesc
vdf.index = vdf.index + 1 # shifting index
vdf = vdf.sort_index() # sxorting by index
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] New row added to verified.csv! now writing to the csv")
# remove it from unverified.csv
uvdf.drop(index, inplace= True)
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
uvdf.to_csv(unverifiedcsvfile, index=False)
print_colors("[+] Link is now moved to verified.csv!")
choice=input("\n[+] Want to trust another website ? (y/n) ")
# remove it from unverified.csv
uvdf.drop(index, inplace= True)
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
uvdf.to_csv(unverifiedcsvfile, index=False)
print_colors("[+] Link is now moved to verified.csv!")
break
case 2:
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)]
# 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!
if filter_vdf.size == 0:
print_colors("ERROR no results, skipping.",is_error=True)
else:
# Each of the rows has an index,
index=-1
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) "))
# once selected, it must be able to SAVE and print_colors that row:
print_colors(f"{uvdf.iloc[index].values}")
# 1) Untrust an existing website (move it from verified.csv to unverified.csv)
newrow=vdf.iloc[index].values
# append it into unverified.csv
uvdf.loc[-1] = newrow # adding a row
uvdf.index = uvdf.index + 1 # shifting index
uvdf = uvdf.sort_index() # sxorting by index
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
uvdf.to_csv(unverifiedcsvfile, index=False)
print_colors("[+] New row added to unverified.csv! now writing to the csv")
# remove it from verified.csv
vdf.drop(index, inplace= True)
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] Link is now moved to unverified.csv!")
break
case 3:
#TODO: 3) Blacklist an existing website
print_colors("[+] Blacklisting link!")
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)]
#TODO: put the URL of the website in your blacklist.csv file
#TODO: drop the rows that contain that URL in your verified.csv and unverified.csv
break
choice=input("\n[+] Want to Trust/Untrust/Blacklist another existing entry ? (y/n) ")
if choice == "n":
break
break
case 3:
print_colors("[+] Untrust a Website entry (move an entry from verified to unverified.csv)")
vdf = pd.read_csv(verifiedcsvfile)
uvdf = pd.read_csv(unverifiedcsvfile)
print_colors(f"{vdf[['Name','URL']]}")
# search for a word
name=''
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)]
# and 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!
if filter_vdf.size == 0:
print_colors("ERROR no results, skipping.", is_error=True)
else:
# Each of the rows has an index,
index=-1
while (index not in filter_vdf.index):
index = int(input("What is the index of the entry that you want to move to unverified.csv ? (ex: 3) "))
# once selected, it must be able to SAVE and print_colors that row:
print_colors(vdf.iloc[index].values)
newrow=vdf.iloc[index].values
# append it into unverified.csv
uvdf.loc[-1] = newrow # adding a row
uvdf.index = uvdf.index + 1 # shifting index
uvdf = uvdf.sort_index() # sorting by index
uvdf.to_csv(unverifiedcsvfile, index=False)
print_colors("[+] New row added to unverified.csv!")
# remove it from verified.csv
vdf.drop(index, inplace= True)
vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] Link is now moved to unverified.csv!")
# TODO change it to "edit link attributes"
print_colors("[+] Edit link attributes (WIP)")
break