僵尸机的条件:

1.足够闲置,不与其他机器进行通讯

2.IPID必须是递增的,不然无法判断端口是否开放

本实验僵尸机选择的是Windows2003

from scapy.all import *
import optparse

def is_zombie(target,zombie):
    pktz=IP(dst=zombie)/TCP(flags='SA')
    pktt=IP(src=zombie,dst=target)/TCP(flags='S')
    res1=sr1(pktz,timeout=1,verbose=0)
    send(pktt,verbose=0)
    res2=sr1(pktz,timeout=1,verbose=0)
    try:
        if res2[IP].id-2==res1[IP].id:
            print('It is a zombie.')
            return 1
        else:
            print('It isn\'t a zombie.')
            return 0
    except:
        print('It isn\'t a zombie.')

def scan(target,zombie,port):
    pktz=IP(dst=zombie)/TCP(flags='SA',dport=int(port))
    pktt=IP(src=zombie,dst=target)/TCP(flags='S',dport=int(port))
    start=sr1(pktz,timeout=1,verbose=0)
    send(pktt,verbose=0)
    end=sr1(pktz,timeout=1,verbose=0)
    if end[IP].id-2==start[IP].id:
        print(port,' is online')

def main():
    parser=optparse.OptionParser("%prog "+'-t <target> -z <zombie> -p <port>')
    parser.add_option('-t',dest='target',type='string',help='Target')
    parser.add_option('-z',dest='zombie',type='string',help='Zombie')
    parser.add_option('-p',dest='port',type='string',help='Port(eg:22,80    or  1-100)')
    (options,args)=parser.parse_args()
    target=options.target
    zombie=options.zombie
    if(target==None) or (zombie==None):
        print('Please input target(-t) and zombie(-z)!')
        exit(0)
    res=is_zombie(target,zombie)
    if res==1:
        if(',' in options.port):
            ports=str(options.port).split(',')
            if ports[0]==None:
                print('Please input port(-p)!')
                exit(0)
            for port in ports:
                scan(target,zombie,port)
        elif('-' in options.port):
            ports=str(options.port).split('-')
            if ports[0]==None:
                print('Please input port(-p)!')
                exit(0)
            for port in range(int(ports[0]),int(ports[1])):
                scan(target,zombie,port)
    else:
        pass

if __name__=='__main__':
    main()

使用说明

程序开始

github:https://github.com/zmqq/pytools/tree/master/zombiescan

 

Python3 小工具-僵尸扫描的更多相关文章

  1. Python3 小工具-UDP扫描

    from scapy.all import * import optparse import threading def scan(target,port): pkt=IP(dst=target)/U ...

  2. Python3 小工具-ICMP扫描

    from scapy.all import * import optparse import threading import os def scan(ipt): pkt=IP(dst=ipt)/IC ...

  3. Python3 小工具-ARP扫描

    from scapy.all import * import optparse import threading import os def scan(ipt): pkt=Ether(dst='ff: ...

  4. python3 小工具

    扫描IP的端口是否开放:Porttest.py # -*- coding: utf-8 -*- import sys import os import socket #扫描 def scanport( ...

  5. ip地址查询python3小工具_V0.0.1

    看到同事在一个一个IP地址的百度来确认导出表格中的ip地址所对应的现实世界的地址是否正确,决定给自己新开一个坑.做一个查询ip“地址”的python小工具,读取Excel表格,在表格中的后续列输出尽可 ...

  6. Python3 小工具-TCP半连接扫描

    from scapy.all import * import optparse import threading def scan(ip,port): pkt=IP(dst=ip)/TCP(dport ...

  7. Python3 小工具-UDP发现

    from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/UDP( ...

  8. Python3 小工具-TCP发现

    from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/TCP( ...

  9. Python3 小工具-MAC泛洪

    from scapy.all import * import optparse def attack(interface): pkt=Ether(src=RandMAC(),dst=RandMAC() ...

随机推荐

  1. Swift _ OC _ 混编

    Swift _ OC _ 混编 在OC环境下使用Swift. GitHub源码

  2. windows10上安装mysql

    环境:windwos 10(1511) 64bit.mysql 5.7.14 一.下载mysql 1. 在浏览器里打开mysql的官网http://www.mysql.com/ 2. 进入页面顶部的& ...

  3. pt-query-digest慢日志分析工具

    简介 pt-query-digest是用于分析mysql慢查询的一个工具,它可以分析binlog.General log.slowlog,也可以通过SHOW PROCESSLIST或者通过tcpdum ...

  4. 爬取豆瓣电影Top250

    1 import json import requests from requests.exceptions import RequestException import re import time ...

  5. Java 面试题 百度/参考的答案

    "a=b"和"a.equals(b)"有什么区别? 如果 a 和 b 都是对象,则 a==b 是比较两个对象的引用,只有当 a 和 b 指向的是堆中的同一个对象 ...

  6. 【JavaWeb】从零实现用户登录

    1.数据库预备 1.1 SQL 创建数据库 create database db; 创建表 create table userInfo( id int primary key , name ), pa ...

  7. 新系统设置 github 私钥

    1.首先我得重新在git设置一下身份的名字和邮箱(因为当初都忘了设置啥了,因为遇到坑了)进入到需要提交的文件夹底下(因为直接打开git Bash,在没有路径的情况下,根本没!法!改!刚使用git时遇到 ...

  8. C# IL DASM 使用-破解c#软件方法

    IL DASM反编译工具 使用C#的猿人或多或少都会对微软的IL反编译工具(ildasm.exe)有所认识.我最早接触到这工具是公司同事使用他反编译exe程序,进行研读和修改.感觉他还是很强大. IL ...

  9. #include stdio.h(A)

    /* 第一个*******知识点工程相关信息******** 1.创建工程 文件->新建->工程->win32 console applecation ->文件名不能为汉字 2 ...

  10. MongoDB入门---文档操作之增删改

    之前的两篇文章,已经分享过关于MongoDB的集合还有数据库的各种操作,接下来就涉及到最主要的喽,那就是数据方面的操作,在这里叫做文档操作.话不多说,大家来看正文.     首先来看一下它的数据结构: ...