mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 20:26:58 +00:00
bring support for simplex links now
This commit is contained in:
parent
35b90d927f
commit
6de26c5fa5
6 changed files with 95 additions and 9 deletions
BIN
SimpleX/__pycache__/utils.cpython-311.pyc
Normal file
BIN
SimpleX/__pycache__/utils.cpython-311.pyc
Normal file
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
import re
|
import re
|
||||||
from SimpleX.utils import IsUrlValid
|
from utils import IsUrlValid
|
||||||
import urllib.parse
|
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
|
#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.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 = '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 = '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))
|
print(IsSimpleXChatroomValid(link))
|
||||||
|
|
|
@ -211,7 +211,7 @@ Maintenance:
|
||||||
category = input("What is the website Category? ")
|
category = input("What is the website Category? ")
|
||||||
# the url of the website (required) + check if its valid
|
# the url of the website (required) + check if its valid
|
||||||
url=''
|
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 ? ")
|
url=input("What is the website URL ? ")
|
||||||
|
|
||||||
# a quick description (optional) + check if its valid
|
# a quick description (optional) + check if its valid
|
||||||
|
@ -412,7 +412,7 @@ Maintenance:
|
||||||
case 3:
|
case 3:
|
||||||
# ask the user to select between 1) verified.csv and 2) unverified.csv
|
# ask the user to select between 1) verified.csv and 2) unverified.csv
|
||||||
while True:
|
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())
|
choice = int(input("Do you want to edit link attributes in 1) verified.csv or 2) unverified.csv ? (-1 to exit)").strip())
|
||||||
index=-1
|
index=-1
|
||||||
name=''
|
name=''
|
||||||
|
@ -460,7 +460,7 @@ Maintenance:
|
||||||
value = input("What is the description of the website ? ")
|
value = input("What is the description of the website ? ")
|
||||||
vdf.at[index,'Description']=value
|
vdf.at[index,'Description']=value
|
||||||
value=''
|
value=''
|
||||||
print(newrow)
|
print(vdf.iloc[index].values)
|
||||||
print("[+] overwriting existing row with new values:")
|
print("[+] overwriting existing row with new values:")
|
||||||
vdf.to_csv(verifiedcsvfile, index=False)
|
vdf.to_csv(verifiedcsvfile, index=False)
|
||||||
break
|
break
|
||||||
|
|
|
@ -2,6 +2,9 @@ import re
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
#from SimpleX.utils import IsUrlValid
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
|
|
||||||
PURPLE = '\033[35;40m'
|
PURPLE = '\033[35;40m'
|
||||||
BOLD_PURPLE = '\033[35;40;1m'
|
BOLD_PURPLE = '\033[35;40;1m'
|
||||||
|
@ -90,16 +93,59 @@ def IsOnionValid(url: str)-> bool:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False
|
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:
|
def IsUrlValid(url:str)->bool:
|
||||||
"""
|
"""
|
||||||
Check if url is valid both dark net end clearnet.
|
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)
|
url = str(url)
|
||||||
if len(url) < 4:
|
if len(url) < 4:
|
||||||
return False
|
return False
|
||||||
if url.endswith('.onion'):
|
if onion_pattern.match(url) is not None:
|
||||||
return IsOnionValid(url)
|
return IsOnionValid(url)
|
||||||
else:
|
else:
|
||||||
if not url.__contains__('.'):
|
if not url.__contains__('.'):
|
||||||
|
@ -109,6 +155,24 @@ def IsUrlValid(url:str)->bool:
|
||||||
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:/.-]+$")
|
||||||
|
# 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:
|
def IsStatusValid(status: str)-> bool:
|
||||||
"""
|
"""
|
||||||
Checks if status contains only ['YES','NO']. Verbose only if False is returned
|
Checks if status contains only ['YES','NO']. Verbose only if False is returned
|
||||||
|
|
|
@ -69,8 +69,13 @@ if (!preg_match("~^(?:f|ht)tps?://~i", $data[3])) {
|
||||||
echo "<td><p>" . ' </p></td>'; // category is already displayed so skip it (empty cell in category column)
|
echo "<td><p>" . ' </p></td>'; // category is already displayed so skip it (empty cell in category column)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<td class="linktitle"><p class="linktitle">' ; // begin the table cell of link title
|
echo '<td class="linktitle"><p class="linktitle">' ; // begin the table cell of link title
|
||||||
if($data[4] == "YES"){
|
if(str_contains(strtolower($data[1]),'monero' )){
|
||||||
|
echo '<a class="xmr" href="'; // begin a href
|
||||||
|
}elseif(str_contains(strtolower($data[1]),'simplex' )){
|
||||||
|
echo '<a class="sxc" href="'; // begin a href
|
||||||
|
}elseif($data[4] == "YES"){
|
||||||
echo '<a class="sensitivelink" href="'; // begin a href
|
echo '<a class="sensitivelink" href="'; // begin a href
|
||||||
}else{
|
}else{
|
||||||
echo '<a href="'; // begin a href
|
echo '<a href="'; // begin a href
|
||||||
|
@ -167,9 +172,17 @@ if (($handle = fopen($csvfile, "r")) !== FALSE) {
|
||||||
if ( $c == "1" ){
|
if ( $c == "1" ){
|
||||||
|
|
||||||
if (strtolower($oldcatname) != strtolower($data[1])){
|
if (strtolower($oldcatname) != strtolower($data[1])){
|
||||||
|
if( str_contains(strtolower($data[1]),'monero' )){
|
||||||
|
echo '<a class="xmr" href="index.php?query=' . $data[1] . '">' . $data[1] . '</a> | '; // display the category as its the first row with this new category
|
||||||
|
$oldcatname=$data[1];
|
||||||
|
}elseif( str_contains(strtolower($data[1]),'simplex' )){
|
||||||
|
echo '<a class="sxc" href="index.php?query=' . $data[1] . '">' . $data[1] . '</a> | '; // display the category as its the first row with this new category
|
||||||
|
$oldcatname=$data[1];
|
||||||
|
}else{
|
||||||
echo '<a href="index.php?query=' . $data[1] . '">' . $data[1] . '</a> | '; // display the category as its the first row with this new category
|
echo '<a href="index.php?query=' . $data[1] . '">' . $data[1] . '</a> | '; // display the category as its the first row with this new category
|
||||||
$oldcatname=$data[1];
|
$oldcatname=$data[1];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.sensitivelink{
|
.sensitivelink{
|
||||||
color: #fc6e02;
|
color: #f43602;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xmr{
|
||||||
|
color: #fcab0a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sxc{
|
||||||
|
color: #0ab7fc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,7 +237,7 @@ h1,h2,h3,p,td{
|
||||||
}
|
}
|
||||||
|
|
||||||
.category{
|
.category{
|
||||||
max-width: 80px;
|
max-width: 90px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
.linktitle{
|
.linktitle{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue