dockerproxy.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:dockerproxy 作者: mdsecresearch 项目源码 文件源码
def run_browser(self):
        configpath = expanduser("~/.dockerproxy.conf")
        logging.debug(configpath)
        if os.path.isfile(configpath):
            config = SafeConfigParser()
            config.read(configpath)
            httphandler = config.get('browser','httphandler')
            if "chrome" in httphandler:
                defaultbrowserpath = self.CHROMEPATH
            elif "firefox" in httphandler:
                defaultbrowserpath = self.FIREFOXPATH
            elif "safari" in httphandler:
                defaultbrowserpath = self.SAFARIPATH
            else:
                # *shrug* you're using something else
                defaultbrowserpath = self.SAFARIPATH

            #attempt to avoid cmd & arg injection
            defaultbrowserpath += " {}"
            cmd = shlex.split(defaultbrowserpath.format(pipes.quote(self.url)))

            if self.DEBUG:
                logging.debug("### Invoking: " + str(cmd))

            result = Popen(cmd, shell=False, env=self.ENVIRONMENT, stdin=None, stdout=None, stderr=None, close_fds=True, preexec_fn=os.setpgrp)
            # need to give the process a little time to load before exiting :)
            time.sleep(2)
            sys.exit(0)
        else:
            tkMessageBox.showinfo("Error", "Config file does not exist")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号