updated dockerfile + option 2 and 3 merging is WIP

This commit is contained in:
root 2025-02-24 08:55:49 +01:00
parent b772fc454d
commit 97fcc4c8c4
3 changed files with 117 additions and 86 deletions

View file

@ -25,7 +25,6 @@ RUN set -ex && \
# Stage 2: Final runtime image.
FROM debian:bookworm-slim
LABEL maintainer="you@example.com"
ENV DEBIAN_FRONTEND=noninteractive
# Note: Do not hard-code INSTANCE_DOMAIN here.
@ -60,9 +59,9 @@ RUN ln -sf /etc/nginx/sites-available/lantern.conf /etc/nginx/sites-enabled/ &&
# Create cron job file using a heredoc to avoid quoting issues.
RUN cat <<'EOF' > /etc/cron.d/lantern-jobs
# Update repo daily at 2:00 AM
0 2 * * * root cd /srv/darknet-lantern && git pull origin master >> /var/log/lantern_git_update.log 2>&1
# Run lantern.py every 3 hours, piping "4\n" as input
0 */3 * * * root sh -c "printf '4\n' | python3 /srv/darknet-lantern/scripts/lantern.py"
0 2 * * * root sh -c "cd /srv/darknet-lantern && git -c http.proxy=socks5://127.0.0.1:9050 pull origin main" >> /var/log/lantern_git_update.log 2>&
# Run lantern.py every 3 hours, piping "4\n" as input to sync links coming from other webring participants
0 */3 * * * root python3 /srv/darknet-lantern/scripts/lantern.py 4
# Run uptimechecker.py every 3 hours
0 */3 * * * root python3 /srv/darknet-lantern/scripts/uptimechecker.py >> /var/log/uptimechecker.log 2>&1
EOF

View file

@ -116,19 +116,18 @@ V1.0.1:
- py: since .gitignore makes it so that www/participants doesnt exist, automatically create the directory structure from www/.official_participants
- git: figured out how to have an automatically updated lantern instance via gitignore+cronjob
V1.0.2:
V1.0.2: (WIP)
- php+css : make the css styling not ugly on mobile
- py: make sure that running option 4 automatically creates the folder for a new official webring participant and downloads the files all the same, instead of just iterating through the folders.
- py: check that banners are at the most 5MB big
- py : if an argument is passed to lantern.py, enter automation mode, and at least automate option 4, 9 and 10 (ex: python3 lantern.py 4)
- py: in option 1, upon listing new links, if the description isn't empty, consider the link as trusted, and write it verified.csv. If description is empty, write it in unverified.csv instead.
```
Future Versions:
```
V1.0.2:
- py: in option 1, upon listing new links, if the description isn't empty, consider the link as trusted, and write it verified.csv. If description is empty, write it in unverified.csv instead.
- py: in option 2, upon trusting links, if description doesnt exist, ask the user to write one that isn't empty, and if it does exist, ask the user to press enter to keep the existing description, otherwise write a new one
- py: merge the option 2 and 3 together, and repurpose option 3 to become "edit links attributes"
V1.0.2: (WIP)
- py: merge the option 2 and 3 together to become "Trust/Untrust/Blacklist a website entry", and repurpose option 3 to become "edit existing links attributes"
- py: option 4: at the end of the synchronization phase, iterate over (your own) unverified links that do NOT have a description, and find the first description in other participants' verified.csv file to put in there, to enrich your unverified list (and skip if nobody wrote a description for it)
V1.0.3:

View file

@ -146,14 +146,13 @@ def main():
print("Perform sanity checks on all csv files for all instances")
option=10
else:
time.sleep(1.5)
print_colors("""
[+] Welcome to your own Darknet Lantern Instance, where you can explore the Darknet and help others do the same.
Managing Websites:
1) Add a new Website entry (into unverified.csv)
2) Trust a Website entry (move an entry from unverified to verified.csv)
3) Untrust a Website entry (move an entry from unverified to verified.csv)
2) Trust/Untrust/ Blacklist(WIP) a Website entry (move an entry from unverified to verified.csv)
3) Edit link attributes (WIP)
Managing Webring Participants:
4) Synchronize new links from existing webring participants, into your unverified.csv file
@ -202,7 +201,7 @@ Maintenance:
# a quick description (optional) + check if its valid
desc='DEFAULT'
while(IsDescriptionValid(desc) is not True):
desc=input("Description for the website ? (Optional) ")
desc=input("Description for the website ? (if not empty = the link will be added to verified.csv directly ) ")
choice=input("Is the website sensitive ? (ex: related to drugs) (y/n) ")
if choice == "n":
sensi = 'NO'
@ -214,12 +213,23 @@ Maintenance:
# (rest is automatic: status, score, instance is = '' because it is your own instance)
# TODO check if the entry doesnt already exist in verified.csv and in unverified.csv
# if it doesnt exist, add it into unverified.csv
if desc == '': # if the description is empty = it means that it goes in unverified.csv
print("Adding new row in unverified.csv since description is empty")
uvdf.loc[-1] = newrow # adding a row
uvdf.index = uvdf.index + 1 # shifting index
uvdf = uvdf.sort_index() # sorting by index
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
print_colors("[+] New row added! now writing the csv file")
uvdf.to_csv(unverifiedcsvfile, index=False)
else: # if the description isnt empty = it means that it goes in verified.csv
print("Adding new row in verified.csv since description is not empty")
vdf.loc[-1] = newrow # adding a row
vdf.index = vdf.index + 1 # shifting index
vdf = vdf.sort_index() # sorting by index
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
print_colors("[+] New row added! now writing the csv file")
vdf.to_csv(verifiedcsvfile, index=False)
choice=input("\n[+] Want to add another website ? (y/n) ")
if choice == "n":
break
@ -227,17 +237,23 @@ Maintenance:
case 2:
print_colors("[+] Trust a Website entry (move an entry from unverified to verified.csv)")
print_colors("[+] Trust/Untrust/Blacklist a Website entry (move an entry from unverified to verified.csv)")
while True:
vdf = pd.read_csv(verifiedcsvfile)
uvdf = pd.read_csv(unverifiedcsvfile)
# search for a word
print_colors(f"{uvdf[['Name','URL']]}")
name=''
#ask the user if they want to 1) trust, 2) untrust 3) blacklist the selected website
choice = int(input("Do you want to 1) Trust, 2) UnTrust, or 3) Blacklist an existing entry ?").strip())
while True:
match choice:
case 1:
print_colors(f"{uvdf[['Name','URL']]}")
while(IsNameValid(name) is not True):
name = input("What is the Website name you want to trust ? (ex: Nowhere)")
name = input("What is the Website name you want to Trust ? (ex: Nowhere)")
filter_uvdf = uvdf[uvdf.Name.str.contains(name)]
# NOTE and display only the matching entries in unverified.csv in an array format (display it in CLI).
# display only the matching entries in unverified.csv in an array format (display it in CLI).
print_colors(f"{filter_uvdf[['Name','URL']]}")
# check if there are no results, dont proceed if there are none!
if filter_uvdf.size == 0:
@ -246,68 +262,85 @@ Maintenance:
# Each of the rows has an index,
index=-1
while (index not in filter_uvdf.index):
index = int(input("What is the index of the entry that you want to move to verified.csv ? (ex: 3) "))
index = int(input("What is the index of the entry that you want to move to Trust ? (ex: 3) "))
# once selected, it must be able to SAVE and print_colors that row:
print_colors(f"{uvdf.iloc[index].values}")
newrow=uvdf.iloc[index].values
# 1) Trust an existing website (move it from unverified.csv to verified.csv)
newrow=uvdf.iloc[index].values
newdesc=""
#while the description is empty, keep looping
while(newdesc == "" or (IsDescriptionValid(newdesc) is not True)):
newdesc=input("Description for the website ? (it cannot be empty, for the link to be added in verified.csv): ")
# append it into verified.csv
vdf.loc[-1] = newrow # adding a row
vdf.at[-1, 'Description']=newdesc
vdf.index = vdf.index + 1 # shifting index
vdf = vdf.sort_index() # sxorting by index
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] New row added to verified.csv! now writing to the csv")
# remove it from unverified.csv
uvdf.drop(index, inplace= True)
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
uvdf.to_csv(unverifiedcsvfile, index=False)
print_colors("[+] Link is now moved to verified.csv!")
choice=input("\n[+] Want to trust another website ? (y/n) ")
break
case 2:
print_colors(f"{vdf[['Name','URL']]}")
while(IsNameValid(name) is not True):
name = input("What is the Website name you want to Untrust ? (ex: BreachForums)")
filter_vdf = vdf[vdf.Name.str.contains(name)]
# display only the matching entries in unverified.csv in an array format (display it in CLI).
print_colors(f"{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)
else:
# Each of the rows has an index,
index=-1
while (index not in filter_vdf.index):
index = int(input("What is the index of the entry that you want to move to Untrust ? (ex: 3) "))
# once selected, it must be able to SAVE and print_colors that row:
print_colors(f"{uvdf.iloc[index].values}")
# 1) Untrust an existing website (move it from verified.csv to unverified.csv)
newrow=vdf.iloc[index].values
# append it into unverified.csv
uvdf.loc[-1] = newrow # adding a row
uvdf.index = uvdf.index + 1 # shifting index
uvdf = uvdf.sort_index() # sxorting by index
uvdf = uvdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
uvdf.to_csv(unverifiedcsvfile, index=False)
print_colors("[+] New row added to unverified.csv! now writing to the csv")
# remove it from verified.csv
vdf.drop(index, inplace= True)
vdf = vdf.sort_values(by=["Category","Score"], ascending=[True,False]) # sorting categories
vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] Link is now moved to unverified.csv!")
break
case 3:
#TODO: 3) Blacklist an existing website
print_colors("[+] Blacklisting link!")
while(IsNameValid(name) is not True):
name = input("What is the Website name you want to Blacklist ? (ex: BreachForums)")
filter_uvdf = uvdf[uvdf.Name.str.contains(name)]
filter_vdf = vdf[vdf.Name.str.contains(name)]
#TODO: put the URL of the website in your blacklist.csv file
#TODO: drop the rows that contain that URL in your verified.csv and unverified.csv
break
choice=input("\n[+] Want to Trust/Untrust/Blacklist another existing entry ? (y/n) ")
if choice == "n":
break
break
case 3:
print_colors("[+] Untrust a Website entry (move an entry from verified to unverified.csv)")
vdf = pd.read_csv(verifiedcsvfile)
uvdf = pd.read_csv(unverifiedcsvfile)
print_colors(f"{vdf[['Name','URL']]}")
# search for a word
name=''
while(IsNameValid(name) is not True):
name = input("What is the Website name you want to untrust? (ex: BreachForums)")
filter_vdf = vdf[vdf.Name.str.contains(name)]
# and display only the matching entries in unverified.csv in an array format (display it in CLI).
print_colors(f"{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)
else:
# Each of the rows has an index,
index=-1
while (index not in filter_vdf.index):
index = int(input("What is the index of the entry that you want to move to unverified.csv ? (ex: 3) "))
# once selected, it must be able to SAVE and print_colors that row:
print_colors(vdf.iloc[index].values)
newrow=vdf.iloc[index].values
# append it into unverified.csv
uvdf.loc[-1] = newrow # adding a row
uvdf.index = uvdf.index + 1 # shifting index
uvdf = uvdf.sort_index() # sorting by index
uvdf.to_csv(unverifiedcsvfile, index=False)
print_colors("[+] New row added to unverified.csv!")
# remove it from verified.csv
vdf.drop(index, inplace= True)
vdf.to_csv(verifiedcsvfile, index=False)
print_colors("[+] Link is now moved to unverified.csv!")
# TODO change it to "edit link attributes"
print_colors("[+] Edit link attributes (WIP)")
break