pcap2har installation issues

214 views
Skip to first unread message

dekela

unread,
Mar 21, 2011, 7:42:51 AM3/21/11
to pcap2har
HI!

First of all I wanted to say a bug thanks for this great tool.

I am trying to get in installed and run but when I try to execute it
against one of the samples cap files I get the following:
root@ip-10-227-34-239:/var/www/pcap2har# ./main.py http.cap http.har
Traceback (most recent call last):
File "./main.py", line 48, in <module>
session = httpsession.HttpSession(dispatcher)
File "/var/www/pcap2har/httpsession.py", line 131, in __init__
self.flows.append(http.Flow(flow))
File "/var/www/pcap2har/http/flow.py", line 23, in __init__
success, requests, responses = parse_streams(tcpflow.fwd,
tcpflow.rev)
File "/var/www/pcap2har/http/flow.py", line 116, in parse_streams
requests = gather_messages(Request, request_stream)
File "/var/www/pcap2har/http/flow.py", line 89, in gather_messages
msg = MessageClass(tcpdir, pointer)
File "/var/www/pcap2har/http/request.py", line 16, in __init__
http.Message.__init__(self, tcpdir, pointer, dpkt_http.Request)
File "/var/www/pcap2har/http/message.py", line 29, in __init__
self.ts_start = tcpdir.seq_final_arrival(self.seq_start)
File "/var/www/pcap2har/tcp/direction.py", line 159, in
seq_final_arrival
return self.final_arrival_data.find_le(seq_num)[1]
File "/var/www/pcap2har/sortedcollection.py", line 163, in find_le
raise ValueError('find_le: No items found')
ValueError: find_le: No items found


What am I missing?

Thanks!
Dekel

dekela

unread,
Mar 21, 2011, 10:50:28 AM3/21/11
to pcap2har
Hi,

I think I manage to overcome most of thje issues, Now I get:
processing ../../../../pcap2har/ynet.pcap ...
Traceback (most recent call last):
File "./main.py", line 44, in <module>
from pcap2har import convert
ImportError: No module named pcap2har

All I am trying to do is run pcap2har outside of google app engine.

Thanks,
Dekel

Libo Song

unread,
Mar 21, 2011, 11:07:33 AM3/21/11
to pcap...@googlegroups.com, dekela
Hi Dekel,

I think you need to set the PYTHONPATH to pcap2har. In the appengine
code, I set the path as the following:

# add third_party directory to sys.path for global import
path = os.path.join(os.path.dirname(__file__), "third_party")
sys.path.append(os.path.abspath(path))
dpkt_path = os.path.join(path, "dpkt")
sys.path.append(os.path.abspath(dpkt_path))
simplejson_path = os.path.join(path, "simplejson")
sys.path.append(os.path.abspath(simplejson_path))

Let me know if this helps.

-Libo

Andrew Fleenor

unread,
Mar 21, 2011, 8:05:20 PM3/21/11
to pcap...@googlegroups.com
If I understand correctly, you're using Libo's modified pcap2har from his pcapperf app. If you want to use it outside AppEngine, you probably want the original Github version: github.com/andrewf/pcap2har. That one is currently configured as a command-line program.

Your original issue is, in fact, a bug related to a flow or flows in http.cap not having TCP handshakes. I'm working on it right now. Thanks for reporting it.

Andrew Fleenor

unread,
Mar 21, 2011, 9:27:58 PM3/21/11
to pcap...@googlegroups.com
I think I fixed it. Check out the latest version.

(By the way, main.py is the file you want to run)

dekela

unread,
Apr 9, 2011, 2:33:35 PM4/9/11
to pcap2har
Hi Andrew,

I tried to install the latest pcap2har on another server of mine and I
get the following error.
This time I am using your pcap2har and not Libo's Fork.

Traceback (most recent call last):
File "./main.py", line 48, in <module>
session = httpsession.HttpSession(dispatcher)
File "/var/www/pcap2har/httpsession.py", line 131, in __init__
self.flows.append(http.Flow(flow))
File "/var/www/pcap2har/http/flow.py", line 23, in __init__
success, requests, responses = parse_streams(tcpflow.fwd,
tcpflow.rev)
File "/var/www/pcap2har/http/flow.py", line 116, in parse_streams
requests = gather_messages(Request, request_stream)
File "/var/www/pcap2har/http/flow.py", line 89, in gather_messages
msg = MessageClass(tcpdir, pointer)
File "/var/www/pcap2har/http/request.py", line 16, in __init__
http.Message.__init__(self, tcpdir, pointer, dpkt_http.Request)
File "/var/www/pcap2har/http/message.py", line 29, in __init__
self.ts_start = tcpdir.seq_final_arrival(self.seq_start)
File "/var/www/pcap2har/tcp/direction.py", line 159, in
seq_final_arrival
return self.final_arrival_data.find_le(seq_num)[1]
File "/var/www/pcap2har/sortedcollection.py", line 163, in find_le
raise ValueError('find_le: No items found')
ValueError: find_le: No items found


This is using your sample HTTP, I wonder what is missing, where do I
need to set my PYTHON PATH?

Thanks,
Dekel


On Mar 22, 4:27 am, Andrew Fleenor <andrewf...@gmail.com> wrote:
> I think I fixed it. Check out the latest version.
>
> (By the way, main.py is the file you want to run)
>

Andrew Fleenor

unread,
Apr 11, 2011, 5:19:25 PM4/11/11
to pcap...@googlegroups.com
That is not a PYTHONPATH issue. It was/is a bug. I'm pretty sure I fixed it, and I can't reproduce it in a fresh clone of the repo. Are you sure you have the absolute latest version (commit 97bf99)?

Dekel Amrani

unread,
Apr 12, 2011, 10:16:51 AM4/12/11
to pcap...@googlegroups.com
Thanks Andrew,

I Downloaded the Master copy and not the commit, Strange, I thought the master is always the latest commit.

I tested the last commit and it is working, Thanks you for your help.

Dekel
--
Dekel Amrani
No Worries...
Reply all
Reply to author
Forward
0 new messages