ARP扫描和ARP欺骗

本文探讨了两种网络技术:ARP扫描(通过kcan.py实现)和ARP欺骗(使用arpspoof.py进行)。ARP扫描用于获取网络中设备的MAC地址,而ARP欺骗则涉及冒充网络节点,干扰数据包的正常路由。
摘要由CSDN通过智能技术生成

ARP扫描:命名为:kcan.py

#!/usr/local/bin/python3.7
import os
import re
from scapy.all import *
import threading

iface = 'ens32'

#得到自己的IP
def get_ip_address():
    try:
        data=os.popen('ifconfig ' + iface).read()
    except:
        print('Not install net-tools')
    words=data.split()
    clearOut=[('255', '255', '255', '0')]
    for x in words:
        result=re.findall('(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})',x)
        if result and result != clearOut:
            return result[0] 
            
#得到网络号内的IP,24位网络号可实现
def constrcut_net_ip():
    my_ip=get_ip_address()
    Net_Ip_List=[]
    for i in range(1,255):
        net_ip = my_ip[0]+'.'+my_ip[1]+'.'+my_ip[2]+'.'+str(i)
        Net_Ip_List.append(net_ip)
    return Net_Ip_List

#得到自己的MAC
def get_mac_address(iface):
    try:
        data=os.popen('ifconfig ' + iface).read()
    except:
     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值