sharktools
sharktools copied to clipboard
sharktools - upgrade for ubuntu 12.04 and wireshark 1.6 and 1.8
Interested in updates to sharktools to be able to build with more recent versions of ubuntu linux (e.g., 12.04) and wireshark (1.6 or 1.8).
Hi dsalmen,
I made some updates to make pyshark work on Wireshark 1.8.* (tested on Wireshark 1.8.3). I haven't gotten around to Wireshark 1.6.* support yet. Unfortunately, matshark might not work, since I didn't test it. May I ask which you use?
If you get a chance, let me know if you have any issues. This update changes the semantics of pyshark a little, and was made in haste, so there could be some issues that pop up.
Thanks,
Armen
Armen,
Thanks for making the updates. I only use pyshark at this time.
I will give the new cut a try - thanks again!
dave
David Salmen [email protected]
Date: Sun, 3 Mar 2013 20:35:26 -0800 From: [email protected] To: [email protected] CC: [email protected] Subject: Re: [sharktools] sharktools - upgrade for ubuntu 12.04 and wireshark 1.6 and 1.8 (#2)
Hi dsalmen,
I made some updates to make pyshark work on Wireshark 1.8.* (tested on Wireshark 1.8.3). I haven't gotten around to Wireshark 1.6.* support yet. Unfortunately, matshark might not work, since I didn't test it. May I ask which you use?
If you get a chance, let me know if you have any issues. This update changes the semantics of pyshark a little, and was made in haste, so there could be some issues that pop up.
Thanks,
Armen
— Reply to this email directly or view it on GitHub.
After successfully building wireshark-1.8.3 on Ubuntu 12.04, I am able to build sharktools (i.e., pyshark), but failing on sharktools_test.
My setup is as follows - note wireshark and other required libs installed to /usr/local/lib vs /usr/lib:
./configure --with-wireshark-src=/home/dsalmen/wireshark-1.8.3 --enable-pyshark --with-wireshark-libpath=/usr/local/lib
Some detail as I was trying to figure out where it went wrong:
cd src make clean make sharktools
gcc -pthread -o pyshark.os -c -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DSWIG_GLOBAL -I/usr/include/python2.7 -I. -I/home/dsalmen/wireshark-1.8.3 -I/home/dsalmen/wireshark-1.8.3/wiretap -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include pyshark.c In file included from pyshark.c:58:0: sharktools_core.h:143:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] In file included from /usr/include/python2.7/Python.h:8:0, from ./pyshark.h:5, from pyshark.c:62: /usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default] /usr/include/features.h:215:0: note: this is the location of the previous definition gcc -o sharktools_cfile.o -c -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 -I. -I/home/dsalmen/wireshark-1.8.3 -I/home/dsalmen/wireshark-1.8.3/wiretap -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include sharktools_cfile.c gcc -o sharktools_core.o -c -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 -I. -I/home/dsalmen/wireshark-1.8.3 -I/home/dsalmen/wireshark-1.8.3/wiretap -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include sharktools_core.c gcc -o sharktools_add_decode_as.o -c -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 -I. -I/home/dsalmen/wireshark-1.8.3 -I/home/dsalmen/wireshark-1.8.3/wiretap -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include sharktools_add_decode_as.c gcc -o sharktools_frame_data.o -c -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 -I. -I/home/dsalmen/wireshark-1.8.3 -I/home/dsalmen/wireshark-1.8.3/wiretap -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include sharktools_frame_data.c gcc -o sharktools_epan.o -c -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 -I. -I/home/dsalmen/wireshark-1.8.3 -I/home/dsalmen/wireshark-1.8.3/wiretap -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include sharktools_epan.c --- making sharktools --- ar rc libsharktools.a sharktools_cfile.o sharktools_core.o sharktools_add_decode_as.o sharktools_frame_data.o sharktools_epan.o ranlib libsharktools.a --- making pyshark --- gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -o pyshark.so -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_M
make sharktools_test
gcc -o sharktools_test.o -c -g -Wall -DHAVE_CONFIG_H -fPIC -O2 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDEBUG=0 -DWIRESHARK_1_8_0=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 -I. -I/home/dsalmen/wireshark-1.8.3 -I/home/dsalmen/wireshark-1.8.3/wiretap -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include sharktools_test.c
--- making sharktools_test ---
gcc -o sharktools_test sharktools_test.o -L. -Wl,--export-dynamic -pthread -lgmodule-2.0 -lrt -lglib-2.0 -Wl,-rpath=/usr/local/lib -L/usr/local/lib -lwireshark -lwiretap -lwsutil -lsharktools
./libsharktools.a(sharktools_core.o): In function get_field_data': /home/dsalmen/sharktools/src/sharktools_core.c:599: undefined reference to
tvb_length_remaining'
/home/dsalmen/sharktools/src/sharktools_core.c:608: undefined reference to tvb_get_ptr' ./libsharktools.a(sharktools_core.o): In function
get_field_hex_value2':
/home/dsalmen/sharktools/src/sharktools_core.c:934: undefined reference to ep_alloc' ./libsharktools.a(sharktools_core.o): In function
get_node_field_value_as_string':
/home/dsalmen/sharktools/src/sharktools_core.c:840: undefined reference to hf_text_only' /home/dsalmen/sharktools/src/sharktools_core.c:885: undefined reference to
proto_construct_match_selected_string'
./libsharktools.a(sharktools_core.o): In function get_field_hex_value2': /home/dsalmen/sharktools/src/sharktools_core.c:917: undefined reference to
tvb_length_remaining'
./libsharktools.a(sharktools_core.o): In function proto_tree_get_node_field_values': /home/dsalmen/sharktools/src/sharktools_core.c:831: undefined reference to
proto_tree_children_foreach'
./libsharktools.a(sharktools_core.o): In function cf_open': /home/dsalmen/sharktools/src/sharktools_core.c:231: undefined reference to
wtap_open_offline'
/home/dsalmen/sharktools/src/sharktools_core.c:240: undefined reference to cleanup_dissection' /home/dsalmen/sharktools/src/sharktools_core.c:244: undefined reference to
init_dissection'
/home/dsalmen/sharktools/src/sharktools_core.c:265: undefined reference to wtap_file_type' /home/dsalmen/sharktools/src/sharktools_core.c:269: undefined reference to
wtap_snapshot_length'
/home/dsalmen/sharktools/src/sharktools_core.c:278: undefined reference to nstime_set_zero' /home/dsalmen/sharktools/src/sharktools_core.c:279: undefined reference to
nstime_set_unset'
/home/dsalmen/sharktools/src/sharktools_core.c:280: undefined reference to nstime_set_unset' /home/dsalmen/sharktools/src/sharktools_core.c:281: undefined reference to
nstime_set_unset'
./libsharktools.a(sharktools_core.o): In function cf_open_error_message': /home/dsalmen/sharktools/src/sharktools_core.c:219: undefined reference to
file_open_error_message'
/home/dsalmen/sharktools/src/sharktools_core.c:210: undefined reference to wtap_strerror' /home/dsalmen/sharktools/src/sharktools_core.c:162: undefined reference to
wtap_file_type_string'
./libsharktools.a(sharktools_core.o): In function proto_tree_get_fields': /home/dsalmen/sharktools/src/sharktools_core.c:970: undefined reference to
proto_tree_children_foreach'
./libsharktools.a(sharktools_core.o): In function process_packet': /home/dsalmen/sharktools/src/sharktools_core.c:989: undefined reference to
wtap_phdr'
/home/dsalmen/sharktools/src/sharktools_core.c:990: undefined reference to wtap_pseudoheader' /home/dsalmen/sharktools/src/sharktools_core.c:991: undefined reference to
wtap_buf_ptr'
/home/dsalmen/sharktools/src/sharktools_core.c:1001: undefined reference to epan_dissect_init' /home/dsalmen/sharktools/src/sharktools_core.c:1003: undefined reference to
frame_data_init'
/home/dsalmen/sharktools/src/sharktools_core.c:1005: undefined reference to frame_data_set_before_dissect' /home/dsalmen/sharktools/src/sharktools_core.c:1012: undefined reference to
epan_dissect_prime_dfilter'
/home/dsalmen/sharktools/src/sharktools_core.c:1015: undefined reference to tap_queue_init' /home/dsalmen/sharktools/src/sharktools_core.c:1020: undefined reference to
epan_dissect_run'
/home/dsalmen/sharktools/src/sharktools_core.c:1022: undefined reference to tap_push_tapped_queue' /home/dsalmen/sharktools/src/sharktools_core.c:1026: undefined reference to
dfilter_apply_edt'
/home/dsalmen/sharktools/src/sharktools_core.c:1040: undefined reference to epan_dissect_cleanup' /home/dsalmen/sharktools/src/sharktools_core.c:1041: undefined reference to
frame_data_cleanup'
/home/dsalmen/sharktools/src/sharktools_core.c:1033: undefined reference to frame_data_set_after_dissect' ./libsharktools.a(sharktools_core.o): In function
sharktools_preload_libs':
/home/dsalmen/sharktools/src/sharktools_core.c:1062: undefined reference to g_module_open' /home/dsalmen/sharktools/src/sharktools_core.c:1070: undefined reference to
g_module_open'
./libsharktools.a(sharktools_core.o): In function sharktools_init': /home/dsalmen/sharktools/src/sharktools_core.c:1114: undefined reference to
epan_get_version'
/home/dsalmen/sharktools/src/sharktools_core.c:1132: undefined reference to init_process_policies' /home/dsalmen/sharktools/src/sharktools_core.c:1144: undefined reference to
register_all_protocol_handoffs'
/home/dsalmen/sharktools/src/sharktools_core.c:1144: undefined reference to register_all_protocols' /home/dsalmen/sharktools/src/sharktools_core.c:1144: undefined reference to
epan_init'
/home/dsalmen/sharktools/src/sharktools_core.c:1116: undefined reference to epan_get_version' /home/dsalmen/sharktools/src/sharktools_core.c:1117: undefined reference to
epan_get_version'
./libsharktools.a(sharktools_core.o): In function sharktools_cleanup': /home/dsalmen/sharktools/src/sharktools_core.c:1166: undefined reference to
epan_cleanup'
./libsharktools.a(sharktools_core.o): In function sharktools_count': /home/dsalmen/sharktools/src/sharktools_core.c:1216: undefined reference to
dfilter_compile'
./libsharktools.a(sharktools_core.o): In function sprintf': /usr/include/x86_64-linux-gnu/bits/stdio2.h:34: undefined reference to
dfilter_error_msg'
./libsharktools.a(sharktools_core.o): In function sharktools_count': /home/dsalmen/sharktools/src/sharktools_core.c:1236: undefined reference to
dfilter_free'
/home/dsalmen/sharktools/src/sharktools_core.c:1248: undefined reference to wtap_read' /home/dsalmen/sharktools/src/sharktools_core.c:1267: undefined reference to
dfilter_free'
/home/dsalmen/sharktools/src/sharktools_core.c:1268: undefined reference to wtap_close' ./libsharktools.a(sharktools_core.o): In function
sharktools_get_cb':
/home/dsalmen/sharktools/src/sharktools_core.c:1304: undefined reference to dfilter_compile' ./libsharktools.a(sharktools_core.o): In function
sprintf':
/usr/include/x86_64-linux-gnu/bits/stdio2.h:34: undefined reference to dfilter_error_msg' ./libsharktools.a(sharktools_core.o): In function
sharktools_get_cb':
/home/dsalmen/sharktools/src/sharktools_core.c:1324: undefined reference to dfilter_free' /home/dsalmen/sharktools/src/sharktools_core.c:1346: undefined reference to
wtap_read'
/home/dsalmen/sharktools/src/sharktools_core.c:1392: undefined reference to dfilter_free' /home/dsalmen/sharktools/src/sharktools_core.c:1393: undefined reference to
wtap_close'
./libsharktools.a(sharktools_core.o): In function sharktools_iter_init': /home/dsalmen/sharktools/src/sharktools_core.c:1424: undefined reference to
dfilter_compile'
./libsharktools.a(sharktools_core.o): In function sprintf': /usr/include/x86_64-linux-gnu/bits/stdio2.h:34: undefined reference to
dfilter_error_msg'
./libsharktools.a(sharktools_core.o): In function sharktools_iter_init': /home/dsalmen/sharktools/src/sharktools_core.c:1443: undefined reference to
dfilter_free'
./libsharktools.a(sharktools_core.o): In function sharktools_iter_next': /home/dsalmen/sharktools/src/sharktools_core.c:1470: undefined reference to
wtap_read'
./libsharktools.a(sharktools_core.o): In function sharktools_iter_cleanup': /home/dsalmen/sharktools/src/sharktools_core.c:1505: undefined reference to
dfilter_free'
/home/dsalmen/sharktools/src/sharktools_core.c:1507: undefined reference to wtap_close' ./libsharktools.a(sharktools_add_decode_as.o): In function
find_protocol_name_func':
/home/dsalmen/sharktools/src/sharktools_add_decode_as.c:91: undefined reference to dissector_handle_get_protocol_index' /home/dsalmen/sharktools/src/sharktools_add_decode_as.c:93: undefined reference to
proto_get_protocol_filter_name'
./libsharktools.a(sharktools_add_decode_as.o): In function add_decode_as': /home/dsalmen/sharktools/src/sharktools_add_decode_as.c:168: undefined reference to
find_dissector_table'
/home/dsalmen/sharktools/src/sharktools_add_decode_as.c:208: undefined reference to get_dissector_table_selector_type' /home/dsalmen/sharktools/src/sharktools_add_decode_as.c:270: undefined reference to
dissector_table_foreach_handle'
/home/dsalmen/sharktools/src/sharktools_add_decode_as.c:284: undefined reference to proto_get_id_by_filter_name' /home/dsalmen/sharktools/src/sharktools_add_decode_as.c:329: undefined reference to
dissector_change_string'
/home/dsalmen/sharktools/src/sharktools_add_decode_as.c:320: undefined reference to dissector_change_uint' ./libsharktools.a(sharktools_add_decode_as.o): In function
remove_decode_as':
/home/dsalmen/sharktools/src/sharktools_add_decode_as.c:409: undefined reference to find_dissector_table' /home/dsalmen/sharktools/src/sharktools_add_decode_as.c:449: undefined reference to
get_dissector_table_selector_type'
/home/dsalmen/sharktools/src/sharktools_add_decode_as.c:511: undefined reference to dissector_table_foreach_handle' /home/dsalmen/sharktools/src/sharktools_add_decode_as.c:525: undefined reference to
proto_get_id_by_filter_name'
/home/dsalmen/sharktools/src/sharktools_add_decode_as.c:570: undefined reference to dissector_reset_string' /home/dsalmen/sharktools/src/sharktools_add_decode_as.c:561: undefined reference to
dissector_reset_uint'
collect2: ld returned 1 exit status
make: *** [sharktools_test] Error 1
EMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PYTHON_H=1 pyshark.os -L. -Wl,--export-dynamic -pthread -lgmodule-2.0 -lrt -lglib-2.0 -Wl,-rpath=/usr/local/lib -L/usr/local/lib -lwireshark -lwiretap -lwsutil -lsharktools
Note - I am able to successfully run the test_pyshark.sh script after i run "make pyshark" in sharktools/src and copy pyshark.so to /usr/local/lib/python2.7/dist-packages/pyshark.
Oof, yeah. I'm pretty sure I ran into the same or similar error at some point with sharktools_test. I really should have deprecated/removed sharktools_test from the Makefile.
I did, however, update the pyshark-related scripts in the tests directory, as you note. I think there are 4 test cases in tests/pysharktest.py that fail, and I'll get around to fixing that soon.
Armen
Armen,
How about for now we just take those tests out of the the all
clause in the Makefile until someone gets around to fixing them?
omar