def post(self): extension = self.get_argument("extension") password = self.get_argument("password") if extension and password: ExtensionFileHandler(extension).set(**{"password": password}) common.shell('/usr/local/freeswitch/bin/fs_cli -x "reloadxml"')
def get_netinfo(self): addr = xhtml_escape(common.shell('ip addr')) routing = xhtml_escape('\n'.join(common.shell('route -n').split("\n")[1:])) ifaces = OutputFormatter.highlight(xhtml_escape(common.shell('mii-tool 2> /dev/null'))) lan = appconfig.get()['net'] sangoma = common.shell("wanrouter status") return {'addr': addr, 'routing': routing, 'lan': lan, 'ifaces': ifaces, 'sangoma': sangoma}
def get(self): # simply read monit if self.get_argument("action", None) is None: try: response = httpclient.HTTPClient().fetch("http://*****:*****@localhost:2812") response = BeautifulSoup(response.body) response = response('table')[-6:] self.render("monit.html", items=response) except: self.render("monit.html", items="<error/>") # reload monit configuration elif self.get_argument("action") == "reload": common.shell("monit reload all") # reboot machine elif self.get_argument("action") == "reboot": common.shell("reboot")
def post(self): exp = self.get_argument("exp", "false") input = self.get_argument("input", '') self.write(exp and common.shell(FS_CLI_COMMAND % ("regex %s|%s" % (input, exp))).strip())
def _get_pipe(self): # dirty way to kill previous tails common.shell("killall tcpdump") # write to file and console at the same time return self._spawn_process("tcpdump -s 0 -i eth1 -w - -U | tee /tmp/eth1.cap | tcpdump -xX -n -r -").stdout
def get(self): fd = common.shell('[ -e %s ] && cat %s || echo "file not found"' % (self.input_path, self.input_path)) self.set_header(*self.header_type); self.set_header('Content-disposition', 'attachment;filename=%s'% (self.output_name)) self.write(fd)
def post(self): command = self.get_argument("x", "sofia status profile internal") output = common.shell(FS_CLI_COMMAND % command) self.write("<pre>") self.write(xhtml_escape(output)) self.write("</pre>")