def execute(self): v = self.http.get("/header_name.shtml", eof_mark=b"</html>") v = strip_html_tags(v) platform = self.rx_html_platform.search(v) if not platform: platform = self.rx_html_platform2.search(v) v = self.http.get("/main.shtml", eof_mark=b"</html>") v = strip_html_tags(v) match = self.rx_html_ver.search(v) return { "vendor": "TFortis", "platform": platform.group("platform").strip(smart_text("\x00")), "version": match.group("version"), "attributes": {"Bootloader": match.group("bootloader")}, }
def execute(self): conf = self.http.get("/") conf = strip_html_tags(conf) conf = self.cleaned_config(conf) conf = conf.split("\n") config = [] for l in conf: match = self.rx_line.match(l) if not match: config.append(l) return "\n".join(config)
def execute(self): if self.access_profile.scheme == self.TELNET: v = self.cli("swversion show") platform, version = v.split() elif self.access_profile.scheme == self.HTTP: v = self.http.get("/info.html") v = strip_html_tags(v) match = rx_html_ver.search(v) version = match.group("version") else: raise Exception("Unsupported access scheme") return {"vendor": "ZTE", "platform": "ZXDSL531", "version": version}
def execute(self): v = self.http.get("/") v = strip_html_tags(v) platform = self.rx_platform.search(v) version = self.rx_version.search(v) return { "vendor": "Linksys", "platform": platform.group("platform"), "version": version.group("version"), "attributes": { "HW version": version.group("hardware"), "Serial Number": platform.group("serial"), }, }
def execute(self): if self.access_profile.scheme == self.TELNET: v = self.cli("wlctl authe_sta_list") elif self.access_profile.scheme == self.HTTP: v = self.http.get("/wlclientview.cmd") v = strip_html_tags(v) else: raise Exception("Unsupported access scheme") r = [] for l in v.split("\n"): m = rx_mac.search(l) if m: r.append({"mac": m.group("mac")}) return r
def test_strip_html_tags(expected): html = """ <html> <head> <title>Title</title> </head> <body> <H1>Body</H1> <P>Text</P> </body> </html> """ out = strip_html_tags(html) out = out.strip() out = out.replace("\n", "") assert out == expected
def execute(self): if self.access_profile.scheme in [self.TELNET, self.SSH]: v = self.cli("show info") match = self.rx_ver.search(v) return { "vendor": "Audiocodes", "platform": match.group("platform"), "version": match.group("version"), } elif self.access_profile.scheme == self.HTTP: v = self.http.get("/SoftwareVersion") v = strip_html_tags(v) match = self.rx_html_ver.search(v) return { "vendor": "Audiocodes", "platform": "Mediant2000", "version": match.group("version"), } else: raise Exception("Unsupported access scheme")
def execute(self): mac = self.http.get("/") mac = strip_html_tags(mac) mac = self.rx_mac.search(mac) mac = mac.group("mac") return {"first_chassis_mac": mac, "last_chassis_mac": mac}