mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 20:26:58 +00:00
fixed the synchronization feature
This commit is contained in:
parent
dc5a91c561
commit
49e39f481c
3 changed files with 162 additions and 90 deletions
|
@ -259,11 +259,74 @@ Maintenance:
|
|||
for participant in os.listdir(participantsdir):
|
||||
participantdir=participantsdir+participant
|
||||
#print(participant)
|
||||
# TODO check if the webring participant is yourself, if it is, then skip it
|
||||
|
||||
# NOTE check if the webring participant is yourself, if it is, then skip it
|
||||
if participant != myinstance: # prod: dont use your own intance
|
||||
#if participant == myinstance: # preprod testing only on your own instance
|
||||
#TODO overwrite the existing files in the participant's directory, with their version (download all the csv files from them again)
|
||||
basewurl='http://'+participant+'/participants/'+participant+'/'
|
||||
print(basewurl)
|
||||
print('[+] Downloading the files of ',participant, ": ")
|
||||
w_vcsv=basewurl+'verified.csv'
|
||||
w_uvcsv=basewurl+'unverified.csv'
|
||||
#print(CheckUrl(w_uvcsv))
|
||||
w_blcsv=basewurl+'blacklist.csv'
|
||||
#print(CheckUrl(w_blcsv))
|
||||
w_scsv=basewurl+'sensitive.csv'
|
||||
#print(CheckUrl(w_scsv))
|
||||
w_webcsv=basewurl+'webring-participants.csv'
|
||||
#print(CheckUrl(w_webcsv))
|
||||
|
||||
# verify that their verified.csv csv file exists at basewurl+'verified.csv'
|
||||
if CheckUrl(w_vcsv) is False or CheckUrl(w_uvcsv) is False or CheckUrl(w_blcsv) is False or CheckUrl(w_scsv) is False or CheckUrl(w_webcsv) is False:
|
||||
print("[-] Webring Participant isn't reachable, skipping")
|
||||
#return False #dont do anything if the webring participant isnt reachable.
|
||||
else: #if the webring participant is reachable, proceed
|
||||
print("[+] Webring Participant is reachable, updating their csv files:")
|
||||
for i in ['verified.csv','unverified.csv','blacklist.csv','sensitive.csv','webring-participants.csv']:
|
||||
# FOR EACH CSV FILE TO GET:
|
||||
# URL: basewurl / FILE.CSV
|
||||
# PATH: participantdir / FILE.CSV
|
||||
#print('[+] DOWNLOADING ',basewurl+i)
|
||||
# download the external csv file and save it into the "text" variable:
|
||||
#response = urllib.request.urlopen(basewurl+i)
|
||||
response = requests.get(basewurl+i, proxies=proxies)
|
||||
#data = response.read() # a `bytes` object
|
||||
#text = data.decode('utf-8')
|
||||
text = response.text
|
||||
# save the text variable into the destination file:
|
||||
#print('[+] SAVING IT INTO ',participantdir+'/'+i)
|
||||
csvfilepath=participantdir+'/'+i
|
||||
with open(csvfilepath, "w") as file:
|
||||
file.write(text)
|
||||
#print("[+] file written, let's read it")
|
||||
f = open(csvfilepath,"r")
|
||||
#print(f.read())
|
||||
|
||||
# download the banner.png image:
|
||||
|
||||
bannerurl=basewurl+'banner.png'
|
||||
bannerpath=participantdir+'/banner.png'
|
||||
r = requests.get(bannerurl, stream=True, proxies=proxies)
|
||||
with open(bannerpath, 'wb') as f:
|
||||
r.raw.decode_content = True
|
||||
shutil.copyfileobj(r.raw, f)
|
||||
|
||||
# SANITY CHECK ON THE BANNER PNG IMAGE:
|
||||
if IsBannerValid(bannerpath):
|
||||
#print('[+] Banner is valid')
|
||||
pass
|
||||
else:
|
||||
# if false, overwrite it with the template banner png file
|
||||
#print('[-] Banner is not valid, replacing it with the default banner')
|
||||
os.remove(bannerpath)
|
||||
# copy templates/banner.png to bannerpath
|
||||
bannertemplatepath=templatepath+'banner.png'
|
||||
shutil.copyfile(bannertemplatepath, bannerpath)
|
||||
|
||||
|
||||
#print("[+] Webring Participant is valid, adding it if it's not already added.")
|
||||
print('[+] PARTICIPANT=',participant)
|
||||
#print('[+] PARTICIPANT=',participant)
|
||||
# check if the participant is already listed in webring-participants.csv or not, and add them if not already listed
|
||||
# and display only the matching entries in unverified.csv in an array format (display it in CLI).
|
||||
filter_wdf = wdf[wdf.URL.str.contains(participant)]
|
||||
|
@ -275,10 +338,11 @@ Maintenance:
|
|||
wdf.loc[-1] = newrow # adding a row
|
||||
wdf.index = wdf.index + 1 # shifting index
|
||||
wdf = wdf.sort_index() # sorting by index
|
||||
print("[+] New row added! now writing the csv file:",webringcsvfile)
|
||||
#print("[+] New row added! now writing the csv file:",webringcsvfile)
|
||||
wdf.to_csv(webringcsvfile, index=False)
|
||||
else:
|
||||
print('[+] Webring participant is already listed in your own webring-participants.csv file!')
|
||||
pass
|
||||
#print('[+] Webring participant is already listed in your own webring-participants.csv file!')
|
||||
|
||||
# iterate through the participant's verified.csv and unverified.csv files
|
||||
for w in ['verified.csv','unverified.csv']:
|
||||
|
@ -682,18 +746,18 @@ def CheckUrl(url):
|
|||
}
|
||||
try:
|
||||
status = requests.get(url,proxies=proxies, timeout=5).status_code
|
||||
print('[+]',url,status)
|
||||
#print('[+]',url,status)
|
||||
if status != 502:
|
||||
print(url,"✔️")
|
||||
#print(url,"✔️")
|
||||
return True
|
||||
else:
|
||||
print(url,"❌")
|
||||
#print(url,"❌")
|
||||
return False
|
||||
except requests.ConnectionError as e:
|
||||
print(url,"❌")
|
||||
#print(url,"❌")
|
||||
return False
|
||||
except requests.exceptions.ReadTimeout as e:
|
||||
print(url,"❌")
|
||||
#print(url,"❌")
|
||||
return False
|
||||
|
||||
#### PROTECTIONS AGAINST MALICIOUS CSV INPUTS ####
|
||||
|
@ -825,6 +889,10 @@ def IsScoreValid(score:str)->bool:
|
|||
pattern = re.compile("^[0-9.,]+$")
|
||||
score = str(score)
|
||||
score.strip()
|
||||
#pattern = ['','nan']
|
||||
if score in ['','nan']:
|
||||
#Score can be empty when initially added
|
||||
return True
|
||||
if pattern.fullmatch(score) is None:
|
||||
# empty description is fine as it's optional
|
||||
return False
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
Instance,Category,Name,URL,Sensitive,Description,Status,Score
|
||||
webring.nowhevi57f4lxxd6db43miewcsgtovakbh6v5f52ci7csc2yjzy5rnid.onion,Forums,Hackliberty Forum,http://yw7nc56v4nsudvwewhmhhwltxpncedfuc43qbubj4nmwhdhwtiu4o6yd.onion/,,,,
|
||||
webring.nowhevi57f4lxxd6db43miewcsgtovakbh6v5f52ci7csc2yjzy5rnid.onion,Communities,Hackliberty main website,http://kj3wvs3wyfhm3uhhuqxlrhhcp6dneuau4mmvptlor27ghmrqx63fqnid.onion/,,,,
|
||||
webring.nowhevi57f4lxxd6db43miewcsgtovakbh6v5f52ci7csc2yjzy5rnid.onion,Hackliberty,Hackliberty Gitea,http://vkp7367tcjpqdwwckigrdrvmwvispvbpg5rlsr2chjxvppfg7hipagyd.onion,,,,
|
||||
uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion,Infos and Links,Tor Taxi,http://tortaxi2dev6xjwbaydqzla77rrnth7yn2oqzjfmiuwn5h6vsk2a4syd.onion/,,List of links to go to popular darknet places,✔️,100.0
|
||||
uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion,Infos and Links,Tor Taxi,http://tortaxi2dev6xjwbaydqzla77rrnth7yn2oqzjfmiuwn5h6vsk2a4syd.onion/,,List of links to go to popular darknet places,✔️,100.0
|
||||
uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion,Infos and Links,Tor Taxi,http://tortaxi2dev6xjwbaydqzla77rrnth7yn2oqzjfmiuwn5h6vsk2a4syd.onion/,,List of links to go to popular darknet places,✔️,100.0
|
||||
|
|
|
|
@ -1,4 +1,5 @@
|
|||
Name,URL,Description,Trusted,Status,Score
|
||||
,webring.nowhevi57f4lxxd6db43miewcsgtovakbh6v5f52ci7csc2yjzy5rnid.onion,,,,
|
||||
,uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion,,,,
|
||||
Nowhere,uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion,,,,
|
||||
Nowhere,uptime.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion,,,,
|
||||
|
|
|
Loading…
Add table
Add a link
Reference in a new issue