Exemplo n.º 1
0
	def mutate(self, packets):
		broadcast = self.broadcast
		timer = self.timer
		result = []
		
		#if fragmented or packets too short
		if utils.check_fragmentation(packets[0]) or len(packets)<2:
			return packets

		for i in range(0,len(packets)):
			forged = packets[i].copy()
			#del tcp payload
			forged.payload = utils.tcp_bad_payload(forged.payload, utils.NOPAYLOAD)
			#set fields
			forged.payload.seq += i*527600			
			forged.payload.flags = 'S'
			#broadcast address
			forged.dst = broadcast
			#set timer
			forged.timeout = timer
			#append packets			
			result.append(packets[i])
			result.append(forged)	

		return result		
Exemplo n.º 2
0
	def mutate(self, packets):
		numfrag = self.numfrag
		position = self.position
		
		#check there is enough fragments and if numfrag-1 is a fragment
		if utils.check_length(numfrag, packets) or not utils.check_fragmentation(packets[numfrag-1]):
			return packets 
		
		
		forged = packets[numfrag-1].copy()
		forged = utils.ip_bad_payload(forged)
		
		if position == "after":
			packets.insert(numfrag, forged)
		else:	
			packets.insert(numfrag-1, forged)

		return packets
Exemplo n.º 3
0
	def mutate(self, packets):
		BADMAC = self.BADMAC
		timer = self.timer	
		
		#if packet is fragmented
		if utils.check_fragmentation(packets[0].payload):
			return packets

		#if SYN	
		if utils.check_syn(packets[0].payload.payload):			
			#create fake SYN
			forged_syn = packets[0].copy()
			forged_syn.dst=BADMAC
			forged_syn.payload.payload.flags = 'S'
			forged_syn.payload.payload.seq = 1000
			forged_syn.payload.payload.ack = 0
			#insert fake SYN
			packets.insert(0, forged_syn)
			#create fake SYN/ACK
			forged_synack = packets[0].copy()
			forged_synack.dst=BADMAC
			forged_synack.payload.payload.sport = packets[0].payload.payload.dport
			forged_synack.payload.payload.dport = packets[0].payload.payload.sport
			forged_synack.payload.payload.flags = 'SA'
			forged_synack.payload.payload.seq = 2000
			forged_synack.payload.payload.ack = packets[0].payload.payload.seq + 1
			forged_synack.payload.dst = packets[0].payload.src
			forged_synack.payload.src = packets[0].payload.dst
			#insert fake SYN/ACK
			packets.insert(1, forged_synack)
			#create fake ACK
			forged_ack = packets[0].copy()
			forged_ack.dst=BADMAC
			forged_ack.payload.payload.flags = 'A'
			forged_ack.payload.payload.seq = packets[1].payload.payload.ack
			forged_ack.payload.payload.ack = packets[1].payload.payload.seq + 1
			#insert fake SYN/ACK
			packets.insert(2, forged_ack)
			#set timeout for real SYN
			packets[3].timeout = timer				
							
		return packets
Exemplo n.º 4
0
	def mutate(self, packets):
		numfrag = self.numfrag
		bigsize = self.bigsize
		big_payload=""
		
		#check numfrag existence, and if it's a fragment
		if utils.check_length(numfrag, packets) or not utils.check_fragmentation(packets[numfrag-1]):
			return packets 

		#create big payload and load it		
		forged = packets[numfrag-1].copy()
		del(forged.payload)
		for i in range(bigsize):
			big_payload =big_payload + random.choice(string.ascii_letters)
		forged.add_payload(scapy.Raw(load=big_payload))
		forged.flags = ip.FLAG_DF
		#insert big packet	
		packets.insert(numfrag-1, forged)

		return packets
Exemplo n.º 5
0
	def mutate(self, packets):
		BADMAC = self.BADMAC
		timer = self.timer	
		numframe = self.numframe
		#if packet is fragmented,SYN or ACK do nothing
		if utils.check_length(numframe, packets) or utils.check_syn(packets[numframe-1].payload.payload) or utils.check_ack(packets[numframe-1].payload.payload) or utils.check_fragmentation(packets[numframe-1].payload):
			return packets
		#create fake RST	
		forged = packets[numframe-1].copy()
		forged.payload.payload = utils.tcp_bad_payload(forged.payload.payload, utils.NOPAYLOAD)
		forged.dst=BADMAC
		#set reset flag
		forged.payload.payload.flags = 'R'
		#insert fake RST
		packets.insert(numframe-1, forged)
		#append original
		packets.append(packets[numframe])
		del(packets[numframe])
		#create fake SYN
		forged_syn = packets[numframe-1].copy()
		forged_syn.dst=BADMAC
		forged_syn.timeout = timer
		forged_syn.payload.payload.flags = 'S'
		forged_syn.payload.payload.seq += 103245
		forged_syn.payload.payload.ack = 0
		#insert fake SYN
		packets.insert(numframe, forged_syn)
		#create fake SYN/ACK
		forged_synack = packets[numframe-1].copy()
		forged_synack.dst=BADMAC
		forged_synack.payload.payload.sport = packets[numframe].payload.payload.dport
		forged_synack.payload.payload.dport = packets[numframe].payload.payload.sport
		forged_synack.payload.payload.flags = 'SA'
		forged_synack.payload.payload.seq += 207654
		forged_synack.payload.payload.ack = packets[numframe].payload.payload.seq + 1
		forged_synack.payload.dst = packets[numframe].payload.src
		forged_synack.payload.src = packets[numframe].payload.dst
		#insert fake SYN/ACK
		packets.insert(numframe+1, forged_synack)		
		#create fake ACK
		forged_ack = packets[numframe-1].copy()
		forged_ack.dst=BADMAC
		forged_ack.payload.payload.flags = 'A'
		forged_ack.payload.payload.seq = packets[numframe+1].payload.payload.ack
		forged_ack.payload.payload.ack = packets[numframe+1].payload.payload.seq + 1
		#insert fake SYN/ACK
		packets.insert(numframe+2, forged_ack)	
		
		#delete reset
		del(packets[numframe-1])

		return packets