mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-07-02 03:36:41 +00:00
Compare commits
16 commits
0240c82df0
...
7059e50660
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7059e50660 | ||
![]() |
e60f7f7e78 | ||
![]() |
0cf9966611 | ||
![]() |
11c1a14266 | ||
![]() |
2d12280dc9 | ||
![]() |
d78ed2bc86 | ||
![]() |
3cb5af0f36 | ||
![]() |
19fa5fefcd | ||
![]() |
124421ed89 | ||
![]() |
bfd1c6ca7c | ||
![]() |
94fcec124b | ||
![]() |
50f6a637cd | ||
![]() |
bc4d6f3af0 | ||
![]() |
4d3fcff125 | ||
![]() |
b43da2d2df | ||
![]() |
7c144fec1d |
9 changed files with 115 additions and 45 deletions
|
@ -9,6 +9,7 @@ OFFICIAL_PARTICIPANTS_FILE = STATIC_PATH + '.official_participants'
|
||||||
WEBRING_CSV_FILE = 'webring-participants.csv'
|
WEBRING_CSV_FILE = 'webring-participants.csv'
|
||||||
|
|
||||||
LOCAL_DIR = '' # Assign on script startup
|
LOCAL_DIR = '' # Assign on script startup
|
||||||
|
LOCAL_INSTANCE = '' # Assign on script startup
|
||||||
|
|
||||||
PROXIES = {
|
PROXIES = {
|
||||||
'http': 'socks5h://127.0.0.1:9050',
|
'http': 'socks5h://127.0.0.1:9050',
|
||||||
|
|
|
@ -153,7 +153,7 @@ def main():
|
||||||
if 'Blacklisted' not in webpdf.columns:
|
if 'Blacklisted' not in webpdf.columns:
|
||||||
webpdf['Blacklisted'] = 'NO'
|
webpdf['Blacklisted'] = 'NO'
|
||||||
|
|
||||||
webpdf.to_csv(webpcsvfile)
|
save_dataframe(webpdf, webpcsvfile)
|
||||||
|
|
||||||
##### CHECK IF ARGUMENTS ARE PASSED TO ENTER PROMPT-LESS MODE #####
|
##### CHECK IF ARGUMENTS ARE PASSED TO ENTER PROMPT-LESS MODE #####
|
||||||
if len(sys.argv) == 2 and sys.argv[1] == "4":
|
if len(sys.argv) == 2 and sys.argv[1] == "4":
|
||||||
|
|
|
@ -69,6 +69,8 @@ def clean_csv(df, blacklist):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not df.empty:
|
if not df.empty:
|
||||||
|
df = utils.sort_instances(df, 'Instance', conf.LOCAL_INSTANCE)
|
||||||
|
|
||||||
df = utils.remove_duplications(df)
|
df = utils.remove_duplications(df)
|
||||||
|
|
||||||
df = df[~df.apply(lambda row: any(word in str(value) for word in blacklist for value in row), axis=1)]
|
df = df[~df.apply(lambda row: any(word in str(value) for word in blacklist for value in row), axis=1)]
|
||||||
|
|
|
@ -15,10 +15,8 @@ def run_option_4():
|
||||||
utils.print_colors("4) Synchronize new links from new or existing webring participants, into your local csv files")
|
utils.print_colors("4) Synchronize new links from new or existing webring participants, into your local csv files")
|
||||||
|
|
||||||
utils.print_colors('[+] Syncing official webrings to local webrings')
|
utils.print_colors('[+] Syncing official webrings to local webrings')
|
||||||
|
|
||||||
webring_df = utils.get_local_webring_participants()
|
|
||||||
|
|
||||||
current_instance = utils.get_current_instance()
|
webring_df = utils.get_local_webring_participants(conf.LOCAL_INSTANCE)
|
||||||
|
|
||||||
utils.print_colors('[+] Reading local blacklist and sensitive words')
|
utils.print_colors('[+] Reading local blacklist and sensitive words')
|
||||||
local_blacklist_df = utils.get_local_blacklist()
|
local_blacklist_df = utils.get_local_blacklist()
|
||||||
|
@ -27,13 +25,9 @@ def run_option_4():
|
||||||
utils.print_colors('[+] Reading local verified and unverified')
|
utils.print_colors('[+] Reading local verified and unverified')
|
||||||
local_verified_df, local_unverified_df = utils.get_local_verified_and_unverified()
|
local_verified_df, local_unverified_df = utils.get_local_verified_and_unverified()
|
||||||
|
|
||||||
#Remove all rows
|
|
||||||
local_unverified_df = local_unverified_df[0:0]
|
|
||||||
local_verified_df = local_verified_df[0:0]
|
|
||||||
|
|
||||||
for participant in webring_df.itertuples(index=False, name='columns'):
|
for participant in webring_df.itertuples(index=False, name='columns'):
|
||||||
# Check if the participant is my instance
|
# Check if the participant is my instance
|
||||||
if current_instance in participant:
|
if conf.LOCAL_INSTANCE in participant:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if participant.Blacklisted == 'YES':
|
if participant.Blacklisted == 'YES':
|
||||||
|
|
|
@ -36,7 +36,8 @@ def get_current_instance():
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
#Set the local dir on script run
|
#Set the local dir on script run
|
||||||
conf.LOCAL_DIR = conf.PARTICIPANT_DIR + get_current_instance() + '/'
|
conf.LOCAL_INSTANCE = get_current_instance()
|
||||||
|
conf.LOCAL_DIR = conf.PARTICIPANT_DIR + conf.LOCAL_INSTANCE + '/'
|
||||||
|
|
||||||
###################### Validations ######################
|
###################### Validations ######################
|
||||||
|
|
||||||
|
@ -305,6 +306,26 @@ def is_row_valid(row):
|
||||||
|
|
||||||
###################### General ######################
|
###################### General ######################
|
||||||
|
|
||||||
|
def renew_csv(df, participant_url):
|
||||||
|
"""
|
||||||
|
Removes all rows that are not generated by the local instance
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
df : pd.DataFrame
|
||||||
|
Dataframe we want to renew
|
||||||
|
participant_url : str
|
||||||
|
the instance url
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
--------
|
||||||
|
pd.DataFrame
|
||||||
|
The renewed dataframe
|
||||||
|
"""
|
||||||
|
|
||||||
|
return df[df['Instance'] == participant_url]
|
||||||
|
|
||||||
|
|
||||||
def merge_verification_df(receiving_df, merging_df):
|
def merge_verification_df(receiving_df, merging_df):
|
||||||
"""
|
"""
|
||||||
Merges 2 dataframes of type verified or unverified (do not merge duplications by name or url)
|
Merges 2 dataframes of type verified or unverified (do not merge duplications by name or url)
|
||||||
|
@ -336,6 +357,39 @@ def merge_verification_df(receiving_df, merging_df):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
return receiving_df
|
return receiving_df
|
||||||
|
|
||||||
|
def sort_instances(df, sort_by, preferred=None):
|
||||||
|
"""
|
||||||
|
Sorts dataframe
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
df : pd.DataFrame
|
||||||
|
The dataframe to sort
|
||||||
|
sort_by : str
|
||||||
|
The column to sort by
|
||||||
|
preferred(optional) : str
|
||||||
|
the preferred value is if i want the column to be sorted with a preferred value at the start of the dataframe
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
pd.DataFrame
|
||||||
|
The sorted dataframe
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
if preferred:
|
||||||
|
df['priority'] = (df[sort_by] == preferred).astype(int)
|
||||||
|
df = df.sort_values(by=['priority', sort_by], ascending=[False, True]).drop(columns='priority')
|
||||||
|
|
||||||
|
else:
|
||||||
|
df = df.sort_values(by=sort_by)
|
||||||
|
|
||||||
|
except Exception as err:
|
||||||
|
print_colors('[-] Sorting failed',is_error=True)
|
||||||
|
|
||||||
|
return df
|
||||||
|
|
||||||
def remove_duplications(df):
|
def remove_duplications(df):
|
||||||
"""
|
"""
|
||||||
Remove url and name duplications from the dataframe
|
Remove url and name duplications from the dataframe
|
||||||
|
@ -350,9 +404,10 @@ def remove_duplications(df):
|
||||||
pd.DataFrame
|
pd.DataFrame
|
||||||
The dataframe after all duplications were removed
|
The dataframe after all duplications were removed
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
df = df.drop_duplicates(subset='Name')
|
df = df.drop_duplicates(subset='Name', keep='first')
|
||||||
df = df.drop_duplicates(subset='URL')
|
df = df.drop_duplicates(subset='URL', keep='first')
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print_colors('[-] Removing duplication failed',is_error=True)
|
print_colors('[-] Removing duplication failed',is_error=True)
|
||||||
|
@ -684,10 +739,8 @@ def get_official_participants():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
current_instance = get_current_instance()
|
|
||||||
|
|
||||||
with open(conf.OFFICIAL_PARTICIPANTS_FILE, 'r') as file:
|
with open(conf.OFFICIAL_PARTICIPANTS_FILE, 'r') as file:
|
||||||
return [line.strip() for line in file if current_instance not in line]
|
return [line.strip() for line in file if conf.LOCAL_INSTANCE not in line]
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print_colors('[-] Couldn\'t read official webring participants file',is_error=True )
|
print_colors('[-] Couldn\'t read official webring participants file',is_error=True )
|
||||||
|
@ -775,10 +828,15 @@ def get_local_verified_and_unverified():
|
||||||
|
|
||||||
return pd.DataFrame(), pd.DataFrame()
|
return pd.DataFrame(), pd.DataFrame()
|
||||||
|
|
||||||
def get_local_webring_participants():
|
def get_local_webring_participants(current_instance):
|
||||||
"""
|
"""
|
||||||
Make sure the official participants are registered in the webring csv file
|
Make sure the official participants are registered in the webring csv file
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
current_instance : str
|
||||||
|
The current local instance url
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
pd.DataFrame
|
pd.DataFrame
|
||||||
|
@ -792,7 +850,9 @@ def get_local_webring_participants():
|
||||||
missing_participants = set(get_official_participants()) - set(webring_df['URL'])
|
missing_participants = set(get_official_participants()) - set(webring_df['URL'])
|
||||||
|
|
||||||
for participant in missing_participants:
|
for participant in missing_participants:
|
||||||
new_row = [{'Name': '','URL': participant,'Description': '','Trusted': 'NO','Status': '','Score': ''}]
|
if participant == current_instance:
|
||||||
|
continue
|
||||||
|
new_row = [{'Name': '','URL': participant,'Description': '','Trusted': 'NO','Status': '','Score': '', 'Blacklisted': 'NO'}]
|
||||||
webring_df = pd.concat([webring_df, pd.DataFrame(new_row)], ignore_index=True)
|
webring_df = pd.concat([webring_df, pd.DataFrame(new_row)], ignore_index=True)
|
||||||
|
|
||||||
save_dataframe(webring_df, conf.LOCAL_DIR + conf.WEBRING_CSV_FILE)
|
save_dataframe(webring_df, conf.LOCAL_DIR + conf.WEBRING_CSV_FILE)
|
||||||
|
|
|
@ -181,7 +181,7 @@ function DisplayCategories($instancename, $path) {
|
||||||
|
|
||||||
if (strtolower($oldcatname) != strtolower($data[1])){
|
if (strtolower($oldcatname) != strtolower($data[1])){
|
||||||
|
|
||||||
echo '<a class="cata ' . ($classmap[strtolower($data[1])] ?? '') . '" href="index.php?query=' . $data[1] . '">' . '<img class="caticon" src="img/' . ($logomap[strtolower($data[1])] ?? 'empty.png') . '"></img>'. $data[1] . '</a> ';
|
echo '<a class="cata ' . ($classmap[strtolower($data[1])] ?? '') . '" href="index.php?query=' . $data[1] . '&sensitive=1">' . '<img class="caticon" src="img/' . ($logomap[strtolower($data[1])] ?? 'empty.png') . '"></img>'. $data[1] . '</a> ';
|
||||||
$oldcatname = strtolower($data[1]);
|
$oldcatname = strtolower($data[1]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -203,8 +203,6 @@ function DisplayCategories($instancename, $path) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</br>
|
</br>
|
||||||
<h1><a href="http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern"><img src="img/lantern project large.png" class="projectbanner"></a></h1>
|
<h1><a href="http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern"><img src="img/lantern project large.png" class="projectbanner"></a></h1>
|
||||||
<p><u>Update Frequency:</u> every 3 hours</p> </br>
|
<p><u>Update Frequency:</u> every 3 hours</p> </br>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<div class="width-class">
|
<div class="width-class">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
require("header.php");
|
require("header.php");
|
||||||
$min_length = 1;
|
$min_length = 1;
|
||||||
$max_length = 32;
|
$max_length = 32;
|
||||||
|
@ -31,12 +32,12 @@ require("header.php");
|
||||||
$verifiedcsvpath="participants/" . $instance . '/verified.csv';
|
$verifiedcsvpath="participants/" . $instance . '/verified.csv';
|
||||||
$unverifiedcsvpath="participants/" . $instance . '/unverified.csv';
|
$unverifiedcsvpath="participants/" . $instance . '/unverified.csv';
|
||||||
|
|
||||||
// check if the verified and unverified csv files have links in them or not:
|
// check if the verified and unverified csv files have links in them or not:
|
||||||
$lines_uv = count(file($unverifiedcsvpath));
|
$lines_uv = count(file($unverifiedcsvpath));
|
||||||
$lines_v = count(file($verifiedcsvpath));
|
$lines_v = count(file($verifiedcsvpath));
|
||||||
//echo "<p>CSV LINES: " . $lines_uv . " " . $lines_v . "</p>";
|
//echo "<p>CSV LINES: " . $lines_uv . " " . $lines_v . "</p>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form action="index.php" method="GET">
|
<form action="index.php" method="GET">
|
||||||
<input type="text" name="query" />
|
<input type="text" name="query" />
|
||||||
<input type="submit" value="Search" /> </br>
|
<input type="submit" value="Search" /> </br>
|
||||||
|
@ -99,6 +100,7 @@ require("header.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<center><a href="submit.php">Submit a new link</a></center>
|
<center><a href="submit.php">Submit a new link</a></center>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -325,3 +325,10 @@ img{
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
.submission-status-success{
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submission-status-error{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
$submission_message = null; // Initialize the variable
|
||||||
|
$status_class = null;
|
||||||
if (isset($_POST['submit'])){
|
if (isset($_POST['submit'])){
|
||||||
// Link checks
|
// Link checks
|
||||||
$link = str_replace(['<','>'],'', $_POST['link']);
|
$link = str_replace(['<','>'],'', $_POST['link']);
|
||||||
// Clear user input
|
// Clear user input
|
||||||
$link = htmlspecialchars($link);
|
$link = htmlspecialchars($link);
|
||||||
$name = htmlspecialchars($_POST['name']);
|
$name = htmlspecialchars($_POST['name']);
|
||||||
$description = htmlspecialchars($_POST['description']);
|
$description = htmlspecialchars($_POST['description']);
|
||||||
|
@ -12,33 +14,36 @@ if (isset($_POST['submit'])){
|
||||||
$captcha = htmlspecialchars($_POST['captcha']);
|
$captcha = htmlspecialchars($_POST['captcha']);
|
||||||
// Captcha Auth check
|
// Captcha Auth check
|
||||||
if ($captcha != htmlspecialchars($_SESSION['secure'])){
|
if ($captcha != htmlspecialchars($_SESSION['secure'])){
|
||||||
echo "Captcha Failed";
|
$submission_message = "Error: Captcha Failed";
|
||||||
}else{
|
} else {
|
||||||
if (empty($link) or empty($name) or empty($description)){
|
if (empty($link) or empty($name) or empty($description)){
|
||||||
echo "All of the fields must not be empty";
|
$submission_message = "Error: All of the fields must not be empty";
|
||||||
}else{
|
} else {
|
||||||
if (strlen($link) > 512 or strlen($name) > 64 or strlen($description) > 256 or strlen($sensitive) > 1 or strlen($category) > 64){
|
if (strlen($link) > 512 or strlen($name) > 64 or strlen($description) > 256 or strlen($sensitive) > 1 or strlen($category) > 64){
|
||||||
echo "Don't excede the limit";
|
$submission_message = "Error: Don't exceed the limit";
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
// Open the file once before the loop
|
// Open the file once before the loop
|
||||||
$file = fopen("../submissions/submission.csv", "a");
|
$file = fopen("../submissions/submission.csv", "a");
|
||||||
|
|
||||||
if ($file !== false) {
|
if ($file !== false) {
|
||||||
// Create an array with the inputs to write as a single row
|
// Create an array with the inputs to write as a single row
|
||||||
$row = [$link, $name,$description,$category,$sensitive];
|
$row = [$link, $name,$description,$category,$sensitive];
|
||||||
|
|
||||||
// Write the row to the CSV file
|
// Write the row to the CSV file
|
||||||
fputcsv($file, $row, ',', '"');
|
fputcsv($file, $row, ',', '"');
|
||||||
|
|
||||||
// Close the file after writing
|
// Close the file after writing
|
||||||
fclose($file);
|
fclose($file);
|
||||||
} else {
|
} else {
|
||||||
// Handle error opening the file
|
// Handle error opening the file
|
||||||
error_log("Error opening the file.");
|
error_log("Error opening the file.");
|
||||||
}
|
}
|
||||||
echo "Link Successfully Submitted";
|
|
||||||
}
|
if ($submission_message === null) { // Only set success message if no error occurred
|
||||||
|
$submission_message = "Link Successfully Submitted";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +73,7 @@ if (isset($_POST['submit'])){
|
||||||
<html>
|
<html>
|
||||||
<?php include("header.php");?>
|
<?php include("header.php");?>
|
||||||
<div class="width-class">
|
<div class="width-class">
|
||||||
|
<h3 class="<?php echo str_contains($submission_message, 'Error') ? 'submission-status-error' : 'submission-status-success' ?>"> <?php echo $submission_message ?> </h3>
|
||||||
<center>
|
<center>
|
||||||
<h1>Character Limits</h1>
|
<h1>Character Limits</h1>
|
||||||
<p>Link should be 354</p>
|
<p>Link should be 354</p>
|
||||||
|
@ -90,7 +96,7 @@ if (isset($_POST['submit'])){
|
||||||
<label style="color:white">Captcha</label>
|
<label style="color:white">Captcha</label>
|
||||||
<div>
|
<div>
|
||||||
<img src="generate.php">
|
<img src="generate.php">
|
||||||
<input type="text" name="captcha">
|
<input required type="text" name="captcha">
|
||||||
<input type="submit" value="submit" name="submit" />
|
<input type="submit" value="submit" name="submit" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue