mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 12:16:57 +00:00
no need for gifs support + fixed prints to be less verbose
This commit is contained in:
parent
d81173a488
commit
f74f7e33e9
2 changed files with 13 additions and 29 deletions
|
@ -392,7 +392,7 @@ Maintenance:
|
|||
rows2delete= [] # it is an empty list at first
|
||||
for i,j in csvdf.iterrows():
|
||||
row=csvdf.loc[i,:].values.tolist()
|
||||
print_colors(f"{row}")
|
||||
#print_colors(f"{row}")
|
||||
|
||||
|
||||
|
||||
|
@ -443,7 +443,8 @@ Maintenance:
|
|||
uvdf.to_csv(unverifiedcsvfile, index=False)
|
||||
print_colors("[+] New row added to your own unverified.csv file!")
|
||||
else:
|
||||
print_colors('[-] Skipping row as it is already added in {w} {row}',is_error=True)
|
||||
pass
|
||||
#print_colors(f'[-] Skipping row as it is already added in {w} {row}',is_error=True)
|
||||
|
||||
|
||||
|
||||
|
@ -455,10 +456,10 @@ Maintenance:
|
|||
seword=sedf.at[k, 'sensitive-words']
|
||||
if any(seword in str(x) for x in row) == True:
|
||||
if csvdf.at[i, 'Sensitive'] != 'NO':
|
||||
print_colors("Marking row", i,"as sensitive, as it matches with a sensitive word")
|
||||
print_colors(f"Marking row {i} as sensitive, as it matches with a sensitive word")
|
||||
csvdf.at[i, 'Sensitive']='YES'
|
||||
|
||||
print_colors(f'[-] Rows to delete: {rows2delete}', is_error=True)
|
||||
#print_colors(f'[-] Rows to delete: {rows2delete}', is_error=True)
|
||||
# only delete rows after you've gone through all the unverified.csv OR verified.csv rows'
|
||||
for i in rows2delete:
|
||||
row=csvdf.loc[i,:].values.tolist()
|
||||
|
@ -604,7 +605,7 @@ Maintenance:
|
|||
print_colors(f"Marking row {i} as sensitive, as it matches with a sensitive word")
|
||||
csvdf.at[i, 'Sensitive']='YES'
|
||||
|
||||
print_colors(f"[-] Rows to delete: {rows2delete}")
|
||||
#print_colors(f"[-] Rows to delete: {rows2delete}")
|
||||
|
||||
for i in rows2delete:
|
||||
row=csvdf.loc[i,:].values.tolist()
|
||||
|
@ -916,7 +917,7 @@ Maintenance:
|
|||
rows2delete= [] # it is an empty list at first
|
||||
for i,j in csvdf.iterrows():
|
||||
row=csvdf.loc[i,:].values.tolist()
|
||||
print_colors(f"{row}")
|
||||
#print_colors(f"{row}")
|
||||
|
||||
|
||||
|
||||
|
@ -940,7 +941,7 @@ Maintenance:
|
|||
if IsUrlValid(csvdf.at[i, 'Instance']) is False or IsCategoryValid(csvdf.at[i, 'Category']) is False or IsNameValid(csvdf.at[i, 'Name']) is False or IsUrlValid(csvdf.at[i, 'URL']) is False or IsStatusValid(csvdf.at[i, 'Sensitive']) is False or IsDescriptionValid(csvdf.at[i, 'Description']) is False or IsStatusValid(csvdf.at[i, 'Status']) is False or IsScoreValid(csvdf.at[i, 'Score']) is False:
|
||||
if i not in rows2delete:
|
||||
print_colors(f"Marking row {i} for deletion, as it has invalid inputs")
|
||||
print_colors(f"{row}")
|
||||
#print_colors(f"{row}")
|
||||
print(IsUrlValid(csvdf.at[i, 'Instance']), IsCategoryValid(csvdf.at[i, 'Category']), IsNameValid(csvdf.at[i, 'Name']), IsUrlValid(csvdf.at[i, 'URL']), IsStatusValid(csvdf.at[i, 'Sensitive']), IsDescriptionValid(csvdf.at[i, 'Description']), IsStatusValid(csvdf.at[i, 'Status']), IsScoreValid(csvdf.at[i, 'Score']))
|
||||
rows2delete.append(i)
|
||||
read=input("Continue?")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import re
|
||||
import os
|
||||
import requests
|
||||
from PIL import Image
|
||||
|
||||
|
@ -33,26 +34,6 @@ def CheckUrl(url):
|
|||
|
||||
|
||||
#### PROTECTIONS AGAINST MALICIOUS CSV INPUTS ####
|
||||
|
||||
def CheckBannerURL(path: str) -> str:
|
||||
"""
|
||||
In: http://participant.onion/participants/participant.onion/banner
|
||||
serves to know what the real banner type is, between png, jpg, jpeg and .gif
|
||||
Out: {png,jpg,jpeg,gif,NOBANNER}
|
||||
"""
|
||||
bannercounter=0
|
||||
# TODO: try to reach (using requests) the URL/banner.{png,jpg,jpeg,gif}
|
||||
# TODO: if any of them succeed,
|
||||
# TODO: Check if the banner file is valid using IsBannerValid()
|
||||
#TODO: if valid: return png/jpg/jpeg/gif
|
||||
#TODO: if invalid REMOVE the file, and keep going (worst case = return NOBANNER at the bottom)
|
||||
# TODO: if any of them fail, it should be able to continue
|
||||
# TODO: if one of them fail, it must keep going and just increment bannercounter once
|
||||
# TODO: if ALL of them fail, it must return NOBANNER
|
||||
#TODO in lantern.py: handle when it returns png,jpg,jpeg and gif
|
||||
#TODO in php: handle when it is not png, how to make sure it finds if its jpg,jpeg or gif
|
||||
#TODO in lantern.py: handle when it returns NOBANNER
|
||||
|
||||
def IsBannerValid(path: str) -> bool:
|
||||
"""
|
||||
Checks if the banner.png file has the correct dimensions (240x60)
|
||||
|
@ -66,8 +47,10 @@ def IsBannerValid(path: str) -> bool:
|
|||
if width != 240 or height != 60:
|
||||
print("INVALID BANNER DIMENSIONS, HEIGHT=",height," WIDTH=",width)
|
||||
return False
|
||||
# TODO:check the filesize, as you can have a gif that has
|
||||
# TODO: test it on all 4 filetypes with both correct and incorrect resolutions, and with a gif that has the correct resolutions but is more than 3mb
|
||||
filesizeMB=os.path.getsize(path)/1024/1024
|
||||
if filesizeMB > 5:
|
||||
print("Banner filesize too large (>5Mb): ",os.path.getsize(path)/1024/1024,"MB")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue