Centos Python ARP 欺骗检测软件 - 实时监控、攻击类型识别、可视化界面
这款基于 Python 的 Centos ARP 欺骗检测软件,能够实时监控局域网流量,识别多种常见网络攻击,包括:
- 'ARP 欺骗' 攻击
- 'ICMP flood' 攻击
- 'TCP' 攻击
软件还具备以下功能:
- 自动识别攻击类型,并输出相应的攻击信息。
- 记录攻击源的 IP 地址和 MAC 地址,并将日志保存至本地文件。
- 扫描并记录局域网内所有活动主机的 IP 地址和 MAC 地址。
- 提供用户登录和注册界面,方便用户管理和使用软件。
- 通过直观的 GUI 界面,用户可以轻松地切换不同的功能页面。
实现思路:
-
ARP 欺骗检测: 通过监听局域网中的 ARP 请求和响应包,分析 ARP 协议数据包,识别伪造的 ARP 包,并判断是否存在 ARP 欺骗攻击。
-
ICMP flood 攻击检测: 监听 ICMP 请求包,统计请求包数量,并与预设的阈值进行比较,超过阈值则认为可能存在 ICMP flood 攻击。
-
TCP 攻击检测: 监听 TCP 请求包,统计请求包数量,并与预设的阈值进行比较,超过阈值则认为可能存在 TCP 攻击。
-
扫描局域网主机信息: 使用 Python 的 scapy 库,发送 ARP 请求包,获取局域网中活动主机的 IP 地址和 MAC 地址。
-
记录攻击源信息: 在检测到攻击时,将攻击源的 IP 地址和 MAC 地址保存到本地文件中。
-
用户登录和注册界面: 使用 Python 的 tkinter 库创建窗口、标签、文本框和按钮等控件,实现用户登录和注册功能。
代码示例:
from scapy.all import *
# 扫描局域网主机信息
def scan_network():
arp_packet = ARP(pdst='192.168.1.0/24')
response = srp(arp_packet, timeout=2, verbose=0)[0]
hosts = []
for packet in response:
host = {'ip': packet[1].psrc, 'mac': packet[1].hwsrc}
hosts.append(host)
return hosts
# 检测 ARP 欺骗攻击
def detect_arp_spoofing():
# 监听 ARP 请求和响应包
# 判断是否存在伪造的 ARP 包
# 如果存在,则记录攻击源的 IP 地址和 MAC 地址
with open('attack_log.txt', 'a') as f:
f.write('ARP spoofing detected: {} {}
'.format(attacker_ip, attacker_mac))
# 检测 ICMP flood 攻击
def detect_icmp_flood():
# 监听 ICMP 请求包
# 统计请求包数量
# 如果超过阈值,则记录攻击源的 IP 地址
with open('attack_log.txt', 'a') as f:
f.write('ICMP flood detected: {}
'.format(attacker_ip))
# 检测 TCP 攻击
def detect_tcp_attack():
# 监听 TCP 请求包
# 统计请求包数量
# 如果超过阈值,则记录攻击源的 IP 地址
with open('attack_log.txt', 'a') as f:
f.write('TCP attack detected: {}
'.format(attacker_ip))
# 用户登录和注册界面
import tkinter as tk
window = tk.Tk()
window.title('ARP Detection')
window.geometry('400x300')
username_label = tk.Label(window, text='Username:')
username_label.pack()
username_entry = tk.Entry(window)
username_entry.pack()
password_label = tk.Label(window, text='Password:')
password_label.pack()
password_entry = tk.Entry(window, show='*')
password_entry.pack()
login_button = tk.Button(window, text='Login')
login_button.pack()
register_button = tk.Button(window, text='Register')
register_button.pack()
window.mainloop()
注意:
- 以上代码仅提供部分实现思路,完整代码需要根据具体需求进行调整和完善。
- 软件的具体功能和界面设计需要根据用户的实际需求进行定制。
- 在使用软件之前,请确保已了解相关网络安全知识,并做好必要的安全防护措施。
原文地址: https://www.cveoy.top/t/topic/jnXS 著作权归作者所有。请勿转载和采集!