Пример #1
0
	def mutate(self, packets):
		timer = self.timer
		numfrag = self.numfrag
						
		# Check there is enough fragments
		if numfrag > len(packets):
			return packets
		
		# Check that the packets to delay it is actually a fragmet
		if packets[numfrag-1].flags % 2 != 1:
			return packets
		
		forged = packets[numfrag-1].copy()
		forged = utils.ip_bad_payload(forged)
		#insert forged		
		packets.insert(0,forged)
		#append original one
		packets.append(packets[numfrag])
		del(packets[numfrag])
		#set timeouts		
		packets[1].timeout = timer
		last=len(packets)-1
		packets[last].timeout = 2
	
		return packets
Пример #2
0
	def mutate(self, packets):
				
		#no fragments, syn or ack
		if len(packets) < 2 or utils.check_syn(packets[0].payload) or utils.check_ack(packets[0].payload):	
			return packets
					
		forged = packets[0].copy()
		forged = utils.ip_bad_payload(forged)
		
		#ip options with bad option length
		forged.options = self.option+self.data
		#insert packet first pos
		packets.insert (0,forged)
		#move original fragment last pos
		packets.append (packets[1])
		del(packets[1])
				
		return packets
Пример #3
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
Пример #4
0
	def mutate(self, packets):
			
		numframe = self.numframe
		BADMAC = self.BADMAC

		
		if utils.check_length(numframe, packets) or utils.check_syn(packets[numframe-1].payload.payload) or utils.check_ack(packets[numframe-1].payload.payload):
			return packets
				
		forged = packets[numframe-1].copy()
		forged.payload = utils.ip_bad_payload(forged.payload)
		forged.dst=BADMAC
		#insert forged frame
		packets.insert(0, forged)
		#append original
		packets.append(packets[numframe])
		del(packets[numframe])
		
		return packets
Пример #5
0
	def mutate(self, packets):
		numfrag = self.numfrag
		
		#if not enough packets, syn or ack return
		if utils.check_length(numfrag, packets) or utils.check_syn(packets[numfrag-1].payload) or utils.check_ack(packets[numfrag-1].payload):
			return packets 
		
		forged = packets[numfrag-1].copy()
		forged = utils.ip_bad_payload(forged)
		
		#change IP version
		forged.version = 8
		#insert forged 
		packets.insert (0 ,forged)
		#append original
		packets.append(packets[numfrag])
		del(packets[numfrag])
				
		return packets
		
Пример #6
0
	def mutate(self, packets):
		numfrag = self.numfrag

		#Not enough elements,  Syn or Ack return
		if utils.check_length(numfrag, packets) or utils.check_syn(packets[numfrag-1].payload) or utils.check_ack(packets[numfrag-1].payload):
			return packets
		
		#set self.TTL for each packet
		for i,f in enumerate(packets):
			packets[i].ttl=self.TTL		
		#create forged
		forged = packets[numfrag-1].copy()
		forged = utils.ip_bad_payload(forged)
		#set short TTL
		forged.ttl=self.shortTTL
		packets.insert(numfrag-1, forged)
		
		#append numfrag
		packets.append(packets[numfrag])
		del(packets[numfrag])
		
		return packets
Пример #7
0
	def mutate(self, packets):
		numfrag = self.numfrag
		ihl = self.ihl
				
		
		#Not enough fragments, Syn or Ack, return
		if utils.check_length(numfrag, packets) or utils.check_syn(packets[numfrag-1].payload) or utils.check_ack(packets[numfrag-1].payload):
			return packets
			
		forged = packets[numfrag-1].copy()
		forged = utils.ip_bad_payload(forged)
		
		#modify total length
		forged.ihl = ihl
		
		#insert fragment first pos
		packets.insert(0,forged)
		#move original fragment last pos
		packets.append(packets[numfrag])
		del(packets[numfrag])
			
		return packets
Пример #8
0
	def mutate(self, packets):
		numfrag = self.numfrag
		
		#Not enough fragments, Syn or Ack, return
		if utils.check_length(numfrag, packets) or utils.check_syn(packets[numfrag-1].payload) or utils.check_ack(packets[numfrag-1].payload):
			return packets

		forged = packets[numfrag-1].copy()
		forged = utils.ip_bad_payload(forged)
		#calculate and modify chksum
		forged.chksum = ip.scapy.checksum(forged)+1

		'''
		forged packet will be accepted by snort only if using -k noip option
		'''

		#insert fragment first pos
		packets.insert(0,forged)
		#move original fragment last pos
		packets.append(packets[numfrag])
		del(packets[numfrag])

		return packets