commit 4c25dec8acddbf9f3eb58474e8dbc56649f1b473 Author: Cinabre Date: Tue Dec 15 12:41:11 2020 +0100 new file: Beaches/auverp new file: Beaches/mkinrs new file: Cities/flshra new file: Cities/jtiomq new file: Mountains/noftaz new file: download.py new file: extensions_changer.py new file: links.txt new file: login.py new file: server.py new file: upload.py diff --git a/Beaches/auverp b/Beaches/auverp new file mode 100644 index 0000000..ca1312b Binary files /dev/null and b/Beaches/auverp differ diff --git a/Beaches/mkinrs b/Beaches/mkinrs new file mode 100644 index 0000000..a6f5e09 Binary files /dev/null and b/Beaches/mkinrs differ diff --git a/Cities/flshra b/Cities/flshra new file mode 100644 index 0000000..39a2cb5 Binary files /dev/null and b/Cities/flshra differ diff --git a/Cities/jtiomq b/Cities/jtiomq new file mode 100644 index 0000000..47259c4 Binary files /dev/null and b/Cities/jtiomq differ diff --git a/Mountains/noftaz b/Mountains/noftaz new file mode 100644 index 0000000..c02c90d Binary files /dev/null and b/Mountains/noftaz differ diff --git a/download.py b/download.py new file mode 100644 index 0000000..3f7cd7f --- /dev/null +++ b/download.py @@ -0,0 +1,59 @@ +# coding: utf-8 + +import cgi +import cgitb; cgitb.enable() +import glob +import random +import string +import requests +form = cgi.FieldStorage() + +def get_random_string(length): + letters = string.ascii_lowercase + result_str = ''.join(random.choice(letters) for i in range(length)) + return result_str + +header = """ + + + + Download the image + + +""" + +link = form.getvalue("link") +choice = form.getvalue("choice") +print(header) + +if link is not None : + print("""

Add an image

""") + print(" Adding the image ") + + path = str(choice) + '/' + get_random_string(6) + print("

Generating a unique URL...

") + with open("links.txt", "a") as myfile: + myfile.write(choice + " - " + path + " - " + link + "\n") + + if True: + print("

Valid URL, ready for download!

") + r = requests.get(link, allow_redirects=True) + print("

" + r.headers.get('content-type') + "

") + header = r.headers.get('content-type') + header = header.split("/") + print("

File identification : " + header[0] + "

") + if header[0] == "image": + print("

Downloading...

") + open(path, 'wb').write(r.content) + print("""
+

Done !

+
""") + print("" % path) + else : + print("""
+

Echec !

+
""") + + +else : + print("Echec") diff --git a/extensions_changer.py b/extensions_changer.py new file mode 100644 index 0000000..889c8c7 --- /dev/null +++ b/extensions_changer.py @@ -0,0 +1,17 @@ +import os +import glob +import random +import string + +def get_random_string(length): + letters = string.ascii_lowercase + result_str = ''.join(random.choice(letters) for i in range(length)) + return result_str + +file = glob.glob("*") + +for i in range(len(file)): + if file[i] != "extensions.py" : + cmd = "mv " + file[i] + " " + get_random_string(6) + print(cmd) + os.system(cmd) diff --git a/links.txt b/links.txt new file mode 100644 index 0000000..e69de29 diff --git a/login.py b/login.py new file mode 100644 index 0000000..bf15ce4 --- /dev/null +++ b/login.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +import cgi +import cgitb; cgitb.enable() +import glob +form = cgi.FieldStorage() +print("Content-type: text/html; charset=utf-8\n") + +header = """ + + + + Simple Image Uploader + + + +""" + +print(header) + +password = form.getvalue("password") +choix = form.getvalue("choice") + +if str(password) == "TheBidouilleur" and choix is None: + print("""

Choix du choice

""") + print("""

Choisissez un choice

""") + Choix = """ + Choix des photos +
+ +
+ +
""" + print(Choix) + +elif str(password) != "TheBidouilleur" and password is not None and choix is None : + print("""

Connexion

""") + print("""
+

Bad password !

+
+ """) + formulaire = """
+

Log in to access the page

+
+ +
+ +
+
""" + print(formulaire) +elif choix is None : + print("""

Connexion

""") + formulaire ="""
+

Log in to access the page

+
+ +
+ +
+
""" + print(formulaire) + +if choix is not None : + if choix == "Beaches": + print("""

Beaches

""") + file = glob.glob("Beaches/*") + if choix == "Cities": + print("""

Cities

""") + file = glob.glob("Cities/*") + if choix == "Skies": + print("""

Skies

""") + file = glob.glob("Skies/*") + if choix == "Mountains": + print("""

Mountains

""") + file = glob.glob("Mountains/*") + + print("
") + for i in range(len(file)): + print("") + + +end = """ + + + """ + +print(end) diff --git a/server.py b/server.py new file mode 100644 index 0000000..d284708 --- /dev/null +++ b/server.py @@ -0,0 +1,13 @@ +import http.server +from discord_webhook import DiscordWebhook + +PORT = 80 +server_address = ("", PORT + +server = http.server.HTTPServer +handler = http.server.CGIHTTPRequestHandler +handler.cgi_directories = ["/"] +print("Used port :", PORT) + +httpd = server(server_address, handler) +httpd.serve_forever() diff --git a/upload.py b/upload.py new file mode 100644 index 0000000..9694fc5 --- /dev/null +++ b/upload.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +import cgi +import cgitb; cgitb.enable() +import glob +form = cgi.FieldStorage() + +header = """ + + + + Envoyer une image + + +""" + +print(header) +password = form.getvalue("password") +link = form.getvalue("link") +choice = form.getvalue("choice") + +if link is not None : + print("""

Confirmation

""") + print("""

Do you want to add this image to the """ + str(form.getvalue("choice")) + """ folder ?



""" ) + print("") + formulaire = """
""" + formulaire += "

Link

" + formulaire += """ Send a picture """) + formulaire =""" +

Login

+
+ +
+ +
+
""" + print(formulaire) + + if str(password) == "TheBidouilleur" and link is None: + print("""

Choose the folder

""") + print("""

Please choose a folder

""") + choice = """ + choice des photos +
+ +
+ +
+ +
""" + print(choice) + + elif str(password) != "TheBidouilleur" and password is not None and link is None: + print("""

Connexion

""") + print("""
+

Mauvais MDP !

+
+ """) + + formulaire ="""
+

Please enter password

+
+ +
+ +
+
""" + print(formulaire) + +end = """ + + + """ + +print(end)