Exemple #1
0
 def _get_raw_data(self):
     iphdr = IpHeader()
     iphdr.protocol = self._protocol
     if self.args.srcip:
         iphdr.saddr = self.args.srcip
     iphdr.daddr = self.args.destip
     data = self._get_data()
     iphdr.ihl = iphdr.length >> 2
     return iphdr.dump() + data
Exemple #2
0
 def _get_raw_data(self):
     iphdr = IpHeader()
     iphdr.protocol = self._protocol
     if self.args.srcip:
         iphdr.saddr = self.args.srcip
     iphdr.daddr = self.args.destip
     data = self._get_data()
     iphdr.ihl = iphdr.length >> 2    
     return iphdr.dump() + data
Exemple #3
0
    def _get_raw_data(self):
        data = self._get_data()

        iphdr = IpHeader()
        iphdr.protocol = socket.IPPROTO_UDP
        if self.args.srcip:
            iphdr.saddr = self.args.srcip
        iphdr.daddr = self.args.destip
        iphdr.ihl = iphdr.length >> 2    

        udphdr = UdpHeader()
        udphdr.uh_sport = self.args.srcport if self.args.srcport else random.randint(30000,40000)
        udphdr.uh_dport = self.args.destport
        udphdr.uh_ulen = len(data) + udphdr.length
        udphdr.uh_sum = 0

        return iphdr.dump() + udphdr.dump() + data
Exemple #4
0
    def _get_raw_data(self):
        data = self._get_data()

        iphdr = IpHeader()
        iphdr.protocol = socket.IPPROTO_UDP
        if self.args.srcip:
            iphdr.saddr = self.args.srcip
        iphdr.daddr = self.args.destip
        iphdr.ihl = iphdr.length >> 2

        udphdr = UdpHeader()
        udphdr.uh_sport = self.args.srcport if self.args.srcport else random.randint(
            30000, 40000)
        udphdr.uh_dport = self.args.destport
        udphdr.uh_ulen = len(data) + udphdr.length
        udphdr.uh_sum = 0

        return iphdr.dump() + udphdr.dump() + data