diff --git a/hiddeneye_reborn/__init__.py b/hiddeneye_reborn/__init__.py index a6286be..4e42978 100644 --- a/hiddeneye_reborn/__init__.py +++ b/hiddeneye_reborn/__init__.py @@ -1,2 +1,2 @@ # TODO Write DocString -__version__ = "0.1.3" +__version__ = "0.2.0" diff --git a/hiddeneye_reborn/hiddeneye.py b/hiddeneye_reborn/hiddeneye.py index 24180e7..059178f 100755 --- a/hiddeneye_reborn/hiddeneye.py +++ b/hiddeneye_reborn/hiddeneye.py @@ -3,6 +3,8 @@ from .core.text_interface.main import args from .network.verification import verify_connection +from .network.server import WebServer + from rich.traceback import install LOGGING_LEVEL = logging.DEBUG @@ -31,6 +33,10 @@ def run_app(): initialize_app() configure_and_log_app() + # testing stuff: + server = WebServer(port=8080, host="localhost") + server.serve(directory="hiddeneye_reborn/public") + if __name__ == "__main__": run_app() \ No newline at end of file diff --git a/hiddeneye_reborn/network/server.py b/hiddeneye_reborn/network/server.py new file mode 100644 index 0000000..0159da0 --- /dev/null +++ b/hiddeneye_reborn/network/server.py @@ -0,0 +1,35 @@ +import os +import http.server +import socketserver +from threading import Thread + + +class WebServer: + def __init__(self, port: int = 8080, host: str = "localhost"): + self.port = port + self.host = host + self.server = None + self.thread = None + self.directory = None + + def start(self): + if not self.server: + os.chdir(self.directory) + handler = http.server.SimpleHTTPRequestHandler + self.server = socketserver.TCPServer((self.host, self.port), handler) + self.thread = Thread(target=self.server.serve_forever) + self.thread.start() + else: + print('Server already started') + + def stop(self): + if self.server: + self.server.shutdown() + self.server = None + self.thread = None + else: + print('No server to stop') + + def serve(self, directory: str): + self.directory = directory + self.start() \ No newline at end of file diff --git a/hiddeneye_reborn/templating/__init__.py b/hiddeneye_reborn/public/__init__.py similarity index 100% rename from hiddeneye_reborn/templating/__init__.py rename to hiddeneye_reborn/public/__init__.py diff --git a/hiddeneye_reborn/public/index.html b/hiddeneye_reborn/public/index.html new file mode 100644 index 0000000..e3b4615 --- /dev/null +++ b/hiddeneye_reborn/public/index.html @@ -0,0 +1,15 @@ + + + + + Simple Web Server + + +

Simple Web Server

+

This is a simple web server.

+ +

Additional content:

+

Welcome to our web page. It is designed to provide a simple and smooth experience.

+

Feel free to explore and let us know if you need any assistance.

+ + \ No newline at end of file diff --git a/hiddeneye_reborn/templating/template_mirrors/github.txt.example b/hiddeneye_reborn/templating/template_mirrors/github.txt.example deleted file mode 100644 index f2a8f26..0000000 --- a/hiddeneye_reborn/templating/template_mirrors/github.txt.example +++ /dev/null @@ -1,20 +0,0 @@ -# This is an example of template_mirrors file -TEMPLATE: Github -0.0.1 - https://example.com/github001.zip -0.2.1 - https://example.com/github021.zip -3.0.1 - https://example.com/github301.zip - -TEMPLATE: Gmail -0.3.1 - https://example.com/gmail031.zip -2.2.8 - https://example.com/gmail228.zip -3.6.9 - https://example.com/gmail369.zip - -# You can also specify multiple sources for the same version of file and it will try to use all of those sources together, example: - -TEMPLATE: Facebook -9.3.2 - https://example.com/facebook932.zip -9.3.2 - https://not-an-example.com/facebook932.zip -9.3.2 - https://just-whatever.com/facebook932.zip -1.5.8 - http://bruh-bruh.red/whatever/lol/facebook1.5.8.zip - -# Link doesn't have to contain archive name but ARCHIVE NAME SHOULD FOLLOW CONVENTION - template_nameVERSIONWITHOUTDOTS.zip or hashes will be wrong! diff --git a/hiddeneye_reborn/web_templates/__init__.py b/hiddeneye_reborn/web_templates/__init__.py new file mode 100644 index 0000000..e69de29