Merge pull request #197 from kpcyrd/stats

Add sn0int stats
This commit is contained in:
kpcyrd
2021-03-20 13:38:12 +00:00
committed by GitHub
17 changed files with 442 additions and 259 deletions

View File

@@ -5,6 +5,8 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 9 * * 1'
env:
CARGO_TERM_COLOR: always
@@ -49,3 +51,19 @@ jobs:
run: cd sn0int-std && cargo test --verbose
- name: Run tests (std, --ignored)
run: cd sn0int-std && cargo test --verbose -- --ignored
notify:
# forks shouldn't notify
if: github.repository == 'kpcyrd/sn0int'
runs-on: ubuntu-latest
needs:
- build
steps:
- name: irc notify
uses: rectalogic/notify-irc@v1
with:
server: irc.hackint.org
channel: "#sn0int"
nickname: github-ci
message: '${{ github.repository }}#${{ github.run_id }}(${{ github.event_name }}): ${{ github.ref }}: tests completed: ${{ needs.build.result }} (https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})'

View File

@@ -1,61 +0,0 @@
language: rust
# upload takes too long on windows and gets killed due to inactivity
#cache: cargo
matrix:
include:
- os: linux
rust: stable
env:
- BUILD_MODE=test
- os: linux
rust: stable
env:
- BUILD_MODE=common
- os: linux
rust: stable
env:
- BUILD_MODE=std
- os: linux
rust: stable
env:
- BUILD_MODE=boxxy
- os: osx
rust: stable
env:
- BUILD_MODE=test
- os: osx
rust: stable
env:
- BUILD_MODE=common
- os: osx
rust: stable
env:
- BUILD_MODE=std
#- os: windows
# rust: stable
# env:
# - BUILD_MODE="windows test"
#- os: windows
# rust: stable
# env:
# - BUILD_MODE="windows common"
before_install:
- ci/setup.sh "$TRAVIS_OS_NAME"
script:
- df -h
- ci/run.sh $BUILD_MODE
- df -h
notifications:
irc:
template:
- "%{repository_slug}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} (%{build_url})"
channels:
- "ircs://irc.hackint.org:6697/#sn0int"
use_notice: true
skip_join: true
#on_success: change # default: always
#on_failure: always # default: always

259
Cargo.lock generated
View File

@@ -21,6 +21,17 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
[[package]]
name = "ahash"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f200cbb1e856866d9eade941cf3aa0c5d7dd36f74311c4273b494f4ef036957"
dependencies = [
"getrandom 0.2.2",
"once_cell",
"version_check 0.9.3",
]
[[package]]
name = "aho-corasick"
version = "0.7.15"
@@ -47,9 +58,9 @@ checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
[[package]]
name = "approx"
version = "0.3.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
dependencies = [
"num-traits",
]
@@ -347,9 +358,9 @@ checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58"
[[package]]
name = "byteorder"
version = "1.4.2"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
@@ -362,12 +373,6 @@ dependencies = [
"iovec",
]
[[package]]
name = "bytes"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]]
name = "bytes"
version = "1.0.1"
@@ -556,7 +561,7 @@ dependencies = [
"failure",
"idna 0.1.5",
"log 0.4.14",
"publicsuffix",
"publicsuffix 1.5.6",
"serde",
"serde_json",
"time",
@@ -732,7 +737,7 @@ dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"smallvec 1.6.1",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -742,7 +747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e"
dependencies = [
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -775,9 +780,9 @@ dependencies = [
[[package]]
name = "curl"
version = "0.4.34"
version = "0.4.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e268162af1a5fe89917ae25ba3b0a77c8da752bdc58e7dbb4f15b91fbd33756e"
checksum = "5a872858e9cb9e3b96c80dd78774ad9e32e44d3b05dc31e142b858d14aebc82c"
dependencies = [
"curl-sys",
"libc",
@@ -790,9 +795,9 @@ dependencies = [
[[package]]
name = "curl-sys"
version = "0.4.40+curl-7.75.0"
version = "0.4.41+curl-7.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ffafc1c35958318bd7fdd0582995ce4c72f4f461a8e70499ccee83a619fd562"
checksum = "0ec466abd277c7cab2905948f3e94d10bc4963f1f5d47921c1cc4ffd2028fe65"
dependencies = [
"cc",
"libc",
@@ -826,7 +831,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f83e699727abca3c56e187945f303389590305ab2f0185ea445aa66e8d5f2a"
dependencies = [
"data-encoding",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -853,9 +858,9 @@ dependencies = [
[[package]]
name = "der-parser"
version = "5.0.0"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4b1e27396f46037881c39d821660f2ff48797aaa7152a45ded7a93b368a819"
checksum = "13e6cad1223a7b98b59275a56516ed8c40508d21284a32e404ed3fe2ae9a809a"
dependencies = [
"der-oid-macro",
"nom 6.1.2",
@@ -873,7 +878,7 @@ checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -931,7 +936,7 @@ checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -1135,7 +1140,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
dependencies = [
"backtrace",
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
@@ -1156,7 +1161,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
"synstructure",
]
@@ -1353,14 +1358,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [
"typenum",
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
name = "geo"
version = "0.16.0"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d893ed768bba4866e3e16b756c96ed7ef23ca270eac190000fc4e40c5d733467"
checksum = "bb5120badf60b67440af049f8c1a265aa44bdccc34027a5bb39eb3b081c56526"
dependencies = [
"geo-types",
"geographiclib-rs",
@@ -1371,9 +1376,9 @@ dependencies = [
[[package]]
name = "geo-types"
version = "0.6.2"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7583925a1fdb2b450c461fe0878ba6e99a8f1332b2bc72fb1383fd25b2f13bf2"
checksum = "f53acb0efebf761179d5346ab1dc2b3657535d461bde5eaf4465ff7fee7a9a15"
dependencies = [
"approx",
"num-traits",
@@ -1483,6 +1488,15 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]]
name = "hashbrown"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "362385356d610bd1e5a408ddf8d022041774b683f345a1d2cfcb4f60f8ae2db5"
dependencies = [
"ahash",
]
[[package]]
name = "heapless"
version = "0.5.6"
@@ -1550,7 +1564,7 @@ dependencies = [
"markup5ever",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -1593,6 +1607,12 @@ version = "1.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691"
[[package]]
name = "humansize"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
[[package]]
name = "humantime"
version = "1.3.0"
@@ -1735,7 +1755,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
dependencies = [
"autocfg 1.0.1",
"hashbrown",
"hashbrown 0.9.1",
]
[[package]]
@@ -1760,11 +1780,11 @@ dependencies = [
[[package]]
name = "input_buffer"
version = "0.3.1"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19a8a95243d5a0398cae618ec29477c6e3cb631152be5c19481f80bc71559754"
checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413"
dependencies = [
"bytes 0.5.6",
"bytes 1.0.1",
]
[[package]]
@@ -1900,9 +1920,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.88"
version = "0.2.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a"
checksum = "538c092e5586f4cdd7dd8078c4a79220e3e168880218124dcbce860f0ea938c6"
[[package]]
name = "libloading"
@@ -2123,7 +2143,7 @@ dependencies = [
"migrations_internals",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -2283,6 +2303,15 @@ version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8d77f3db4bce033f4d04db08079b2ef1c3d02b44e86f25d08886fafa7756ffa"
[[package]]
name = "nibble_vec"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43"
dependencies = [
"smallvec 1.6.1",
]
[[package]]
name = "nix"
version = "0.14.1"
@@ -2309,18 +2338,6 @@ dependencies = [
"void",
]
[[package]]
name = "nix"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
]
[[package]]
name = "nix"
version = "0.20.0"
@@ -2346,7 +2363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
dependencies = [
"memchr",
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
@@ -2359,7 +2376,7 @@ dependencies = [
"funty",
"lexical-core",
"memchr",
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
@@ -2539,15 +2556,15 @@ dependencies = [
[[package]]
name = "openssl"
version = "0.10.32"
version = "0.10.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70"
checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"foreign-types",
"lazy_static",
"libc",
"once_cell",
"openssl-sys",
]
@@ -2559,9 +2576,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "openssl-sys"
version = "0.9.60"
version = "0.9.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6"
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"
dependencies = [
"autocfg 1.0.1",
"cc",
@@ -2657,7 +2674,7 @@ dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
"syn 0.15.44",
"version_check 0.9.2",
"version_check 0.9.3",
"yansi",
]
@@ -2719,7 +2736,7 @@ dependencies = [
"pest_meta",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -2775,7 +2792,7 @@ dependencies = [
"proc-macro-hack",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -2881,8 +2898,8 @@ dependencies = [
"proc-macro-error-attr",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"version_check 0.9.2",
"syn 1.0.64",
"version_check 0.9.3",
]
[[package]]
@@ -2893,7 +2910,7 @@ checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
@@ -2920,6 +2937,12 @@ dependencies = [
"unicode-xid 0.2.1",
]
[[package]]
name = "psl-types"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9aa996d9ccdfb96682edbcdfbeb899efa3deae893ae0f932c21a56cdbf90ff"
[[package]]
name = "publicsuffix"
version = "1.5.6"
@@ -2930,6 +2953,16 @@ dependencies = [
"url 2.2.1",
]
[[package]]
name = "publicsuffix"
version = "2.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35974d3a8dd212ecc4f85ea06183a2bb61a4e15e57c728e438b8d9c1086de9c2"
dependencies = [
"hashbrown 0.11.0",
"psl-types",
]
[[package]]
name = "quick-error"
version = "1.2.3"
@@ -2978,7 +3011,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d3681b28cd95acfb0560ea9441f82d6a4504fa3b15b97bd7b6e952131820e95"
dependencies = [
"endian-type",
"nibble_vec",
"nibble_vec 0.0.4",
]
[[package]]
name = "radix_trie"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd"
dependencies = [
"endian-type",
"nibble_vec 0.1.0",
]
[[package]]
@@ -3250,21 +3293,20 @@ dependencies = [
[[package]]
name = "regex"
version = "1.4.3"
version = "1.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
]
[[package]]
name = "regex-syntax"
version = "0.6.22"
version = "0.6.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
[[package]]
name = "remove_dir_all"
@@ -3347,7 +3389,7 @@ dependencies = [
"state",
"time",
"toml 0.4.10",
"version_check 0.9.2",
"version_check 0.9.3",
"yansi",
]
@@ -3362,7 +3404,7 @@ dependencies = [
"indexmap",
"quote 0.6.13",
"rocket_http",
"version_check 0.9.2",
"version_check 0.9.3",
"yansi",
]
@@ -3527,9 +3569,9 @@ dependencies = [
[[package]]
name = "rustyline"
version = "7.1.0"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8227301bfc717136f0ecbd3d064ba8199e44497a0bdd46bb01ede4387cfd2cec"
checksum = "b9e1b597fcd1eeb1d6b25b493538e5aa19629eb08932184b85fef931ba87e893"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
@@ -3538,8 +3580,10 @@ dependencies = [
"libc",
"log 0.4.14",
"memchr",
"nix 0.19.1",
"nix 0.20.0",
"radix_trie 0.2.1",
"scopeguard",
"smallvec 1.6.1",
"unicode-segmentation",
"unicode-width",
"utf8parse 0.2.0",
@@ -3625,9 +3669,9 @@ dependencies = [
[[package]]
name = "security-framework"
version = "2.1.1"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfd318104249865096c8da1dfabf09ddbb6d0330ea176812a62ec75e40c4166"
checksum = "d493c5f39e02dfb062cd8f33301f90f9b13b650e8c1b1d0fd75c19dd64bff69d"
dependencies = [
"bitflags",
"core-foundation",
@@ -3722,7 +3766,7 @@ checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -3928,13 +3972,14 @@ dependencies = [
"glob",
"hlua-badtouch",
"hmac",
"humansize",
"ipnetwork",
"lazy_static",
"libsqlite3-sys",
"log 0.4.14",
"maplit",
"md-5",
"nix 0.19.1",
"nix 0.20.0",
"nude",
"opener",
"os-version",
@@ -3942,7 +3987,7 @@ dependencies = [
"pledge 0.4.1",
"rand 0.8.3",
"regex",
"rustyline 7.1.0",
"rustyline 8.0.0",
"semver 0.11.0",
"separator",
"serde",
@@ -4033,7 +4078,7 @@ dependencies = [
"maxminddb",
"mqtt-protocol",
"pem",
"publicsuffix",
"publicsuffix 2.0.8",
"rand 0.8.3",
"regex",
"rustls 0.18.1",
@@ -4045,7 +4090,7 @@ dependencies = [
"tungstenite",
"url 2.2.1",
"webpki",
"webpki-roots 0.20.0",
"webpki-roots 0.21.0",
"x509-parser",
"xml-rs",
]
@@ -4157,7 +4202,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -4181,7 +4226,7 @@ dependencies = [
"heck",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -4193,7 +4238,7 @@ dependencies = [
"heck",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
]
[[package]]
@@ -4221,9 +4266,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.62"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512"
checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
@@ -4238,7 +4283,7 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
"unicode-xid 0.2.1",
]
@@ -4349,16 +4394,7 @@ checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
]
[[package]]
name = "thread_local"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
dependencies = [
"once_cell",
"syn 1.0.64",
]
[[package]]
@@ -4669,7 +4705,7 @@ dependencies = [
"futures",
"lazy_static",
"log 0.4.14",
"radix_trie",
"radix_trie 0.1.6",
"rand 0.7.3",
"tokio",
"tokio-tcp",
@@ -4719,19 +4755,20 @@ dependencies = [
[[package]]
name = "tungstenite"
version = "0.11.1"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0308d80d86700c5878b9ef6321f020f29b1bb9d5ff3cab25e75e23f3a492a23"
checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093"
dependencies = [
"base64 0.12.3",
"base64 0.13.0",
"byteorder",
"bytes 0.5.6",
"bytes 1.0.1",
"http 0.2.3",
"httparse",
"input_buffer",
"log 0.4.14",
"rand 0.7.3",
"rand 0.8.3",
"sha-1 0.9.4",
"thiserror",
"url 2.2.1",
"utf-8",
]
@@ -4744,9 +4781,9 @@ checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
[[package]]
name = "typenum"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
[[package]]
name = "ucd-trie"
@@ -4778,7 +4815,7 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check 0.9.2",
"version_check 0.9.3",
]
[[package]]
@@ -4908,9 +4945,9 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
[[package]]
name = "version_check"
version = "0.9.2"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
[[package]]
name = "void"
@@ -4973,7 +5010,7 @@ dependencies = [
"log 0.4.14",
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
"wasm-bindgen-shared",
]
@@ -4995,7 +5032,7 @@ checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.62",
"syn 1.0.64",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -5046,9 +5083,9 @@ dependencies = [
[[package]]
name = "webpki-roots"
version = "0.20.0"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f"
checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376"
dependencies = [
"webpki",
]

View File

@@ -38,7 +38,7 @@ sqlite-bundled = ["libsqlite3-sys/bundled"]
[dependencies]
sn0int-common = { version="0.12.0", path="sn0int-common" }
sn0int-std = { version="=0.20.1", path="sn0int-std" }
rustyline = "7.0"
rustyline = "8.0"
log = "0.4"
env_logger = "0.8"
hlua-badtouch = "0.4"
@@ -79,6 +79,7 @@ ipnetwork = "0.17"
strum = "0.20"
strum_macros = "0.20"
embedded-triple = "0.1.0"
humansize = "1.1.0"
digest = "0.9"
md-5 = "0.9"
@@ -96,7 +97,7 @@ os-version = "0.1.1"
caps = "0.5"
#syscallz = { path="../syscallz-rs" }
syscallz = "0.15"
nix = "0.19"
nix = "0.20"
[target.'cfg(target_os="openbsd")'.dependencies]
pledge = "0.4"

View File

@@ -1,32 +0,0 @@
#!/bin/sh
set -exu
case "$1" in
build)
cargo build --verbose
cargo build --verbose --examples
;;
test)
cargo test --verbose
cargo test --verbose -- --ignored
;;
common)
cd sn0int-common
cargo test --verbose
;;
std)
cd sn0int-std
cargo test --verbose
cargo test --verbose -- --ignored
;;
windows)
cargo build --verbose
cargo build --verbose --examples
;;
boxxy)
cargo build --verbose --examples
if cat ci/boxxy_stage1.txt | RUST_LOG=boxxy cargo run --example boxxy; then
echo "SANDOX ERROR: should've crashed"
exit 1
fi
;;
esac

View File

@@ -1,11 +0,0 @@
#!/bin/sh
set -exu
case "$1" in
linux)
sudo apt update
sudo apt install libsqlite3-dev libseccomp-dev libsodium-dev
;;
osx)
brew install libsodium
;;
esac

View File

@@ -21,7 +21,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_urlencoded = "0.7"
webpki = "0.21"
webpki-roots = "0.20"
webpki-roots = "0.21"
ct-logs = "0.7"
#chrootable-https = { path = "../../chrootable-https" }
chrootable-https = "0.16"
@@ -29,14 +29,14 @@ http = "0.2"
bufstream = "0.1.4"
pem = "0.8"
url = "2.0"
tungstenite = { version = "0.11", default-features = false }
tungstenite = { version = "0.13", default-features = false }
kuchiki = "0.8.0"
maxminddb = "0.17"
x509-parser = "0.9"
der-parser = "5"
publicsuffix = { version="1.5", default-features=false }
publicsuffix = { version="2", default-features=false }
xml-rs = "0.8"
geo = "0.16"
geo = "0.17"
bytes = "0.4"
base64 = "0.13"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -1,11 +1,12 @@
use crate::errors::*;
use chrootable_https::Client;
use crate::errors::*;
use crate::lazy::LazyInit;
use publicsuffix::{List, Psl as _};
use std::fs::{self, File};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use crate::lazy::LazyInit;
use std::str::FromStr;
#[derive(Debug, PartialEq)]
pub struct DnsName {
@@ -72,11 +73,15 @@ impl PslReader {
impl LazyInit<Arc<Psl>> for PslReader {
fn initialize(self) -> Result<Arc<Psl>> {
let list = match self {
PslReader::Reader(file) => publicsuffix::List::from_reader(file),
PslReader::String(s) => publicsuffix::List::from_str(&s),
PslReader::Reader(mut file) => {
let mut buf = String::new();
file.read_to_string(&mut buf)?;
buf
},
PslReader::String(s) => s,
};
let list = list
let list = List::from_str(&list)
.map_err(|e| format_err!("Failed to load public suffix list: {}", e))?;
Ok(Arc::new(Psl {
@@ -87,32 +92,28 @@ impl LazyInit<Arc<Psl>> for PslReader {
#[derive(Debug)]
pub struct Psl {
list: publicsuffix::List,
list: List,
}
impl Psl {
pub fn parse_dns_name(&self, name: &str) -> Result<DnsName> {
let dns_name = self.list.parse_dns_name(name)
.map_err(|e| format_err!("Failed to parse dns_name: {}", e))?;
let bytes = name.as_bytes();
let (root, suffix) = if let Some(domain) = dns_name.domain() {
let root = domain.to_string();
if let Some(suffix) = domain.suffix() {
(root, suffix.to_string())
} else {
// XXX: not sure if this is reachable
(root.clone(), root)
}
let suffix = self.list.suffix(bytes)
.ok_or_else(|| format_err!("Failed to detect suffix"))?;
let suffix = String::from_utf8(suffix.as_bytes().to_vec())?;
let root = if let Some(root) = self.list.domain(bytes) {
String::from_utf8(root.as_bytes().to_vec())?
} else {
// this is technically a tld, but support eg. a.prod.fastly.net anyway
// XXX: consider forcing domain to be in self.list.private()
(name.to_string(), name.to_string())
name.to_string()
};
let fulldomain = if root.as_str() != name {
Some(name.to_string())
} else {
let fulldomain = if root == name {
None
} else {
Some(name.to_string())
};
Ok(DnsName {

View File

@@ -81,6 +81,9 @@ pub enum SubCommand {
/// Export a workspace for external processing
#[structopt(name="export")]
Export(cmd::export_cmd::Args),
/// Show statistics about your current workspace
#[structopt(name="stats")]
Stats(cmd::stats_cmd::Args),
/// Run a lua repl
#[structopt(name="repl")]
Repl,

View File

@@ -93,6 +93,14 @@ impl BlobStorage {
}
Ok(blobs)
}
pub fn stat(&self, id: &str) -> Result<u64> {
let path = self.join(id)?;
debug!("Stat-ing blob: {:?}", path);
let md = fs::metadata(path)
.context("Failed to stat blob")?;
Ok(md.len())
}
}

View File

@@ -21,6 +21,7 @@ pub fn run(_rl: &mut Shell, _args: &[String]) -> Result<()> {
help("run", "Run the currently selected module");
help("scope", "Include entities in the scope again");
help("select", "Select entities from the database");
help("stats", "Show statistics about your current workspace");
help("target", "Preview targeted entities or narrow them down");
help("use", "Select a module");
help("workspace", "Switch to a different workspace");

View File

@@ -34,6 +34,7 @@ pub mod notify_cmd;
pub mod pkg_cmd;
pub mod set_cmd;
pub mod scope_cmd;
pub mod stats_cmd;
pub mod target_cmd;
pub mod quickstart_cmd;
pub mod workspace_cmd;

161
src/cmd/stats_cmd.rs Normal file
View File

@@ -0,0 +1,161 @@
use crate::errors::*;
use colored::Colorize;
use crate::blobs::BlobStorage;
use crate::cmd::Cmd;
use crate::db::Database;
use crate::db::ttl;
use crate::models::*;
use crate::shell::Shell;
use humansize::{FileSize, file_size_opts};
use separator::Separatable;
use serde::{Serialize, Deserialize};
use structopt::StructOpt;
use structopt::clap::AppSettings;
#[derive(Debug, StructOpt)]
#[structopt(global_settings = &[AppSettings::ColoredHelp])]
pub struct Args {
/// Exclude blob storage
#[structopt(long)]
short: bool,
/// Show workspace statistics in json
#[structopt(long)]
json: bool,
}
fn show_amount(label: &str, count: usize, amount: &str) {
let label = format!("{:20}", label);
let amount = format!("{:>20}", amount);
if count > 0 {
println!("{} {}", label.green(), amount.yellow());
} else {
println!("{} {}", label, amount);
}
}
fn show_count(label: &str, count: usize) {
show_amount(label, count, &count.separated_string());
}
fn count_models<T: Model>(db: &Database) -> Result<usize> {
let query = db.list::<T>()?;
let count = query.len();
Ok(count)
}
#[derive(Debug, Serialize, Deserialize)]
struct Stats {
workspace: String,
domains: usize,
subdomains: usize,
ipaddrs: usize,
urls: usize,
emails: usize,
phonenumbers: usize,
devices: usize,
networks: usize,
accounts: usize,
breaches: usize,
images: usize,
ports: usize,
netblocks: usize,
cryptoaddrs: usize,
activity: usize,
blobs: Option<BlobStats>,
}
#[derive(Debug, Serialize, Deserialize)]
struct BlobStats {
count: usize,
total_size: u64,
total_human_size: String,
}
impl Stats {
fn count(workspace: String, db: &Database) -> Result<Stats> {
Ok(Stats {
workspace,
domains: count_models::<Domain>(&db)?,
subdomains: count_models::<Subdomain>(&db)?,
ipaddrs: count_models::<IpAddr>(&db)?,
urls: count_models::<Url>(&db)?,
emails: count_models::<Email>(&db)?,
phonenumbers: count_models::<PhoneNumber>(&db)?,
devices: count_models::<Device>(&db)?,
networks: count_models::<Network>(&db)?,
accounts: count_models::<Account>(&db)?,
breaches: count_models::<Breach>(&db)?,
images: count_models::<Image>(&db)?,
ports: count_models::<Port>(&db)?,
netblocks: count_models::<Netblock>(&db)?,
cryptoaddrs: count_models::<CryptoAddr>(&db)?,
activity: Activity::count(&db)?,
blobs: None,
})
}
fn add_blob_usage(&mut self, storage: &BlobStorage) -> Result<()> {
let blobs = storage.list()?;
let mut total_size = 0;
for blob in &blobs {
total_size += storage.stat(blob)?;
}
let total_human_size = total_size.file_size(file_size_opts::CONVENTIONAL)
.map_err(|e| format_err!("Failed to format size: {}", e))?;
self.blobs = Some(BlobStats {
count: blobs.len(),
total_size,
total_human_size,
});
Ok(())
}
}
impl Cmd for Args {
#[inline]
fn run(self, rl: &mut Shell) -> Result<()> {
ttl::reap_expired(rl)?;
let db = rl.db();
let mut stats = Stats::count(rl.workspace().into(), &db)?;
if !self.short {
stats.add_blob_usage(rl.blobs())?;
}
if self.json {
let stats = serde_json::to_string(&stats)?;
println!("{}", stats);
} else {
println!("{:>41}", stats.workspace.bold());
show_count("domains", stats.domains);
show_count("subdomains", stats.subdomains);
show_count("ipaddrs", stats.ipaddrs);
show_count("urls", stats.urls);
show_count("emails", stats.emails);
show_count("phonenumbers", stats.phonenumbers);
show_count("devices", stats.devices);
show_count("networks", stats.networks);
show_count("accounts", stats.accounts);
show_count("breaches", stats.breaches);
show_count("images", stats.images);
show_count("ports", stats.ports);
show_count("netblocks", stats.netblocks);
show_count("cryptoaddrs", stats.cryptoaddrs);
show_count("activity", stats.activity);
if let Some(blobs) = stats.blobs {
show_count("blobs", blobs.count);
show_amount("blobs (size)", blobs.total_size as usize, &blobs.total_human_size);
}
}
Ok(())
}
}

View File

@@ -128,6 +128,7 @@ fn run() -> Result<()> {
Some(SubCommand::Export(export)) => run_cmd(&args, export, &config),
Some(SubCommand::Cal(cal)) => run_cmd(&args, cal, &config),
Some(SubCommand::Notify(notify)) => run_cmd(&args, notify, &config),
Some(SubCommand::Stats(stats)) => run_cmd(&args, stats, &config),
Some(SubCommand::Repl) => repl::run(&config),
Some(SubCommand::Paths) => paths::run(&config),
Some(SubCommand::Completions(completions)) => complete::run_generate(&completions),

View File

@@ -83,6 +83,14 @@ impl Activity {
.optional()
.map_err(Error::from)
}
pub fn count(db: &Database) -> Result<usize> {
use crate::schema::activity::dsl::*;
activity.count()
.get_result::<i64>(db.db())
.map(|x| x as usize)
.map_err(Error::from)
}
}
pub struct ActivityFilter {

View File

@@ -191,18 +191,60 @@ impl Completer for CmdCompleter {
},
Command::Pkg => {
// we can only complete the 2nd argument
if args != 2 {
Ok((0, vec![]))
} else {
Ok(filter_options("pkg", &[
"list",
"install",
"search",
"reload",
"update",
"uninstall",
"quickstart",
], &cmd[1]))
let subcommand = cmd.get(1).map(|x| x.as_str());
let current = &cmd[args - 1];
let prev = &cmd[args - 2];
match (args, subcommand) {
(_, Some("list")) => {
let line = &line[..line.len() - current.len() - 1];
match prev.as_str() {
"--source" => Ok(filter_options(line, &[
"domains",
"subdomains",
"ipaddrs",
"urls",
"emails",
"phonenumbers",
"devices",
"networks",
"accounts",
"breaches",
"images",
"ports",
"netblocks",
"cryptoaddrs",
], current)),
"--stealth" => Ok(filter_options(line, &[
"loud",
"normal",
"passive",
"offline",
], current)),
_ => if current.starts_with("-") {
Ok(filter_options(line, &[
"--source",
"--stealth",
], current))
} else {
Ok((0, vec![]))
},
}
},
(2, Some(subcommand)) => {
Ok(filter_options("pkg", &[
"list",
"install",
"search",
"reload",
"update",
"uninstall",
"quickstart",
], &subcommand))
},
(_, _) => Ok((0, vec![])),
}
},
Command::Noscope => self.filter("noscope", &cmd),
@@ -251,13 +293,13 @@ impl Hinter for CmdCompleter {
type Hint = String;
#[inline]
fn hint(&self, _line: &str, _pos: usize, _ctx: &Context<'_>) -> Option<String> {
fn hint(&self, line: &str, pos: usize, ctx: &Context<'_>) -> Option<String> {
// None
match self.complete(_line, _pos, _ctx) {
match self.complete(line, pos, ctx) {
Ok((_, mut cmds)) => if cmds.len() == 1 {
// TODO: this fails if we complete a 2nd argument
let hint = cmds.remove(0);
Some(hint[_pos..].to_string())
Some(hint[pos..].to_string())
} else {
None
},

View File

@@ -45,6 +45,7 @@ pub enum Command {
Scope,
Set,
Select,
Stats,
Target,
Use,
Quickstart,
@@ -76,6 +77,7 @@ impl Command {
Command::Scope => "scope",
Command::Set => "set",
Command::Select => "select",
Command::Stats => "stats",
Command::Target => "target",
Command::Use => "use",
Command::Quickstart => "quickstart",
@@ -104,6 +106,7 @@ impl Command {
Command::Scope.as_str(),
Command::Set.as_str(),
Command::Select.as_str(),
Command::Stats.as_str(),
Command::Target.as_str(),
Command::Use.as_str(),
Command::Quit.as_str(),
@@ -137,6 +140,7 @@ impl FromStr for Command {
"scope" => Ok(Command::Scope),
"set" => Ok(Command::Set),
"select" => Ok(Command::Select),
"stats" => Ok(Command::Stats),
"target" => Ok(Command::Target),
"use" => Ok(Command::Use),
"quickstart" => Ok(Command::Quickstart),
@@ -504,6 +508,7 @@ pub fn run_once(rl: &mut Shell) -> Result<bool> {
Some((Command::Scope, args)) => scope_cmd::run(rl, &args)?,
Some((Command::Set, args)) => set_cmd::run(rl, &args)?,
Some((Command::Select, args)) => cmd::<select_cmd::Args>(rl, &args)?,
Some((Command::Stats, args)) => cmd::<stats_cmd::Args>(rl, &args)?,
Some((Command::Target, args)) => target_cmd::run(rl, &args)?,
Some((Command::Use, args)) => use_cmd::run(rl, &args)?,
Some((Command::Quickstart, args)) => quickstart_cmd::run(rl, &args)?,