mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-17 04:36:57 +00:00
reworking in progress
This commit is contained in:
parent
1493e57174
commit
196cf331a8
8 changed files with 165 additions and 1 deletions
146
scripts/darknet_exploration.py
Normal file
146
scripts/darknet_exploration.py
Normal file
|
@ -0,0 +1,146 @@
|
|||
import os, pwd
|
||||
def main():
|
||||
|
||||
rootpath='/srv/darknet-onion-webring/'
|
||||
homepath=pwd.getpwuid(os.getuid()).pw_dir
|
||||
urlpath=homepath+'/.darknet_participant_url'
|
||||
print(urlpath)
|
||||
isitvalid="n"
|
||||
|
||||
#check if ~/.darknet_participant_url exists,
|
||||
# if exists, instance= the content of ~/.darknet_participant_url (which is the url: such as uptime.nowherejez...onion)
|
||||
|
||||
while isitvalid != "y":
|
||||
if os.path.isfile(urlpath):
|
||||
with open(urlpath) as f:
|
||||
instance = f.read()
|
||||
# TODO check if the instance URL domain is valid
|
||||
|
||||
print("[+] file exists, your Webring URL is ", instance)
|
||||
isitvalid = "y"
|
||||
else:
|
||||
print("[+] Instance Path doesn't exist yet")
|
||||
# and ask for the instance URL domain
|
||||
instance = input("What is your Instance domain ? (ex: uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion):")
|
||||
instancepath=rootpath+'www/participants/'+instance
|
||||
# TODO check if the instance URL domain is valid
|
||||
|
||||
# ask the user if the instance URL is valid ?
|
||||
print()
|
||||
print(instance)
|
||||
isitvalid=input("Is your this your instance domain ?")
|
||||
# if yes, then write it into ~/.darknet_participant_url
|
||||
if isitvalid != "y" :
|
||||
print("OK writing the instance url to ~/.darknet_participants_url")
|
||||
with open(urlpath, 'w') as file:
|
||||
file.write(instance)
|
||||
|
||||
print("[+] Welcome to the Darknet Onion Webring, where you are exploring the Darknet and helping others do the same.")
|
||||
print("""
|
||||
1) add a new entry (into unverified.csv)
|
||||
2) verify an entry (move an entry from unverified to verified.csv)
|
||||
3) add a new webring participant (and download their files into their directory (without trusting them yet!))
|
||||
4) trust a webring participant (Potentially dangerous)
|
||||
""")
|
||||
option = input("Select Option? (1-4)")
|
||||
print(option)
|
||||
match option:
|
||||
case "0":
|
||||
print("[+] Initial Setup")
|
||||
# what is your instance url ? ex: uptime.nowherejez...onion
|
||||
instance = input("What is your Instance domain ? (ex: uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion):")
|
||||
# check that it is only url.onion or subdomain.url.onion, and if the characters are only [a-zA-Z0-9.], use the function IsOnionDomainValid()
|
||||
instancepath='/srv/darknet-onion-webring/www/participants/'+instance
|
||||
print(instancepath)
|
||||
# check if the directory already exists or not in www/participants/nowherejez...onion
|
||||
if os.path.isdir(instancepath):
|
||||
print("[+] Instance Path already exists, skipping.")
|
||||
else:
|
||||
print("[-] path doesnt exist")
|
||||
# if doesnt exist, create it, copy the default anonymous instance banner in there.
|
||||
# copy the blank verified.csv unverified.csv sensitive.csv blacklist.csv and webring-participants.csv files in the new directory
|
||||
# print message to explain what's next: you have a new instance, it's now time to list your own links, and to browse other participant's links
|
||||
|
||||
case "1":
|
||||
print("[+] Add a new Entry (into unverified.csv)")
|
||||
# ask for the following:
|
||||
# the name of the website (required)
|
||||
# the url of the website (required)
|
||||
# a quick description (optional)
|
||||
# sensitive ? (y/n)
|
||||
# (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
|
||||
|
||||
case "2":
|
||||
print("[+] Verify an entry (move an entry from unverified.csv to verified.csv)")
|
||||
# search for a word
|
||||
# and display only the matching entries in an array format (display it in CLI).
|
||||
# Each of the rows must have an index,
|
||||
# prompt the user to ask for with row they want to move to verified.csv
|
||||
# once selected, it must be able to print that row, and:
|
||||
# append it into verified.csv
|
||||
# remove it from unverified.csv
|
||||
# print completed! You are now listing [name] (url) (sensitive).
|
||||
|
||||
case "3":
|
||||
print("[+] add a new webring participant (and download their files into their directory (without trusting them yet!))")
|
||||
# ask for the url to the other webring participant
|
||||
# check if the url is valid or not: at http://URL.onion/participants/URL.onion/{verified.csv,unverified.csv,sensitive.csv,blacklist.csv,webring-participants.csv}
|
||||
|
||||
case "4":
|
||||
print("[+] trust a webring participant (Potentially dangerous)")
|
||||
# list the existing webring participants from webring-participants.csv and
|
||||
# ask the user to pick the index (0-9?) of the instance to trust
|
||||
# if index is valid, then mark the instance as trusted in webring-participants.csv
|
||||
|
||||
case _:
|
||||
print("[-] ERROR, incorrect input")
|
||||
|
||||
|
||||
def IsOnionValid(domain):
|
||||
# check if the characters are only [a-zA-Z0-9.] with maximum 128 chars max?
|
||||
# check that it is only url.onion or subdomain.url.onion,
|
||||
# if OK return True
|
||||
#if not : return False
|
||||
return True
|
||||
|
||||
def IsUrlValid(url):
|
||||
# check if the characters are only [a-zA-Z0-9.:/] with maximum 128 chars max?
|
||||
# check that it is only http(s)://wordA.wordB or http(s)://WordC.WordB.WordC, (onion or not), clearnet is fine too (double check if those are fine!)
|
||||
# if OK return True
|
||||
#if not : return False
|
||||
return True
|
||||
|
||||
def IsStatusValid(status):
|
||||
# check if the characters are only [vx] with maximum 1 chars max
|
||||
# if OK return True
|
||||
#if not : return False
|
||||
return True
|
||||
|
||||
def IsDescriptionValid(desc):
|
||||
# check if the characters are only [a-zA-Z0-9.,' ] with maximum 256 chars max
|
||||
#(careful with the ' and , make sure you test if it fucks the csv up or else)
|
||||
# if OK return True
|
||||
#if not : return False
|
||||
return True
|
||||
|
||||
def IsCategoryValid(category):
|
||||
# check if the characters are only [a-zA-Z0-9 ] with maximum 64 chars max
|
||||
#(careful with the ' and , make sure you test if it fucks the csv up or else)
|
||||
# if OK return True
|
||||
#if not : return False
|
||||
return True
|
||||
|
||||
def IsNameValid(name):
|
||||
# check if the characters are only [a-zA-Z0-9 ] with maximum 64 chars max
|
||||
#(careful with the ' and , make sure you test if it fucks the csv up or else)
|
||||
# if OK return True
|
||||
#if not : return False
|
||||
return True
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue