When I launch my module from the command-line (pthon3 -m labot.mitm.launch), it executes as expected (it's a bot for a game: it stays active in the background and listens to network packets). When I launch it from the debugger (see configuration below), it immediately terminates with the following output:
I put relevant files below, please let me know if anything else is needed.
If you want to try it yourself, the used code is at https://github.com/louisabraham/LaBot , feel free to clone and try it out (although it might take some setting up).
#!/usr/bin/env python3
from .proxy import startProxyServer
from .proxychains import launchDofus
# to interrupt : httpd.shutdown()
httpd = startProxyServer()
# you can launch several instances
# of dofus with the same httpd
# the bot will be launched after the connexion
dofus = launchDofus()
proxy.py :
from socketserver import ThreadingMixIn
from http.server import HTTPServer, BaseHTTPRequestHandler
import socket
from threading import Thread
from .bridge import Bridge, PrintingMsgBridgeHandler
connection_servers = ['213.248.126.39', '213.248.126.40']
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
debug = False
class ProxyRequestHandler(BaseHTTPRequestHandler):
def do_CONNECT(self):
address = self.path.split(':', 1)
address[1] = int(address[1]) or 443
try:
coServ = socket.create_connection(address, timeout=self.timeout)
except Exception as e:
self.send_error(502)
return
self.send_response(200, 'Connection Established')
self.end_headers()
# Here the main function is launched
Bridge(self.connection, coServ, PrintingMsgBridgeHandler).run()
# It MUST run in sync mode (not threaded)
# The bot will run in sync mode and will have a Bridge in async
# You can use the condition
# if address[0] not in connection_servers
# to start your bot only after the connexion
# VERY IMPORTANT
self.close_connection = True
def log_message(self, format, *args):
"""To avoid silly debug messages"""
if self.server.debug:
super().log_message(format, *args)
def startProxyServer(port=8000):
httpd = ThreadingHTTPServer(('localhost', port), ProxyRequestHandler)
Thread(None, httpd.serve_forever).start()
return httpd
Issue Type: Bug
When I launch my module from the command-line (
pthon3 -m labot.mitm.launch
), it executes as expected (it's a bot for a game: it stays active in the background and listens to network packets). When I launch it from the debugger (see configuration below), it immediately terminates with the following output:I put relevant files below, please let me know if anything else is needed. If you want to try it yourself, the used code is at https://github.com/louisabraham/LaBot , feel free to clone and try it out (although it might take some setting up).
Launch Configuration:
Relevant files:
labot.mitm.launch:
proxy.py :
proxychains.py:
VS Code version: Code 1.23.1 (d0182c3417d225529c6d5ad24b7572815d0de9ac, 2018-05-10T16:03:31.083Z) OS version: Darwin x64 17.5.0
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz (8 x 2600)| |GPU Status|2d_canvas: unavailable_softwareflash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: unavailable_software
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|2, 2, 2| |Memory (System)|16.00GB (0.37GB free)| |Process Argv|/Applications/Visual Studio Code.app/Contents/MacOS/Electron| |Screen Reader|no| |VM|0%|
Extensions (35)
Extension|Author (truncated)|Version ---|---|--- bracket-pair-colorizer|Coe|1.0.50 vscode-markdownlint|Dav|0.17.0 beautify|Hoo|1.3.0 quokka-vscode|Wal|1.0.124 html-css-class-completion|Zig|1.17.1 vscode-color|ans|0.4.5 vscode-nextgenas|bow|0.11.1 mapfile|chi|0.0.1 npm-intellisense|chr|1.3.0 path-intellisense|chr|1.4.2 gitignore|cod|0.5.0 vscode-eslint|dba|1.4.9 githistory|don|0.4.1 gitlens|eam|8.3.1 vscode-npm-script|eg2|0.3.4 json-tools|eri|1.0.2 semantic-data-model-language|fan|0.0.1 flow-for-vscode|flo|0.8.1 code-runner|for|0.9.3 sass-lint|gle|1.0.2 webpack|jer|2.0.2 intellij-idea-keybindings|k--|0.2.23 gitignore|mic|1.0.1 python|ms-|2018.4.0 debugger-for-chrome|msj|4.4.3 vscode-icons|rob|7.23.0 sass-indented|rob|1.4.9 bash-debug|rog|0.2.0 vscode-sass-format|sas|1.1.4 bash-beautify|sha|0.1.1 stylelint|shi|0.36.0 gitconfig|sid|1.0.1 open-in-browser|tec|1.1.0 shellcheck|tim|0.4.0 markdown-all-in-one|yzh|1.3.0