Compile sshdump and ciscodump for Windows

Use libSSH 0.7.2 compiled with MinGW(32|64) and linked with zlib and gcrypt support

Change-Id: I7c17d1ba3dd1890e2f83c119f5ea851834807e43
Reviewed-on: https://code.wireshark.org/review/12117
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Pascal Quantin 2015-11-24 23:03:13 +01:00 committed by Anders Broman
parent c3574ed417
commit ae316e2d88
18 changed files with 81 additions and 34 deletions

View File

@ -1325,6 +1325,7 @@ set(INSTALL_FILES
${CMAKE_BINARY_DIR}/doc/androiddump.html
${CMAKE_BINARY_DIR}/doc/capinfos.html
${CMAKE_BINARY_DIR}/doc/captype.html
${CMAKE_BINARY_DIR}/doc/ciscodump.html
${CMAKE_BINARY_DIR}/doc/dftest.html
${CMAKE_BINARY_DIR}/doc/dumpcap.html
${CMAKE_BINARY_DIR}/doc/editcap.html

View File

@ -819,7 +819,7 @@ randpkt_core:: help config.h version.h doxygen
$(MAKE) /$(MAKEFLAGS) /f Makefile.nmake librandpkt_core.lib
cd ..
extcap::
extcap:: writecap
cd extcap
$(MAKE) /$(MAKEFLAGS) /f Makefile.nmake all
cd ..
@ -1077,8 +1077,8 @@ process_libs:
!ENDIF
!IFDEF LIBSSH_DIR
@$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
libssh-$(LIBSSH_PKG)-$(WIRESHARK_TARGET_PLATFORM)ws \
libssh-$(LIBSSH_PKG)-$(WIRESHARK_TARGET_PLATFORM)ws.zip \
. \
libssh-0.7.2-$(WIRESHARK_TARGET_PLATFORM)ws.zip \
"$(DOWNLOAD_TAG)" "$(WIRESHARK_TARGET_PLATFORM)"
!ENDIF
!IFDEF WINSPARKLE_DIR
@ -1155,6 +1155,7 @@ clean_setup:
rm -r -f libsmi-0.4.5
rm -r -f libsmi-0.4.8
rm -r -f libsmi-svn-40773-win??ws
rm -r -f libssh-0.7.2-win??ws
rm -r -f nasm-2.00
rm -r -f nasm-2.02
rm -r -f nasm-2.09.08
@ -1234,6 +1235,8 @@ install-generated-files: doc
if exist ".\extcap\randpktdump.pdb" xcopy ".\extcap\randpktdump.pdb" $(INSTALL_DIR)\extcap /d
if exist ".\extcap\sshdump.exe" xcopy ".\extcap\sshdump.exe" $(INSTALL_DIR)\extcap /d
if exist ".\extcap\sshdump.pdb" xcopy ".\extcap\sshdump.pdb" $(INSTALL_DIR)\extcap /d
if exist ".\extcap\ciscodump.exe" xcopy ".\extcap\ciscodump.exe" $(INSTALL_DIR)\extcap /d
if exist ".\extcap\ciscodump.pdb" xcopy ".\extcap\ciscodump.pdb" $(INSTALL_DIR)\extcap /d
if not exist $(INSTALL_DIR_QT)\extcap mkdir $(INSTALL_DIR_QT)\extcap
if exist ".\extcap\androiddump.exe" xcopy ".\extcap\androiddump.exe" $(INSTALL_DIR_QT)\extcap /d
if exist ".\extcap\androiddump.pdb" xcopy ".\extcap\androiddump.pdb" $(INSTALL_DIR_QT)\extcap /d
@ -1241,6 +1244,8 @@ install-generated-files: doc
if exist ".\extcap\randpktdump.pdb" xcopy ".\extcap\randpktdump.pdb" $(INSTALL_DIR_QT)\extcap /d
if exist ".\extcap\sshdump.exe" xcopy ".\extcap\sshdump.exe" $(INSTALL_DIR_QT)\extcap /d
if exist ".\extcap\sshdump.pdb" xcopy ".\extcap\sshdump.pdb" $(INSTALL_DIR_QT)\extcap /d
if exist ".\extcap\ciscodump.exe" xcopy ".\extcap\ciscodump.exe" $(INSTALL_DIR_QT)\extcap /d
if exist ".\extcap\ciscodump.pdb" xcopy ".\extcap\ciscodump.pdb" $(INSTALL_DIR_QT)\extcap /d
if exist capinfos.exe xcopy capinfos.exe $(INSTALL_DIR) /d
if exist capinfos.pdb xcopy capinfos.pdb $(INSTALL_DIR) /d
if exist captype.exe xcopy captype.exe $(INSTALL_DIR) /d

View File

@ -86,7 +86,7 @@ else ()
CACHE PATH "Path to libssh DLL"
)
file(GLOB _libssh_dll RELATIVE "${LIBSSH_DLL_DIR}"
"${LIBSSH_DLL_DIR}/ssh.dll"
"${LIBSSH_DLL_DIR}/libssh.dll"
)
set(LIBSSH_DLL ${_libssh_dll}
# We're storing filenames only. Should we use STRING instead?

View File

@ -434,7 +434,7 @@ GCC_DLL=libgcc_s_sjlj-1.dll
# If you don't have libssh, comment this line out so that LIBSSH_DIR
# isn't defined.
#
#LIBSSH_DIR=$(WIRESHARK_LIB_DIR)\libssh-0.7.2
LIBSSH_DIR=$(WIRESHARK_LIB_DIR)\libssh-0.7.2-win32ws
#
# Optional: the KFW library enables kerberos/sasl/dcerpc decryption.
@ -674,6 +674,14 @@ GNUTLS_PKG=3.2.15-2.9
GPGERROR_DLL=libgpg-error6-0.dll
GCC_DLL=libgcc_s_seh-1.dll
#
# Optional: libssh library is required for sshdump support
#
# If you don't have libssh, comment this line out so that LIBSSH_DIR
# isn't defined.
#
LIBSSH_DIR=$(WIRESHARK_LIB_DIR)\libssh-0.7.2-win64ws
#
# Optional: the KFW library enables kerberos/sasl/dcerpc decryption.
#

View File

@ -1,4 +1,5 @@
obj-*/doc/androiddump.1
obj-*/doc/ciscodump.1
obj-*/doc/sshdump.1
obj-*/doc/randpktdump.1
obj-*/doc/editcap.1

View File

@ -97,6 +97,7 @@ set(MAN1_INSTALL_FILES
${CMAKE_CURRENT_BINARY_DIR}/androiddump.1
${CMAKE_CURRENT_BINARY_DIR}/capinfos.1
${CMAKE_CURRENT_BINARY_DIR}/captype.1
${CMAKE_CURRENT_BINARY_DIR}/ciscodump.1
${CMAKE_CURRENT_BINARY_DIR}/dftest.1
${CMAKE_CURRENT_BINARY_DIR}/dumpcap.1
${CMAKE_CURRENT_BINARY_DIR}/editcap.1
@ -124,6 +125,7 @@ set(HTML_INSTALL_FILES
${CMAKE_CURRENT_BINARY_DIR}/androiddump.html
${CMAKE_CURRENT_BINARY_DIR}/capinfos.html
${CMAKE_CURRENT_BINARY_DIR}/captype.html
${CMAKE_CURRENT_BINARY_DIR}/ciscodump.html
${CMAKE_CURRENT_BINARY_DIR}/dftest.html
${CMAKE_CURRENT_BINARY_DIR}/dumpcap.html
${CMAKE_CURRENT_BINARY_DIR}/editcap.html

View File

@ -86,7 +86,7 @@ man_MANS =
noinst_DATA = asn2deb.1 asn2deb.html idl2deb.1 idl2deb.html idl2wrs.1 idl2wrs.html
pkgdata_DATA = AUTHORS-SHORT $(top_srcdir)/docbook/ws.css wireshark.html \
tshark.html wireshark-filter.html capinfos.html editcap.html \
tshark.html wireshark-filter.html capinfos.html ciscodump.html editcap.html \
mergecap.html reordercap.html text2pcap.html dumpcap.html androiddump.html \
sshdump.html randpktdump.html rawshark.html dftest.html randpkt.html \
extcap.html
@ -237,6 +237,13 @@ sshdump.html: sshdump.pod ../config.h $(top_srcdir)/docbook/ws.css
--noindex \
$(srcdir)/sshdump.pod > sshdump.html
ciscodump.html: ciscodump.pod ../config.h $(top_srcdir)/docbook/ws.css
$(AM_V_POD2HTML)$(POD2HTML) \
--title="ciscodump - The Wireshark Network Analyzer $(VERSION)" \
--css=$(POD_CSS_URL) \
--noindex \
$(srcdir)/ciscodump.pod > ciscodump.html
randpktdump.html: randpktdump.pod ../config.h $(top_srcdir)/docbook/ws.css
$(AM_V_POD2HTML)$(POD2HTML) \
--title="randpktdump - The Wireshark Network Analyzer $(VERSION)" \
@ -307,6 +314,7 @@ EXTRA_DIST = \
asn2deb.pod \
capinfos.pod \
captype.pod \
ciscodump.pod \
dfilter2pod.pl \
dftest.pod \
dumpcap.pod \
@ -326,7 +334,7 @@ EXTRA_DIST = \
rawshark.pod \
reordercap.pod \
sgml.doc.template \
sshdump.pod \
sshdump.pod \
text2pcap.pod \
tshark.pod \
wireshark-filter.pod \

View File

@ -25,7 +25,7 @@
include ../config.nmake
doc: wireshark.html tshark.html wireshark-filter.html capinfos.html \
editcap.html idl2wrs.html mergecap.html reordercap.html \
ciscodump.html editcap.html idl2wrs.html mergecap.html reordercap.html \
text2pcap.html dumpcap.html androiddump.html sshdump.html rawshark.html \
dftest.html randpkt.html randpktdump.html \
idl2deb.html asn2deb.html extcap.html
@ -33,7 +33,7 @@ doc: wireshark.html tshark.html wireshark-filter.html capinfos.html \
man: wireshark.1 tshark.1 wireshark-filter.4 capinfos.1 \
editcap.1 idl2wrs.1 mergecap.1 reordercap.1 \
text2pcap.1 dumpcap.1 androiddump.1 sshdump.1 rawshark.1 dftest.1 randpkt.1 \
idl2deb.1 asn2deb.1 extcap.4 randpktdump.1
idl2deb.1 asn2deb.1 extcap.4 randpktdump.1 ciscodump.1
wireshark.pod: wireshark.pod.template AUTHORS-SHORT-FORMAT
copy /B wireshark.pod.template + AUTHORS-SHORT-FORMAT wireshark.pod
@ -249,6 +249,19 @@ sshdump.html: sshdump.pod ../config.h ws.css
--noindex \
sshdump.pod > sshdump.html
ciscodump.1: ciscodump.pod ../config.h
$(POD2MAN) \
--center="The Wireshark Network Analyzer" \
--release=$(VERSION) \
ciscodump.pod > ciscodump.1
ciscodump.html: ciscodump.pod ../config.h ws.css
$(POD2HTML) \
--title="ciscodump - The Wireshark Network Analyzer $(VERSION)" \
--css=ws.css \
--noindex \
ciscodump.pod > ciscodump.html
randpktdump.1: randpktdump.pod ../config.h
$(POD2MAN) \
--center="The Wireshark Network Analyzer" \

View File

@ -211,7 +211,7 @@ static void extcap_foreach(gint argc, gchar **args, extcap_cb_t cb,
&command_output, NULL, &exit_status, NULL);
if (status && exit_status == 0)
keep_going = cb(extcap_path->str, ifname, command_output, cb_data, err_str);
keep_going = cb(extcap_path->str, ifname, command_output, cb_data, err_str);
g_free(argv[0]);
g_free(command_output);

View File

@ -76,7 +76,7 @@ ciscodump_LIBS = $(ciscodump_WSLIBS) \
EXECUTABLES=androiddump.exe randpktdump.exe
!IFDEF LIBSSH_DIR
EXECUTABLES += sshdump.exe ciscodump.exe
EXECUTABLES = $(EXECUTABLES) sshdump.exe ciscodump.exe
!ENDIF
all: $(EXECUTABLES)

View File

@ -22,6 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "ssh-base.h"
#include <extcap/extcap-base.h>

View File

@ -26,6 +26,7 @@
#include <extcap/extcap-base.h>
#include <wsutil/interface.h>
#include <wsutil/file_util.h>
#include <extcap/ssh-base.h>
#include <errno.h>
@ -90,7 +91,7 @@ static void ssh_loop_read(ssh_channel channel, int fd)
/* read from stdin until data are available */
do {
nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE, 0);
if (write(fd, buffer, nbytes) != nbytes) {
if (ws_write(fd, buffer, nbytes) != nbytes) {
errmsg_print("ERROR reading: %s", g_strerror(errno));
return;
}
@ -99,7 +100,7 @@ static void ssh_loop_read(ssh_channel channel, int fd)
/* read loop finished... maybe something wrong happened. Read from stderr */
do {
nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE, 1);
if (write(STDERR_FILENO, buffer, nbytes) != nbytes) {
if (ws_write(STDERR_FILENO, buffer, nbytes) != nbytes) {
return;
}
} while(nbytes > 0);
@ -188,9 +189,9 @@ static int ssh_open_remote_connection(const char* hostname, const unsigned int p
if (g_strcmp0(fifo, "-")) {
/* Open or create the output file */
fd = open(fifo, O_WRONLY);
fd = ws_open(fifo, O_WRONLY, 0640);
if (fd == -1) {
fd = open(fifo, O_WRONLY | O_CREAT, 0640);
fd = ws_open(fifo, O_WRONLY | O_CREAT, 0640);
if (fd == -1) {
errmsg_print("Error creating output file: %s", g_strerror(errno));
return EXIT_FAILURE;
@ -222,7 +223,7 @@ cleanup:
ssh_cleanup(&sshs, &channel);
if (g_strcmp0(fifo, "-"))
close(fd);
ws_close(fd);
return ret;
}
@ -258,7 +259,7 @@ static void help(const char* binname)
printf(" --remote-filter <filter>: a filter for remote capture (default: don't listen on local local interfaces IPs)\n");
}
static char* interfaces_list_to_filter(GSList* interfaces, unsigned int remote_port)
static char* interfaces_list_to_filter(GSList* interfaces, const unsigned int remote_port)
{
GString* filter = g_string_new(NULL);
GSList* cur;

View File

@ -132,7 +132,7 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.nsh" "${_config_nsh_contents}")
set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/all-manifest.nsh")
set(_all_manifest_contents "# Files required for all sections. Generated by CMake.\n")
foreach(_dll ${GLIB2_DLLS} ${CARES_DLL} ${GCRYPT_DLLS} ${GEOIP_DLL}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LUA_DLL} ${SMI_DLL}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LUA_DLL} ${SMI_DLL} ${LIBSSH_DLL}
${WINSPARKLE_DLL} ${ZLIB_DLL}
)
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")

View File

@ -22,12 +22,14 @@ DLL=../../wiretap/wiretap-$(WTAP_VERSION).dll ../../wsutil/libwsutil.dll ../../c
DOC=../../doc/ws.css \
../../doc/androiddump.html \
../../doc/capinfos.html \
../../doc/ciscodump.html \
../../doc/dumpcap.html \
../../doc/editcap.html \
../../doc/extcap.html \
../../doc/mergecap.html \
../../doc/randpktdump.html \
../../doc/rawshark.html \
../../doc/sshdump.html \
../../doc/text2pcap.html \
../../doc/tshark.html \
../../doc/wireshark-filter.html \
@ -37,9 +39,6 @@ DOC=../../doc/ws.css \
$(STAGING_DIR)/README.txt \
$(STAGING_DIR)/README.windows.txt
#WIP: uncomment and add to the above when sshdump on windows will be ready to go
#../../doc/sshdump.html
GPL=../../COPYING
HELP=$(STAGING_DIR)/help/capture_filters.txt \
$(STAGING_DIR)/help/capturing.txt \
@ -176,6 +175,9 @@ all-manifest.nsh: Makefile.nmake ..\..\config.nmake
@echo # SMI >> $@
@echo File "$(STAGING_DIR)\libsmi-2.dll" >> $@
!ENDIF
!IFDEF LIBSSH_DIR
@echo File "$(STAGING_DIR)\libssh.dll" >> $@
!ENDIF
!IFDEF WINSPARKLE_DIR
@echo # WinSparkle >> $@
@echo File "$(STAGING_DIR)\WinSparkle.dll" >> $@

View File

@ -126,8 +126,8 @@ SetShellVarContext all
Push "${EXECUTABLE_MARKER}"
Push "androiddump"
;WIP: uncomment when sshdump on windows will be ready to go
;Push "sshdump"
Push "ciscodump"
Push "sshdump"
Push "dumpcap"
Push "${PROGRAM_NAME}"
Push "tshark"
@ -180,9 +180,9 @@ Delete "$INSTDIR\etc\gtk-2.0\*.*"
Delete "$INSTDIR\etc\gtk-3.0\*.*"
Delete "$INSTDIR\etc\pango\*.*"
Delete "$INSTDIR\extcap\androiddump.*"
;WIP: uncomment when sshdump on windows will be ready to go
;Delete "$INSTDIR\extcap\sshdump.*"
Delete "$INSTDIR\extcap\randpktdump.*"
Delete "$INSTDIR\extcap\sshdump.*"
Delete "$INSTDIR\extcap\ciscodump.*"
Delete "$INSTDIR\help\*.*"
Delete "$INSTDIR\iconengines\*.*"
Delete "$INSTDIR\imageformats\*.*"

View File

@ -1059,14 +1059,15 @@ SetOutPath $INSTDIR\extcap
File "${STAGING_DIR}\extcap\androiddump.exe"
SectionEnd
;WIP: uncomment this section when sshdump on windows will be ready to go
;Section /o "Sshdump" SecSshdumpinfos
Section /o "SSHdump" SecSSHdumpinfos
;-------------------------------------------
;SetOutPath $INSTDIR
;File "${STAGING_DIR}\sshdump.html"
;SetOutPath $INSTDIR\extcap
;File "${STAGING_DIR}\extcap\sshdump.exe"
;SectionEnd
SetOutPath $INSTDIR
File "${STAGING_DIR}\sshdump.html"
File "${STAGING_DIR}\ciscodump.html"
SetOutPath $INSTDIR\extcap
File "${STAGING_DIR}\extcap\sshdump.exe"
File "${STAGING_DIR}\extcap\ciscodump.exe"
SectionEnd
Section /o "Randpktdump" SecRandpktdumpinfos
;-------------------------------------------
@ -1122,8 +1123,7 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${SecToolsGroup} "Additional command line based tools."
!insertmacro MUI_DESCRIPTION_TEXT ${SecAndroiddumpinfos} "Provide capture interfaces from Android devices"
;WIP: uncomment this section when sshdump on windows will be ready to go
;!insertmacro MUI_DESCRIPTION_TEXT ${SecSshdumpinfos} "Provide remote capture through SSH"
!insertmacro MUI_DESCRIPTION_TEXT ${SecSSHdumpinfos} "Provide remote capture through SSH"
!insertmacro MUI_DESCRIPTION_TEXT ${SecRandpktdumpinfos} "Provide random packet generator"
!insertmacro MUI_DESCRIPTION_TEXT ${SecEditCap} "Copy packets to a new file, optionally trimmming packets, omitting them, or saving to a different format."
!insertmacro MUI_DESCRIPTION_TEXT ${SecText2Pcap} "Read an ASCII hex dump and write the data into a libpcap-style capture file."

View File

@ -113,6 +113,7 @@ $Win64Archives = @{
"gtk+-bundle_2.24.23-3.39_win64ws.zip" = "gtk2";
"kfw-3-2-2-x64-ws.zip" = "";
"libsmi-svn-40773-win64ws.zip" = "";
"libssh-0.7.2-win64ws.zip" = "";
"nasm-2.09.08-win32.zip" = "";
"portaudio_v19_2.zip" = "";
"upx303w.zip" = "";
@ -130,6 +131,7 @@ $Win32Archives = @{
"gtk+-bundle_2.24.23-1.1_win32ws.zip" = "gtk2";
"kfw-3-2-2-i386-ws-vc6.zip" = "";
"libsmi-svn-40773-win32ws.zip" = "";
"libssh-0.7.2-win32ws.zip" = "";
"nasm-2.09.08-win32.zip" = "";
"portaudio_v19_2.zip" = "";
"upx303w.zip" = "";
@ -182,6 +184,7 @@ $CleanupItems = @(
"lua5.2.?"
"libsmi-0.4.8"
"libsmi-svn-40773-win??ws"
"libssh-0.7.2-win??ws"
"nasm-2.09.08"
"portaudio_v19"
"portaudio_v19_2"

View File

@ -544,6 +544,7 @@ win32 {
$${GNUTLS_DIR}/bin/libintl-8.dll $${SMI_DIR}/bin/libsmi-2.dll \
$${LUA_DIR}/lua52.dll \
$${GEOIP_DIR}/bin/libGeoIP-1.dll \
$${LIBSSH_DIR}/bin/libssh.dll \
$${WINSPARKLE_DIR}/WinSparkle.dll \
../../colorfilters ../../dfilters ../../cfilters