Ejemplo n.º 1
0
 def prepare(self, options):
     '''解析参数
     '''
     self.org_id = self.get_option('org_id', options, self.org_id)
     ipdomain = IpDomain()
     self.target = []
     for host in options['target']:
         if check_ip_or_domain(host):
             ip = parse_ip(host)
             if not ip:
                 continue
             if isinstance(ip, list):
                 for t in ip:
                     self.target.append({'ip': t})
             else:
                 self.target.append({'ip': ip})
         # 获取域名IP信息
         else:
             iplist = ipdomain.fetch_domain_ip(host)
             self.save_domain(([
                 iplist,
             ]))
             # 如果没有CDN,则将ip地址加入到扫描目标地址
             if len(iplist['CNAME']) == 0 and len(iplist['A']) > 0:
                 for ip in iplist['A']:
                     self.target.append({'ip': ip})
Ejemplo n.º 2
0
    def prepare(self, options):
        '''解析参数
        '''
        for t in options['target']:
            if check_ip_or_domain(t):
                ip_target = parse_ip(t)
                if ip_target and isinstance(ip_target, (tuple, list)):
                    self.target.extend(ip_target)
                else:
                    self.target.append(ip_target)
            else:
                self.target.append(t)

        self.org_id = self.get_option('org_id', options, self.org_id)