Compare commits
No commits in common. "72432181dbadc989006d994a344ef008421b0a3e" and "5bb904a442a8e92207916dbf021c3087c35e8b37" have entirely different histories.
72432181db
...
5bb904a442
231
Cargo.lock
generated
231
Cargo.lock
generated
@ -18,7 +18,7 @@ version = "0.8.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241"
|
checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"cipher 0.4.4",
|
"cipher 0.4.4",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
]
|
]
|
||||||
@ -195,7 +195,7 @@ dependencies = [
|
|||||||
"arrayref",
|
"arrayref",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"constant_time_eq",
|
"constant_time_eq",
|
||||||
"digest 0.10.6",
|
"digest 0.10.6",
|
||||||
]
|
]
|
||||||
@ -260,6 +260,12 @@ version = "1.0.79"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "0.1.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -272,7 +278,7 @@ version = "0.8.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6"
|
checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"cipher 0.3.0",
|
"cipher 0.3.0",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
@ -362,7 +368,7 @@ version = "1.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -372,7 +378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
|
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 1.1.0",
|
"autocfg 1.1.0",
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
"memoffset",
|
"memoffset",
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
@ -384,7 +390,32 @@ version = "0.8.15"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
|
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossterm"
|
||||||
|
version = "0.17.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"crossterm_winapi",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"mio 0.7.14",
|
||||||
|
"parking_lot 0.10.2",
|
||||||
|
"signal-hook",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossterm_winapi"
|
||||||
|
version = "0.6.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c2265c3f8e080075d9b6417aa72293fc71662f34b4af2612d8d1b074d29510db"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -461,9 +492,9 @@ version = "5.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
|
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"lock_api",
|
"lock_api 0.4.9",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"parking_lot_core 0.9.7",
|
"parking_lot_core 0.9.7",
|
||||||
]
|
]
|
||||||
@ -602,7 +633,7 @@ version = "0.8.32"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
|
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -833,7 +864,7 @@ version = "0.1.16"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi 0.9.0+wasi-snapshot-preview1",
|
"wasi 0.9.0+wasi-snapshot-preview1",
|
||||||
@ -846,7 +877,7 @@ version = "0.2.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
|
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||||
@ -1007,7 +1038,7 @@ version = "0.2.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d26ac735f676c52305becf53264b91cea9866a8de61ccbf464405b377b9cbca9"
|
checksum = "d26ac735f676c52305becf53264b91cea9866a8de61ccbf464405b377b9cbca9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"uuid 0.8.2",
|
"uuid 0.8.2",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@ -1042,7 +1073,7 @@ version = "0.1.12"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@ -1125,6 +1156,15 @@ version = "0.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
|
checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.3.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
|
||||||
|
dependencies = [
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
@ -1141,7 +1181,7 @@ version = "0.4.17"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1359,6 +1399,19 @@ version = "0.3.17"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mio"
|
||||||
|
version = "0.7.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"miow",
|
||||||
|
"ntapi",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.8.6"
|
version = "0.8.6"
|
||||||
@ -1371,6 +1424,15 @@ dependencies = [
|
|||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miow"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "native-tls"
|
name = "native-tls"
|
||||||
version = "0.2.11"
|
version = "0.2.11"
|
||||||
@ -1389,6 +1451,28 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"cc",
|
||||||
|
"cfg-if 0.1.10",
|
||||||
|
"libc",
|
||||||
|
"void",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ntapi"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_cpus"
|
name = "num_cpus"
|
||||||
version = "1.15.0"
|
version = "1.15.0"
|
||||||
@ -1418,7 +1502,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1"
|
checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@ -1455,6 +1539,16 @@ dependencies = [
|
|||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
|
||||||
|
dependencies = [
|
||||||
|
"lock_api 0.3.4",
|
||||||
|
"parking_lot_core 0.7.3",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.11.2"
|
version = "0.11.2"
|
||||||
@ -1462,17 +1556,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"instant",
|
"instant",
|
||||||
"lock_api",
|
"lock_api 0.4.9",
|
||||||
"parking_lot_core 0.8.6",
|
"parking_lot_core 0.8.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.7.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b93f386bb233083c799e6e642a9d73db98c24a5deeb95ffc85bf281255dffc98"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 0.1.10",
|
||||||
|
"cloudabi",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall 0.1.57",
|
||||||
|
"smallvec",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot_core"
|
name = "parking_lot_core"
|
||||||
version = "0.8.6"
|
version = "0.8.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
|
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"instant",
|
"instant",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall 0.2.16",
|
"redox_syscall 0.2.16",
|
||||||
@ -1486,7 +1594,7 @@ version = "0.9.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
|
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall 0.2.16",
|
"redox_syscall 0.2.16",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@ -1842,6 +1950,12 @@ dependencies = [
|
|||||||
"rand_core 0.3.1",
|
"rand_core 0.3.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.1.57"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.2.16"
|
version = "0.2.16"
|
||||||
@ -1925,27 +2039,6 @@ dependencies = [
|
|||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rpassword"
|
|
||||||
version = "7.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"rtoolbox",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rtoolbox"
|
|
||||||
version = "0.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.7.4"
|
version = "0.7.4"
|
||||||
@ -2067,7 +2160,7 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scam-police"
|
name = "scam-police"
|
||||||
version = "0.5.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dirs",
|
"dirs",
|
||||||
@ -2075,13 +2168,25 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rpassword",
|
"scanpw",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scanpw"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "80f65c5c067e5eb335001a5f5f659fa3c0f75f3b90e1ccdd697570d9027242c5"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 0.1.10",
|
||||||
|
"crossterm",
|
||||||
|
"nix",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "schannel"
|
name = "schannel"
|
||||||
version = "0.1.21"
|
version = "0.1.21"
|
||||||
@ -2179,7 +2284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
|
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer 0.9.0",
|
"block-buffer 0.9.0",
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
"digest 0.9.0",
|
"digest 0.9.0",
|
||||||
"opaque-debug",
|
"opaque-debug",
|
||||||
@ -2191,11 +2296,31 @@ version = "0.10.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
|
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
"digest 0.10.6",
|
"digest 0.10.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "signal-hook"
|
||||||
|
version = "0.1.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"mio 0.7.14",
|
||||||
|
"signal-hook-registry",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "signal-hook-registry"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "signature"
|
name = "signature"
|
||||||
version = "1.6.4"
|
version = "1.6.4"
|
||||||
@ -2224,7 +2349,7 @@ dependencies = [
|
|||||||
"fxhash",
|
"fxhash",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot",
|
"parking_lot 0.11.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2303,7 +2428,7 @@ version = "3.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
|
checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"redox_syscall 0.3.5",
|
"redox_syscall 0.3.5",
|
||||||
"rustix",
|
"rustix",
|
||||||
@ -2354,7 +2479,7 @@ dependencies = [
|
|||||||
"autocfg 1.1.0",
|
"autocfg 1.1.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
"libc",
|
"libc",
|
||||||
"mio",
|
"mio 0.8.6",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"socket2",
|
"socket2",
|
||||||
@ -2435,7 +2560,7 @@ version = "0.1.37"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"tracing-attributes",
|
"tracing-attributes",
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
@ -2586,6 +2711,12 @@ dependencies = [
|
|||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "void"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "want"
|
name = "want"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -2614,7 +2745,7 @@ version = "0.2.84"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
|
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro",
|
||||||
@ -2641,7 +2772,7 @@ version = "0.4.34"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
|
checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@ -2684,7 +2815,7 @@ checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"parking_lot",
|
"parking_lot 0.11.2",
|
||||||
"pin-utils",
|
"pin-utils",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "scam-police"
|
name = "scam-police"
|
||||||
version = "0.5.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = [ "@0xf8:projectsegfau.lt", "@jjj333:pain.agency" ]
|
authors = [ "@0xf8:projectsegfau.lt", "@jjj333:pain.agency" ]
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ matrix-sdk = "0.6.2"
|
|||||||
once_cell = "1.17.1"
|
once_cell = "1.17.1"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
reqwest = "0.11.16"
|
reqwest = "0.11.16"
|
||||||
rpassword = "7.2.0"
|
scanpw = "0.1.0"
|
||||||
serde = "1.0.160"
|
serde = "1.0.160"
|
||||||
serde_json = "1.0.95"
|
serde_json = "1.0.95"
|
||||||
tokio = { version = "1.27.0", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.27.0", features = ["macros", "rt-multi-thread"] }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"keywords":{
|
"scams":{
|
||||||
"verbs":[
|
"verbs":[
|
||||||
"earn",
|
"earn",
|
||||||
"make", "making", "made",
|
"make", "making", "made",
|
||||||
@ -9,13 +9,11 @@
|
|||||||
"cashout",
|
"cashout",
|
||||||
"sell",
|
"sell",
|
||||||
"get",
|
"get",
|
||||||
"pay",
|
|
||||||
"sex",
|
"sex",
|
||||||
"meet",
|
"meet",
|
||||||
"upload",
|
"upload",
|
||||||
"login",
|
"login",
|
||||||
"send",
|
"send",
|
||||||
"join",
|
|
||||||
"buy",
|
"buy",
|
||||||
"check",
|
"check",
|
||||||
"private"
|
"private"
|
||||||
@ -29,15 +27,13 @@
|
|||||||
"paypal",
|
"paypal",
|
||||||
"bitcoin", "btc",
|
"bitcoin", "btc",
|
||||||
"etherium", " eth",
|
"etherium", " eth",
|
||||||
"usd",
|
|
||||||
"nft",
|
|
||||||
"token",
|
|
||||||
"free",
|
"free",
|
||||||
|
"meet",
|
||||||
|
"upload",
|
||||||
"gift",
|
"gift",
|
||||||
"card",
|
"card",
|
||||||
"nude",
|
"nude",
|
||||||
"18+",
|
"18+"
|
||||||
"pay"
|
|
||||||
],
|
],
|
||||||
"socials":[
|
"socials":[
|
||||||
"l.wl.co/",
|
"l.wl.co/",
|
||||||
@ -47,9 +43,6 @@
|
|||||||
"matrix.to/",
|
"matrix.to/",
|
||||||
"wa.me/",
|
"wa.me/",
|
||||||
"t.me/",
|
"t.me/",
|
||||||
"cash.app",
|
|
||||||
"cash app",
|
|
||||||
"cashapp",
|
|
||||||
"discord.gg/",
|
"discord.gg/",
|
||||||
"discord",
|
"discord",
|
||||||
"is.gd/",
|
"is.gd/",
|
||||||
@ -58,9 +51,10 @@
|
|||||||
"wickr",
|
"wickr",
|
||||||
"kik",
|
"kik",
|
||||||
"instagram",
|
"instagram",
|
||||||
"dm me",
|
|
||||||
"👇", "👆️",
|
"👇", "👆️",
|
||||||
"+1", "+2"
|
"+1", "+2"
|
||||||
]
|
],
|
||||||
|
"response":"Warning! This message is likely to be a scam, hoping to lure you in and steal your money. Please visit [ https://www.sec.gov/oiea/investor-alerts-and-bulletins/digital-asset-and-crypto-investment-scams-investor-alert ] for more information. [!mods !modhelp]",
|
||||||
|
"response_md":"Warning! This message is likely to be a <b>scam</b>, hoping to lure you in and steal your money! Please visit <a href=\"https://www.sec.gov/oiea/investor-alerts-and-bulletins/digital-asset-and-crypto-investment-scams-investor-alert\">here</a> for more information. [!mods !modhelp]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"reply": {
|
|
||||||
"Ok": null,
|
|
||||||
"MaybeScam": null,
|
|
||||||
"LikelyScam": {
|
|
||||||
"plain": "Watch out, the message you replied to has been detected as a scam! Please don't do anything they ask you to do! Stay safe",
|
|
||||||
"html": "Watch out, the message you replied to has been detected as a <b>scam</b>! <u>Please don't do anything they ask you to do</u>! Stay safe"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"Ok": null,
|
|
||||||
"MaybeScam": null,
|
|
||||||
"LikelyScam": {
|
|
||||||
"plain": "Warning! This message is likely to be a scam, seeking to lure you in and steal your money! Please visit these resources for more information:\n- https://www.sec.gov/oiea/investor-alerts-and-bulletins/digital-asset-and-crypto-investment-scams-investor-alert \n [!mods !modhelp]",
|
|
||||||
"html": "Warning! This message is likely to be a <b>scam</b>, seeking to lure you in and steal your money! Please visit these resources for more information: <ul><li><a href=\"https://www.sec.gov/oiea/investor-alerts-and-bulletins/digital-asset-and-crypto-investment-scams-investor-alert\">https://www.sec.gov/oiea/investor-alerts-and-bulletins/digital-asset-and-crypto-investment-scams-investor-alert</a></li></ul> [!mods !modhelp]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,24 +2,15 @@ use serde_json::Value;
|
|||||||
|
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub keywords: Value,
|
pub keywords: Value,
|
||||||
pub responses: Value,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn load() -> Config {
|
pub fn load() -> Config {
|
||||||
let keywords_reader =
|
let keywords_reader = std::fs::File::open("config/keywords.json").expect("Couldn't find keywords.json");
|
||||||
std::fs::File::open("config/keywords.json").expect("Couldn't find keywords.json");
|
let keywords: Value = serde_json::from_reader(keywords_reader).expect("Couldn't read keywords.json");
|
||||||
let keywords: Value =
|
|
||||||
serde_json::from_reader(keywords_reader).expect("Couldn't read keywords");
|
|
||||||
|
|
||||||
let responses_reader =
|
|
||||||
std::fs::File::open("config/responses.json").expect("Couldn't find responses.json");
|
|
||||||
let responses: Value =
|
|
||||||
serde_json::from_reader(responses_reader).expect("Couldn't read responses");
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
keywords,
|
keywords
|
||||||
responses,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
165
src/judge.rs
165
src/judge.rs
@ -1,165 +0,0 @@
|
|||||||
use crate::{
|
|
||||||
keywords::{KeywordCategory, Keywords},
|
|
||||||
CONFIG,
|
|
||||||
};
|
|
||||||
use matrix_sdk::{
|
|
||||||
room::Joined,
|
|
||||||
ruma::events::room::message::{OriginalRoomMessageEvent, RoomMessageEventContent},
|
|
||||||
};
|
|
||||||
use serde_json::json;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum JudgementResult {
|
|
||||||
Ok,
|
|
||||||
MaybeScam, // hit atleast one category
|
|
||||||
LikelyScam, // hit all categories
|
|
||||||
}
|
|
||||||
|
|
||||||
impl JudgementResult {
|
|
||||||
pub fn to_json_var(&self) -> &str {
|
|
||||||
match self {
|
|
||||||
Self::Ok => "Ok",
|
|
||||||
Self::MaybeScam => "MaybeScam",
|
|
||||||
Self::LikelyScam => "LikelyScam",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Judgement {
|
|
||||||
pub text: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Judgement {
|
|
||||||
pub fn judge(&self) -> anyhow::Result<JudgementResult> {
|
|
||||||
// Load keywords
|
|
||||||
let mut keywords = CONFIG.keywords.clone();
|
|
||||||
let keywords = keywords
|
|
||||||
.as_object_mut()
|
|
||||||
.unwrap()
|
|
||||||
.get_mut("keywords")
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Turn json into Keywords
|
|
||||||
let verbs = Keywords::create("verbs", &keywords["verbs"]);
|
|
||||||
let currencies = Keywords::create("currencies", &keywords["currencies"]);
|
|
||||||
let socials = Keywords::create("socials", &keywords["socials"]);
|
|
||||||
|
|
||||||
// Count occurences
|
|
||||||
let mut counter = KeywordCategory::create_counter_map();
|
|
||||||
counter.insert(KeywordCategory::Verb, verbs.find(&self.text));
|
|
||||||
counter.insert(KeywordCategory::Currency, currencies.find(&self.text));
|
|
||||||
counter.insert(KeywordCategory::Social, socials.find(&self.text));
|
|
||||||
|
|
||||||
let mut count_all = 0;
|
|
||||||
let total = counter.len();
|
|
||||||
for (_category, count) in counter.to_owned() {
|
|
||||||
if count > 0 {
|
|
||||||
count_all = count_all + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if count_all == 0 {
|
|
||||||
return Ok(JudgementResult::Ok);
|
|
||||||
};
|
|
||||||
if count_all < total {
|
|
||||||
return Ok(JudgementResult::MaybeScam);
|
|
||||||
};
|
|
||||||
Ok(JudgementResult::LikelyScam)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn send_debug(&self, room: &Joined) -> anyhow::Result<()> {
|
|
||||||
// Load keywords
|
|
||||||
let mut keywords = CONFIG.keywords.clone();
|
|
||||||
let keywords = keywords
|
|
||||||
.as_object_mut()
|
|
||||||
.unwrap()
|
|
||||||
.get_mut("keywords")
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Turn json into Keywords
|
|
||||||
let verbs = Keywords::create("verbs", &keywords["verbs"]);
|
|
||||||
let currencies = Keywords::create("currencies", &keywords["currencies"]);
|
|
||||||
let socials = Keywords::create("socials", &keywords["socials"]);
|
|
||||||
|
|
||||||
// Count occurences
|
|
||||||
let mut counter = KeywordCategory::create_counter_map();
|
|
||||||
counter.insert(KeywordCategory::Verb, verbs.find(&self.text));
|
|
||||||
counter.insert(KeywordCategory::Currency, currencies.find(&self.text));
|
|
||||||
counter.insert(KeywordCategory::Social, socials.find(&self.text));
|
|
||||||
|
|
||||||
let mut count_all = 0;
|
|
||||||
let total = counter.len();
|
|
||||||
for (_category, count) in counter.to_owned() {
|
|
||||||
if count > 0 {
|
|
||||||
count_all = count_all + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut result = JudgementResult::LikelyScam;
|
|
||||||
if count_all == 0 {
|
|
||||||
result = JudgementResult::Ok
|
|
||||||
}
|
|
||||||
if count_all < total {
|
|
||||||
result = JudgementResult::MaybeScam
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send message
|
|
||||||
let msg = RoomMessageEventContent::text_html(
|
|
||||||
format!("{counter:?}, {count_all}/{total}, {result:?}"),
|
|
||||||
format!("<code>{counter:?}</code><br>Categories covered: <code>{count_all}/{total}</code><br>Verdict: <code>{result:?}</code>"));
|
|
||||||
room.send(msg, None).await.expect("Couldn't send message");
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn alert(
|
|
||||||
room: &Joined,
|
|
||||||
event: &OriginalRoomMessageEvent,
|
|
||||||
result: JudgementResult,
|
|
||||||
is_reply: bool,
|
|
||||||
) -> anyhow::Result<()> {
|
|
||||||
let mut responses = CONFIG.responses.clone();
|
|
||||||
let responses = responses.as_object_mut().unwrap();
|
|
||||||
|
|
||||||
// Determine which message to send
|
|
||||||
let section = if is_reply {
|
|
||||||
responses["reply"].as_object().unwrap()
|
|
||||||
} else {
|
|
||||||
responses["message"].as_object().unwrap()
|
|
||||||
};
|
|
||||||
|
|
||||||
let response_type = section.get(result.to_json_var()).unwrap();
|
|
||||||
if response_type.is_null() {
|
|
||||||
anyhow::bail!("Called alert with result that has no detection message");
|
|
||||||
}
|
|
||||||
|
|
||||||
let response_type = response_type.as_object().unwrap();
|
|
||||||
let plain = response_type["plain"].as_str().unwrap();
|
|
||||||
let html = response_type["html"].as_str().unwrap();
|
|
||||||
|
|
||||||
// Send message
|
|
||||||
let msg = RoomMessageEventContent::text_html(plain, html);
|
|
||||||
room.send(msg, None).await.expect("Couldn't send message");
|
|
||||||
// Todo: Add room config?
|
|
||||||
// let reply = msg.make_reply_to(event);
|
|
||||||
// room.send(reply, None).await.expect("Couldn't send message");
|
|
||||||
|
|
||||||
// Send reaction
|
|
||||||
if !is_reply {
|
|
||||||
room.send_raw(
|
|
||||||
json!({
|
|
||||||
"m.relates_to": {
|
|
||||||
"rel_type": "m.annotation",
|
|
||||||
"event_id": event.event_id.to_string(),
|
|
||||||
"key": "🚨🚨 SCAM 🚨🚨"
|
|
||||||
}}),
|
|
||||||
"m.reaction",
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.expect("Couldn't send reaction");
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,6 +19,7 @@ impl std::fmt::Display for KeywordCategory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl KeywordCategory {
|
impl KeywordCategory {
|
||||||
pub fn to_json_var(&self) -> &str {
|
pub fn to_json_var(&self) -> &str {
|
||||||
use KeywordCategory::*;
|
use KeywordCategory::*;
|
||||||
@ -37,7 +38,7 @@ impl KeywordCategory {
|
|||||||
"verbs" => Ok(Verb),
|
"verbs" => Ok(Verb),
|
||||||
"currencies" => Ok(Currency),
|
"currencies" => Ok(Currency),
|
||||||
"socials" => Ok(Social),
|
"socials" => Ok(Social),
|
||||||
_ => Err(()),
|
_ => Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,9 +54,10 @@ impl KeywordCategory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub struct Keywords {
|
pub struct Keywords {
|
||||||
pub category: KeywordCategory,
|
pub category: KeywordCategory,
|
||||||
pub words: Vec<Value>,
|
pub words: Vec<Value>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Keywords {
|
impl Keywords {
|
||||||
@ -67,7 +69,7 @@ impl Keywords {
|
|||||||
|
|
||||||
Self {
|
Self {
|
||||||
category,
|
category,
|
||||||
words: v.to_vec(),
|
words: v.to_vec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
170
src/main.rs
170
src/main.rs
@ -1,126 +1,86 @@
|
|||||||
use matrix_sdk::{
|
use matrix_sdk::{
|
||||||
room::Room,
|
room::Room,
|
||||||
ruma::{
|
ruma::{events::room::message::{
|
||||||
events::room::message::{
|
MessageType, OriginalSyncRoomMessageEvent, RoomMessageEventContent, Relation
|
||||||
MessageType, OriginalSyncRoomMessageEvent, Relation, RoomMessageEvent,
|
}, OwnedRoomId},
|
||||||
},
|
|
||||||
OwnedRoomId,
|
|
||||||
},
|
|
||||||
Error, LoopCtrl,
|
Error, LoopCtrl,
|
||||||
};
|
};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
use serde_json::json;
|
||||||
|
|
||||||
pub mod config;
|
|
||||||
pub mod judge;
|
|
||||||
pub mod keywords;
|
|
||||||
pub mod matrix;
|
pub mod matrix;
|
||||||
|
pub mod config;
|
||||||
|
pub mod keywords;
|
||||||
|
|
||||||
static CONFIG: Lazy<config::Config> = Lazy::new(|| config::Config::load());
|
static CONFIG: Lazy<config::Config> = Lazy::new(|| config::Config::load());
|
||||||
|
|
||||||
async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) -> anyhow::Result<()> {
|
async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) {
|
||||||
if let Room::Joined(room) = room {
|
if let Room::Joined(room) = room {
|
||||||
let orig_event = event
|
let orig_event = event.to_owned().into_full_event(OwnedRoomId::from(room.room_id()));
|
||||||
.to_owned()
|
|
||||||
.into_full_event(OwnedRoomId::from(room.room_id()));
|
|
||||||
|
|
||||||
// Ignore non-text
|
// Ignore non-text
|
||||||
let MessageType::Text(text_content) = event.to_owned().content.msgtype else {
|
let MessageType::Text(text_content) = event.to_owned().content.msgtype else {
|
||||||
return Ok(());
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Too short to be a scam lol
|
// Ignore own messages
|
||||||
if text_content.body.chars().count() < 12 {
|
if event.sender == room.client().user_id().expect("Couldn't get user_id").to_string() { return }
|
||||||
return Ok(());
|
|
||||||
|
// Ignore replies
|
||||||
|
if let Some(relation) = orig_event.to_owned().content.relates_to {
|
||||||
|
if match relation {
|
||||||
|
Relation::Reply { in_reply_to: _ } => true,
|
||||||
|
_ => false
|
||||||
|
} {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Too short to be a scam lol
|
||||||
|
if text_content.body.chars().count() < 12 { return }
|
||||||
|
|
||||||
let text_content = text_content.body.to_lowercase();
|
let text_content = text_content.body.to_lowercase();
|
||||||
let debug = text_content.contains(";spdebug");
|
|
||||||
|
|
||||||
// Ignore own messages
|
// Load keywords
|
||||||
if !debug
|
let mut keywords = CONFIG.keywords.clone();
|
||||||
&& event.sender
|
let scams = keywords.as_object_mut().unwrap().get_mut("scams").unwrap();
|
||||||
== room
|
|
||||||
.client()
|
// Turn json into Keywords
|
||||||
.user_id()
|
let verbs = keywords::Keywords::create("verbs", &scams["verbs"]);
|
||||||
.expect("Couldn't get user_id")
|
let currencies = keywords::Keywords::create("currencies", &scams["currencies"]);
|
||||||
.to_string()
|
let socials = keywords::Keywords::create("socials", &scams["socials"]);
|
||||||
{
|
|
||||||
return Ok(());
|
// Count occurences
|
||||||
|
let mut counter = keywords::KeywordCategory::create_counter_map();
|
||||||
|
counter.insert(keywords::KeywordCategory::Verb, verbs.find(&text_content));
|
||||||
|
counter.insert(keywords::KeywordCategory::Currency, currencies.find(&text_content));
|
||||||
|
counter.insert(keywords::KeywordCategory::Social, socials.find(&text_content));
|
||||||
|
|
||||||
|
// Test if every category has atleast one hit
|
||||||
|
let mut hit_all = true;
|
||||||
|
for (_category, count) in counter.to_owned() {
|
||||||
|
hit_all = hit_all && count != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let judgement = judge::Judgement { text: text_content };
|
if hit_all {
|
||||||
|
// Add stats to end of response
|
||||||
|
let response = format!("{}\nDetection stats: {:?}", scams["response"].as_str().unwrap(), counter.to_owned());
|
||||||
|
let response_html = format!("{}<br>Detection stats: <code>{:?}</code>", scams["response_md"].as_str().unwrap(), counter.to_owned());
|
||||||
|
|
||||||
// Handle replies
|
// Send message
|
||||||
if let Some(relation) = orig_event.to_owned().content.relates_to {
|
let msg = RoomMessageEventContent::text_html(response, response_html);
|
||||||
if let Some(event) = match relation {
|
let reply = msg.make_reply_to(&orig_event);
|
||||||
Relation::Reply { in_reply_to } => {
|
room.send(reply, None).await.expect("Couldn't send message");
|
||||||
let replied_event = room.event(&in_reply_to.event_id).await?;
|
|
||||||
let t = replied_event.event.get_field::<&str>("type")?;
|
|
||||||
|
|
||||||
if t.as_deref() == Some("m.room.message") {
|
// Send reaction
|
||||||
let event = replied_event.event.deserialize_as::<RoomMessageEvent>()?;
|
room.send_raw(json!({
|
||||||
Some(event.to_owned())
|
"m.relates_to": {
|
||||||
} else {
|
"rel_type": "m.annotation",
|
||||||
None
|
"event_id": orig_event.event_id.to_string(),
|
||||||
|
"key": "🚨🚨 SCAM 🚨🚨"
|
||||||
|
}}), "m.reaction", None).await.expect("Couldn't send reaction");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => None,
|
|
||||||
} {
|
|
||||||
let event = event.as_original().unwrap();
|
|
||||||
let content = event.content.to_owned().body().to_lowercase();
|
|
||||||
|
|
||||||
if !debug
|
|
||||||
&& event.sender
|
|
||||||
== room
|
|
||||||
.client()
|
|
||||||
.user_id()
|
|
||||||
.expect("Couldn't get user_id")
|
|
||||||
.to_string()
|
|
||||||
{
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
let reply_judgement = judge::Judgement { text: content };
|
|
||||||
|
|
||||||
if debug {
|
|
||||||
reply_judgement.send_debug(&room).await?;
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
match reply_judgement.judge()? {
|
|
||||||
judge::JudgementResult::Ok => (),
|
|
||||||
judge::JudgementResult::MaybeScam => (),
|
|
||||||
judge::JudgementResult::LikelyScam => {
|
|
||||||
judge::Judgement::alert(
|
|
||||||
&room,
|
|
||||||
&orig_event,
|
|
||||||
judge::JudgementResult::LikelyScam,
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match judgement.judge()? {
|
|
||||||
judge::JudgementResult::Ok => return Ok(()),
|
|
||||||
judge::JudgementResult::MaybeScam => return Ok(()),
|
|
||||||
judge::JudgementResult::LikelyScam => {
|
|
||||||
judge::Judgement::alert(
|
|
||||||
&room,
|
|
||||||
&orig_event,
|
|
||||||
judge::JudgementResult::LikelyScam,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@ -135,15 +95,9 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
let (client, sync_token) = if session_file.exists() {
|
let (client, sync_token) = if session_file.exists() {
|
||||||
matrix::restore_session(&session_file).await?
|
matrix::restore_session(&session_file).await?
|
||||||
} else if args.len() > 1 {
|
} else if args.len() > 1 {
|
||||||
(
|
(matrix::login(&data_dir, &session_file, args.get(1).unwrap().to_owned()).await?, None)
|
||||||
matrix::login(&data_dir, &session_file, args.get(1).unwrap().to_owned()).await?,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
anyhow::bail!(
|
anyhow::bail!("No previous session found, please run \"{} <MXID>\"", args.get(0).unwrap());
|
||||||
"No previous session found, please run \"{} <MXID>\"",
|
|
||||||
args.get(0).unwrap()
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let (client, sync_settings) = match matrix::sync(client, sync_token).await {
|
let (client, sync_settings) = match matrix::sync(client, sync_token).await {
|
||||||
@ -156,8 +110,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
client.add_event_handler(on_room_message);
|
client.add_event_handler(on_room_message);
|
||||||
|
|
||||||
client
|
client.sync_with_result_callback(sync_settings, |sync_result| async move {
|
||||||
.sync_with_result_callback(sync_settings, |sync_result| async move {
|
|
||||||
let response = sync_result?;
|
let response = sync_result?;
|
||||||
|
|
||||||
matrix::persist_sync_token(response.next_batch)
|
matrix::persist_sync_token(response.next_batch)
|
||||||
@ -165,8 +118,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.map_err(|err| Error::UnknownError(err.into()))?;
|
.map_err(|err| Error::UnknownError(err.into()))?;
|
||||||
|
|
||||||
Ok(LoopCtrl::Continue)
|
Ok(LoopCtrl::Continue)
|
||||||
})
|
}).await?;
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use matrix_sdk::{
|
use matrix_sdk::{
|
||||||
config::SyncSettings, ruma::api::client::filter::FilterDefinition, Client, Session,
|
config::SyncSettings, ruma::api::client::filter::FilterDefinition, Client, Session
|
||||||
};
|
};
|
||||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
||||||
use reqwest::Client as http;
|
|
||||||
use rpassword::prompt_password;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{from_str, Value};
|
use serde_json::{Value, from_str};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use reqwest::Client as http;
|
||||||
|
use scanpw::scanpw;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
@ -24,6 +24,7 @@ pub struct FullSession {
|
|||||||
sync_token: Option<String>,
|
sync_token: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Matrix Login & Init
|
// Matrix Login & Init
|
||||||
//
|
//
|
||||||
@ -35,7 +36,7 @@ pub async fn login(data_dir: &Path, session_file: &Path, mxid: String) -> anyhow
|
|||||||
let (client, client_session) = build_client(data_dir, hs).await?;
|
let (client, client_session) = build_client(data_dir, hs).await?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let password = prompt_password("Password\n> ")?;
|
let password = scanpw!("Password\n> ");
|
||||||
|
|
||||||
match client
|
match client
|
||||||
.login_username(&user, &password)
|
.login_username(&user, &password)
|
||||||
@ -97,7 +98,7 @@ pub async fn build_client(data_dir: &Path, hs: String) -> anyhow::Result<(Client
|
|||||||
db_path,
|
db_path,
|
||||||
passphrase,
|
passphrase,
|
||||||
},
|
},
|
||||||
));
|
))
|
||||||
}
|
}
|
||||||
Err(error) => match &error {
|
Err(error) => match &error {
|
||||||
matrix_sdk::ClientBuildError::AutoDiscovery(_)
|
matrix_sdk::ClientBuildError::AutoDiscovery(_)
|
||||||
@ -140,10 +141,7 @@ pub async fn resolve_homeserver(homeserver: String) -> anyhow::Result<String> {
|
|||||||
hs.pop();
|
hs.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
let ident = http::new()
|
let ident = http::new().get(format!("{hs}/.well-known/matrix/client")).send().await;
|
||||||
.get(format!("{hs}/.well-known/matrix/client"))
|
|
||||||
.send()
|
|
||||||
.await;
|
|
||||||
match ident {
|
match ident {
|
||||||
Ok(r) => {
|
Ok(r) => {
|
||||||
let body = r.text().await?;
|
let body = r.text().await?;
|
||||||
@ -152,10 +150,13 @@ pub async fn resolve_homeserver(homeserver: String) -> anyhow::Result<String> {
|
|||||||
let discovered = json["m.homeserver"]["base_url"].as_str().unwrap();
|
let discovered = json["m.homeserver"]["base_url"].as_str().unwrap();
|
||||||
|
|
||||||
Ok(discovered.to_string())
|
Ok(discovered.to_string())
|
||||||
}
|
},
|
||||||
Err(e) => Err(e.into()),
|
Err(e) => {
|
||||||
|
Err(e.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Persistence
|
// Persistence
|
||||||
|
Loading…
Reference in New Issue
Block a user