Closed GoogleCodeExporter closed 9 years ago
what version of libpcap do you have installed? it looks like a missing
pcap-int.h
header file.
can you show me the output for these commands?
cat config.h
and in python:
>>> import cPickle
>>> cPickle.loads(open('config.pkl').read())
Original comment by dugsong
on 11 Mar 2007 at 4:23
thank you for your kind and quick comment, dugsong :0
i `v installed libpcap version 0.9.5.
there is no pcap-int.h in this version.
config.pkl
there `s no config.h or config.pkl too.
i have to go back libpcap version with pcap-int.h?
for example libpcap version 0.7.1.
Original comment by gage...@gmail.com
on 11 Mar 2007 at 6:54
sorry dugsong,
i brought compiled binary version libpcap from sunfreeware.
but there "IS" definetely pcap-int.h in libpcap 0.9.5 source from tcpdump.org.
i`m lazy.very soory for that.
Original comment by gage...@gmail.com
on 11 Mar 2007 at 7:04
only after in the source directory do "gmake" ,cconfig.h or config.pkl came
into view.
[07:16:04 sandy@gagemel pypcap-1.1]$ more config.h
#define HAVE_PCAP_SETNONBLOCK 1
#define HAVE_PCAP_FILE 1
#define HAVE_PCAP_INT_H 1
#define HAVE_PCAP_COMPILE_NOPCAP 1
[07:16:20 sandy@gagemel pypcap-1.1]$ python
Python 2.5 (r25:51908, Sep 20 2006, 03:11:51)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import cPickle
>>> cPickle.loads(open('config.pkl').read())
{'libraries': ['pcap'], 'library_dirs': ['/usr/local/lib'], 'include_dirs':
['/usr/local/include']}
>>>
Original comment by gage...@gmail.com
on 11 Mar 2007 at 7:20
and finally got pcap.so.only after " do gmake",everything goes
well.interesting.:)
[07:36:46 sandy@gagemel pypcap-1.1]$ sudo python setup.py install
Password:
running install
running build
running build_ext
building 'pcap' extension
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC
-I/usr/local/include/python2.5 -c pcap_ex.c -o
build/temp.solaris-2.10-i86pc-2.5/pcap_ex.o
creating build/lib.solaris-2.10-i86pc-2.5
gcc -shared build/temp.solaris-2.10-i86pc-2.5/pcap.o
build/temp.solaris-2.10-i86pc-2.5/pcap_ex.o -o
build/lib.solaris-2.10-i86pc-2.5/pcap.so
running install_lib
copying build/lib.solaris-2.10-i86pc-2.5/pcap.so ->
/usr/local/lib/python2.5/site-packages
running install_egg_info
Writing /usr/local/lib/python2.5/site-packages/pcap-1.1-py2.5.egg-info
[07:36:51 sandy@gagemel pypcap-1.1]$
Original comment by gage...@gmail.com
on 11 Mar 2007 at 7:39
** final comment.
i`v copied pcap-int.h file from libpcap 0.9.5 source to /usr/local/include .
because gmake install only copied pcap.h,pcap-bpf.h,pcap-namedb.h.
[07:03:09 sandy@gagemel libpcap-0.9.5]$ sudo gmake install
Password:
[ -d /usr/local/lib ] || \
(mkdir -p /usr/local/lib; chmod 755 /usr/local/lib)
/opt/csw/bin/ginstall -c -m 644 libpcap.a /usr/local/lib/libpcap.a
ranlib /usr/local/lib/libpcap.a
[ -d /usr/local/include ] || \
(mkdir -p /usr/local/include; chmod 755 /usr/local/include)
/opt/csw/bin/ginstall -c -m 644 ./pcap.h /usr/local/include/pcap.h
/opt/csw/bin/ginstall -c -m 644 ./pcap-bpf.h \
/usr/local/include/pcap-bpf.h
/opt/csw/bin/ginstall -c -m 644 ./pcap-namedb.h \
/usr/local/include/pcap-namedb.h
[ -d /usr/local/man/man3 ] || \
(mkdir -p /usr/local/man/man3; chmod 755 /usr/local/man/man3)
/opt/csw/bin/ginstall -c -m 644 ./pcap.3 \
/usr/local/man/man3/pcap.3
Original comment by gage...@gmail.com
on 11 Mar 2007 at 7:55
ㅠㅠ . maybe there are some problems in compiled pcap.so.
[09:43:31 sandy@gagemel ~]$ python scapy.py
scapy.py:3689: Warning: 'with' will become a reserved keyword in Python 2.6
scapy.py:3691: Warning: 'with' will become a reserved keyword in Python 2.6
ERROR: did not find pcap module
[09:43:40 sandy@gagemel ~]$ python
Python 2.5 (r25:51908, Sep 20 2006, 03:11:51)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
Welcome to Python 2.5! This is the online help utility.
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
help> modules pcap
Here is a list of matching modules. Enter any module name to get more help.
pcap
help> pcap
problem in pcap - <type 'exceptions.ImportError'>: ld.so.1: python: 치명적:
재할당 오
류: 파일 /usr/local/lib/python2.5/site-packages/pcap.so: 기호 bpf_filter:
참조 기호가
없습니다.
Original comment by gage...@gmail.com
on 11 Mar 2007 at 9:54
[09:34:43 sandy@gagemel Numeric-24.2]$ python
Python 2.5 (r25:51908, Sep 20 2006, 03:11:51)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcap
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: ld.so.1: python: 치명적: 재할당 오류: 파일
/usr/local/lib/python2.5/site-packages/pcap.so: 기호 bpf_filter: 참조
기호가 없습니다.
>>>
Original comment by gage...@gmail.com
on 11 Mar 2007 at 9:57
dugsong!!
in my ubuntu box, there is same error.
so using Pyrex, fixed pcap.pyx.
pyrexc pcap.pyx
python setup.py build.
after that, nothing wrong happen.everything goes well.
but back to solaris box, that fix doesn`t work.
Original comment by gage...@gmail.com
on 11 Mar 2007 at 1:52
using Pyrex, fix pcap.pyx.
this is last solution.maybe.
on my solaris box , this fix worked.
thanks, dugsong.
Original comment by gage...@gmail.com
on 11 Mar 2007 at 2:06
yes, you have to 'make' or 'gmake' in order for 'python setup.py config' to be
executed. i should probably change this. :-(
the missing pcap-int.h in comment #6 can be worked around by modifying
CONFIG_ARGS in
the Makefile to point to your libpcap build directory, instead of using an
installed
version.
the missing bpf_filter symbol in comment #7 and #8 i don't understand - and i
don't
understand how regenerating the pcap.c source using pyrex in comment #9 and #10
would
have fixed it. but if it works, that's great! :-)
can you mail me your regenerated pcap.c file so i can compare? also, what
version of
Pyrex are you using? i don't have access to a Solaris 10 x86 box right now, so i
cannot reproduce this easily.
thank you!
Original comment by dugsong
on 11 Mar 2007 at 8:59
i`m very sorry about symbol error in comment #7 and #8.
that was my ld setting error.i used /usr/ccs/bin/ld in error situation.
whem i use gnu ld , erorr message has gone. :)
Original comment by gage...@gmail.com
on 11 Mar 2007 at 10:27
well working pcap module.
[22:28:40 sandy@gagemel xchat-2.8.0]$ python
Python 2.5 (r25:51908, Sep 20 2006, 03:11:51)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
Welcome to Python 2.5! This is the online help utility.
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
help> modules pcap
Here is a list of matching modules. Enter any module name to get more help.
pcap
help> pcap
Help on module pcap:
NAME
pcap - packet capture library
FILE
/usr/local/lib/python2.5/site-packages/pcap.so
DESCRIPTION
This module provides a high level interface to packet capture systems.
All packets on the network, even those destined for other hosts, are
accessible through this mechanism.
CLASSES
__builtin__.object
bpf
pcap
class bpf(__builtin__.object)
| bpf(filter, dlt=DLT_RAW) -> BPF filter object
|
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| filter(...)
| Return boolean match for buf against our filter.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object at 0xcf4a3700>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
class pcap(__builtin__.object)
| pcap(name=None, snaplen=65535, promisc=True, immediate=False) -> packet
capture object
|
help>
Original comment by gage...@gmail.com
on 11 Mar 2007 at 10:32
great!
i upgraded to Pyrex-0.9.5.1a and regenerated pcap.c for the package, and added
a note
to the README about the build. sorry for any confusion.
the fix is in svn, and i'll cut a new version later, after some additional
changes go
in...
Original comment by dugsong
on 12 Mar 2007 at 2:37
Original issue reported on code.google.com by
gage...@gmail.com
on 10 Mar 2007 at 11:59