Python3 小工具-ICMP扫描】的更多相关文章

from scapy.all import * import optparse import threading import os def scan(ipt): pkt=IP(dst=ipt)/ICMP() res=sr1(pkt,timeout=0.1,verbose=0) if res: print(ipt,' is online') def main(): parser=optparse.OptionParser("%prog "+"-t <target>…
from scapy.all import * import optparse import threading def scan(target,port): pkt=IP(dst=target)/UDP(dport=int(port)) res=sr1(pkt,timeout=0.1,verbose=0) if res==None: print(port,' is online') def main(): parser=optparse.OptionParser("%prog"+&q…
僵尸机的条件: 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,…
from scapy.all import * import optparse import threading import os def scan(ipt): pkt=Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst=ipt) res=srp1(pkt,timeout=0.1,verbose=0) if res: print(ipt,' is online') def main(): parser=optparse.OptionParser('%prog'+"-…
扫描IP的端口是否开放:Porttest.py # -*- coding: utf-8 -*- import sys import os import socket #扫描 def scanport(ip,port): try: socket.setdefaulttimeout(2) s=socket.socket() s.connect((ip,port)) portrecv=s.recv(1024) return portrecv except Exception as e: print(e…
看到同事在一个一个IP地址的百度来确认导出表格中的ip地址所对应的现实世界的地址是否正确,决定给自己新开一个坑.做一个查询ip“地址”的python小工具,读取Excel表格,在表格中的后续列输出尽可能多的ip地址查询平台的结果以供验证比对. 第一个版本写的比较丑,仅仅能用,后续慢慢完善吧. # -*- coding: utf-8 -*- # @Author: EnderZhou # @E-mail: zptxwd@gmail.com # @Date: 2018-11-09 15:17:21 #…
from scapy.all import * import optparse import threading def scan(ip,port): pkt=IP(dst=ip)/TCP(dport=int(port)) res=sr1(pkt,timeout=0.1,verbose=0) try: if int(res[TCP].flags)==18: print(port,' is open') except: pass def main(): parser=optparse.Option…
from scapy.all import * import optparse def attack(interface): pkt=Ether(src=RandMAC(),dst=RandMAC())/IP(src=RandIP(),dst=RandIP())/ICMP() sendp(pkt,iface=interface) def main(): parser=optparse.OptionParser("%prog "+"-i interface") par…
from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/UDP(dport=65535) res=sr1(pkt,timeout=0.1,verbose=0) try: if int(res[IP].proto)==1: print(ip,' is online') except: pass def main(): parser=optparse.OptionP…
from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/TCP(flags='A') res=sr1(pkt,timeout=0.1,verbose=0) if res: print(ip,' is online') def main(): parser=optparse.OptionParser("%prog "+"-t <targe…