mirror of
https://github.com/bee-san/RustScan.git
synced 2026-11-07 09:46:04 -10:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14e1d4f0f9 | ||
|
|
ce9ecdfeef | ||
|
|
4dcd929ba4 | ||
|
|
5b35a09b0b | ||
|
|
734595da46 | ||
|
|
943980ee83 | ||
|
|
61b691eaa4 | ||
|
|
6dcad646fa | ||
|
|
d2c84f5f33 | ||
|
|
0eaf63683e | ||
|
|
06c1d37aea | ||
|
|
4d560f4eb5 | ||
|
|
dbc3d510d5 | ||
|
|
68e1c8e8b6 | ||
|
|
15dd31e350 | ||
|
|
b3a64271dc | ||
|
|
abb08958cb | ||
|
|
d5935c4ce7 | ||
|
|
5c613082fb | ||
|
|
2868e13db4 | ||
|
|
31ed2e8914 | ||
|
|
0426aa83e3 | ||
|
|
4deb5eff53 |
No files matched your search
@@ -2,7 +2,7 @@ pkgbase = rustscan-bin
|
||||
pkgdesc = Faster Nmap Scanning with Rust
|
||||
pkgver = 1.1.0
|
||||
pkgrel = 1
|
||||
url = https://github.com/brandonskerritt/rustscan
|
||||
url = https://github.com/rustscan/rustscan
|
||||
arch = x86_64
|
||||
license = MIT
|
||||
depends = rustup
|
||||
|
||||
@@ -202,6 +202,42 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "bofh69",
|
||||
"name": "Sebastian Andersson",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/1444315?v=4",
|
||||
"profile": "https://github.com/bofh69",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "mattcorbin",
|
||||
"name": "Matt Corbin",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/6537765?v=4",
|
||||
"profile": "https://github.com/mattcorbin",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "rootsploit",
|
||||
"name": "RootSploit",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/67270834?v=4",
|
||||
"profile": "http://rootsploit.com",
|
||||
"contributions": [
|
||||
"blog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "eiffel-fl",
|
||||
"name": "eiffel-fl",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/12171754?v=4",
|
||||
"profile": "https://github.com/eiffel-fl",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
github: bee-san
|
||||
patreon: brandonskerritt
|
||||
ko_fi: hacker
|
||||
custom: ["https://monzo.me/bee", "https://paypal.me/brandonskerritt"]
|
||||
@@ -0,0 +1,15 @@
|
||||
on:
|
||||
push:
|
||||
tags: '*'
|
||||
|
||||
jobs:
|
||||
homebrew:
|
||||
name: Bump Homebrew formula
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: mislav/bump-homebrew-formula-action@v1
|
||||
with:
|
||||
# A PR will be sent to github.com/Homebrew/homebrew-core to update this formula:
|
||||
formula-name: rustscan
|
||||
env:
|
||||
COMMITTER_TOKEN: ${{secrets.brew}}
|
||||
File renamed without changes.
@@ -17,6 +17,7 @@ jobs:
|
||||
script:
|
||||
- cargo build
|
||||
- cargo test
|
||||
- "ulimit -n 5000; cargo test timelimits:: -- --ignored --test-threads=1 --show-output"
|
||||
- cargo fmt -- --check
|
||||
after_failure:
|
||||
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
|
||||
|
||||
Generated
+212
-377
File diff suppressed because it is too large.
Load diff
+6
-8
@@ -18,7 +18,7 @@ exclude = [
|
||||
|
||||
[dependencies]
|
||||
colored = "2.0.0"
|
||||
structopt = "0.3.18"
|
||||
structopt = "0.3.20"
|
||||
async-std = "1.6.4"
|
||||
futures = "0.3"
|
||||
rlimit = "0.4.0"
|
||||
@@ -30,13 +30,15 @@ gcd = "2.0.1"
|
||||
rand = "0.7.3"
|
||||
colorful = "0.2.1"
|
||||
ansi_term = "0.12.1"
|
||||
toml = "0.5.6"
|
||||
toml = "0.5.7"
|
||||
serde = "1.0.116"
|
||||
serde_derive = "1.0.116"
|
||||
cidr-utils = "0.5.0"
|
||||
itertools = "0.9.0"
|
||||
trust-dns-resolver = { version = "0.19.5"}
|
||||
criterion = "0.3"
|
||||
trust-dns-resolver = { version = "0.19.5", features = ["dns-over-rustls"] }
|
||||
|
||||
[dev-dependencies]
|
||||
wait-timeout = "0.2"
|
||||
|
||||
[package.metadata.deb]
|
||||
depends = "$auto, nmap"
|
||||
@@ -45,7 +47,3 @@ section = "rust"
|
||||
[profile.release]
|
||||
lto = true
|
||||
panic = 'abort'
|
||||
|
||||
[[bench]]
|
||||
name = "main"
|
||||
harness = false
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
FROM rust:alpine as builder
|
||||
LABEL maintainer="CMNatic <https://github.com/CMNatic">
|
||||
LABEL maintainer="RustScan <https://github.com/RustScan>"
|
||||
RUN apk add --no-cache build-base
|
||||
|
||||
# Encourage some layer caching here rather then copying entire directory that includes docs to builder container ~CMN
|
||||
WORKDIR /usr/src/rustscan
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY src src
|
||||
COPY src/ src/
|
||||
RUN cargo install --path .
|
||||
|
||||
FROM alpine:3.12
|
||||
@@ -16,4 +16,4 @@ RUN addgroup -S rustscan && \
|
||||
apk add --no-cache nmap nmap-scripts wget
|
||||
COPY --from=builder /usr/local/cargo/bin/rustscan /usr/local/bin/rustscan
|
||||
USER rustscan
|
||||
ENTRYPOINT [ "/usr/local/bin/rustscan" ]
|
||||
ENTRYPOINT [ "/usr/local/bin/rustscan" ]
|
||||
@@ -10,12 +10,12 @@ build:
|
||||
build-linux:
|
||||
@echo 'Building for Linux... 🐧'
|
||||
cross build --release --target=x86_64-unknown-linux-musl
|
||||
mkdir -p target/release-archives && tar -czf target/release-archives/rustscan-linux.tar.gz target/x86_64-unknown-linux-musl/release/rustscan
|
||||
mkdir -p target/release-archives && tar -C target/x86_64-unknown-linux-musl/release -czf target/release-archives/rustscan-linux.tar.gz rustscan
|
||||
|
||||
build-mac:
|
||||
@echo 'Building for MacOS... 🍏'
|
||||
cross build --release --target=x86_64-apple-darwin
|
||||
mkdir -p target/release-archives && tar -czf target/release-archives/rustscan-mac.tar.gz target/x86_64-apple-darwin/release/rustscan
|
||||
mkdir -p target/release-archives && tar -C target/x86_64-apple-darwin/release -czf target/release-archives/rustscan-mac.tar.gz rustscan
|
||||
|
||||
shasum:
|
||||
shasum -a 256 target/release-archives/rustscan-*.tar.gz
|
||||
@@ -24,7 +24,7 @@
|
||||
| <p align="center"><a href="https://hub.docker.com/r/cmnatic/rustscan">🐋 Docker (Recommended) </a></p> | <p align="center"><a href="https://github.com/RustScan/RustScan/releases">👩💻 Kali / Debian </p> | <p align="center"><a href="https://aur.archlinux.org/packages/rustscan/">🏗️ Arch </a></p> | <p align="center"><a href="https://crates.io/crates/rustscan">🔧 Cargo (Universal) </a></p> |
|
||||
| ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
||||
| <p align="center"><img src="https://github.com/RustScan/RustScan/blob/master/pictures/docker.png?raw=true" /></p> | <p align="center"><img src="https://github.com/RustScan/RustScan/blob/master/pictures/kali.png?raw=true" /></p> | <p align="center"><img src="https://github.com/RustScan/RustScan/blob/master/pictures/arch.png?raw=true" /></p> | <p align="center"><img src="https://github.com/RustScan/RustScan/blob/master/pictures/rust.png?raw=true" /></p> |
|
||||
| `docker pull rustscan/rustscan:v1.9.0` <p>[Usage](https://github.com/RustScan/RustScan#docker-whale) | [Read the install guide](https://github.com/Rustscan/RustScan/blob/master/README.md#%EF%B8%8F-debian--kali) | `yay -S rustscan` | `cargo install rustscan` |
|
||||
| `docker pull rustscan/rustscan:1.10.0` <p>[Usage](https://github.com/RustScan/RustScan#docker-whale) | [Read the install guide](https://github.com/Rustscan/RustScan/blob/master/README.md#%EF%B8%8F-debian--kali) | `yay -S rustscan` | `cargo install rustscan` |
|
||||
|
||||
<hr>
|
||||
|
||||
@@ -103,7 +103,7 @@ The easiest way to install RustScan is to use one of the packages provided for y
|
||||
|
||||
The most universal way is to use `cargo`, Rust's built in package manager (think Pip but for Rust). [Follow this guide to installing Rust & Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html).
|
||||
|
||||
If you face any issues at all, please leave a GitHub issue. I have only tested this on Linux, so there may be issues for Mac OS or Windows.
|
||||
If you face any issues at all, please leave a GitHub issue. We have only tested this on Linux, so there may be issues for Mac OS or Windows.
|
||||
|
||||
Note: sometimes Rust doesn't add Cargo to the path. Please see [this issue](https://github.com/rust-lang/rustup/issues/2436) for how to fix that.
|
||||
|
||||
@@ -130,22 +130,22 @@ To install Docker, [follow their guide](https://docs.docker.com/engine/install/)
|
||||
|
||||
**Once Docker is installed, you can either build your own image using the `Dockerfile` (alpine) provided in the repo, or alternatively, use the published Docker image like below (most convenient)**
|
||||
|
||||
Please see our [DockerHub](https://hub.docker.com/repository/docker/rustscan/rustscan) for further our published versions. However, we recommend using our latest release [v1.9.0](https://github.com/RustScan/RustScan/releases/tag/1.9.0)
|
||||
Please see our [DockerHub](https://hub.docker.com/repository/docker/rustscan/rustscan) for further our published versions. However, we recommend using our latest **major** release [1.10.0](https://github.com/RustScan/RustScan/releases/tag/1.10.0)
|
||||
|
||||
```
|
||||
Stable and supported: rustscan/rustscan:v1.9.0
|
||||
Stable and supported: rustscan/rustscan:1.10.0
|
||||
|
||||
Bleeding edge (run at your own risk!): rustscan/rustscan:latest
|
||||
```
|
||||
|
||||
We strongly recommend using the `v1.9.0` tag, as this is the latest major - stable - release of RustScan. This README uses the `v1.9.0` image by default, however, note that the `latest` image is considered experimental.
|
||||
We strongly recommend using the `1.10.0` tag, as this is the latest major - stable - release of RustScan. This README uses the `1.10.0` image by default, however, note that the `latest` image is considered experimental. You can use all releases of Docker by visiting the [DockerHub Tags](https://hub.docker.com/r/rustscan/rustscan/tags) and replacing the command with the tag you desire. i.e. `docker pull rustscan/rustscan:1.10.0` can be `docker pull rustscan/rustscan:1.6.0`
|
||||
|
||||
#### To get started:
|
||||
|
||||
Simply run this command against the IP you want to target:
|
||||
|
||||
```bash
|
||||
docker run -it --rm --name rustscan rustscan/rustscan:v1.9.0 <rustscan arguments here> <ip address to scan>
|
||||
docker run -it --rm --name rustscan rustscan/rustscan:1.10.0 <rustscan arguments here> <ip address to scan>
|
||||
```
|
||||
|
||||
Note: this will scan the Docker's localhost, not your own.
|
||||
@@ -155,7 +155,7 @@ Once done, you will no longer need to re-download the image (except when RustSca
|
||||
You will have to run this command every time, so we suggest aliasing it to something memorable.
|
||||
|
||||
```bash
|
||||
alias rustscan='docker run -it --rm --name rustscan rustscan/rustscan:v1.9.0'
|
||||
alias rustscan='docker run -it --rm --name rustscan rustscan/rustscan:1.10.0'
|
||||
```
|
||||
|
||||
Then we can scan:
|
||||
@@ -195,7 +195,7 @@ brew install rustscan
|
||||
## 🔧 Building it yourself
|
||||
|
||||
1. Git clone the repo.
|
||||
2. Install Rust. You can do this with `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` which I took from the Rust website https://www.rust-lang.org/tools/install
|
||||
2. Install Rust. You can do this with `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` which we took from the Rust website https://www.rust-lang.org/tools/install
|
||||
3. cd into the Git repo, and run `cargo build --release`
|
||||
4. The binary is located at `target/release/rustscan`
|
||||
5. Symlink to the binary or something. Whatever you want!
|
||||
@@ -225,15 +225,16 @@ USAGE:
|
||||
|
||||
FLAGS:
|
||||
--accessible Accessible mode. Turns off features which negatively affect screen readers
|
||||
-g, --greppable Greppable mode. Only output the ports. No Nmap. Useful for grep or outputting to a file
|
||||
-h, --help Prints help information
|
||||
-n, --no-config Whether to ignore the configuration file or not
|
||||
--no-nmap Turns off Nmap
|
||||
-q, --quiet Quiet mode. Only output the ports. No Nmap. Useful for grep or outputting to a file
|
||||
--top Use the top 1000 ports
|
||||
-V, --version Prints version information
|
||||
|
||||
OPTIONS:
|
||||
-b, --batch-size <batch-size> The batch size for port scanning, it increases or slows the speed of scanning.
|
||||
Depends on the open file limit of your OS. If you do 65535 it will do every port
|
||||
-b, --batch-size <batch-size> The batch size for port scanning, it increases or decreases the speed of scanning.
|
||||
Depends on the open file limit of your OS. If you use 65535 it will scan every port
|
||||
at the same time. Although, your OS may not support this [default: 4500]
|
||||
-p, --ports <ports>... A list of comma separed ports to be scanned. Example: 80,443,8080
|
||||
-r, --range <range> A range of ports with format start-end. Example: 1-1000
|
||||
@@ -246,7 +247,7 @@ OPTIONS:
|
||||
ARGS:
|
||||
<addresses>... A list of comma separated CIDRs, IPs, or hosts to be scanned
|
||||
<command>... The Nmap arguments to run. To use the argument -A, end RustScan's args with '-- -A'. Example:
|
||||
'rustscan -t 1500 127.0.0.1 -- -A -sC'. This command adds -Pn -vvv -p $PORTS automatically to
|
||||
'rustscan -T 1500 127.0.0.1 -- -A -sC'. This command adds -Pn -vvv -p $PORTS automatically to
|
||||
nmap. For things like --script '(safe and vuln)' enclose it in quotations marks \"'(safe and
|
||||
vuln)'\"")
|
||||
```
|
||||
@@ -255,7 +256,7 @@ The format is `rustscan -b 500 -t 1500 192.168.0.1` to scan 192.168.0.1 with 500
|
||||
|
||||
The batch size determines how fast RustScan is. Set it to 65k, and it will scan all 65k ports at the same time. This means at at 65k batch size, RustScan will take TIMEOUT long to scan all ports. Essentially, if timeout is 1000ms, **RustScan can scan in 1 second**.
|
||||
|
||||
Your operating system may not support this, but it is worth it to play around and see where your open file limit is. Shortly I will be releasing a dockerised version with a much larger open file limit, so this will be possible.
|
||||
Your operating system may not support this, but it is worth it to play around and see where your open file limit is. Shortly we will be releasing a dockerised version with a much larger open file limit, so this will be possible.
|
||||
|
||||
## Configuration file
|
||||
|
||||
@@ -268,7 +269,7 @@ and accepts the following fields:
|
||||
- `scan_order`
|
||||
- `command`
|
||||
- `accessible`
|
||||
- `quiet`
|
||||
- `greppable`
|
||||
- `batch-size`
|
||||
- `timeout`
|
||||
- `ulimit`
|
||||
@@ -280,7 +281,7 @@ addresses = ["127.0.0.1", "192.168.0.0/30", "www.google.com"]
|
||||
command = ["-A"]
|
||||
ports = [80, 443, 8080]
|
||||
range = { start = 1, end = 10 }
|
||||
quiet = false
|
||||
greppable = false
|
||||
accessible = true
|
||||
scan_order = "Serial"
|
||||
batch_size = 1000
|
||||
@@ -347,11 +348,11 @@ ulimit -n 5000
|
||||
```
|
||||
|
||||
**Mac OS**
|
||||
Mac OS has, from what I can tell, a naturally very low open file descriptor limit. The limit for Ubuntu is 8800. The limit for Mac OS is 255!
|
||||
Mac OS has, from what we can tell, a naturally very low open file descriptor limit. The limit for Ubuntu is 8800. The limit for Mac OS is 255!
|
||||
|
||||
In this case, I would say it is safe to increase the open file limit. As most Linux based OS' have limits in the thousands.
|
||||
In this case, we would say it is safe to increase the open file limit. As most Linux based OS' have limits in the thousands.
|
||||
|
||||
Although, if this breaks anything, please don't blame me.
|
||||
Although, if this breaks anything, please don't blame us.
|
||||
|
||||
**Windows Subsystem for Linux**
|
||||
Windows Subsystem for Linux does not support ulimit (see issue #39).
|
||||
@@ -373,7 +374,7 @@ If you want to run commands such as `--script (vuln and safe)`, you will need to
|
||||
|
||||
- Batch size
|
||||
|
||||
This increases speed, by allowing us to process more at once. Something experimental I am working on is changing the open file limit. You can do this manually with `ulimit -n 70000` and then running rustscan with `-b 65535`. This _should_ scan all 65535 ports at the exact same time. But this is extremely experimental.
|
||||
This increases speed, by allowing us to process more at once. Something experimental we are working on is changing the open file limit. You can do this manually with `ulimit -n 70000` and then running rustscan with `-b 65535`. This _should_ scan all 65535 ports at the exact same time. But this is extremely experimental.
|
||||
|
||||
For non-experimental speed increases, slowly increase the batch size until it no longer gets open ports, or it breaks.
|
||||
|
||||
@@ -381,7 +382,7 @@ For non-experimental speed increases, slowly increase the batch size until it no
|
||||
|
||||
To increase accuracy, the easiest way is to increase the timeout. The default is 1.5 seconds, by setting it to 4 seconds (4000) we are telling RustScan "if we do not hear back from a port in 4 seconds, assume it is closed".
|
||||
|
||||
Decreasing accuracy gives some speed bonus, but my testing found that batch size dramatically changed the speed whereas timeout did, but not so much.
|
||||
Decreasing accuracy gives some speed bonus, but our testing found that batch size dramatically changed the speed whereas timeout did, but not so much.
|
||||
|
||||
# 🎪 Community
|
||||
|
||||
@@ -420,14 +421,14 @@ We communicate over Discord. [Click here](https://discord.gg/GFrQsGy) to join ou
|
||||
|
||||
## Rewarding you
|
||||
|
||||
I cannot pay you :-( But, I can place your GitHub profile on the README under `#Contributors` as a thank you! :)
|
||||
We cannot pay you :-( But, We can place your GitHub profile on the README under `#Contributors` as a thank you! :)
|
||||
|
||||
Please read the [contributing.md file](contributing.md)
|
||||
|
||||
## Contributors ✨
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
||||
@@ -461,6 +462,12 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
<td align="center"><a href="https://github.com/buermarc"><img src="https://avatars2.githubusercontent.com/u/44375277?v=4" width="100px;" alt=""/><br /><sub><b>buermarc</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=buermarc" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/bergabman"><img src="https://avatars1.githubusercontent.com/u/44554109?v=4" width="100px;" alt=""/><br /><sub><b>bergabman</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=bergabman" title="Code">💻</a> <a href="https://github.com/RustScan/RustScan/issues?q=author%3Abergabman" title="Bug reports">🐛</a> <a href="#design-bergabman" title="Design">🎨</a></td>
|
||||
<td align="center"><a href="https://github.com/dmitris"><img src="https://avatars0.githubusercontent.com/u/31205?v=4" width="100px;" alt=""/><br /><sub><b>Dmitry Savintsev</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=dmitris" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/bofh69"><img src="https://avatars3.githubusercontent.com/u/1444315?v=4" width="100px;" alt=""/><br /><sub><b>Sebastian Andersson</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=bofh69" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/mattcorbin"><img src="https://avatars3.githubusercontent.com/u/6537765?v=4" width="100px;" alt=""/><br /><sub><b>Matt Corbin</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=mattcorbin" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://rootsploit.com"><img src="https://avatars2.githubusercontent.com/u/67270834?v=4" width="100px;" alt=""/><br /><sub><b>RootSploit</b></sub></a><br /><a href="#blog-rootsploit" title="Blogposts">📝</a></td>
|
||||
<td align="center"><a href="https://github.com/eiffel-fl"><img src="https://avatars2.githubusercontent.com/u/12171754?v=4" width="100px;" alt=""/><br /><sub><b>eiffel-fl</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=eiffel-fl" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use rustscan::*;
|
||||
|
||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||
c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20))));
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
criterion_main!(benches);
|
||||
Whitespace-only changes.
@@ -0,0 +1,42 @@
|
||||
# https://github.com/minimaxir/big-list-of-naughty-strings
|
||||
|
||||
|
||||
|
||||
|
||||
Ω≈ç√∫˜µ≤≥÷
|
||||
åß∂ƒ©˙∆˚¬…æ
|
||||
œ∑´®†¥¨ˆøπ“‘
|
||||
¡™£¢∞§¶•ªº–≠
|
||||
¸˛Ç◊ı˜Â¯˘¿
|
||||
ÅÍÎÏ˝ÓÔÒÚÆ☃
|
||||
Œ„´‰ˇÁ¨ˆØ∏”’
|
||||
`⁄€‹›fifl‡°·‚—±
|
||||
⅛⅜⅝⅞
|
||||
ЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя
|
||||
٠١٢٣٤٥٦٧٨٩
|
||||
|
||||
|
||||
|
||||
⁰⁴⁵
|
||||
₀₁₂
|
||||
⁰⁴⁵₀₁₂
|
||||
ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็
|
||||
|
||||
田中さんにあげて下さい
|
||||
パーティーへ行かないか
|
||||
和製漢語
|
||||
部落格
|
||||
사회과학원 어학연구소
|
||||
찦차를 타고 온 펲시맨과 쑛다리 똠방각하
|
||||
社會科學院語學研究所
|
||||
울란바토르
|
||||
𠜎𠜱𠝹𠱓𠱸𠲖𠳏
|
||||
𝐓𝐡𝐞 𝐪𝐮𝐢𝐜𝐤 𝐛𝐫𝐨𝐰𝐧 𝐟𝐨𝐱 𝐣𝐮𝐦𝐩𝐬 𝐨𝐯𝐞𝐫 𝐭𝐡𝐞 𝐥𝐚𝐳𝐲 𝐝𝐨𝐠
|
||||
𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐 𝖇𝖗𝖔𝖜𝖓 𝖋𝖔𝖝 𝖏𝖚𝖒𝖕𝖘 𝖔𝖛𝖊𝖗 𝖙𝖍𝖊 𝖑𝖆𝖟𝖞 𝖉𝖔𝖌
|
||||
𝑻𝒉𝒆 𝒒𝒖𝒊𝒄𝒌 𝒃𝒓𝒐𝒘𝒏 𝒇𝒐𝒙 𝒋𝒖𝒎𝒑𝒔 𝒐𝒗𝒆𝒓 𝒕𝒉𝒆 𝒍𝒂𝒛𝒚 𝒅𝒐𝒈
|
||||
𝓣𝓱𝓮 𝓺𝓾𝓲𝓬𝓴 𝓫𝓻𝓸𝔀𝓷 𝓯𝓸𝔁 𝓳𝓾𝓶𝓹𝓼 𝓸𝓿𝓮𝓻 𝓽𝓱𝓮 𝓵𝓪𝔃𝔂 𝓭𝓸𝓰
|
||||
𝕋𝕙𝕖 𝕢𝕦𝕚𝕔𝕜 𝕓𝕣𝕠𝕨𝕟 𝕗𝕠𝕩 𝕛𝕦𝕞𝕡𝕤 𝕠𝕧𝕖𝕣 𝕥𝕙𝕖 𝕝𝕒𝕫𝕪 𝕕𝕠𝕘
|
||||
𝚃𝚑𝚎 𝚚𝚞𝚒𝚌𝚔 𝚋𝚛𝚘𝚠𝚗 𝚏𝚘𝚡 𝚓𝚞𝚖𝚙𝚜 𝚘𝚟𝚎𝚛 𝚝𝚑𝚎 𝚕𝚊𝚣𝚢 𝚍𝚘𝚐
|
||||
⒯⒣⒠ ⒬⒰⒤⒞⒦ ⒝⒭⒪⒲⒩ ⒡⒪⒳ ⒥⒰⒨⒫⒮ ⒪⒱⒠⒭ ⒯⒣⒠ ⒧⒜⒵⒴ ⒟⒪⒢
|
||||
|
||||
ثم نفس سقطت وبالتحديد،, جزيرتي باستخدام أن دنو. إذ هنا؟ الستار وتنصيب كان. أهّل ايطاليا، بريطانيا-فرنسا قد أخذ. سليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو.
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
use serde_derive::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
||||
use structopt::{clap::arg_enum, StructOpt};
|
||||
|
||||
const LOWEST_PORT_NUMBER: u16 = 1;
|
||||
@@ -57,7 +58,7 @@ fn parse_range(input: &str) -> Result<PortRange, String> {
|
||||
/// - GitHub https://github.com/RustScan/RustScan
|
||||
pub struct Opts {
|
||||
/// A list of comma separated CIDRs, IPs, or hosts to be scanned.
|
||||
#[structopt(use_delimiter = true)]
|
||||
#[structopt(short, long, use_delimiter = true)]
|
||||
pub addresses: Vec<String>,
|
||||
|
||||
/// A list of comma separed ports to be scanned. Example: 80,443,8080.
|
||||
@@ -210,7 +211,7 @@ impl Config {
|
||||
///
|
||||
/// addresses = ["127.0.0.1", "127.0.0.1"]
|
||||
/// ports = [80, 443, 8080]
|
||||
/// quiet = true
|
||||
/// greppable = true
|
||||
/// scan_order: "Serial"
|
||||
///
|
||||
pub fn read() -> Self {
|
||||
|
||||
+139
-102
@@ -15,20 +15,17 @@ mod benchmark;
|
||||
use benchmark::{Benchmark, NamedTimer};
|
||||
|
||||
use cidr_utils::cidr::IpCidr;
|
||||
use colorful::Color;
|
||||
use colorful::Colorful;
|
||||
use colorful::{Color, Colorful};
|
||||
use futures::executor::block_on;
|
||||
use rlimit::Resource;
|
||||
use rlimit::{getrlimit, setrlimit};
|
||||
use rlimit::{getrlimit, setrlimit, Resource};
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::io::BufReader;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::io::{prelude::*, BufReader};
|
||||
use std::net::{IpAddr, ToSocketAddrs};
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::{net::IpAddr, time::Duration};
|
||||
use trust_dns_resolver::config::*;
|
||||
use trust_dns_resolver::Resolver;
|
||||
use std::time::Duration;
|
||||
use trust_dns_resolver::{config::*, Resolver};
|
||||
|
||||
extern crate colorful;
|
||||
extern crate dirs;
|
||||
@@ -121,7 +118,7 @@ fn main() {
|
||||
// nmap port style is 80,443. Comma separated with no spaces.
|
||||
let ports_str = nmap_str_ports.join(",");
|
||||
|
||||
// if quiet mode is on nmap should not be spawned
|
||||
// if greppable mode is on nmap should not be spawned
|
||||
if opts.greppable || opts.no_nmap {
|
||||
println!("{} -> [{}]", &ip, ports_str);
|
||||
continue;
|
||||
@@ -188,6 +185,118 @@ Faster Nmap scanning with Rust."#;
|
||||
opts.accessible
|
||||
);
|
||||
}
|
||||
|
||||
/// Goes through all possible IP inputs (files or via argparsing)
|
||||
/// Parses the string(s) into IPs
|
||||
fn parse_addresses(input: &Opts) -> Vec<IpAddr> {
|
||||
let mut ips: Vec<IpAddr> = Vec::new();
|
||||
let mut unresolved_addresses: Vec<&str> = Vec::new();
|
||||
let resolver =
|
||||
&Resolver::new(ResolverConfig::cloudflare_tls(), ResolverOpts::default()).unwrap();
|
||||
|
||||
for address in &input.addresses {
|
||||
match parse_address(address, resolver) {
|
||||
Ok(parsed_ips) => {
|
||||
if !parsed_ips.is_empty() {
|
||||
ips.extend(parsed_ips);
|
||||
} else {
|
||||
unresolved_addresses.push(address);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
warning!(
|
||||
format!("Host {:?} could not be resolved.", address),
|
||||
input.greppable,
|
||||
input.accessible
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we got to this point this can only be a file path or the wrong input.
|
||||
for file_path in unresolved_addresses {
|
||||
let file_path = Path::new(file_path);
|
||||
|
||||
if !file_path.is_file() {
|
||||
warning!(
|
||||
format!("Host {:?} could not be resolved.", file_path),
|
||||
input.greppable,
|
||||
input.accessible
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
match read_ips_from_file(file_path, &resolver) {
|
||||
Ok(x) => ips.extend(x),
|
||||
_ => {
|
||||
warning!(
|
||||
format!("Host {:?} could not be resolved.", file_path),
|
||||
input.greppable,
|
||||
input.accessible
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ips
|
||||
}
|
||||
|
||||
/// Given a string, parse it as an host, IP address, or CIDR.
|
||||
/// This allows us to pass files as hosts or cidr or IPs easily
|
||||
/// Call this everytime you have a possible IP_or_host
|
||||
fn parse_address(address: &str, resolver: &Resolver) -> Result<Vec<IpAddr>, std::io::Error> {
|
||||
let mut ips: Vec<IpAddr> = Vec::new();
|
||||
|
||||
match IpCidr::from_str(&address) {
|
||||
Ok(cidr) => cidr.iter().for_each(|ip| ips.push(ip)),
|
||||
_ => match format!("{}:{}", &address, 80).to_socket_addrs() {
|
||||
Ok(mut iter) => ips.push(iter.nth(0).unwrap().ip()),
|
||||
_ => match resolve_ips_from_host(address, resolver) {
|
||||
Ok(hosts) => ips.extend(hosts),
|
||||
_ => (),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Ok(ips)
|
||||
}
|
||||
|
||||
/// Uses DNS to get the IPS assiocated with host
|
||||
fn resolve_ips_from_host(source: &str, resolver: &Resolver) -> Result<Vec<IpAddr>, std::io::Error> {
|
||||
match resolver.lookup_ip(&source) {
|
||||
Ok(x) => Ok(x.iter().collect()),
|
||||
_ => Ok(Vec::new()),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
/// Parses an input file of IPs and uses those
|
||||
fn read_ips_from_file(
|
||||
ips: &std::path::Path,
|
||||
resolver: &Resolver,
|
||||
) -> Result<Vec<std::net::IpAddr>, std::io::Error> {
|
||||
let file = File::open(ips)?;
|
||||
let reader = BufReader::new(file);
|
||||
|
||||
let mut ips: Vec<std::net::IpAddr> = Vec::new();
|
||||
|
||||
for address_line in reader.lines() {
|
||||
match address_line {
|
||||
Ok(address) => match parse_address(&address, resolver) {
|
||||
Ok(result) => ips.extend(result),
|
||||
Err(e) => {
|
||||
debug!("{} is not a valid IP or host", e);
|
||||
}
|
||||
},
|
||||
Err(_) => {
|
||||
debug!("Line in file is not valid");
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(ips)
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn build_nmap_arguments<'a>(
|
||||
addr: &'a str,
|
||||
@@ -209,96 +318,6 @@ fn build_nmap_arguments<'a>(
|
||||
arguments
|
||||
}
|
||||
|
||||
/// Goes through all possible IP inputs (files or via argparsing)
|
||||
/// Parses the string(s) into IPs
|
||||
fn parse_addresses(opts: &Opts) -> Vec<IpAddr> {
|
||||
let mut ips: Vec<IpAddr> = Vec::new();
|
||||
let resolver = &Resolver::new(ResolverConfig::default(), ResolverOpts::default()).unwrap();
|
||||
|
||||
for ip_or_host in &opts.addresses {
|
||||
match read_ips_from_file(ip_or_host.to_owned(), &resolver) {
|
||||
Ok(x) => ips.extend(x),
|
||||
_ => match parse_to_ip(ip_or_host.to_owned(), &resolver) {
|
||||
Ok(x) => ips.extend(x),
|
||||
_ => {
|
||||
warning!(
|
||||
format!("Host {:?} could not be resolved.", ip_or_host),
|
||||
opts.greppable,
|
||||
opts.accessible
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
ips
|
||||
}
|
||||
|
||||
/// Uses DNS to get the IPS assiocated with host
|
||||
fn resolve_ips_from_host(
|
||||
source: &String,
|
||||
resolver: &Resolver,
|
||||
) -> Result<Vec<IpAddr>, std::io::Error> {
|
||||
let mut ips: Vec<std::net::IpAddr> = Vec::new();
|
||||
|
||||
match resolver.lookup_ip(&source) {
|
||||
Ok(x) => {
|
||||
for ip in x.iter() {
|
||||
ips.push(ip);
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
return Ok(ips);
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
/// Parses an input file of IPs and uses those
|
||||
fn read_ips_from_file(
|
||||
ips: String,
|
||||
resolver: &Resolver,
|
||||
) -> Result<Vec<std::net::IpAddr>, std::io::Error> {
|
||||
// if we cannot open it as a file, it is not a file so move on
|
||||
let file = File::open(ips)?;
|
||||
let reader = BufReader::new(file);
|
||||
|
||||
let mut ips: Vec<std::net::IpAddr> = Vec::new();
|
||||
|
||||
for str_ip in reader.lines() {
|
||||
match str_ip {
|
||||
Ok(x) => match parse_to_ip(x, resolver) {
|
||||
Ok(result) => ips.extend(result),
|
||||
Err(e) => {
|
||||
debug!("{} is not a valid IP or host", e);
|
||||
}
|
||||
},
|
||||
Err(_) => {
|
||||
debug!("Line in file is not valid");
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(ips)
|
||||
}
|
||||
|
||||
/// Given a string, parse it as an host, IP address, or CIDR.
|
||||
/// This allows us to pass files as hosts or cidr or IPs easily
|
||||
/// Call this everytime you have a possible IP_or_host
|
||||
fn parse_to_ip(address: String, resolver: &Resolver) -> Result<Vec<IpAddr>, std::io::Error> {
|
||||
let mut ips: Vec<IpAddr> = Vec::new();
|
||||
|
||||
match IpCidr::from_str(&address) {
|
||||
Ok(cidr) => cidr.iter().for_each(|ip| ips.push(ip)),
|
||||
_ => match format!("{}:{}", &address, 80).to_socket_addrs() {
|
||||
Ok(mut iter) => ips.push(iter.nth(0).unwrap().ip()),
|
||||
_ => match resolve_ips_from_host(&address, resolver) {
|
||||
Ok(hosts) => ips.extend(hosts),
|
||||
_ => (),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Ok(ips)
|
||||
}
|
||||
|
||||
fn adjust_ulimit_size(opts: &Opts) -> rlimit::rlim {
|
||||
if opts.ulimit.is_some() {
|
||||
let limit: rlimit::rlim = opts.ulimit.unwrap();
|
||||
@@ -475,4 +494,22 @@ mod tests {
|
||||
let ips = parse_addresses(&opts);
|
||||
assert_eq!(ips.len(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_empty_hosts_file() {
|
||||
// Host file contains IP, Hosts, incorrect IPs, incorrect hosts
|
||||
let mut opts = Opts::default();
|
||||
opts.addresses = vec!["fixtures/empty_hosts.txt".to_owned()];
|
||||
let ips = parse_addresses(&opts);
|
||||
assert_eq!(ips.len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_naughty_host_file() {
|
||||
// Host file contains IP, Hosts, incorrect IPs, incorrect hosts
|
||||
let mut opts = Opts::default();
|
||||
opts.addresses = vec!["fixtures/naughty_string.txt".to_owned()];
|
||||
let ips = parse_addresses(&opts);
|
||||
assert_eq!(ips.len(), 0);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -19,7 +19,7 @@ use std::{
|
||||
/// start & end is where the port scan starts and ends
|
||||
/// batch_size is how many ports at a time should be scanned
|
||||
/// Timeout is the time RustScan should wait before declaring a port closed. As datatype Duration.
|
||||
/// Quiet is whether or not RustScan should print things, or wait until the end to print only open ports.
|
||||
/// greppable is whether or not RustScan should print things, or wait until the end to print only the ip and open ports.
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
#[derive(Debug)]
|
||||
pub struct Scanner {
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Test rustscan against different targets with a time limit.
|
||||
* The tests assumes target/debug/rustscan has already been built.
|
||||
*
|
||||
* The tests are #[ignore] to avoid running them during normal development.
|
||||
*
|
||||
* Their tests in the timelimits module are run by travis during CI.
|
||||
*/
|
||||
|
||||
use std::process::Command;
|
||||
use std::time::Duration;
|
||||
use wait_timeout::ChildExt;
|
||||
|
||||
const TIMEOUT_MARGIN: u32 = 3;
|
||||
|
||||
fn run_rustscan_with_timeout(args: &[&str], timeout: Duration) {
|
||||
println!("Running: target/debug/rustscan: {}", args.join(" "));
|
||||
|
||||
use std::time::Instant;
|
||||
|
||||
let start = Instant::now();
|
||||
|
||||
let mut child = Command::new("target/debug/rustscan")
|
||||
.args(args)
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let mut tries = TIMEOUT_MARGIN;
|
||||
loop {
|
||||
match child.wait_timeout(timeout).unwrap() {
|
||||
Some(_status) => break,
|
||||
None => {
|
||||
tries -= 1;
|
||||
if tries == 0 {
|
||||
// child hasn't exited yet
|
||||
child.kill().unwrap();
|
||||
child.wait().unwrap().code();
|
||||
panic!("Timeout while running command");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let end = Instant::now();
|
||||
let duration = end.saturating_duration_since(start).as_secs_f32();
|
||||
|
||||
println!("time: {:1.1}s", duration);
|
||||
}
|
||||
|
||||
mod timelimits {
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn scan_localhost() {
|
||||
let timeout = super::Duration::from_secs(25);
|
||||
super::run_rustscan_with_timeout(&["--greppable", "--no-nmap", "127.0.0.1"], timeout);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn scan_google_com() {
|
||||
super::run_rustscan_with_timeout(
|
||||
&[
|
||||
"--greppable",
|
||||
"--no-nmap",
|
||||
"-u",
|
||||
"5000",
|
||||
"-b",
|
||||
"2500",
|
||||
"google.com",
|
||||
],
|
||||
super::Duration::from_secs(28),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn scan_example_com() {
|
||||
super::run_rustscan_with_timeout(
|
||||
&[
|
||||
"--greppable",
|
||||
"--no-nmap",
|
||||
"-u",
|
||||
"5000",
|
||||
"-b",
|
||||
"2500",
|
||||
"example.com",
|
||||
],
|
||||
super::Duration::from_secs(28),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn scan_rustscan_cmnatic_co_uk() {
|
||||
super::run_rustscan_with_timeout(
|
||||
&[
|
||||
"--greppable",
|
||||
"--no-nmap",
|
||||
"-u",
|
||||
"5000",
|
||||
"-b",
|
||||
"2500",
|
||||
"rustscan.cmnatic.co.uk",
|
||||
],
|
||||
super::Duration::from_secs(26),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user