Browse Source

packet padding

master
Robin Thoni 9 years ago
parent
commit
858b40b287
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      dhcp_basic_packet.py

+ 5
- 2
dhcp_basic_packet.py View File

@@ -143,8 +143,11 @@ class DhcpBasicPacket:
143 143
         pack_fmt = str(len(packet))+"c"
144 144
 
145 145
         packet = map(chr,packet)
146
-        
147
-        return pack(pack_fmt,*packet)
146
+        data = pack(pack_fmt,*packet)
147
+        data_len = len(data)
148
+        if data_len < 300:
149
+            data = data + (300 - data_len) * '\0'
150
+        return data
148 151
 
149 152
 
150 153
     # Insert packet in the object

Loading…
Cancel
Save