mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-17 04:36:57 +00:00
option 6 almost completed
This commit is contained in:
parent
064e791407
commit
b30efdb483
12 changed files with 155 additions and 64 deletions
|
@ -591,55 +591,98 @@ Maintenance:
|
|||
|
||||
case "6":
|
||||
print("[+] Trust/UnTrust/Blacklist a webring participant (Potentially dangerous)")
|
||||
# TODO list each webring participant in your webring-participants.csv file
|
||||
# TODO ask the user to pick an index
|
||||
# TODO once a valid index is picked, ask if the user wants to 1) trust the webring participant, or 2) untrust them, or 3) black list them
|
||||
# if 1:
|
||||
#ask the user if they want to proceed, as this is potentially risky if the webring participant tries to list malicious links in the future
|
||||
#choice=input("You're about to trust another peer, this means that you're going to automatically trust all of the links they have in their verified.csv file! If this is a malicious peer, you're about to potentially trust malicious links, it is potentially risky! Do you want to continue ? (y/n)")
|
||||
# if user wants to proceed, mark the "trusted" column as V
|
||||
webringcsvfile=instancepath+'/'+'webring-participants.csv'
|
||||
wdf = pd.read_csv(webringcsvfile)
|
||||
# list each webring participant in your webring-participants.csv file
|
||||
print(wdf[["URL","Trusted"]])
|
||||
# ask the user to pick an index
|
||||
index=""
|
||||
while (index not in wdf.index):
|
||||
# prompt the user to ask for with row they want to move to verified.csv
|
||||
index = int(input("What is the index of the webring participant that you want to edit ? (ex: 3) "))
|
||||
# once a valid index is picked, ask if the user wants to 1) trust the webring participant, or 2) untrust them, or 3) black list them
|
||||
choice=""
|
||||
while (choice not in ["1","2","3"]):
|
||||
choice = input("Do you want to 1) Trust, 2) UnTrust, or 3) Blacklist the webring participant ?")
|
||||
if choice == "1":
|
||||
# trust the webring participant
|
||||
# ask the user if they want to proceed, as this is potentially risky if the webring participant tries to list malicious links in the future
|
||||
choice2=input("You're about to trust another peer, this means that you're going to automatically trust all of the links they have in their verified.csv file! If this is a malicious peer, you're about to potentially going to automatically trust malicious links, it is potentially risky! Do you want to continue ? (y/n)")
|
||||
if choice2 == "y":
|
||||
# if user wants to proceed, mark the "trusted" column as V
|
||||
print("[+] Trusting webring participant", wdf.at[index,"URL"])
|
||||
wdf.at[index,"Trusted"]='✔️'
|
||||
|
||||
else:
|
||||
print("[-] not trusting webring participant, skipping.")
|
||||
if choice == "2":
|
||||
print("[+] UnTrusting webring participant", wdf.at[index,"URL"])
|
||||
wdf.at[index,"Trusted"]=''
|
||||
# untrust the webring participant
|
||||
# if 2: mark the "trusted" column as empty
|
||||
# if 3:
|
||||
# TODO add it's URL to your own blacklist.csv
|
||||
# TODO remove all of the entries that came from that participant (drop the lines in verified+unverified.csv that have that instance in the instance column)
|
||||
# TODO remove it from your own webring-participants.csv
|
||||
# TODO remove the entire directory in www/participants/INSTANCENAME
|
||||
if choice == "3":
|
||||
print("[+] Blacklisting webring participant", wdf.at[index,"URL"])
|
||||
# blacklist the webring participant
|
||||
# add it's URL to your own blacklist.csv
|
||||
instance2blacklist=wdf.at[index,"URL"]
|
||||
newrow=[instance2blacklist]
|
||||
print("[+] NEWROW=",newrow)
|
||||
# (rest is automatic: status, score, instance is = '' because it is your own instance)
|
||||
# check if the entry doesn't already exist in verified.csv and in unverified.csv
|
||||
# if it doesnt exist, add it into unverified.csv
|
||||
bldf.loc[-1] = newrow # adding a row
|
||||
bldf.index = bldf.index + 1 # shifting index
|
||||
bldf = bldf.sort_index() # sorting by index
|
||||
print("[+] New row added! now writing the csv file:")
|
||||
bldf.to_csv(blcsvfile, index=False)
|
||||
|
||||
|
||||
# remove all of the entries that came from that participant (drop the lines in your own verified+unverified.csv that have that instance in the instance column)
|
||||
|
||||
#vdf
|
||||
rows2delete= [] # it is an empty list at first
|
||||
for i,j in vdf.iterrows():
|
||||
row=vdf.loc[i,:].values.tolist()
|
||||
for k,l in bldf.iterrows():
|
||||
#print("[+] Blacklisted word=",k, bldf.at[k, 'blacklisted-words'])
|
||||
blword=bldf.at[k, 'blacklisted-words']
|
||||
if any(blword in str(x) for x in row) == True:
|
||||
#print("found blacklisted word! marking row for deletion")
|
||||
if i not in rows2delete:
|
||||
print("Marking row", i,"for deletion, as it matches with a blacklisted word")
|
||||
rows2delete.append(i) #mark the row for deletion if not already done
|
||||
for i in rows2delete:
|
||||
row=vdf.loc[i,:].values.tolist()
|
||||
print('[+] REMOVING ROW :',i,row)
|
||||
vdf.drop(i, inplace= True)
|
||||
vdf.to_csv(verifiedcsvfile, index=False)
|
||||
print(vdf)
|
||||
rows2delete= [] # it is an empty list at first
|
||||
#uvdf
|
||||
rows2delete= [] # it is an empty list at first
|
||||
for i,j in uvdf.iterrows():
|
||||
row=uvdf.loc[i,:].values.tolist()
|
||||
for k,l in bldf.iterrows():
|
||||
#print("[+] Blacklisted word=",k, bldf.at[k, 'blacklisted-words'])
|
||||
blword=bldf.at[k, 'blacklisted-words']
|
||||
if any(blword in str(x) for x in row) == True:
|
||||
#print("found blacklisted word! marking row for deletion")
|
||||
if i not in rows2delete:
|
||||
print("Marking row", i,"for deletion, as it matches with a blacklisted word")
|
||||
rows2delete.append(i) #mark the row for deletion if not already done
|
||||
for i in rows2delete:
|
||||
row=uvdf.loc[i,:].values.tolist()
|
||||
print('[+] REMOVING ROW :',i,row)
|
||||
uvdf.drop(i, inplace= True)
|
||||
uvdf.to_csv(unverifiedcsvfile, index=False)
|
||||
print(uvdf)
|
||||
rows2delete= [] # it is an empty list at first
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO ask if you want to trust or untrust a webring participant
|
||||
# TODO print a warning to tell the user that you're about to trust all of the links that are trusted by another peer, if that peer is malicious they may start trusting links that you don't trust! proceed? (answer is y otherwise skip)
|
||||
choice=''
|
||||
if choice == "y":
|
||||
# TODO list all of the webring participants in webring-participants.csv
|
||||
print("Please choose a webring participant to trust:")
|
||||
# TODO make the user choose a valid index
|
||||
# TODO and write V into the "Trusted" column
|
||||
# TODO for each row in the webring participant's verified.csv file, (use the url to check)
|
||||
# TODO check if it already exists or not in your verified.csv file (if length of url to check is 0 then save and add new row, else ignore it)
|
||||
# TODO write to csv
|
||||
else:
|
||||
print("Exiting.")
|
||||
searchterm = input("What is the index of the entry that you want to trust ?")
|
||||
|
||||
# TODO
|
||||
print("[+] Untrust a webring participant (safer)")
|
||||
print("Please choose a webring participant to untrust:")
|
||||
# TODO list the webring participants in the webring-participants.csv file
|
||||
# TODO make the user choose a valid index
|
||||
# TODO and write "" into the "Trusted" column
|
||||
|
||||
|
||||
|
||||
# TODO find all rows that match with the instance name in wdf aswell
|
||||
wdf.drop(index, inplace= True)
|
||||
wdf.to_csv(webringcsvfile, index=False)
|
||||
print(wdf)
|
||||
# TODO remove the entire directory in www/participants/INSTANCENAME
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue