diff --git a/scripts/darknet_exploration.py b/scripts/darknet_exploration.py index a2232c3..eb05d53 100644 --- a/scripts/darknet_exploration.py +++ b/scripts/darknet_exploration.py @@ -2,8 +2,7 @@ import os, pwd def main(): rootpath='/srv/darknet-onion-webring/' - homepath=pwd.getpwuid(os.getuid()).pw_dir - urlpath=homepath+'/.darknet_participant_url' + urlpath=pwd.getpwuid(os.getuid()).pw_dir+"/.darknet_participant_url" print(urlpath) isitvalid="n" @@ -15,7 +14,7 @@ def main(): with open(urlpath) as f: instance = f.read() # TODO check if the instance URL domain is valid - + instancepath=rootpath+'www/participants/'+instance print("[+] file exists, your Webring URL is ", instance) isitvalid = "y" else: @@ -32,8 +31,12 @@ def main(): # 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: + with open(urlpath, "w") as file: file.write(instance) + print("[+] file written, let's read it") + f = open(urlpath,"r") + print(f.read()) + print("[+] Initial Setup Completed!") print("[+] Welcome to the Darknet Onion Webring, where you are exploring the Darknet and helping others do the same.") print(""" @@ -45,31 +48,20 @@ def main(): 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: + unverifiedpath=instancepath+'/unverified.csv' # the name of the website (required) + entry_name = input("What is the Website name ?") # the url of the website (required) + entry_url = input("What is URL of the Website ? (ex: https://torproject.org or http://2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion") # a quick description (optional) + entry_url = input("(Optional) Description of the website ? (max 256 characters) (press enter to skip)" # sensitive ? (y/n) + entry_url = input("is it a sensitive website ? (ex: website related to drugs)" # (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 + # 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": diff --git a/scripts/tests/writefile.py b/scripts/tests/writefile.py new file mode 100644 index 0000000..04031d6 --- /dev/null +++ b/scripts/tests/writefile.py @@ -0,0 +1,14 @@ +import os, pwd +def main(): + urlpath=pwd.getpwuid(os.getuid()).pw_dir+"/.darknet_participant_url" + url="uptime.nowherejezaaa...onion" + print(urlpath, ":", url) + with open(urlpath, "w") as f: + f.write(url) + print("[+] file written, let's read it") + f = open(urlpath,"r") + print(f.read()) + + +if __name__ == '__main__': + main()