extcap: Add support for Android - androiddump

androiddump is extcap program that can be used with Android devices
(need Android SDK in system PATH). Supported is Logcat/Logger logs and
Bluetooth interfaces for all Android to this day (Lollipop).

Please note that it will work also for FirefoxOS.

Interfaces:
1. Logcat Main (binary or text)
2. Logcat System (binary or text)
3. Logcat Events (binary or text)
4. Logcat Radio (binary or text)
5. Logcat Crash (text; Lollipop)
6. Bluetooth Hcidump (<Kitkat)
7. Bluetooth Bluedroid External Parser (Kitkat)
8. Bluetooth BtsnoopNet (Lollipop)

Change-Id: I26e4cd1a37a6af805f8b932399b4aa44ee7b5a80
Reviewed-on: https://code.wireshark.org/review/7475
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
This commit is contained in:
Michal Labedzki 2015-02-14 19:10:21 +01:00
parent f3d2cb5881
commit b99cf21c25
8 changed files with 2227 additions and 2 deletions

View File

@ -763,6 +763,9 @@ endif()
if(HAVE_LIBSBC)
set(HAVE_SBC 1)
endif()
if(EXTCAP_ANDROIDDUMP_LIBPCAP)
set(ANDROIDDUMP_USE_LIBPCAP 1)
endif()
if (HAVE_LIBWINSPARKLE)
set(HAVE_SOFTWARE_UPDATE 1)
@ -2083,6 +2086,39 @@ if (WIN32)
endif()
endif()
if(BUILD_androiddump)
if(EXTCAP_ANDROIDDUMP_LIBPCAP)
if(HAVE_LIBPCAP)
set(androiddump_LIBS
${GLIB2_LIBRARIES}
${PCAP_LIBRARIES}
)
else()
message(FATAL_ERROR "You try to build androiddump with libpcap but do not have it")
endif()
else()
set(androiddump_LIBS
wiretap
${GLIB2_LIBRARIES}
${CMAKE_DL_LIBS}
)
endif()
set(androiddump_FILES
${GLIB2_LIBRARIES}
extcap/androiddump.c
)
set(COPY_CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap)
add_executable(androiddump ${androiddump_FILES})
add_dependencies(androiddump gitversion)
set_target_properties(androiddump PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(androiddump PROPERTIES FOLDER "Executables/Extcaps")
target_link_libraries(androiddump ${androiddump_LIBS})
install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${COPY_CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
COMMAND ${PERL_EXECUTABLE}

View File

@ -14,10 +14,12 @@ option(BUILD_capinfos "Build capinfos" ON)
option(BUILD_captype "Build captype" ON)
option(BUILD_randpkt "Build randpkt" ON)
option(BUILD_dftest "Build dftest" ON)
option(BUILD_androiddump "Build androiddump" ON)
option(AUTOGEN_dcerpc "Autogenerate DCE RPC dissectors" OFF)
option(AUTOGEN_pidl "Autogenerate pidl dissectors" OFF)
option(DISABLE_WERROR "Do not treat warnings as errors" OFF)
option(EXTCAP_ANDROIDDUMP_LIBPCAP "Build androiddump using libpcap" OFF)
option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (disables -Werror)" OFF)
option(ENABLE_CODE_ANALYSIS "Enable the compiler's static analyzer if possible" OFF)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (May be slow down)" OFF)

View File

@ -42,10 +42,11 @@ bin_PROGRAMS = \
@dumpcap_bin@ \
@reordercap_bin@ \
@rawshark_bin@ \
@androiddump_bin@ \
@echld_test_bin@
EXTRA_PROGRAMS = wireshark-gtk wireshark tshark tfshark capinfos captype editcap \
mergecap dftest randpkt text2pcap dumpcap reordercap rawshark \
mergecap dftest randpkt text2pcap dumpcap reordercap rawshark androiddump \
echld_test
#
@ -532,6 +533,21 @@ rawshark_LDADD = \
rawshark_CFLAGS = $(AM_CLEAN_CFLAGS)
if ENABLE_STATIC
androiddump_LDFLAGS = -Wl,-static -all-static
else
androiddump_LDFLAGS = -export-dynamic
endif
# Libraries and plugin flags with which to link androiddump.
androiddump_LDADD = \
wiretap/libwiretap.la \
wsutil/libwsutil.la \
@GLIB_LIBS@ \
@SOCKET_LIBS@
androiddump_CFLAGS = $(AM_CLEAN_CFLAGS)
# Libraries with which to link text2pcap.
text2pcap_LDADD = \
wsutil/libwsutil.la \

View File

@ -95,6 +95,10 @@ rawshark_SOURCES = \
$(SHARK_COMMON_SRC) \
rawshark.c
# androiddump specifics
androiddump_SOURCES = \
extcap/androiddump.c
# text2pcap specifics
text2pcap_SOURCES = \
pcapio.c \

View File

@ -397,6 +397,9 @@
first (like Motorola and SPARC, unlike Intel and VAX). */
#cmakedefine WORDS_BIGENDIAN 1
/* Build androiddump with libpcap instead of wireshark stuff */
#cmakedefine ANDROIDDUMP_USE_LIBPCAP 1
/* Large file support */
#cmakedefine _LARGEFILE_SOURCE
#cmakedefine _LARGEFILE64_SOURCE

View File

@ -2296,6 +2296,38 @@ fi
AC_SUBST(rawshark_bin)
AC_SUBST(rawshark_man)
dnl androiddump check
AC_MSG_CHECKING(whether to build androiddump)
AC_ARG_ENABLE(androiddump,
AC_HELP_STRING( [--enable-androiddump],
[build androiddump @<:@default=yes@:>@]),
androiddump=$enableval,enable_androiddump=yes)
if test "x$enable_androiddump" = "xyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_ARG_ENABLE(androiddump_use_libpcap,
AC_HELP_STRING( [--enable-androiddump-use-libpcap],
[build androiddump using libpcap @<:@default=no@:>@]),
androiddump_use_libpcap=$enableval,enable_androiddump_use_libpcap=no)
if test "x$enable_androiddump_use_libpcap" = "xyes" ; then
AC_DEFINE(ANDROIDDUMP_USE_LIBPCAP, 1, [Androiddump will use Libpcap])
fi
if test "x$enable_androiddump" = "xyes" ; then
androiddump_bin="androiddump\$(EXEEXT)"
androiddump_man=""
else
androiddump_bin=""
androiddump_man=""
fi
AC_SUBST(androiddump_bin)
AC_SUBST(androiddump_man)
# Enable/disable echld
AC_ARG_ENABLE(echld,
@ -3343,6 +3375,7 @@ echo " Build text2pcap : $enable_text2pcap"
echo " Build randpkt : $enable_randpkt"
echo " Build dftest : $enable_dftest"
echo " Build rawshark : $enable_rawshark"
echo " Build androiddump : $enable_androiddump"
echo " Build echld : $have_echld"
echo ""
echo " Save files as pcap-ng by default : $enable_pcap_ng_default"

2131
extcap/androiddump.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ fi
exit_status=0
for FILE in `git diff-index --cached --name-status ${COMMIT_ID} | grep -v "^D" | cut -f2 | grep "\.[ch]$"` ; do
for FILE in `git diff-index --cached --name-status ${COMMIT_ID} | grep -v "^D" | cut -f2 | grep "\.[ch]$" | grep -v "extcap/"` ; do
#Check if checkhf is good
./tools/checkhf.pl $FILE || exit_status=1