Logshark: Add initial UI.

Add a separate UI application named "Logshark". It's currently a very
thin superclass of Wireshark, but that will change over time. Based on
work by Loris Degioanni.
This commit is contained in:
Gerald Combs 2021-12-23 13:55:15 -08:00
parent 2fdf85c6eb
commit 245f988e9e
9 changed files with 16093 additions and 792 deletions

View File

@ -1178,8 +1178,8 @@ ws_find_package(PCAP ENABLE_PCAP HAVE_LIBPCAP)
ws_find_package(AIRPCAP ENABLE_AIRPCAP HAVE_AIRPCAP)
ws_find_package(Systemd BUILD_sdjournal HAVE_SYSTEMD)
# Build the Qt GUI?
if(BUILD_wireshark)
# Build one of the Qt GUIs?
if(BUILD_wireshark OR BUILD_logshark)
if(USE_qt6)
set(qtver "6")
if(DEFINED ENV{WIRESHARK_QT6_PREFIX_PATH})
@ -1340,7 +1340,7 @@ find_package( Asciidoctor 1.5 )
find_package(DOXYGEN)
# The SpeexDSP resampler is required iff building wireshark or sharkd.
if(BUILD_wireshark OR BUILD_sharkd)
if(BUILD_wireshark OR BUILD_logshark OR BUILD_sharkd)
# We don't provide a binary package for SpeexDSP in our repository.
# If using the repository don't bother searching for a system SpeexDSP
# installation and just use the bundled resampler code instead.
@ -1583,6 +1583,10 @@ if(BUILD_wireshark AND QT_FOUND)
add_subdirectory( ui/qt )
endif()
if(BUILD_logshark AND QT_FOUND)
add_subdirectory( ui/qt_logshark )
endif()
# Location of our plugins. PLUGIN_DIR should allow running
# from the build directory similar to DATAFILE_DIR above.
if(ENABLE_PLUGINS)
@ -1710,7 +1714,8 @@ set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CFG_OUT_FILES
doxygen.cfg
packaging/macosx/Info.plist
packaging/macosx/WiresharkInfo.plist
packaging/macosx/LogsharkInfo.plist
packaging/macosx/osx-app.sh
packaging/macosx/osx-dmg.sh
packaging/macosx/wireshark-app.dmgbuild
@ -2432,6 +2437,22 @@ if(BUILD_wireshark AND QT_FOUND)
set_executable_resources(wireshark "Wireshark" UNIQUE_RC)
endif()
if(BUILD_logshark AND QT_FOUND)
set(LOGSHARK_SRC
file.c
fileset.c
${PLATFORM_UI_SRC}
)
set(logshark_FILES
$<TARGET_OBJECTS:capture_opts>
$<TARGET_OBJECTS:ui_qt_logshark>
$<TARGET_OBJECTS:shark_common>
${LOGSHARK_SRC}
${PLATFORM_UI_RC_FILES}
)
set_executable_resources(logshark "Logshark" UNIQUE_RC)
endif()
if(ENABLE_APPLICATION_BUNDLE)
#
# Add -Wl,-single_module to the LDFLAGS used with shared
@ -2553,7 +2574,7 @@ if(BUILD_wireshark AND QT_FOUND)
endif()
set_target_properties(
wireshark PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/Info.plist
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/WiresharkInfo.plist
)
if(CMAKE_CFG_INTDIR STREQUAL ".")
# Add a wrapper script which opens the bundle. This adds
@ -2606,6 +2627,109 @@ if(BUILD_wireshark AND QT_FOUND)
endif(QT_WINDEPLOYQT_EXECUTABLE)
endif()
if(BUILD_logshark AND QT_FOUND)
set(logshark_LIBS
ui
capchild
caputils
wiretap
epan
version_info
${QT_LIBRARIES}
${APPLE_APPLICATION_SERVICES_LIBRARY}
${APPLE_APPKIT_LIBRARY}
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
${SPARKLE_LIBRARIES}
${WIN_WS2_32_LIBRARY}
${WIN_VERSION_LIBRARY}
${WINSPARKLE_LIBRARIES}
$<$<BOOL:${WIN32}>:UxTheme.lib>
${SPEEXDSP_LIBRARIES}
${MINIZIP_LIBRARIES}
)
add_executable(logshark WIN32 MACOSX_BUNDLE ${logshark_FILES} ${EXTRA_BUNDLE_FILES})
if(WIN32 AND NOT BUILD_wireshark)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT logshark)
endif()
set(PROGLIST ${PROGLIST} logshark)
set_target_properties(logshark PROPERTIES
LINK_FLAGS "${WS_LINK_FLAGS}"
FOLDER "Executables"
INSTALL_RPATH "${EXECUTABLE_INSTALL_RPATH}"
AUTOMOC ON
AUTOUIC ON
AUTORCC ON
)
if(MSVC)
set_target_properties(logshark PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
endif()
if(ENABLE_APPLICATION_BUNDLE OR WIN32)
set_target_properties(logshark PROPERTIES OUTPUT_NAME Logshark)
endif()
if(ENABLE_APPLICATION_BUNDLE)
if(ASCIIDOCTOR_FOUND)
# Make sure to generate files referenced by
# BUNDLE_RESOURCE_SHARE_MAN1_FILES
add_dependencies(logshark manpages)
endif()
set_target_properties(
logshark PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/LogsharkInfo.plist
)
if(CMAKE_CFG_INTDIR STREQUAL ".")
# Add a wrapper script which opens the bundle. This adds
# convenience but makes debugging more difficult.
# It is not created if using Xcode
# XXX Running run/Logshark.app/Contents/MacOS/Logshark works
# fine for me (Gerald) here on Mojave. Can we just make this a
# symlink?
file(REMOVE ${CMAKE_BINARY_DIR}/run/logshark)
file(WRITE ${CMAKE_BINARY_DIR}/run/logshark "#!/bin/sh\n")
file(APPEND ${CMAKE_BINARY_DIR}/run/logshark "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n")
file(APPEND ${CMAKE_BINARY_DIR}/run/logshark "# Wrapper script which should work around the issue described at\n")
file(APPEND ${CMAKE_BINARY_DIR}/run/logshark "# https://stackoverflow.com/questions/25318524/what-exactly-should-i-pass-to-nsapp-activateignoringotherapps-to-get-my-appl\n")
file(APPEND ${CMAKE_BINARY_DIR}/run/logshark "exec ${CMAKE_BINARY_DIR}/run/Logshark.app/Contents/MacOS/Logshark \"\$\@\"\n")
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/logshark)
endif()
endif()
target_link_libraries(logshark ${logshark_LIBS})
target_include_directories(logshark SYSTEM PRIVATE ${SPARKLE_INCLUDE_DIRS})
install(
TARGETS logshark
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(QT_WINDEPLOYQT_EXECUTABLE)
add_custom_target(copy_ls_qt_dlls ALL)
set_target_properties(copy_ls_qt_dlls PROPERTIES FOLDER "Copy Tasks")
# Will we ever need to use --debug? Windeployqt seems to
# be smart enough to copy debug DLLs when needed.
add_custom_command(TARGET copy_ls_qt_dlls
POST_BUILD
COMMAND set "PATH=${QT_BIN_PATH};%PATH%"
COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
--no-compiler-runtime
--verbose 0
$<$<BOOL:${MSVC}>:--pdb>
"$<TARGET_FILE:logshark>"
)
add_dependencies(copy_ls_qt_dlls logshark)
install(CODE "execute_process(COMMAND
\"${QT_WINDEPLOYQT_EXECUTABLE}\"
--no-compiler-runtime
\"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/Logshark.exe\")"
)
endif(QT_WINDEPLOYQT_EXECUTABLE)
endif()
# Common properties for CLI executables
macro(set_extra_executable_properties _executable _folder)
set_target_properties(${_executable} PROPERTIES

View File

@ -1,7 +1,8 @@
# Build options for use by CMake
option(BUILD_wireshark "Build Wireshark" ON)
if(BUILD_wireshark)
option(BUILD_logshark "Build Logshark" OFF)
if(BUILD_wireshark OR BUILD_logshark)
option(USE_qt6 "Use Qt6 instead of Qt5 - WIP, GUI developers only!" OFF)
endif()
option(BUILD_tshark "Build tshark" ON)

View File

@ -5,215 +5,25 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Wireshark</string>
<string>Logshark</string>
<key>CFBundleGetInfoString</key>
<string>@VERSION@, Copyright 1998-2022 Wireshark Development Team</string>
<key>CFBundleIconFile</key>
<string>Wireshark.icns</string>
<key>CFBundleIdentifier</key>
<string>org.wireshark.Wireshark</string>
<string>org.wireshark.Logshark</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>5vw</string>
<string>5vw.gz</string>
<string>scap</string>
<string>scap.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>InfoVista/Accellent 5View Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>apc</string>
<string>pkt</string>
<string>tpc</string>
<string>wpz</string>
<string>apc.gz</string>
<string>pkt.gz</string>
<string>tpc.gz</string>
<string>wpz.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>LiveAction/Savvius/WildPackets *Peek Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>bfr</string>
<string>bfr.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Viavi/Network Instruments Observer Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>erf</string>
<string>erf.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Endace ERF Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ipfix</string>
<string>ipfix.gz</string>
<!-- Don't register for .pfx: that extension
has another (more common) use.
-->
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>IPFIX Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mplog</string>
<string>mplog.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Micropross mplog Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pcap</string>
<string>pcap.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.tcpdump.pcap</string>
</array>
<key>CFBundleTypeName</key>
<string>Pcap Network Capture</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>PCAP</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pcapng</string>
<string>ntar</string>
<string>pcapng.gz</string>
<string>ntar.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Pcapng Network Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pklg</string>
<string>pklg.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>macOS PacketLogger Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>rf5</string>
<string>rf5.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Tektronix K12 Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>snoop</string>
<string>snoop.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Solaris snoop Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tr1</string>
<string>tr1.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Novell LANalyzer Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>trc0</string>
<string>trc0.gz</string>
<string>trc1</string>
<string>trc1.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>HP-UX nettl Packet Capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>vwr</string>
<string>vwr.gz</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Wiresharkdoc.icns</string>
<key>CFBundleTypeName</key>
<string>Ixia IxVeriWave Packet Capture</string>
<string>Sysdig capture</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
@ -226,7 +36,7 @@
<key>CFBundleShortVersionString</key>
<string>@VERSION@</string>
<key>CFBundleSignature</key>
<string>Wshk</string>
<string>Lshk</string>
<key>CFBundleVersion</key>
<string>@VERSION@</string>
<key>NSHumanReadableCopyright</key>
@ -243,7 +53,7 @@
<!-- Sparkle settings https://sparkle-project.org/documentation/customization/ -->
<key>SUFeedURL</key>
<string>https://www.wireshark.org/update/0/Wireshark/@PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_PATCH_VERSION@/macOS/x86-64/en-US/stable.xml</string>
<string>https://www.wireshark.org/update/0/Logshark/@PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_PATCH_VERSION@/macOS/x86-64/en-US/stable.xml</string>
<key>SUEnableAutomaticChecks</key>
<false/>
<key>SUPublicEDKey</key>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
<RCC>
<qresource prefix="/i18n">@i18n_qresource@
</qresource>
</RCC>

View File

@ -0,0 +1,24 @@
/* logshark_application.cpp
*
* Logshark - Event log analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "logshark_application.h"
LogsharkApplication *lsApp = NULL;
LogsharkApplication::LogsharkApplication(int &argc, char **argv) :
WiresharkApplication(argc, argv)
{
lsApp = this;
setApplicationName("Logshark");
}
LogsharkApplication::~LogsharkApplication()
{
lsApp = NULL;
}

View File

@ -0,0 +1,24 @@
/** @file
*
* Logshark - Event log analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef LOGSHARK_APPLICATION_H
#define LOGSHARK_APPLICATION_H
#include <wireshark_application.h>
class LogsharkApplication : public WiresharkApplication
{
public:
explicit LogsharkApplication(int &argc, char **argv);
~LogsharkApplication();
};
extern LogsharkApplication *lsApp;
#endif // LOGSHARK_APPLICATION_H

14183
ui/qt_logshark/logshark_en.ts Normal file

File diff suppressed because it is too large Load Diff

1090
ui/qt_logshark/ls_main.cpp Normal file

File diff suppressed because it is too large Load Diff