{"id":29019260,"url":"https://github.com/harr1424/shark-scan","last_synced_at":"2025-06-26T00:09:37.656Z","repository":{"id":251989003,"uuid":"839062097","full_name":"harr1424/shark-scan","owner":"harr1424","description":"A multi-threaded port scanner supporting user specified port ranges and thread quantity","archived":false,"fork":false,"pushed_at":"2024-11-21T23:01:03.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T00:09:34.835Z","etag":null,"topics":["async-rust","port-scanner","port-sniffer","rust","tokio-rs"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/shark-scan","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harr1424.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-06T22:26:07.000Z","updated_at":"2024-11-21T23:01:06.000Z","dependencies_parsed_at":"2024-08-07T12:58:08.904Z","dependency_job_id":"0a0fb254-708f-457e-96c9-6910c73036d5","html_url":"https://github.com/harr1424/shark-scan","commit_stats":null,"previous_names":["harr1424/thread_safe_port_scanner","harr1424/shark-scan"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harr1424/shark-scan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harr1424%2Fshark-scan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harr1424%2Fshark-scan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harr1424%2Fshark-scan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harr1424%2Fshark-scan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harr1424","download_url":"https://codeload.github.com/harr1424/shark-scan/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harr1424%2Fshark-scan/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261973759,"owners_count":23238589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-rust","port-scanner","port-sniffer","rust","tokio-rs"],"created_at":"2025-06-26T00:09:36.840Z","updated_at":"2025-06-26T00:09:37.605Z","avatar_url":"https://github.com/harr1424.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## shark-scan\n\nAllows for fearless concurrent scanning of open TCP ports on a target IP address:\n\n```text\nshark-scan\nAn async multi-threaded port scanner supporting user specified port ranges, timeout durations, and thread quantity\n\nUsage: shark-scan [OPTIONS] --target \u003cTARGET\u003e\n\nOptions:\n  -t, --target \u003cTARGET\u003e          The target IP address to scan\n  -v, --verbosity \u003cVERBOSITY\u003e    The verbosity level (none, low, high) [default: none]\n  -n, --threads \u003cTHREADS\u003e        [default: 4]\n  -p, --port-range \u003cPORT_RANGE\u003e  The port range to scan in the format start:end or comma separated [default: 1:1024]\n  -m, --timeout \u003cTIMEOUT\u003e        The time in milliseconds to await successful port connection [default: 100]\n      --probe                    ***Do not use against untrusted hosts*** Probe the socket by performing an HTTP GET request\n  -h, --help                     Print help\n  -V, --version                  Print version\n```\n\n### Examples\n```text\nshark-scan -t 192.168.1.1 -n 6\n****************************************\n* Scanning: 192.168.1.1 *\n****************************************\n\nPort 53 open\nPort 80 open\nPort 443 open\n\nScanning completed in 0.40 seconds\n```\n\n```text\nshark-scan -t 192.168.1.1 -p 20:25 -n 6 -m 1000 -v high\n****************************************\n* Scanning: 192.168.1.1 *\n****************************************\n[2024-08-07T09:12:47Z INFO  shark_scan::scanner] Port 24 refused\n[2024-08-07T09:12:47Z INFO  shark_scan::scanner] Port 21 refused\n[2024-08-07T09:12:47Z INFO  shark_scan::scanner] Port 22 refused\n[2024-08-07T09:12:47Z INFO  shark_scan::scanner] Port 25 refused\n[2024-08-07T09:12:47Z INFO  shark_scan::scanner] Port 20 refused\n[2024-08-07T09:12:47Z INFO  shark_scan::scanner] Port 23 refused\n\n\nScanning completed in 0.00 seconds\n```\n\n```text\n❯ shark-scan -t 2600:6c67:6f3f:e79b::1 -p 50:60 -v high\n****************************************\n* Scanning: 2600:6c67:6f3f:e79b::1 *\n****************************************\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 51 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 50 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 52 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 55 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 54 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 56 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 57 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 59 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 60 refused\n[2024-08-07T14:14:04Z INFO  shark_scan::scanner] Port 58 refused\n\nPort 53 open\n\nScanning completed in 0.03 seconds\n```\n\n### Safety\nWhile this binary crate does not violate Rust's memory or type safety, executing this program\nwith the `--probe` flag on an untrusted host may present a security risk. When this flag is used,\nthe following code will execute:\n```rust\nlet http_request = format!(\n    \"GET / HTTP/1.1\\r\\nHost: {}\\r\\nConnection: close\\r\\n\\r\\n\",\n    target\n);\nmatch stream.write_all(http_request.as_bytes()).await {\n    Ok(_) =\u003e info!(\"Sent HTTP GET request to {}\", address),\n    Err(e) =\u003e {\n        error!(\"Failed to send HTTP GET request to {}: {:?}\", address, e);\n        return None;\n    }\n}\n\nlet mut banner = vec![0; 1024];\n\n// Wait one full second to read response from server\nmatch timeout(Duration::from_secs(1), stream.read(\u0026mut banner)).await {\n    Ok(Ok(n)) if n \u003e 0 =\u003e {\n        info!(\"Read {} bytes from {}\", n, address);\n        return Some(String::from_utf8_lossy(\u0026banner[..n]).to_string());\n    }\n    Ok(Ok(_)) =\u003e {\n        error!(\"No data read from {}\", address);\n    }\n    Ok(Err(e)) =\u003e {\n        error!(\"Failed to read from {}: {:?}\", address, e);\n    }\n    Err(_) =\u003e {\n        error!(\"Read operation timed out for {}\", address);\n    }\n}\n```\n\nA malicious host may respond with a payload crafted to damage your system.\nIf the `--probe` flag is not supplied, no HTTP requests will be sent, and the program will simply\ntry to complete a TCP connection with the target IP address ports. The decision to use this feature is left to\nthe crate's user and the author assumes no liability for any consequences.\n\n### Probe functionality\nCurrently the functionality provided by passing the `--probe` flag is limited: it will only perform an HTTP GET\nrequest to the service root (\"/\") endpoint. In the future, I would like to research additional probes that work\non services not supporting HTTP. An example of current functionality is shown below:\n\n```text\nshark-scan -t 192.168.1.1 -n 6 --probe\n****************************************\n* Scanning: 192.168.1.1 *\n****************************************\n[2024-08-07T09:07:43Z ERROR shark_scan::scanner] No data read from 192.168.1.1:443\n[2024-08-07T09:07:44Z ERROR shark_scan::scanner] Read operation timed out for 192.168.1.1:53\n\nPort 80 open - HTTP/1.1 308 Permanent Redirect\nLocation: https://192.168.1.1/\nContent-Length: 0\nConnection: close\nDate: Wed, 07 Aug 2024 09:07:28 GMT\nServer: lighttpd/1.4.59\n\n\nPort 443 open\nPort 53 open\n\nScanning completed in 1.03 seconds\n```\n\nAnother example:\n\n```text\nshark-scan -t  104.21.94.80 -p 80,443 --probe\n****************************************\n* Scanning: 104.21.94.80 *\n****************************************\n\nPort 443 open - HTTP/1.1 400 Bad Request\nServer: cloudflare\nDate: Wed, 07 Aug 2024 09:08:42 GMT\nContent-Type: text/html\nContent-Length: 253\nConnection: close\nCF-RAY: -\n\n\u003chtml\u003e\n\u003chead\u003e\u003ctitle\u003e400 The plain HTTP request was sent to HTTPS port\u003c/title\u003e\u003c/head\u003e\n\u003cbody\u003e\n\u003ccenter\u003e\u003ch1\u003e400 Bad Request\u003c/h1\u003e\u003c/center\u003e\n\u003ccenter\u003eThe plain HTTP request was sent to HTTPS port\u003c/center\u003e\n\u003chr\u003e\u003ccenter\u003ecloudflare\u003c/center\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n\nPort 80 open - HTTP/1.1 403 Forbidden\nDate: Wed, 07 Aug 2024 09:08:43 GMT\nContent-Type: text/plain; charset=UTF-8\nContent-Length: 16\nConnection: close\nX-Frame-Options: SAMEORIGIN\nReferrer-Policy: same-origin\nCache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0\nExpires: Thu, 01 Jan 1970 00:00:01 GMT\nServer: cloudflare\nCF-RAY: 8af61faa6fd130d1-SEA\n\nerror code: 1003\n\nScanning completed in 0.43 seconds\n```\n\nAs you can see, some useful information might be obtained. Pull requests adding to this functionality are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharr1424%2Fshark-scan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharr1424%2Fshark-scan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharr1424%2Fshark-scan/lists"}