def mutate(self, packets): offset = self.offset #find tcp manager reference, otherwise return packets l4m = utils.check_l4m(packets) if not l4m: return packets if ((packets[0].flags & tcp.FLAG_ACK) and (l4m.post_syn == 0)): rst = packets[0].copy() rst.flags = 'R' #syn syn = scapy.TCP(dport=l4m.dport, sport=l4m.sport, flags='S', seq=l4m.iss, window=l4m.rcv_wnd,\ options=[('MSS', l4m.default_max_size)]) # update seqs and akcs l4m.sent_next_seq = l4m.iss + 1 l4m.sent_last_ack = 0 l4m.rcv_last_ack = 0 l4m.rcv_next_seq = 0 packets.append(rst) packets.append(syn) l4m.post_syn = 1 return packets return packets
def mutate(self, packets): #find tcp manager reference, otherwise return packetsS l4m = utils.check_l4m(packets) if not l4m: return packets #if real SYN if utils.check_syn(packets[0]) and (packets[0].l4manager.state == tcp.TCPS_SYN_SENT): l4m.delay_syn = True return [] return packets
def mutate(self, packets): result = [] #find tcp manager reference, otherwise return packetsS l4m = utils.check_l4m(packets) if not l4m: return packets #SYN if utils.check_syn(packets[0]): l4m.no3whs = True l4m.change_state(tcp.TCPS_ESTABLISHED) return result #data if ( hasattr(packets[0], "load") ): l4m.tcpref.send_packet(packets) return result return packets