diff --git a/SimpleX/__pycache__/utils.cpython-311.pyc b/SimpleX/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..965119d Binary files /dev/null and b/SimpleX/__pycache__/utils.cpython-311.pyc differ diff --git a/SimpleX/regex_simplexlinks.py b/SimpleX/regex_simplexlinks.py index 67247b2..dd09f59 100644 --- a/SimpleX/regex_simplexlinks.py +++ b/SimpleX/regex_simplexlinks.py @@ -1,5 +1,5 @@ import re -from SimpleX.utils import IsUrlValid +from utils import IsUrlValid import urllib.parse #simplex:/contact#/?v=2-7&smp=smp%3A%2F%2FBD4qkVq8lJUgjHt0kUaxeQBYsKaxDejeecxm6-2vOwI%3D%40 b6geeakpwskovltbesvy3b6ah3ewxfmnhnshojndmpp7wcv2df7bnead.onion %2FOReK0M4-3C5NeZyQx_yFuTHSknVVS-3h%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEANi5VHx-Q1mIKmgZEg2ls47NGSlntttvcgLLbfKBpym4%253D&data=%7B%22groupLinkId%22%3A%22ndniy85i4DjITgVhB-MXnQ%3D%3D%22%7D @@ -128,4 +128,5 @@ if __name__ == '__main__': #link = 'https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2Fhpq7_4gGJiilmz5Rf-CswuU5kZGkm_zOIooSw6yALRg%3D%40smp5.simplex.im%2F2KNui9H8xxaPTuHAsQzJlfLmz_SOMsFk%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEA8BPETTg3ooyvQ1LiMGeCFbh2MeK9NyubT6NLE8EJzyA%253D%26srv%3Djjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%22wNDKKQR3EW8Y045FsVofSg%3D%3D%22%7D' #link = 'https://simplex.hackliberty.org/contact/#/?v=2-7&smp=smp%3A%2F%2Fhpq7_4gGJiilmz5Rf-CswuU5kZGkm_zOIooSw6yALRg%3D%40smp5.simplex.im%2F2KNui9H8xxaPTuHAsQzJlfLmz_SOMsFk%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEA8BPETTg3ooyvQ1LiMGeCFbh2MeK9NyubT6NLE8EJzyA%253D%26srv%3Djjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%22wNDKKQR3EW8Y045FsVofSg%3D%3D%22%7D' #link = 'http://b6geeakpwskovltbesvy3b6ah3ewxfmnhnshojndmpp7wcv2df7bnead.onion/contact/#/?v=2-7&smp=smp%3A%2F%2Fhpq7_4gGJiilmz5Rf-CswuU5kZGkm_zOIooSw6yALRg%3D%40smp5.simplex.im%2F2KNui9H8xxaPTuHAsQzJlfLmz_SOMsFk%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEA8BPETTg3ooyvQ1LiMGeCFbh2MeK9NyubT6NLE8EJzyA%253D%26srv%3Djjbyvoemxysm7qxap7m5d5m35jzv5qq6gnlv7s4rsn7tdwwmuqciwpid.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%22wNDKKQR3EW8Y045FsVofSg%3D%3D%22%7D' + link = 'https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2F9u8jZd9XK7B_jSBYgA3Dz1r1AMxAPgdgnwdHMO_v2FA%3D%40dghh7wjyjrectfblqnyuy4mbshrybvlvnc5d5if5uyaceogtiiq5fnyd.onion%3A5323%2F60QZxNoVdYuN0rtbAGdxU41dyHCIMrId%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEAs0m-mZlZxDhgNuiCU9JCSGIusbbraab7szGSMxS7ikY%253D&data=%7B%22groupLinkId%22%3A%22PfpAPeihagUZdHGvAKENIQ%3D%3D%22%7D' print(IsSimpleXChatroomValid(link)) diff --git a/scripts/lantern.py b/scripts/lantern.py index e080413..19c9cfb 100644 --- a/scripts/lantern.py +++ b/scripts/lantern.py @@ -211,7 +211,7 @@ Maintenance: category = input("What is the website Category? ") # the url of the website (required) + check if its valid url='' - while(IsUrlValid(url) is not True): + while(IsUrlValid(url) is not True and IsSimpleXChatroomValid(url) is not True): url=input("What is the website URL ? ") # a quick description (optional) + check if its valid @@ -412,7 +412,7 @@ Maintenance: case 3: # ask the user to select between 1) verified.csv and 2) unverified.csv while True: - print_colors("[+] Edit link attributes (WIP)") + print_colors("[+] Edit link attributes") choice = int(input("Do you want to edit link attributes in 1) verified.csv or 2) unverified.csv ? (-1 to exit)").strip()) index=-1 name='' @@ -460,7 +460,7 @@ Maintenance: value = input("What is the description of the website ? ") vdf.at[index,'Description']=value value='' - print(newrow) + print(vdf.iloc[index].values) print("[+] overwriting existing row with new values:") vdf.to_csv(verifiedcsvfile, index=False) break diff --git a/scripts/utils.py b/scripts/utils.py index 5099baf..391a464 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -2,6 +2,9 @@ import re import os import requests from PIL import Image +#from SimpleX.utils import IsUrlValid +import urllib.parse + PURPLE = '\033[35;40m' BOLD_PURPLE = '\033[35;40;1m' @@ -90,16 +93,59 @@ def IsOnionValid(url: str)-> bool: except Exception as e: return False +def IsSimpleXChatroomValid(url: str) -> bool: + """Validate the SimpleX chatroom URL.""" + REQUIRED_SUBSTRING = "#/?v=2-7&smp=smp%3A%2F" + + # Step 1: Check if it starts with http://, https://, or simplex:/ + if url.startswith(('http://', 'https://', 'simplex:/')): + # Step 1.5: If http:// or https://, check for valid clearnet or onion domain + if url.startswith(('http://', 'https://')) and not IsUrlValid(url): + return False + elif not url.startswith('simplex:/'): + return False # Must start with one of the valid protocols + + # Step 2: Check for the presence of the required substring + if REQUIRED_SUBSTRING not in url: + return False # Required substring not found + + # Step 3: Extract the part after "smp=smp%3A%2F" + smp_start = url.find("smp=smp%3A%2F") + if smp_start == -1: + return False # Required substring not found + + smp_start += len("smp=smp%3A%2F") + smp_end = url.find("&", smp_start) + if smp_end == -1: + smp_end = len(url) # Take until the end if no "&" is found + + smp_value = urllib.parse.unquote(url[smp_start:smp_end]) # Decode the URL-encoded string + + # Step 3.5: Check if the smp_value contains a valid hostname + if '@' not in smp_value: + return False # Must contain '@' to separate fingerprint and hostname + + fingerprint, hostname = smp_value.split('@', 1) + if not IsUrlValid(hostname): + return False # Invalid hostname + + # Step 4: Check for the presence of "%2F" in the original URL + if "%2F" not in url: + return False # Required substring not found + + # If all checks pass, return True + return True def IsUrlValid(url:str)->bool: """ Check if url is valid both dark net end clearnet. """ - pattern = re.compile("^[A-Za-z0-9:/.-]+$") + pattern = re.compile(r"^[A-Za-z0-9:/._%-=#?&@]+$") + onion_pattern = re.compile(r"^(\w+:)?(?://)?(\w+\.)?[a-z2-7]{56}\.onion") url = str(url) if len(url) < 4: return False - if url.endswith('.onion'): + if onion_pattern.match(url) is not None: return IsOnionValid(url) else: if not url.__contains__('.'): @@ -109,6 +155,24 @@ def IsUrlValid(url:str)->bool: return True +#def IsUrlValid(url:str)->bool: +# """ +# Check if url is valid both dark net end clearnet. +# """ +# pattern = re.compile("^[A-Za-z0-9:/.-]+$") +# url = str(url) +# if len(url) < 4: +# return False +# if url.endswith('.onion'): +# return IsOnionValid(url) +# else: +# if not url.__contains__('.'): +# return False +# if pattern.fullmatch(url) is None: +# return False +# return True + + def IsStatusValid(status: str)-> bool: """ Checks if status contains only ['YES','NO']. Verbose only if False is returned diff --git a/www/header.php b/www/header.php index 511c606..0e360fb 100644 --- a/www/header.php +++ b/www/header.php @@ -69,8 +69,13 @@ if (!preg_match("~^(?:f|ht)tps?://~i", $data[3])) { echo "
" . '
' ; // begin the table cell of link title - if($data[4] == "YES"){ + if(str_contains(strtolower($data[1]),'monero' )){ + echo '' . $data[1] . ' | '; // display the category as its the first row with this new category + $oldcatname=$data[1]; + }elseif( str_contains(strtolower($data[1]),'simplex' )){ + echo '' . $data[1] . ' | '; // display the category as its the first row with this new category + $oldcatname=$data[1]; + }else{ echo '' . $data[1] . ' | '; // display the category as its the first row with this new category $oldcatname=$data[1]; } + } } } } diff --git a/www/style.css b/www/style.css index ff7aafd..6c57a03 100644 --- a/www/style.css +++ b/www/style.css @@ -42,7 +42,15 @@ } .sensitivelink{ - color: #fc6e02; + color: #f43602; +} + +.xmr{ + color: #fcab0a; +} + +.sxc{ + color: #0ab7fc; } @@ -229,7 +237,7 @@ h1,h2,h3,p,td{ } .category{ - max-width: 80px; + max-width: 90px; word-wrap: break-word; } .linktitle{