Configuration
impacket version: master (source)
Python version: 3.11.2
Target OS: Linux x86_64
Debug Output With Command String
python -c "import sys,traceback; sys.path.insert(0,'./'); from impacket.ImpactPacket import IP; ip=IP(); ip.fragment_by_size(8)"
Observed output:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "./impacket/ImpactPacket.py", line 1028, in fragment_by_size
data_len = len(self.get_data_as_string())
TypeError: object of type 'NoneType' has no len()
PCAP
N/A
Additional context
get_data_as_string() returns None when there is no child/payload. fragment_by_size() calls len() on it unconditionally.
Suggested fix:
data = self.get_data_as_string()
if not data:
return [self]
data_len = len(data)