示例#1
0
文件: run.py 项目: thinks520/ZeroScan
    def collate(self):
        conn = helper.get_domains_conn()
        cur = conn.cursor()
        cur.execute("SELECT * FROM domains WHERE cdn=0")
        rows = cur.fetchall()
        for row in rows:
            domain, ip, cname, cdn, internal = row
            if internal:
                self.internal_domain.add(domain)
                continue
            if not self.ip_all.get(ip, None):
                self.ip_all[ip] = {'domain': [], 'ports': [], 'service': []}
            if domain not in self.ip_all[ip]['domain']:
                self.ip_all[ip]['domain'].append(domain)
        conn.close()

        conn = helper.get_ports_conn()
        cur = conn.cursor()
        cur.execute("SELECT * FROM open")
        rows = cur.fetchall()
        for row in rows:
            ip, port, service, comment = row
            self.ip_all[ip]['ports'].append(port)
            self.ip_all[ip]['service'].append(service)
        conn.close()
示例#2
0
文件: run.py 项目: thinks520/ZeroScan
    def port_scan(self):
        recv_process = None
        if self.ips:
            recv_process = subprocess.Popen(["python", "recv.py"])

        time.sleep(5)

        dst_port = (1, 65535)
        for ip in self.ips:
            try:
                send(IP(dst=ip) / TCP(dport=dst_port, flags="S"))
            except KeyboardInterrupt:
                break
            except Exception as e:
                print e
                continue
            time.sleep(3)

        print "send done"
        time.sleep(120)

        scanned_ips = set()
        conn = helper.get_ports_conn()
        cur = conn.cursor()
        cur.execute("SELECT * FROM open")
        rows = cur.fetchall()
        for row in rows:
            ip, port, service, comment = row
            scanned_ips.add(ip)
        conn.close()

        second_stage_ips = self.ips - scanned_ips

        dst_port = (1, 65535)
        for ip in second_stage_ips:
            try:
                send(IP(dst=ip) / TCP(dport=dst_port, flags="S"))
            except KeyboardInterrupt:
                break
            except Exception as e:
                print e
                continue
            time.sleep(3)

        print "second stage send done"
        time.sleep(120)

        recv_process.kill()
示例#3
0
文件: run.py 项目: hahadaxia/ZeroScan
for ip in ips:
    try:
        send(IP(dst=ip) / TCP(dport=dst_port, flags="S"))
    except KeyboardInterrupt:
        break
    except Exception as e:
        print e
        continue
    time.sleep(3)

print "send done"
time.sleep(120)

# second stage scan
scanned_ips = set()
conn = helper.get_ports_conn()
cur = conn.cursor()
cur.execute("SELECT * FROM open")
rows = cur.fetchall()
for row in rows:
    ip, port, service, comment = row
    scanned_ips.add(ip)
conn.close()

second_stage_ips = ips - scanned_ips

dst_port = (1, 65535)
for ip in second_stage_ips:
    try:
        send(IP(dst=ip) / TCP(dport=dst_port, flags="S"))
    except KeyboardInterrupt: