mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-07-01 19:36:41 +00:00
small fixes (no protocol requirement for isonion, bool return types)
This commit is contained in:
parent
c9a2fbcfdd
commit
4f1e6dbbc8
2 changed files with 8 additions and 6 deletions
|
@ -244,7 +244,7 @@ Maintenance:
|
||||||
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
|
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
|
||||||
print_colors("[+] New row added! now writing the csv file")
|
print_colors("[+] New row added! now writing the csv file")
|
||||||
else:
|
else:
|
||||||
print("Adding new row in verified.csv since descriptioln is not empty")
|
print("Adding new row in verified.csv since description is not empty")
|
||||||
vdf.loc[-1] = newrow # adding a row
|
vdf.loc[-1] = newrow # adding a row
|
||||||
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
|
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
|
||||||
print_colors("[+] New row added! now writing the csv file")
|
print_colors("[+] New row added! now writing the csv file")
|
||||||
|
@ -652,8 +652,9 @@ Maintenance:
|
||||||
csvdf.at[i, 'Sensitive'] = "NO"
|
csvdf.at[i, 'Sensitive'] = "NO"
|
||||||
csvdf.to_csv(csvfilepath, index=False)
|
csvdf.to_csv(csvfilepath, index=False)
|
||||||
|
|
||||||
|
print('sync:::', csvdf.at[i, 'Instance'])
|
||||||
### SANITY CHECK 1: Mark all the rows that have incorrect formatting for deletion###
|
### SANITY CHECK 1: Mark all the rows that have incorrect formatting for deletion###
|
||||||
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 IsURLValid(str(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:
|
||||||
#mark the row for deletion as it has invalid inputs
|
#mark the row for deletion as it has invalid inputs
|
||||||
if i not in rows2delete:
|
if i not in rows2delete:
|
||||||
print_colors(f"Marking row {i} for deletion, as it has invalid inputs")
|
print_colors(f"Marking row {i} for deletion, as it has invalid inputs")
|
||||||
|
|
|
@ -25,8 +25,9 @@ CLEARNET_URL_PATTERN = re.compile(
|
||||||
)
|
)
|
||||||
|
|
||||||
# pattern for onion urls (56 bytes of base32 alphabet + .onion)
|
# pattern for onion urls (56 bytes of base32 alphabet + .onion)
|
||||||
|
# it works also without http(s)://, so just the hostname will also go through
|
||||||
ONION_URL_PATTERN = re.compile(
|
ONION_URL_PATTERN = re.compile(
|
||||||
r"^https?:\/\/([a-zA-Z0-9-]+\.)*[a-z2-7-]{56}\.onion[^\s]*$"
|
r"^(https?:\/\/)?([a-zA-Z0-9-]+\.)*[a-z2-7-]{56}\.onion[^\s]*$"
|
||||||
)
|
)
|
||||||
|
|
||||||
# pattern for simplex chatroom links
|
# pattern for simplex chatroom links
|
||||||
|
@ -49,7 +50,7 @@ def IsSimplexChatroomValid(url: str) -> bool:
|
||||||
Returns True if URL is a SimpleX chatroom,
|
Returns True if URL is a SimpleX chatroom,
|
||||||
False otherwise
|
False otherwise
|
||||||
"""
|
"""
|
||||||
return SIMPLEX_CHATROOM_PATTERN.match(url)
|
return bool(SIMPLEX_CHATROOM_PATTERN.match(url))
|
||||||
|
|
||||||
def RecognizeSimplexType(url: str) -> str:
|
def RecognizeSimplexType(url: str) -> str:
|
||||||
"""
|
"""
|
||||||
|
@ -82,14 +83,14 @@ def IsClearnetLinkValid(url: str) -> bool:
|
||||||
Returns True if URL is a valid clearnet URL
|
Returns True if URL is a valid clearnet URL
|
||||||
False otherwise
|
False otherwise
|
||||||
"""
|
"""
|
||||||
return CLEARNET_URL_PATTERN.match(url)
|
return bool(CLEARNET_URL_PATTERN.match(url))
|
||||||
|
|
||||||
def IsOnionLinkValid(url: str) -> bool:
|
def IsOnionLinkValid(url: str) -> bool:
|
||||||
"""
|
"""
|
||||||
Returns True if URL is a valid onion URL
|
Returns True if URL is a valid onion URL
|
||||||
False otherwise
|
False otherwise
|
||||||
"""
|
"""
|
||||||
return ONION_URL_PATTERN.match(url)
|
return bool(ONION_URL_PATTERN.match(url))
|
||||||
|
|
||||||
def RecognizeURLType(url: str) -> str:
|
def RecognizeURLType(url: str) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue