From c2d46da747c4901c7fd7821c0fde715dd6bbf3a1 Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Wed, 12 Mar 2025 08:07:18 -0600 Subject: Working on tv corner --- cgi-bin/blahaj_list.cgi | 123 ------------------------------------------------ 1 file changed, 123 deletions(-) delete mode 100755 cgi-bin/blahaj_list.cgi (limited to 'cgi-bin/blahaj_list.cgi') diff --git a/cgi-bin/blahaj_list.cgi b/cgi-bin/blahaj_list.cgi deleted file mode 100755 index e6bbc85..0000000 --- a/cgi-bin/blahaj_list.cgi +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python - -import cgi -import json - -from bs4 import BeautifulSoup - -# Worse code here. Prepare your eyes for this monster. -# Its almost as bad as programming anything in php or even worse javascript. - -print('Content-Type: text/html') - -# Mode for letting peope inject stuff. -form = cgi.FieldStorage() -unsafe_mode = form.getvalue("unsafe_mode") == "on" - -# Hehehe -def check_for_injection(value): - if bool(BeautifulSoup(value, "html.parser").find()) and not unsafe_mode: - return """ - This silly silly tried to hack this website lmao. - Click to see the website with the hack - """ - - return value - -def create_blahaj_tables(): - try: - tables_html = """ -

Blahaj list!!!!!

- - - - -
-

Submit yours here if you haven't already!

-

Back to blahaj room

-
-
- """ - - with open("blahaj_info.json", "r") as fp: - blahaj_list = json.load(fp) - - for blahaj in blahaj_list[::-1]: - current_table = """ - - - - - - - - -
- -

put_name_here

-

Date submitted: put_date_here

-
-

put_info_here

-
- """ - - current_table = current_table.replace("put_name_here", check_for_injection(blahaj["name"])) - current_table = current_table.replace("put_info_here", check_for_injection(blahaj["info"])) - current_table = current_table.replace("put_date_here", check_for_injection(blahaj["date"])) - - tables_html += current_table - - return tables_html - - except FileNotFoundError: # No blahaj's yet - return """ - - - - -
-

No blahaj's found ):

-

Yours could be first tho :3

-

Submit yours here

-
- """ - -html_text = """ - - - - - hehehe - - - - - -
- thing_to_replace -
- - - -""" - -tables = create_blahaj_tables() -html_text = html_text.replace("thing_to_replace", tables) - -print(html_text) -- cgit v1.2.3