def init_from_log_file(self, log_file): self.reset_scanner() self.log_file = log_file self.scheme, self.host, self.path = self._parse_url_from_file() self.domain_sub = get_domain_sub(self.host) if self.host: if self.host.find(':') > 0: _ret = self.host.split(':') self.host = _ret[0] self.port = _ret[1] elif self.scheme == 'https': self.port = 443 elif self.scheme == 'http': self.port = 80 else: self.port = None if not is_port_open(self.host, self.port): self.print_msg('[Port Not Open] %s:%s' % (self.host, self.port)) return False self.has_http = True self.no_scripts = 1 self.init_final() self.load_all_urls_from_log_file() return True else: host = os.path.basename(log_file).replace('.log', '') try: socket.gethostbyname(host) self.init_from_url(host) # Fix Me return True except Exception as e: self.print_msg('[ERROR] Invalid host from log name: %s' % host) return False
def init_from_url(self, url): self.init_reset() if not url.find('://') > 0: self.url = 'http://' + url else: self.url = url self.schema, self.host, self.path = parse_url(url) self.domain_sub = get_domain_sub(self.host) self.init_final()
def init_from_log_file(self, log_file): self.init_reset() self.log_file = log_file self.schema, self.host, self.path = self._parse_url_from_file() self.domain_sub = get_domain_sub(self.host) if self.host: self.load_all_urls_from_log_file() self.init_final() else: self.init_from_url(os.path.basename(log_file).replace('.log', ''))
def init_from_url(self, target): self.reset_scanner() self.scheme = target['scheme'] self.host = target['host'] self.port = target['port'] self.path = target['path'] self.has_http = target['has_http'] self.ports_open = target['ports_open'] self.ports_closed = target['ports_closed'] self.no_scripts = target['no_scripts'] if 'no_scripts' in target else 0 self.domain_sub = get_domain_sub(self.host) self.init_final() return True
def init_from_log_file(self, log_file): self.reset_scanner() self.log_file = log_file self.schema, self.host, self.path = self._parse_url_from_file() self.domain_sub = get_domain_sub(self.host) if self.host: self.load_all_urls_from_log_file() self.init_final() return True else: host = os.path.basename(log_file).replace('.log', '') try: socket.gethostbyname(host) self.init_from_url(host) return True except Exception as e: print_msg('[ERROR] Invalid host from log name: %s' % host) return False
def init_from_url(self, url): self.reset_scanner() self.url = 'http://' + url if url.find('://') < 0 else url self.schema, self.host, self.path = parse_url(url) self.domain_sub = get_domain_sub(self.host) self.init_final()