diff --git a/.editorconfig b/.editorconfig index 5721b26e..4bb1cfa6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,6 +8,12 @@ indent_style = space indent_size = 4 trim_trailing_whitespace = true +[*.{ps1,rtf}] +end_of_line = crlf + +[*.ps1] +indent_style = tab + [{.gitignore,*.desktop}] indent_size = 0 diff --git a/.gitattributes b/.gitattributes index a6efae89..cd335aad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,7 @@ * text eol=lf .* text eol=lf +*.bmp binary *.png binary *.icns binary *.ico binary diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index bad586b0..710ba9b9 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -2,6 +2,9 @@ name: Package on: workflow_dispatch: + secrets: + NPCAP_OEM_URL: + required: true workflow_call: secrets: NPCAP_OEM_URL: @@ -9,12 +12,189 @@ on: jobs: - package: - runs-on: ${{ matrix.os }} + build: + runs-on: ${{ matrix.os }}-latest strategy: + fail-fast: true matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu + arch: amd64 + target: x86_64-unknown-linux-gnu + - os: ubuntu + arch: i386 + target: i686-unknown-linux-gnu + - os: ubuntu + arch: arm64 + target: aarch64-unknown-linux-gnu + - os: ubuntu + arch: armhf + target: armv7-unknown-linux-gnueabihf + - os: macos + arch: amd64 + target: x86_64-apple-darwin + - os: macos + arch: arm64 + target: aarch64-apple-darwin + - os: windows + arch: amd64 + target: x86_64-pc-windows-msvc + - os: windows + arch: i386 + target: i686-pc-windows-msvc + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install dependencies + if: ${{ matrix.os == 'windows' }} + shell: powershell + run: .\resources\packaging\windows\scripts\npcap.ps1 -ARCH ${{ matrix.arch }} -OEM "${{ secrets.NPCAP_OEM_URL }}" + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + default: true + + - name: Add build targets + if: ${{ matrix.os == 'macos' }} + run: | + rustup target add \ + x86_64-apple-darwin \ + aarch64-apple-darwin + + - name: Add build targets + if: ${{ matrix.os == 'windows' }} + run: | + rustup target add ` + x86_64-pc-windows-msvc ` + i686-pc-windows-msvc + + - name: Install Cross + if: ${{ matrix.os == 'ubuntu' }} + run: cargo install cross --git https://github.com/cross-rs/cross + + - name: Build binary + if: ${{ matrix.os == 'ubuntu' }} + run: cross build --release --target ${{ matrix.target }} + + - name: Build binary + if: ${{ matrix.os == 'macos' || matrix.os == 'windows' }} + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target ${{ matrix.target }} + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: build-${{ matrix.os }} + path: | + target/*/release/sniffnet + target/*/release/sniffnet.exe + if-no-files-found: error + + deb: + runs-on: ubuntu-latest + container: + image: debian:latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install dependencies + run: apt update -y && apt install -y curl build-essential + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + default: true + + - name: Install packaging tools + run: cargo install cargo-deb + + - uses: actions/download-artifact@v3 + with: + name: build-ubuntu + path: target/ + + - name: Package for Debian-based Linux distros + shell: bash + run: | + targets=( + x86_64-unknown-linux-gnu + i686-unknown-linux-gnu + aarch64-unknown-linux-gnu + armv7-unknown-linux-gnueabihf + ) + mkdir artifacts + for target in "${targets[@]}"; do + cargo deb --no-build --no-strip --target $target + mv target/${target}/debian/*.deb artifacts/ + done + + - name: Upload package artifacts + uses: actions/upload-artifact@v3 + with: + name: deb + path: artifacts/ + + rpm: + runs-on: ubuntu-latest + container: + image: fedora:latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install dependencies + run: dnf update -y && dnf install -y @development-tools patchelf + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + default: true + + - name: Install packaging tools + run: cargo install cargo-generate-rpm + + - uses: actions/download-artifact@v3 + with: + name: build-ubuntu + path: target/ + + - name: Package for RPM-based Linux distros + shell: bash + run: | + targets=( + x86_64-unknown-linux-gnu + aarch64-unknown-linux-gnu + ) + mkdir artifacts + for target in "${targets[@]}"; do + patchelf --replace-needed libpcap.so.0.8 libpcap.so target/${target}/release/sniffnet + cargo generate-rpm --target $target + mv target/${target}/generate-rpm/*.rpm artifacts/ + done + + - name: Upload package artifacts + uses: actions/upload-artifact@v3 + with: + name: rpm + path: artifacts/ + + dmg: + runs-on: macos-latest + needs: build steps: - name: Checkout repository uses: actions/checkout@v3 @@ -24,80 +204,89 @@ jobs: with: toolchain: stable profile: minimal - components: rustfmt, clippy default: true - - name: Install Linux dependencies - if: matrix.os == 'ubuntu-latest' - run: sudo apt-get install libpcap-dev libasound2-dev - - - name: Install Windows dependency - npcap sdk - if: matrix.os == 'windows-latest' - run: | - Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "C:/npcap-sdk.zip" - Expand-Archive -LiteralPath C:/npcap-sdk.zip -DestinationPath C:/npcap-sdk - echo "LIB=C:/npcap-sdk/Lib/x64" >> $env:GITHUB_ENV - - - name: Install Windows dependency - npcap dll - if: matrix.os == 'windows-latest' - run: | - Invoke-WebRequest -Uri ${{secrets.NPCAP_OEM_URL}} -OutFile C:/npcap-oem.exe - C:/npcap-oem.exe /S - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release - - - name: Package for Debian-based Linux distros - if: matrix.os == 'ubuntu-latest' - run: | - cargo install cargo-deb - cargo deb - mkdir artifacts - mv target/debian/*.deb artifacts/ - -# doesn't work properly on ubuntu-latest! -# - name: Package for RPM-based Linux distros -# if: matrix.os == 'ubuntu-latest' -# run: | -# cargo install cargo-generate-rpm -# cargo generate-rpm -# mv target/generate-rpm/*.rpm artifacts/ - - - name: Package DMG for macOS - if: matrix.os == 'macOS-latest' + - name: Install packaging tools run: | cargo install cargo-bundle - cargo bundle --release - rm target/release/bundle/osx/sniffnet.app/Contents/Info.plist - cp resources/Info.plist target/release/bundle/osx/sniffnet.app/Contents/Info.plist - cp resources/wrapper.sh target/release/bundle/osx/sniffnet.app/Contents/MacOS/wrapper.sh brew install create-dmg + + - uses: actions/download-artifact@v3 + with: + name: build-macos + path: target/ + + - name: Package for macOS + run: | + cargo bundle --release + lipo -create -output target/release/bundle/osx/Sniffnet.app/Contents/MacOS/sniffnet \ + target/x86_64-apple-darwin/release/sniffnet \ + target/aarch64-apple-darwin/release/sniffnet + cp resources/packaging/macos/wrapper.sh \ + target/release/bundle/osx/Sniffnet.app/Contents/MacOS/wrapper.sh + cp resources/packaging/macos/Info.plist \ + target/release/bundle/osx/Sniffnet.app/Contents/Info.plist mkdir artifacts create-dmg \ --volname "Sniffnet Installer" \ - --background "resources/logos/bg_dmg.png" \ + --background "resources/packaging/macos/graphics/dmg_bg.png" \ --window-pos 200 120 \ --window-size 900 450 \ --icon-size 100 \ --app-drop-link 620 240 \ --icon "Sniffnet.app" 300 240 \ --hide-extension "Sniffnet.app" \ - "artifacts/sniffnet.dmg" \ + "artifacts/sniffnet-universal.dmg" \ "target/release/bundle/osx/" - - name: Package MSI for Windows - if: matrix.os == 'windows-latest' - run: | - cargo install cargo-wix - cargo wix --nocapture - mkdir artifacts - mv target/wix/*.msi artifacts/ - - - name: Upload artifacts + - name: Upload package artifacts uses: actions/upload-artifact@v3 with: - name: ${{ matrix.os }}-artifacts + name: dmg + path: artifacts/ + + msi: + runs-on: windows-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install dependencies + shell: powershell + run: .\resources\packaging\windows\scripts\wix.ps1 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + default: true + + - name: Install packaging tools + run: cargo install cargo-wix + + - uses: actions/download-artifact@v3 + with: + name: build-windows + path: target/ + + - name: Package for Microsoft Windows + shell: powershell + run: | + $targets=@( + "x86_64-pc-windows-msvc", + "i686-pc-windows-msvc" + ) + New-Item -ItemType Directory -Path artifacts + foreach ($target in $targets) + { + cargo wix --no-build --nocapture --target $target + Move-Item -Path target\wix\*.msi -Destination .\artifacts\ + } + + - name: Upload package artifacts + uses: actions/upload-artifact@v3 + with: + name: msi path: artifacts/ diff --git a/Cargo.lock b/Cargo.lock index d4a3ef24..a2763f63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,7 +154,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.6.2", "object", "rustc-demangle", ] @@ -200,6 +200,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + [[package]] name = "bitflags" version = "1.3.2" @@ -627,6 +633,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "cty" version = "0.2.2" @@ -860,17 +872,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "errno" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.45.0", -] - [[package]] name = "errno-dragonfly" version = "0.1.2" @@ -920,12 +921,19 @@ dependencies = [ ] [[package]] -name = "fastrand" -version = "1.9.0" +name = "exr" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +checksum = "279d3efcc55e19917fff7ab3ddd6c14afb6a90881a0078465196fe2f99d08c56" dependencies = [ - "instant", + "bit_field", + "flume", + "half", + "lebe", + "miniz_oxide 0.7.1", + "rayon-core", + "smallvec", + "zune-inflate", ] [[package]] @@ -944,7 +952,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.6.2", ] [[package]] @@ -962,6 +970,19 @@ dependencies = [ "num-traits", ] +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "pin-project", + "spin 0.9.8", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1184,8 +1205,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1371,6 +1394,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" +dependencies = [ + "crunchy", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1404,12 +1436,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - [[package]] name = "hexf-parse" version = "0.2.1" @@ -1475,16 +1501,16 @@ dependencies = [ ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hyper-rustls" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" dependencies = [ - "bytes", + "http", "hyper", - "native-tls", + "rustls", "tokio", - "tokio-native-tls", + "tokio-rustls", ] [[package]] @@ -1524,6 +1550,7 @@ dependencies = [ "iced_native", "iced_wgpu", "iced_winit", + "image", "thiserror", ] @@ -1578,6 +1605,8 @@ dependencies = [ "glam", "iced_native", "iced_style", + "image", + "kamadak-exif", "log", "lyon", "raw-window-handle 0.5.0", @@ -1675,6 +1704,25 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "image" +version = "0.24.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527909aa81e20ac3a44803521443a765550f09b5130c2c2fa1ea59c2f8f50a3a" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "exr", + "gif", + "jpeg-decoder", + "num-rational", + "num-traits", + "png", + "qoi", + "tiff", +] + [[package]] name = "imagesize" version = "0.11.0" @@ -1703,17 +1751,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "io-lifetimes" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.45.0", -] - [[package]] name = "ipnet" version = "2.7.2" @@ -1783,6 +1820,9 @@ name = "jpeg-decoder" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" +dependencies = [ + "rayon", +] [[package]] name = "js-sys" @@ -1793,6 +1833,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kamadak-exif" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4fc70d0ab7e5b6bafa30216a6b48705ea964cdfc29c050f2412295eba58077" +dependencies = [ + "mutate_once", +] + [[package]] name = "khronos-egl" version = "4.1.0" @@ -1834,6 +1883,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + [[package]] name = "libc" version = "0.2.144" @@ -1881,12 +1936,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd550e73688e6d578f0ac2119e32b797a327631a42f9433e59d02e139c8df60d" - [[package]] name = "lock_api" version = "0.4.9" @@ -2056,6 +2105,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.6" @@ -2068,6 +2126,12 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "mutate_once" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b" + [[package]] name = "naga" version = "0.11.0" @@ -2089,21 +2153,12 @@ dependencies = [ ] [[package]] -name = "native-tls" -version = "0.2.11" +name = "nanorand" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", + "getrandom", ] [[package]] @@ -2232,6 +2287,27 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -2248,7 +2324,7 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi", "libc", ] @@ -2350,51 +2426,6 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" -[[package]] -name = "openssl" -version = "0.10.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "ordered-float" version = "3.7.0" @@ -2491,7 +2522,7 @@ dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", "winapi", ] @@ -2504,7 +2535,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", "windows-sys 0.45.0", ] @@ -2516,7 +2547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbaa01d616eb84eb35cd085fdeaa8671dc8d951bdc4a75bfc414466e76b039ce" dependencies = [ "bitflags", - "errno 0.2.8", + "errno", "libc", "libloading 0.6.7", "pkg-config", @@ -2584,6 +2615,26 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" +[[package]] +name = "pin-project" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.4", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -2641,7 +2692,7 @@ dependencies = [ "bitflags", "crc32fast", "flate2", - "miniz_oxide", + "miniz_oxide 0.6.2", ] [[package]] @@ -2699,6 +2750,15 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74605f360ce573babfe43964cbe520294dcb081afbf8c108fc6e23036b4da2df" +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + [[package]] name = "quote" version = "1.0.26" @@ -2809,15 +2869,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags", -] - [[package]] name = "redox_users" version = "0.4.3" @@ -2825,7 +2876,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall 0.2.16", + "redox_syscall", "thiserror", ] @@ -2867,25 +2918,27 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-tls", + "hyper-rustls", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", + "rustls", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", - "tokio-native-tls", + "tokio-rustls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] @@ -2917,6 +2970,21 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rodio" version = "0.17.1" @@ -2997,17 +3065,34 @@ dependencies = [ ] [[package]] -name = "rustix" -version = "0.37.3" +name = "rustls" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2" +checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e" dependencies = [ - "bitflags", - "errno 0.3.0", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.45.0", + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64", +] + +[[package]] +name = "rustls-webpki" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +dependencies = [ + "ring", + "untrusted", ] [[package]] @@ -3050,15 +3135,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" -dependencies = [ - "windows-sys 0.42.0", -] - [[package]] name = "scoped-tls" version = "1.0.1" @@ -3077,6 +3153,16 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "sctk-adwaita" version = "0.4.3" @@ -3089,29 +3175,6 @@ dependencies = [ "tiny-skia 0.7.0", ] -[[package]] -name = "security-framework" -version = "2.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys 0.8.3", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" -dependencies = [ - "core-foundation-sys 0.8.3", - "libc", -] - [[package]] name = "semver" version = "1.0.16" @@ -3188,6 +3251,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +[[package]] +name = "simd-adler32" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f" + [[package]] name = "simplecss" version = "0.2.1" @@ -3276,6 +3345,7 @@ dependencies = [ "rodio", "rstest", "serde", + "winres", ] [[package]] @@ -3298,6 +3368,21 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + [[package]] name = "spirv" version = "0.2.0+1.5.4" @@ -3449,19 +3534,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.45.0", -] - [[package]] name = "termcolor" version = "1.2.0" @@ -3491,6 +3563,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "tiff" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7449334f9ff2baf290d55d73983a7d6fa15e01198faef72af07e2a8db851e471" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + [[package]] name = "tiny-skia" version = "0.7.0" @@ -3573,12 +3656,12 @@ dependencies = [ ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "tokio-rustls" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5" dependencies = [ - "native-tls", + "rustls", "tokio", ] @@ -3746,6 +3829,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -3790,12 +3879,6 @@ dependencies = [ "usvg", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "vec_map" version = "0.8.2" @@ -3999,6 +4082,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + [[package]] name = "weezl" version = "0.1.7" @@ -4199,21 +4301,6 @@ dependencies = [ "windows_x86_64_msvc 0.36.1", ] -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -4418,6 +4505,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml", +] + [[package]] name = "wio" version = "0.2.2" @@ -4476,3 +4572,12 @@ name = "xmlparser" version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml index 9652a3f0..914a6186 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,9 @@ include = [ "resources/sounds/*" ] +[target."cfg(windows)"] +rustflags = ["-C", "target-feature=+crt-static"] + #═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ [profile.release] @@ -36,7 +39,7 @@ etherparse = "0.13.0" chrono = { version = "0.4.26", default_features = false, features = ["clock"] } indexmap = "1.9.3" plotters = { version = "0.3.4", default_features = false, features = ["area_series"] } -iced = { version = "0.9.0", features = ["tokio", "svg"] } +iced = { version = "0.9.0", features = ["tokio", "svg", "image"] } iced_native = "0.10.3" iced_lazy = "0.6.1" plotters-iced = "0.8.0" @@ -44,7 +47,7 @@ maxminddb = "0.23.0" confy = "0.5.1" serde = { version = "1.0.163", default_features = false, features = ["derive"] } rodio = { version = "0.17.1", default_features = false, features = ["mp3"] } -reqwest = { version = "0.11.18", features = ["json", "blocking"] } +reqwest = { version = "0.11.18", default-features = false, features = ["json", "blocking", "rustls-tls"] } dns-lookup = "2.0.2" #─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── @@ -52,70 +55,112 @@ dns-lookup = "2.0.2" [dev-dependencies] rstest = "0.17.0" +#─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + +[target."cfg(windows)".build-dependencies] +winres = "0.1.12" + +#═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ + +[package.metadata.cross.target.x86_64-unknown-linux-gnu] +pre-build = [ + "dpkg --add-architecture amd64", + "apt update -y && apt install -y libfreetype6-dev:amd64 libexpat1-dev:amd64 libpcap-dev:amd64 libasound2-dev:amd64 libfontconfig1-dev:amd64" +] + +[package.metadata.cross.target.i686-unknown-linux-gnu] +pre-build = [ + "dpkg --add-architecture i386", + "apt update -y && apt install -y libfreetype6-dev:i386 libexpat1-dev:i386 libpcap-dev:i386 libasound2-dev:i386 libfontconfig1-dev:i386" +] + +[package.metadata.cross.target.aarch64-unknown-linux-gnu] +pre-build = [ + "dpkg --add-architecture arm64", + "apt update -y && apt install -y libfreetype6-dev:arm64 libexpat1-dev:arm64 libpcap-dev:arm64 libasound2-dev:arm64 libfontconfig1-dev:arm64" +] + +[package.metadata.cross.target.armv7-unknown-linux-gnueabihf] +pre-build = [ + "dpkg --add-architecture armhf", + "apt update -y && apt install -y libfreetype6-dev:armhf libexpat1-dev:armhf libpcap-dev:armhf libasound2-dev:armhf libfontconfig1-dev:armhf" +] + #═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ [package.metadata.deb] -depends = "libasound2-dev, libpcap-dev, libfontconfig1" +section="Network" +license-file="resources/packaging/LICENSE" +extended-description-file="resources/packaging/linux/description.txt" +maintainer-scripts="resources/packaging/linux/scripts/" +depends = "libasound2, libpcap0.8, libfontconfig1" assets = [ ["target/release/sniffnet", "/usr/bin/", "755"], - ["resources/sniffnet.desktop", "/usr/share/applications/", "644"], - ["resources/icons/sniffnet-linux_8x8.png", "/usr/share/icons/hicolor/8x8/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_16x16.png", "/usr/share/icons/hicolor/16x16/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_22x22.png", "/usr/share/icons/hicolor/22x22/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_24x24.png", "/usr/share/icons/hicolor/24x24/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_32x32.png", "/usr/share/icons/hicolor/32x32/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_36x36.png", "/usr/share/icons/hicolor/36x36/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_42x42.png", "/usr/share/icons/hicolor/42x42/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_48x48.png", "/usr/share/icons/hicolor/48x48/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_64x64.png", "/usr/share/icons/hicolor/64x64/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_72x72.png", "/usr/share/icons/hicolor/72x72/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_96x96.png", "/usr/share/icons/hicolor/96x96/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_128x128.png", "/usr/share/icons/hicolor/128x128/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_160x160.png", "/usr/share/icons/hicolor/160x160/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_192x192.png", "/usr/share/icons/hicolor/192x192/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_256x256.png", "/usr/share/icons/hicolor/256x256/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_384x384.png", "/usr/share/icons/hicolor/384x384/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_512x512.png", "/usr/share/icons/hicolor/512x512/apps/sniffnet.png", "644"], - ["resources/icons/sniffnet-linux_1024x1024.png", "/usr/share/icons/hicolor/1024x1024/apps/sniffnet.png", "644"] + ["resources/packaging/linux/sniffnet.desktop", "/usr/share/applications/", "644"], + ["resources/packaging/linux/graphics/sniffnet_8x8.png", "/usr/share/icons/hicolor/8x8/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_16x16.png", "/usr/share/icons/hicolor/16x16/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_22x22.png", "/usr/share/icons/hicolor/22x22/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_24x24.png", "/usr/share/icons/hicolor/24x24/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_32x32.png", "/usr/share/icons/hicolor/32x32/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_36x36.png", "/usr/share/icons/hicolor/36x36/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_42x42.png", "/usr/share/icons/hicolor/42x42/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_48x48.png", "/usr/share/icons/hicolor/48x48/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_64x64.png", "/usr/share/icons/hicolor/64x64/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_72x72.png", "/usr/share/icons/hicolor/72x72/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_96x96.png", "/usr/share/icons/hicolor/96x96/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_128x128.png", "/usr/share/icons/hicolor/128x128/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_160x160.png", "/usr/share/icons/hicolor/160x160/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_192x192.png", "/usr/share/icons/hicolor/192x192/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_256x256.png", "/usr/share/icons/hicolor/256x256/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_384x384.png", "/usr/share/icons/hicolor/384x384/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_512x512.png", "/usr/share/icons/hicolor/512x512/apps/sniffnet.png", "644"], + ["resources/packaging/linux/graphics/sniffnet_1024x1024.png", "/usr/share/icons/hicolor/1024x1024/apps/sniffnet.png", "644"] ] #─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── [package.metadata.generate-rpm] -auto-req = "no" +post_install_script = "setcap cap_net_raw,cap_net_admin=eip /usr/bin/sniffnet" +pre_uninstall_script = "setcap '' /usr/bin/sniffnet" assets = [ { source = "target/release/sniffnet", dest = "/usr/bin/", mode = "755" }, - { source = "resources/sniffnet.desktop", dest = "/usr/share/applications/", mode = "644" }, - { source = "resources/icons/sniffnet-linux_8x8.png", dest = "/usr/share/icons/hicolor/8x8/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_16x16.png", dest = "/usr/share/icons/hicolor/16x16/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_22x22.png", dest = "/usr/share/icons/hicolor/22x22/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_24x24.png", dest = "/usr/share/icons/hicolor/24x24/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_32x32.png", dest = "/usr/share/icons/hicolor/32x32/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_36x36.png", dest = "/usr/share/icons/hicolor/36x36/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_42x42.png", dest = "/usr/share/icons/hicolor/42x42/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_48x48.png", dest = "/usr/share/icons/hicolor/48x48/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_64x64.png", dest = "/usr/share/icons/hicolor/64x64/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_72x72.png", dest = "/usr/share/icons/hicolor/72x72/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_96x96.png", dest = "/usr/share/icons/hicolor/96x96/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_128x128.png", dest = "/usr/share/icons/hicolor/128x128/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_160x160.png", dest = "/usr/share/icons/hicolor/160x160/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_192x192.png", dest = "/usr/share/icons/hicolor/192x192/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_256x256.png", dest = "/usr/share/icons/hicolor/256x256/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_384x384.png", dest = "/usr/share/icons/hicolor/384x384/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_512x512.png", dest = "/usr/share/icons/hicolor/512x512/apps/sniffnet.png", mode = "644" }, - { source = "resources/icons/sniffnet-linux_1024x1024.png", dest = "/usr/share/icons/hicolor/1024x1024/apps/sniffnet.png", mode = "644" } + { source = "resources/packaging/linux/sniffnet.desktop", dest = "/usr/share/applications/", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_8x8.png", dest = "/usr/share/icons/hicolor/8x8/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_16x16.png", dest = "/usr/share/icons/hicolor/16x16/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_22x22.png", dest = "/usr/share/icons/hicolor/22x22/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_24x24.png", dest = "/usr/share/icons/hicolor/24x24/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_32x32.png", dest = "/usr/share/icons/hicolor/32x32/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_36x36.png", dest = "/usr/share/icons/hicolor/36x36/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_42x42.png", dest = "/usr/share/icons/hicolor/42x42/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_48x48.png", dest = "/usr/share/icons/hicolor/48x48/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_64x64.png", dest = "/usr/share/icons/hicolor/64x64/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_72x72.png", dest = "/usr/share/icons/hicolor/72x72/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_96x96.png", dest = "/usr/share/icons/hicolor/96x96/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_128x128.png", dest = "/usr/share/icons/hicolor/128x128/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_160x160.png", dest = "/usr/share/icons/hicolor/160x160/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_192x192.png", dest = "/usr/share/icons/hicolor/192x192/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_256x256.png", dest = "/usr/share/icons/hicolor/256x256/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_384x384.png", dest = "/usr/share/icons/hicolor/384x384/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_512x512.png", dest = "/usr/share/icons/hicolor/512x512/apps/sniffnet.png", mode = "644" }, + { source = "resources/packaging/linux/graphics/sniffnet_1024x1024.png", dest = "/usr/share/icons/hicolor/1024x1024/apps/sniffnet.png", mode = "644" } ] [package.metadata.generate-rpm.requires] -alsa-lib-devel = "*" -libpcap-devel = "*" -fontconfig-devel = "*" +alsa-lib = "*" +libpcap = "*" +fontconfig = "*" #─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── [package.metadata.bundle] name = "Sniffnet" -identifier = "gyulyvgc.sniffnet" +category = "Utilities" +identifier = "io.github.gyulyvgc.sniffnet" icon = [ - "resources/icons/sniffnet-macos.icns" + "resources/packaging/macos/graphics/sniffnet.icns" ] + +#─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + +[package.metadata.wix] +include = [".\\resources\\packaging\\windows\\setup.wxs"] diff --git a/build.rs b/build.rs new file mode 100644 index 00000000..df4eea93 --- /dev/null +++ b/build.rs @@ -0,0 +1,12 @@ +#[cfg(windows)] +extern crate winres; + +#[cfg(windows)] +fn main() { + let mut res = winres::WindowsResource::new(); + res.set_icon("resources/packaging/windows/graphics/sniffnet.ico"); + res.compile().unwrap(); +} + +#[cfg(unix)] +fn main() {} diff --git a/resources/Info.plist b/resources/Info.plist deleted file mode 100644 index 5f36e107..00000000 --- a/resources/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - Sniffnet - CFBundleExecutable - wrapper.sh - CFBundleIconFile - sniffnet-macos.icns - CFBundleIdentifier - gyulyvgc.sniffnet - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Sniffnet - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0.0 - CFBundleVersion - 20221123.150927 - CSResourcesFileMapped - - LSRequiresCarbon - - NSHighResolutionCapable - - - diff --git a/resources/logos/icon.png b/resources/logos/raw/icon.png similarity index 100% rename from resources/logos/icon.png rename to resources/logos/raw/icon.png diff --git a/resources/logos/icon_macos.png b/resources/logos/raw/icon_macos.png similarity index 100% rename from resources/logos/icon_macos.png rename to resources/logos/raw/icon_macos.png diff --git a/resources/packaging/LICENSE b/resources/packaging/LICENSE new file mode 100644 index 00000000..e383d1a4 --- /dev/null +++ b/resources/packaging/LICENSE @@ -0,0 +1,236 @@ +******************************************************************************* + DUAL LICENSED SOFTWARE +******************************************************************************* + +The software in this project is dual licensed under the terms of the MIT License +and the Apache License 2.0. You may choose to use this software under either +license, at your discretion. + +------------------------------------------------------------------------------- +The MIT License +------------------------------------------------------------------------------- + +Copyright (c) 2022 - Bellini Giuliano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +------------------------------------------------------------------------------- +Apache License 2.0 +------------------------------------------------------------------------------- + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +******************************************************************************* diff --git a/resources/packaging/linux/description.txt b/resources/packaging/linux/description.txt new file mode 100644 index 00000000..4558398a --- /dev/null +++ b/resources/packaging/linux/description.txt @@ -0,0 +1,18 @@ +Features: +Choose a network adapter of your PC to inspect +Select a set of filters to apply to the observed traffic; +View overall statistics about your Internet traffic; +View real-time charts about traffic intensity (bytes and packets per second, incoming and outgoing); +Get details about domain names and network providers of the hosts you are exchanging traffic with; +Identify connections in your local network; +Get information about the country of the remote hosts (IP geolocation); +Save your favorite network hosts; +Set custom notifications to inform you when defined network events occur; +Choose the style that fits you the most from 4 different available themes; +Inspect each of your network connections in real time; +Save complete textual report with detailed information for each network connection: +Source and destination IP addresses, +Source and destination ports, +Carried protocols, +Amount of exchanged packets and bytes, +Initial and final timestamp of information exchange diff --git a/resources/icons/sniffnet-linux_1024x1024.png b/resources/packaging/linux/graphics/sniffnet_1024x1024.png similarity index 100% rename from resources/icons/sniffnet-linux_1024x1024.png rename to resources/packaging/linux/graphics/sniffnet_1024x1024.png diff --git a/resources/icons/sniffnet-linux_128x128.png b/resources/packaging/linux/graphics/sniffnet_128x128.png similarity index 100% rename from resources/icons/sniffnet-linux_128x128.png rename to resources/packaging/linux/graphics/sniffnet_128x128.png diff --git a/resources/icons/sniffnet-linux_160x160.png b/resources/packaging/linux/graphics/sniffnet_160x160.png similarity index 100% rename from resources/icons/sniffnet-linux_160x160.png rename to resources/packaging/linux/graphics/sniffnet_160x160.png diff --git a/resources/icons/sniffnet-linux_16x16.png b/resources/packaging/linux/graphics/sniffnet_16x16.png similarity index 100% rename from resources/icons/sniffnet-linux_16x16.png rename to resources/packaging/linux/graphics/sniffnet_16x16.png diff --git a/resources/icons/sniffnet-linux_192x192.png b/resources/packaging/linux/graphics/sniffnet_192x192.png similarity index 100% rename from resources/icons/sniffnet-linux_192x192.png rename to resources/packaging/linux/graphics/sniffnet_192x192.png diff --git a/resources/icons/sniffnet-linux_22x22.png b/resources/packaging/linux/graphics/sniffnet_22x22.png similarity index 100% rename from resources/icons/sniffnet-linux_22x22.png rename to resources/packaging/linux/graphics/sniffnet_22x22.png diff --git a/resources/icons/sniffnet-linux_24x24.png b/resources/packaging/linux/graphics/sniffnet_24x24.png similarity index 100% rename from resources/icons/sniffnet-linux_24x24.png rename to resources/packaging/linux/graphics/sniffnet_24x24.png diff --git a/resources/icons/sniffnet-linux_256x256.png b/resources/packaging/linux/graphics/sniffnet_256x256.png similarity index 100% rename from resources/icons/sniffnet-linux_256x256.png rename to resources/packaging/linux/graphics/sniffnet_256x256.png diff --git a/resources/icons/sniffnet-linux_32x32.png b/resources/packaging/linux/graphics/sniffnet_32x32.png similarity index 100% rename from resources/icons/sniffnet-linux_32x32.png rename to resources/packaging/linux/graphics/sniffnet_32x32.png diff --git a/resources/icons/sniffnet-linux_36x36.png b/resources/packaging/linux/graphics/sniffnet_36x36.png similarity index 100% rename from resources/icons/sniffnet-linux_36x36.png rename to resources/packaging/linux/graphics/sniffnet_36x36.png diff --git a/resources/icons/sniffnet-linux_384x384.png b/resources/packaging/linux/graphics/sniffnet_384x384.png similarity index 100% rename from resources/icons/sniffnet-linux_384x384.png rename to resources/packaging/linux/graphics/sniffnet_384x384.png diff --git a/resources/icons/sniffnet-linux_42x42.png b/resources/packaging/linux/graphics/sniffnet_42x42.png similarity index 100% rename from resources/icons/sniffnet-linux_42x42.png rename to resources/packaging/linux/graphics/sniffnet_42x42.png diff --git a/resources/icons/sniffnet-linux_48x48.png b/resources/packaging/linux/graphics/sniffnet_48x48.png similarity index 100% rename from resources/icons/sniffnet-linux_48x48.png rename to resources/packaging/linux/graphics/sniffnet_48x48.png diff --git a/resources/icons/sniffnet-linux_512x512.png b/resources/packaging/linux/graphics/sniffnet_512x512.png similarity index 100% rename from resources/icons/sniffnet-linux_512x512.png rename to resources/packaging/linux/graphics/sniffnet_512x512.png diff --git a/resources/icons/sniffnet-linux_64x64.png b/resources/packaging/linux/graphics/sniffnet_64x64.png similarity index 100% rename from resources/icons/sniffnet-linux_64x64.png rename to resources/packaging/linux/graphics/sniffnet_64x64.png diff --git a/resources/icons/sniffnet-linux_72x72.png b/resources/packaging/linux/graphics/sniffnet_72x72.png similarity index 100% rename from resources/icons/sniffnet-linux_72x72.png rename to resources/packaging/linux/graphics/sniffnet_72x72.png diff --git a/resources/icons/sniffnet-linux_8x8.png b/resources/packaging/linux/graphics/sniffnet_8x8.png similarity index 100% rename from resources/icons/sniffnet-linux_8x8.png rename to resources/packaging/linux/graphics/sniffnet_8x8.png diff --git a/resources/icons/sniffnet-linux_96x96.png b/resources/packaging/linux/graphics/sniffnet_96x96.png similarity index 100% rename from resources/icons/sniffnet-linux_96x96.png rename to resources/packaging/linux/graphics/sniffnet_96x96.png diff --git a/resources/packaging/linux/scripts/.gitkeep b/resources/packaging/linux/scripts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/resources/packaging/linux/scripts/postinst b/resources/packaging/linux/scripts/postinst new file mode 100644 index 00000000..0791d87a --- /dev/null +++ b/resources/packaging/linux/scripts/postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +setcap cap_net_raw,cap_net_admin=eip /usr/bin/sniffnet diff --git a/resources/packaging/linux/scripts/prerm b/resources/packaging/linux/scripts/prerm new file mode 100644 index 00000000..af71e5de --- /dev/null +++ b/resources/packaging/linux/scripts/prerm @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +setcap '' /usr/bin/sniffnet diff --git a/resources/sniffnet.desktop b/resources/packaging/linux/sniffnet.desktop similarity index 67% rename from resources/sniffnet.desktop rename to resources/packaging/linux/sniffnet.desktop index 6650acb2..e5216212 100644 --- a/resources/sniffnet.desktop +++ b/resources/packaging/linux/sniffnet.desktop @@ -3,8 +3,8 @@ Version=1.0 Type=Application Name=Sniffnet Comment=Application to comfortably monitor your network traffic -Categories=Network;Security;Utility; +Categories=Network; Icon=sniffnet -Exec=sudo /usr/bin/sniffnet +Exec=/usr/bin/sniffnet StartupWMClass=sniffnet -Terminal=true +Terminal=false diff --git a/resources/packaging/macos/Info.plist b/resources/packaging/macos/Info.plist new file mode 100644 index 00000000..d795c489 --- /dev/null +++ b/resources/packaging/macos/Info.plist @@ -0,0 +1,19 @@ + + + + + CFBundleDevelopmentRegionEnglish + CFBundleDisplayNameSniffnet + CFBundleExecutablewrapper.sh + CFBundleIconFilesniffnet.icns + CFBundleIdentifierio.github.gyulyvgc.sniffnet + CFBundleInfoDictionaryVersion6.0 + CFBundleNameSniffnet + CFBundlePackageTypeAPPL + CFBundleShortVersionString1.0.0 + CFBundleVersion20221123.150927 + CSResourcesFileMapped + LSRequiresCarbon + NSHighResolutionCapable + + diff --git a/resources/logos/bg_dmg.png b/resources/packaging/macos/graphics/dmg_bg.png similarity index 100% rename from resources/logos/bg_dmg.png rename to resources/packaging/macos/graphics/dmg_bg.png diff --git a/resources/icons/sniffnet-macos.icns b/resources/packaging/macos/graphics/sniffnet.icns similarity index 100% rename from resources/icons/sniffnet-macos.icns rename to resources/packaging/macos/graphics/sniffnet.icns diff --git a/resources/packaging/macos/wrapper.sh b/resources/packaging/macos/wrapper.sh new file mode 100755 index 00000000..e8478f3a --- /dev/null +++ b/resources/packaging/macos/wrapper.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env zsh +osacompile -e "do shell script \"/Applications/Sniffnet.app/Contents/MacOS/sniffnet >/dev/null 2>&1 &\" with administrator privileges" \ No newline at end of file diff --git a/resources/packaging/windows/EULA.rtf b/resources/packaging/windows/EULA.rtf new file mode 100644 index 00000000..a901a2eb Binary files /dev/null and b/resources/packaging/windows/EULA.rtf differ diff --git a/resources/packaging/windows/graphics/banner.bmp b/resources/packaging/windows/graphics/banner.bmp new file mode 100644 index 00000000..ba56740a Binary files /dev/null and b/resources/packaging/windows/graphics/banner.bmp differ diff --git a/resources/packaging/windows/graphics/dialog.bmp b/resources/packaging/windows/graphics/dialog.bmp new file mode 100644 index 00000000..c59e5155 Binary files /dev/null and b/resources/packaging/windows/graphics/dialog.bmp differ diff --git a/resources/icons/sniffnet-windows.ico b/resources/packaging/windows/graphics/sniffnet.ico similarity index 100% rename from resources/icons/sniffnet-windows.ico rename to resources/packaging/windows/graphics/sniffnet.ico diff --git a/resources/packaging/windows/graphics/sniffnet_icon.png b/resources/packaging/windows/graphics/sniffnet_icon.png new file mode 100644 index 00000000..9b17dbcb Binary files /dev/null and b/resources/packaging/windows/graphics/sniffnet_icon.png differ diff --git a/resources/packaging/windows/scripts/npcap.ps1 b/resources/packaging/windows/scripts/npcap.ps1 new file mode 100644 index 00000000..4b21c567 --- /dev/null +++ b/resources/packaging/windows/scripts/npcap.ps1 @@ -0,0 +1,25 @@ +[CmdletBinding()] +param ( + [Parameter(Mandatory)] + [ValidateSet("amd64", "i386", "arm64")] + [string]$ARCH, + [Parameter(Mandatory)] + [string]$OEM +) + +Write-Host "::group::Npcap SDK" +Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "$env:TEMP\\npcap-sdk.zip" -Verbose +Expand-Archive -LiteralPath "$env:TEMP\\npcap-sdk.zip" -DestinationPath "$env:TEMP\\npcap-sdk" -Verbose +$LibPath = switch ($ARCH) +{ + "amd64" { "Lib\\x64" } + "i386" { "Lib" } + "arm64" { "Lib\\ARM64" } +} +Add-Content -Path "$env:GITHUB_ENV" -Value "LIB=$env:TEMP\\npcap-sdk\\$LibPath" +Write-Host "::endgroup::" + +Write-Host "::group::Npcap DLL" +Invoke-WebRequest -Uri "$OEM" -OutFile "$env:TEMP\\npcap-oem.exe" -Verbose +Start-Process -FilePath "$env:TEMP\\npcap-oem.exe" -ArgumentList "/S" -Wait +Write-Host "::endgroup::" diff --git a/resources/packaging/windows/scripts/wix.ps1 b/resources/packaging/windows/scripts/wix.ps1 new file mode 100644 index 00000000..24a310d5 --- /dev/null +++ b/resources/packaging/windows/scripts/wix.ps1 @@ -0,0 +1,5 @@ +Write-Host "::group::WiX Toolset" +Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip" -OutFile "$env:TEMP\\wix-binaries.zip" -Verbose +Expand-Archive -LiteralPath "$env:TEMP\\wix-binaries.zip" -DestinationPath "$env:TEMP\\wix" -Verbose +Set-Item -Path env:Path -Value "$env:Path;$env:TEMP\\wix" +Write-Host "::endgroup::" diff --git a/resources/packaging/windows/setup.wxs b/resources/packaging/windows/setup.wxs new file mode 100644 index 00000000..95f94019 --- /dev/null +++ b/resources/packaging/windows/setup.wxs @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed + + + + + + + + + + + diff --git a/resources/wrapper.sh b/resources/wrapper.sh deleted file mode 100755 index 45febf2d..00000000 --- a/resources/wrapper.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -osascript \ - -e "do shell script \"/*/Sniffnet.app/Contents/MacOS/sniffnet > /dev/null 2>&1 & \" with administrator privileges" diff --git a/src/main.rs b/src/main.rs index 23430ad9..141c271b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,9 +2,11 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +// use std::path::Path; // TODO: Uncomment to set window icon use std::sync::{Arc, Condvar, Mutex}; use std::{panic, process, thread}; +// use iced::window::icon; // TODO: Uncomment to set window icon use iced::window::{PlatformSpecific, Position}; use iced::{window, Application, Settings}; @@ -96,6 +98,13 @@ pub fn main() -> iced::Result { print_cli_welcome_message(); + // TODO: Uncomment to set window icon + // let icon_path = "resources/packaging/windows/graphics/sniffnet_icon.png"; + // let icon = match get_icon(icon_path) { + // Ok(icon) => icon, + // Err(err) => panic!("Error: {:?}", err) + // }; + Sniffer::run(Settings { id: None, window: window::Settings { @@ -108,7 +117,7 @@ pub fn main() -> iced::Result { decorations: true, transparent: false, always_on_top: false, - icon: None, + icon: None, // TODO: Replace with 'Some(icon)' to set window icon platform_specific: PlatformSpecific::default(), }, flags: Sniffer::new( @@ -129,3 +138,11 @@ pub fn main() -> iced::Result { try_opengles_first: false, }) } + +// TODO: Uncomment to set window icon +// fn get_icon(file_path: &str) -> Result> { +// let icon_path = Path::new(file_path); +// let icon = icon::from_file(icon_path)?; +// +// Ok(icon) +// } diff --git a/wix/main.wxs b/wix/main.wxs deleted file mode 100644 index 3bd580d5..00000000 --- a/wix/main.wxs +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - - - - - - - - - - - - - - - -