def space_code_provision(self, new_space_code): r = """/vb.htm?IntelligentInfo={"version":1.1,"method":"get","devicetype":1}""" for host in self.ssh.hosts: data = HttpUtil.httpget(host[0], r) json = data.split(" ")[-1] print("get intelligentinfo = %s" % json) output = re.sub(""""pointcode":"[0-9]*""", '''"pointcode":"''' + new_space_code, json) newdata = "/vb.htm?language=ie&IntelligentInfo=" + urllib.parse.quote(output) HttpUtil.httpget(host[0], newdata)
def install_openvpn(self, client_key, client_crt, firmware=''): if firmware == '': self.upgrade('openvpn_patch_20160426113637_A1.bin') else: self.upgrade('openvpn_patch_20160426113637_A1.bin') self.ssh.do_scp_put(client_key, '/opt/ipnc/openvpn/client.key') self.ssh.do_scp_put(client_crt, '/opt/ipnc/openvpn/client.crt') for host in self.ssh.hosts: HttpUtil.httpget(host[0], '/cgi-bin/net_adv.cgi?openvpn_enable=1')
def install_openvpn(self, client_key, client_crt, firmware=""): if firmware == "": self.upgrade("openvpn_patch_20160426113637_A1.bin") else: self.upgrade("openvpn_patch_20160426113637_A1.bin") self.ssh.do_scp_put(client_key, "/opt/ipnc/openvpn/client.key") self.ssh.do_scp_put(client_crt, "/opt/ipnc/openvpn/client.crt") for host in self.ssh.hosts: HttpUtil.httpget(host[0], "/cgi-bin/net_adv.cgi?openvpn_enable=1")
def space_code_provision(self, new_space_code): r = '''/vb.htm?IntelligentInfo={"version":1.1,"method":"get","devicetype":1}''' for host in self.ssh.hosts: data = HttpUtil.httpget(host[0], r) json = data.split(' ')[-1] print('get intelligentinfo = %s' % json) output = re.sub('''"pointcode":"[0-9]*''', '''"pointcode":"''' + new_space_code, json) newdata = '/vb.htm?language=ie&IntelligentInfo=' + urllib.parse.quote( output) HttpUtil.httpget(host[0], newdata)