Dave-ee Jones Posted April 10, 2017 Share Posted April 10, 2017 (edited) Hey all, I've got a problem with my python server. The Bash Bunny doesn't want to handle it forever, so it seems to stop handling after about 5 seconds (or shutting it down, can't tell which). The exact same code works locally on my computer (python script that runs a simple SocketServer), and it runs forever (using httpd.serve_forever()), however the BB doesn't want to run it forever. Any ideas why the BB stops handling? EDIT: Just for those that are interested, the browser error says "Site cannot be reached; connection was reset (ERR_CONNECTION_RESET)". Edited April 10, 2017 by Dave-ee Jones Quote Link to comment Share on other sites More sharing options...
Sebkinne Posted April 10, 2017 Share Posted April 10, 2017 Without seeing what python code you are running, we can't really help you :) Quote Link to comment Share on other sites More sharing options...
Dave-ee Jones Posted April 10, 2017 Author Share Posted April 10, 2017 1 hour ago, Sebkinne said: Without seeing what python code you are running, we can't really help you :) Generic HTTPServer script (this is my SimpleHTTPServer version, CGI was basically the same except I added a cgi_directory). import etc, etc, etc. rootdir = os.getcwd() global bRunning bRunning = True class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): found_type = '' if self.path.endswith('/'): self.path = '/index.html' found_type = 'text/html' try: if self.path.endswith('.html'): found_type = 'text/html' if self.path.endswith('.css'): found_type = 'text/css' if self.path.endswith('.js'): found_type = 'application/javascript' if self.path.endswith('.php') or self.path.endswith('.txt') or self.path.endswith('.md'): found_type = 'text/plain' if found_type != '': self.send_response(200) self.send_header('Content-type',found_type) self.end_headers() f = open(rootdir + self.path,'r') self.wfile.write(f.read()) f.close() if found_type == 'text/html' and self.path.endswith('exit.html'): global bRunning bRunning = False return except IOError: self.send_error(404,'File not found: %s' % (rootdir + self.path)) def run(): httpd = SocketServer.TCPServer(('0.0.0.0',8080),http_handler) while bRunning: httpd.handle_request() run() Also, just to let you know, I'm playing around with PHP's in-built server and it isn't serving me well either (pun intended). Quote Link to comment Share on other sites More sharing options...
oXis Posted April 10, 2017 Share Posted April 10, 2017 I've been also working with a HTTP Python server with firmware 1.1 of the Bunny and I discovered that sometimes, when you reach the end of the payload, the server stop working. But it doesn't happen all the time, it's like the bunny kills the payload. If it happens, you can see the LED switched off. Put a "sleep 60" a the end of the payload and see if this is the same error. Quote Link to comment Share on other sites More sharing options...
Dave-ee Jones Posted April 11, 2017 Author Share Posted April 11, 2017 (edited) 14 hours ago, oXis said: I've been also working with a HTTP Python server with firmware 1.1 of the Bunny and I discovered that sometimes, when you reach the end of the payload, the server stop working. But it doesn't happen all the time, it's like the bunny kills the payload. If it happens, you can see the LED switched off. Put a "sleep 60" a the end of the payload and see if this is the same error. Yes, I noticed other people had issues with their payloads stopping. Apparently the bug came out with 1.1. Just confirming, you did say you would fix that in 1.2 correct, @Sebkinne? EDIT: Also, for some reason whenever my BB is in the RNDIS_ETHERNET attackmode, any requests I make to the internet (e.g. trying to access Google) fail. Meaning, the BB is apparently overriding everything, which means I cannot share internet between BB and computer. Waddaya think? Edited April 11, 2017 by Dave-ee Jones Quote Link to comment Share on other sites More sharing options...
qdba Posted April 11, 2017 Share Posted April 11, 2017 Look here Quote Link to comment Share on other sites More sharing options...
Dave-ee Jones Posted April 13, 2017 Author Share Posted April 13, 2017 On 4/11/2017 at 5:38 PM, qdba said: Look here Yes, that was what I was suspecting. Please, 1.2, come soon bb... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.