make sure lantern.py can be automated for option 4, 9 and 10

This commit is contained in:
root 2025-02-22 16:47:46 +01:00
parent 87cf3cae10
commit b772fc454d
3 changed files with 65 additions and 10 deletions

View file

@ -120,12 +120,12 @@ V1.0.2:
- php+css : make the css styling not ugly on mobile - php+css : make the css styling not ugly on mobile
- py: make sure that running option 4 automatically creates the folder for a new official webring participant and downloads the files all the same, instead of just iterating through the folders. - py: make sure that running option 4 automatically creates the folder for a new official webring participant and downloads the files all the same, instead of just iterating through the folders.
- py: check that banners are at the most 5MB big - py: check that banners are at the most 5MB big
- py : if an argument is passed to lantern.py, enter automation mode, and at least automate option 4, 9 and 10 (ex: python3 lantern.py 4)
``` ```
Future Versions: Future Versions:
``` ```
V1.0.2: V1.0.2:
- py : if an argument is passed to lantern.py, enter automation mode, and at least automate option 4 (python3 lantern.py 4)
- py: in option 1, upon listing new links, if the description isn't empty, consider the link as trusted, and write it verified.csv. If description is empty, write it in unverified.csv instead. - py: in option 1, upon listing new links, if the description isn't empty, consider the link as trusted, and write it verified.csv. If description is empty, write it in unverified.csv instead.
- py: in option 2, upon trusting links, if description doesnt exist, ask the user to write one that isn't empty, and if it does exist, ask the user to press enter to keep the existing description, otherwise write a new one - py: in option 2, upon trusting links, if description doesnt exist, ask the user to write one that isn't empty, and if it does exist, ask the user to press enter to keep the existing description, otherwise write a new one
- py: merge the option 2 and 3 together, and repurpose option 3 to become "edit links attributes" - py: merge the option 2 and 3 together, and repurpose option 3 to become "edit links attributes"

View file

@ -6,6 +6,7 @@ import requests
import shutil import shutil
import time import time
import urllib import urllib
import sys
def main(): def main():
@ -37,6 +38,8 @@ def main():
print_colors(""" print_colors("""
; ;
ED. ED.
@ -132,7 +135,17 @@ def main():
webpdf = pd.read_csv(webpcsvfile) webpdf = pd.read_csv(webpcsvfile)
print_colors(f"[+] file exists, your Webring URL is {instance}") print_colors(f"[+] file exists, your Webring URL is {instance}")
while True: ##### CHECK IF ARGUMENTS ARE PASSED TO ENTER PROMPT-LESS MODE #####
if len(sys.argv) == 2 and sys.argv[1] == "4":
print("4) Synchronize new links from existing webring participants into your unverified.csv file")
option=4
elif len(sys.argv) == 2 and sys.argv[1] == "9":
print("remove duplicate urls from instance")
option=9
elif len(sys.argv) == 2 and sys.argv[1] == "10":
print("Perform sanity checks on all csv files for all instances")
option=10
else:
time.sleep(1.5) time.sleep(1.5)
print_colors(""" print_colors("""
[+] Welcome to your own Darknet Lantern Instance, where you can explore the Darknet and help others do the same. [+] Welcome to your own Darknet Lantern Instance, where you can explore the Darknet and help others do the same.
@ -162,7 +175,8 @@ Maintenance:
option = int(option) option = int(option)
except ValueError: except ValueError:
print_colors(f"[-] Exiting. {option} is not a valid option.", bold=True, is_error=True) print_colors(f"[-] Exiting. {option} is not a valid option.", bold=True, is_error=True)
break return False
while True:
match option: match option:
########## MANAGING WEBSITE ENTRIES ################# ########## MANAGING WEBSITE ENTRIES #################
@ -209,6 +223,7 @@ Maintenance:
choice=input("\n[+] Want to add another website ? (y/n) ") choice=input("\n[+] Want to add another website ? (y/n) ")
if choice == "n": if choice == "n":
break break
break
case 2: case 2:
@ -254,6 +269,7 @@ Maintenance:
choice=input("\n[+] Want to trust another website ? (y/n) ") choice=input("\n[+] Want to trust another website ? (y/n) ")
if choice == "n": if choice == "n":
break break
break
case 3: case 3:
print_colors("[+] Untrust a Website entry (move an entry from verified to unverified.csv)") print_colors("[+] Untrust a Website entry (move an entry from verified to unverified.csv)")
@ -292,6 +308,7 @@ Maintenance:
vdf.drop(index, inplace= True) vdf.drop(index, inplace= True)
vdf.to_csv(verifiedcsvfile, index=False) vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] Link is now moved to unverified.csv!") print_colors("[+] Link is now moved to unverified.csv!")
break
####### MANAGING WEBRING PARTICIPANTS ########### ####### MANAGING WEBRING PARTICIPANTS ###########
@ -467,7 +484,7 @@ Maintenance:
csvdf.drop(i, inplace= True) csvdf.drop(i, inplace= True)
csvdf.to_csv(csvfilepath, index=False) csvdf.to_csv(csvfilepath, index=False)
rows2delete= [] # it is an empty list at first rows2delete= [] # it is an empty list at first
break
@ -612,6 +629,7 @@ Maintenance:
print_colors(f"[+] REMOVING ROW: {i}{row}") print_colors(f"[+] REMOVING ROW: {i}{row}")
csvdf.drop(i, inplace= True) csvdf.drop(i, inplace= True)
csvdf.to_csv(csvfilepath, index=False) csvdf.to_csv(csvfilepath, index=False)
break
############################################## ##############################################
@ -733,6 +751,7 @@ Maintenance:
break break
except Exception: except Exception:
break break
break
@ -810,6 +829,7 @@ Maintenance:
print_colors(f"[-] An unexpected error occurred: {str(e)}", is_error=True) print_colors(f"[-] An unexpected error occurred: {str(e)}", is_error=True)
except Exception: except Exception:
break break
break
@ -881,6 +901,7 @@ Maintenance:
print_colors(f"[-] An unexpected error occurred: {str(e)}", is_error=True) print_colors(f"[-] An unexpected error occurred: {str(e)}", is_error=True)
except Exception: except Exception:
break break
break
@ -900,6 +921,7 @@ Maintenance:
except Exception as e: except Exception as e:
print_colors(f"An error occurred while processing {csvfilepath}: {e}") print_colors(f"An error occurred while processing {csvfilepath}: {e}")
break break
break
case 10: case 10:
print_colors("[+] 10) perform sanity checks on all csv files (to mark them as sensitive / or remove the ones that are blacklisted)") print_colors("[+] 10) perform sanity checks on all csv files (to mark them as sensitive / or remove the ones that are blacklisted)")
@ -970,10 +992,11 @@ Maintenance:
csvdf.drop(i, inplace= True) csvdf.drop(i, inplace= True)
csvdf.to_csv(csvfilepath, index=False) csvdf.to_csv(csvfilepath, index=False)
#read=input("Continue?") #read=input("Continue?")
break
case 0: case 0:
print_colors(f"[-] Exiting", bold=True) print_colors(f"[-] Exiting", bold=True)
break break

View file

@ -1,12 +1,44 @@
import sys import sys
def main(): def main():
print(sys.argv, len(sys.argv)) #print(sys.argv, len(sys.argv))
option='' option=''
if len(sys.argv) == 2: if len(sys.argv) == 2 and sys.argv[1] == "4":
print("option = ", sys.argv[1]) print("4) Synchronize new links from existing webring participants into your unverified.csv file")
option=sys.argv[1] elif len(sys.argv) == 2 and sys.argv[1] == "9":
print("remove duplicate urls from instance")
elif len(sys.argv) == 2 and sys.argv[1] == "10":
print("Perform sanity checks on all csv files for all instances")
else:
print("""
[+] 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)
Managing Webring Participants:
4) Synchronize new links from existing webring participants, into your unverified.csv file
5) Add a new webring participant (and download their files into their directory (without trusting them yet!))
6) Trust/UnTrust/Blacklist a webring participant (Potentially dangerous)
Managing Wordlists:
7) Add/Remove Words/URLs in the sensitive list (ex: drug)
8) Add/Remove Words/URLs or links in the blacklist (ex: porn)
Maintenance:
9) Remove the duplicate URLs for your own instance
10) Perform sanity checks on all csv files for all instances (to mark them as sensitive / or remove the ones that are blacklisted)
0) Exit
""")
option = input("Select an option? (0-10): ").strip()
print("option =", option)
if __name__ == '__main__': if __name__ == '__main__':