Issue 96 in dpkt: dpkt.dpkt.UnpackError: invalid request: ''

104 views
Skip to first unread message

dp...@googlecode.com

unread,
Sep 4, 2012, 5:43:20 AM9/4/12
to dp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 96 by daw...@un0wn.org: dpkt.dpkt.UnpackError: invalid request: ''
http://code.google.com/p/dpkt/issues/detail?id=96

What steps will reproduce the problem?
1. When I type in this line: http = dpkt.http.Request(tcp.data)

What is the expected output? What do you see instead?

I expect the script to run without any errors.

What version of the product are you using? On what operating system?

Python 2.7. The python script is meant to be cross-platform


Please provide any additional information below.

This is my code:

import dpkt, glob, pcap, socket, time

def delay():
time.sleep(0.6) # delay execution of python script
print "\n"

fileName = glob.glob("*.pcap") # finds all matching pathnames specified
for .pcap files (hardcode for now)
print "Files present:",fileName
print ""

for files in fileName:
f = open(files)
print f
delay()
pcap = dpkt.pcap.Reader(f) #@UndefinedVariable
pkt_counter = 0
pkt_counter_relevant = 0
pkt_counter_non_relevant = 0

for ts, buf in pcap:
pkt_counter += 1

eth = dpkt.ethernet.Ethernet(buf)

# check if frame type is an IP packet
if type(eth.data) == dpkt.ip.IP:

if pkt_counter > 0:
pkt_counter_relevant += 1
last_time = ts
ip = eth.data
tcp = ip.data
src = socket.inet_ntoa(ip.src)
dst = socket.inet_ntoa(ip.dst)
srcPort = tcp.sport
dstPort = tcp.dport

print "---------------"
print "- Packet #%d -" % (pkt_counter)
print "---------------"
print "Timestamp:",ts
print "Bytes:",len(buf)
print "Source IP/Port:",src,"/",srcPort
print "Destination IP/Port:",dst,"/",dstPort

# check if it's a TCP/HTTP protocol
if dstPort == 80:
delay()
print "Protocol: TCP/HTTP"
delay()
http = dpkt.http.Request(tcp.data)


dp...@googlecode.com

unread,
Sep 4, 2012, 5:45:23 AM9/4/12
to dp...@googlegroups.com

Comment #1 on issue 96 by daw...@un0wn.org: dpkt.dpkt.UnpackError: invalid
request: ''
http://code.google.com/p/dpkt/issues/detail?id=96

Traceback (most recent call last):
http = dpkt.http.Request(tcp.data) - my script
self.unpack(args[0]) - dpkt http.py
raise dpkt.UnpackError('invalid request: %r' % line) - dpkt http.py

dp...@googlecode.com

unread,
Jun 17, 2015, 10:32:54 PM6/17/15
to dp...@googlegroups.com
Updates:
Status: Invalid

Comment #2 on issue 96 by kba...@in2void.com: dpkt.dpkt.UnpackError:
invalid request: ''
https://code.google.com/p/dpkt/issues/detail?id=96

Can you provide the test pcap ?
This issue is now tracked here : https://github.com/kbandla/dpkt/issues/122
Closing it here. Insufficient data to reproduce problem.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages