mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 20:26:58 +00:00
fixed the print colors
This commit is contained in:
parent
0e0f1359b9
commit
e3a10675ef
5 changed files with 56 additions and 45 deletions
BIN
scripts/__pycache__/utils.cpython-311.pyc
Normal file
BIN
scripts/__pycache__/utils.cpython-311.pyc
Normal file
Binary file not shown.
|
@ -62,7 +62,7 @@ def main():
|
|||
print_colors("[+] Instance Name:",instance,IsOnionValid(instance))
|
||||
isitvalid="y"
|
||||
else:
|
||||
print_colors(f'[-] Invalid instance name in ~/.darknet_participant_url: {instance}',is_error=True )
|
||||
print_colors(f'[-] Invalid instance name in ~/.darknet_participant_url: {instance}' )
|
||||
return False
|
||||
else:
|
||||
print_colors("[+] Instance Path doesn't exist yet")
|
||||
|
@ -73,7 +73,7 @@ def main():
|
|||
if IsOnionValid(instance):
|
||||
print_colors("[+] Instance Name: ",instance,IsUrlValid(instance))
|
||||
else:
|
||||
print_colors(f'[-] Invalid instance name in ~/.darknet_participant_url: {instance}', is_error=True )
|
||||
print_colors(f'[-] Invalid instance name in ~/.darknet_participant_url: {instance}' )
|
||||
return False
|
||||
|
||||
|
||||
|
@ -122,11 +122,10 @@ def main():
|
|||
while True:
|
||||
print_colors("""
|
||||
|
||||
|
||||
|
||||
|
||||
[+] Welcome to your own Darknet Lantern Instance, where you can explore the Darknet and help others do the same.
|
||||
""",highlight=True)
|
||||
|
||||
print_colors("""
|
||||
Managing Websites:
|
||||
1) Add a new Website entry (into unverified.csv)
|
||||
2) Trust a Website entry (move an entry from unverified to verified.csv)
|
||||
|
@ -219,7 +218,7 @@ Maintenance:
|
|||
print_colors(filter_uvdf[['Name','URL']])
|
||||
# check if there are no results, dont proceed if there are none!
|
||||
if filter_uvdf.size == 0:
|
||||
print_colors("ERROR no results, skipping.",is_error=True)
|
||||
print_colors("ERROR no results, skipping.")
|
||||
else:
|
||||
# Each of the rows has an index,
|
||||
index=-1
|
||||
|
@ -261,7 +260,7 @@ Maintenance:
|
|||
print_colors(filter_vdf[['Name','URL']])
|
||||
# check if there are no results, dont proceed if there are none!
|
||||
if filter_vdf.size == 0:
|
||||
print_colors("ERROR no results, skipping.", is_error=True)
|
||||
print_colors("ERROR no results, skipping.")
|
||||
else:
|
||||
# Each of the rows has an index,
|
||||
index=-1
|
||||
|
@ -333,7 +332,7 @@ Maintenance:
|
|||
|
||||
# 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_colors("[-] Webring Participant isn't reachable, skipping", is_error=True)
|
||||
print_colors("[-] 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_colors("[+] Webring Participant is reachable, updating their csv files:")
|
||||
|
@ -453,7 +452,7 @@ 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)
|
||||
print_colors('[-] Skipping row as it is already added in', w, row, is_error=True )
|
||||
|
||||
|
||||
|
||||
|
@ -469,7 +468,7 @@ Maintenance:
|
|||
print_colors("Marking row", i,"as sensitive, as it matches with a sensitive word")
|
||||
csvdf.at[i, 'Sensitive']='✔️'
|
||||
|
||||
print_colors(f'[-] Rows to delete: {rows2delete}', is_error=True)
|
||||
print_colors(f'[-] Rows to delete: {rows2delete}')
|
||||
# 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()
|
||||
|
@ -497,7 +496,7 @@ Maintenance:
|
|||
#if not os.path.isdir(participantdir): # to test on your own instance
|
||||
if os.path.isdir(participantdir):
|
||||
# if it does, it means that the webring is ALREADY added
|
||||
print_colors("[-] Webring Participant is already listed, skipping.",is_error=True)
|
||||
print_colors("[-] Webring Participant is already listed, skipping.")
|
||||
return False
|
||||
else:
|
||||
# if not, then proceed:
|
||||
|
@ -517,7 +516,7 @@ Maintenance:
|
|||
|
||||
# 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_colors("[-] Webring Participant is invalid, exiting.",is_error=True)
|
||||
print_colors("[-] Webring Participant is invalid, exiting.")
|
||||
return False
|
||||
else:
|
||||
print_colors("[+] Webring Participant is valid, adding it.")
|
||||
|
@ -581,7 +580,7 @@ Maintenance:
|
|||
print_colors('[+] Banner is valid')
|
||||
else:
|
||||
# if false, overwrite it with the template banner png file
|
||||
print_colors('[-] Banner is not valid, replacing it with the default banner',is_error=True)
|
||||
print_colors('[-] Banner is not valid, replacing it with the default banner')
|
||||
os.remove(bannerpath)
|
||||
# copy templates/banner.png to bannerpath
|
||||
bannertemplatepath=templatepath+'banner.png'
|
||||
|
@ -629,7 +628,7 @@ Maintenance:
|
|||
print_colors("Marking row", i,"as sensitive, as it matches with a sensitive word")
|
||||
csvdf.at[i, 'Sensitive']='✔️'
|
||||
|
||||
print_colors(f'[-] Rows to delete: {rows2delete}',is_error=True)
|
||||
print_colors(f'[-] Rows to delete: {rows2delete}')
|
||||
|
||||
for i in rows2delete:
|
||||
row=csvdf.loc[i,:].values.tolist()
|
||||
|
@ -670,7 +669,7 @@ Maintenance:
|
|||
wdf.to_csv(webringcsvfile, index=False)
|
||||
|
||||
else:
|
||||
print_colors("[-] not trusting webring participant, skipping.", is_error=True)
|
||||
print_colors("[-] not trusting webring participant, skipping.")
|
||||
if choice == "2":
|
||||
print_colors("[+] UnTrusting webring participant", wdf.at[index,"URL"])
|
||||
wdf.at[index,"Trusted"]=''
|
||||
|
@ -824,7 +823,7 @@ Maintenance:
|
|||
sedf.to_csv(secsvfile, index=False)
|
||||
|
||||
else:
|
||||
print_colors('[-] Error, invalid index', is_error=True)
|
||||
print_colors('[-] Error, invalid index')
|
||||
|
||||
|
||||
else:
|
||||
|
@ -883,7 +882,7 @@ Maintenance:
|
|||
bldf.to_csv(blcsvfile, index=False)
|
||||
|
||||
else:
|
||||
print_colors('[-] Error, invalid index',is_error=True)
|
||||
print_colors('[-] Error, invalid index')
|
||||
|
||||
|
||||
else:
|
||||
|
@ -973,7 +972,7 @@ Maintenance:
|
|||
# mark the sensitive rows as sensitive
|
||||
# delete the rows that match with blacklisted words
|
||||
case _:
|
||||
print_colors("[-] Exiting",is_error=True)
|
||||
print_colors("[-] Exiting")
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import re
|
||||
import os, pwd, re, pandas as pd, requests, shutil
|
||||
from PIL import Image
|
||||
import urllib
|
||||
import socks, socket, glob
|
||||
|
||||
PURPLE = '\033[35;40m'
|
||||
BOLD_PURPLE = '\033[35;40;1m'
|
||||
ORANGE = '\033[33;40;1m'
|
||||
RED = '\033[31;40m'
|
||||
BOLD_RED = '\033[31;40;1m'
|
||||
RESET = '\033[m'
|
||||
|
@ -242,18 +246,25 @@ def IsNameValid(name: str)->bool:
|
|||
|
||||
|
||||
|
||||
def print_colors(s:str, bold=False, is_error = False, default=False):
|
||||
"""
|
||||
Helper function to print with colors
|
||||
"""
|
||||
#def print_colors(s:str, bold=False, is_error = False, default=False):
|
||||
def print_colors(*args, bold=False, is_error=False, default=False, highlight=False):
|
||||
"""
|
||||
Helper function to print with colors
|
||||
"""
|
||||
for s in args:
|
||||
if is_error:
|
||||
print(f"{RED}{s}{RESET}")
|
||||
print(f"{RED}{s}{RESET}",end='')
|
||||
elif highlight:
|
||||
print(f"{ORANGE}{s}{RESET}",end='')
|
||||
elif bold:
|
||||
print(f"{BOLD_PURPLE}{s}{RESET}")
|
||||
print(f"{BOLD_PURPLE}{s}{RESET}",end='')
|
||||
elif is_error and bold:
|
||||
print(f"{BOLD_RED}{s}{RESET}")
|
||||
print(f"{BOLD_RED}{s}{RESET}",end='')
|
||||
elif default:
|
||||
print(f'{s}')
|
||||
print(f'{s}',end='')
|
||||
else:
|
||||
print(f"{PURPLE}{s}{RESET}")
|
||||
|
||||
print(f"{PURPLE}{s}{RESET}",end='')
|
||||
if s is args[-1]:
|
||||
print()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue