Compare commits

..
546 Commits
Author SHA1 Message Date
bee-san 16ea3613c1 2.4.0 2024-07-08 14:36:22 +01:00
Ærvin 8879fa7ff4 removed unnecessary .clone()s (#610) 2024-07-08 14:34:35 +01:00
dependabot[bot] 5d532356fd Bump log from 0.4.21 to 0.4.22 (#605)
Bumps [log](https://github.com/rust-lang/log) from 0.4.21 to 0.4.22.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.21...0.4.22)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 14:32:39 +01:00
dependabot[bot] 9f69d36057 Bump clap from 4.5.7 to 4.5.8 (#607)
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.7 to 4.5.8.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.7...v4.5.8)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 14:32:28 +01:00
dependabot[bot] dc18469af6 Bump text_placeholder from 0.5.0 to 0.5.1 (#609)
Bumps [text_placeholder](https://github.com/bernardoamc/text-placeholder) from 0.5.0 to 0.5.1.
- [Commits](https://github.com/bernardoamc/text-placeholder/commits)

---
updated-dependencies:
- dependency-name: text_placeholder
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 14:32:20 +01:00
Neal Caffery 01fb9a14ba fix for the target x86_64-pc-windows-gnu (#611) 2024-07-08 14:32:06 +01:00
dependabot[bot] e2ddd93835 Bump actions/upload-artifact from 4.3.3 to 4.3.4 (#612)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.3 to 4.3.4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.3.3...v4.3.4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 14:31:38 +01:00
dependabot[bot] 3873117324 Bump alpine from 3.20.0 to 3.20.1 (#604)
Bumps alpine from 3.20.0 to 3.20.1.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 07:57:48 +01:00
dependabot[bot] dcb91d95e4 Bump docker/build-push-action from 5 to 6 (#603)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 07:57:23 +01:00
dependabot[bot] 4947158ff8 Bump clap from 4.5.6 to 4.5.7 (#601)
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.6 to 4.5.7.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.6...v4.5.7)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 07:57:09 +01:00
BrendanGlancy f544f2240b Udp Scanning (#596)
Added UDP scanning support to RustScan
2024-06-25 15:16:06 +01:00
dependabot[bot] f33476468f Bump clap from 4.5.4 to 4.5.6 (#600)
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.4 to 4.5.6.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.4...v4.5.6)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-08 12:00:05 +01:00
dependabot[bot] 534cf8adf8 Bump alpine from 3.19.1 to 3.20.0 (#597)
Bumps alpine from 3.19.1 to 3.20.0.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-07 09:23:58 +01:00
dependabot[bot] 8290cad8d6 Bump toml from 0.8.13 to 0.8.14 (#599)
Bumps [toml](https://github.com/toml-rs/toml) from 0.8.13 to 0.8.14.
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.13...toml-v0.8.14)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-07 09:23:50 +01:00
LeoFVO ac3ad3a6f7 ci: refactor ci/cd and extends matrix build (#598)
* ci(release): refactor ci/cd and extends matrix build

- adding ARM release
- fix build/test issues during release
- adding binary (linux + exe) in the release assets
- uploading all cross-build assets via archive (zip + tar.xz)

Signed-off-by: LeoFVO <[email protected]>

* fix(ci): upload assets to release only in case of release

Signed-off-by: LeoFVO <[email protected]>

---------

Signed-off-by: LeoFVO <[email protected]>
2024-06-06 21:31:10 +01:00
Autumn (Bee) 3e74f5cb69 Update dockere in README (#595) 2024-05-20 13:20:34 +01:00
dependabot[bot] bfb827c0b8 Bump toml from 0.8.12 to 0.8.13 (#592)
Bumps [toml](https://github.com/toml-rs/toml) from 0.8.12 to 0.8.13.
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.12...toml-v0.8.13)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 15:18:47 +01:00
dependabot[bot] 16250456e6 Bump itertools from 0.12.1 to 0.13.0 (#593)
Bumps [itertools](https://github.com/rust-itertools/itertools) from 0.12.1 to 0.13.0.
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.12.1...v0.13.0)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 15:18:37 +01:00
Autumn (Bee) 0779071f7f 2.2.4-rc1 2024-05-18 14:49:03 +01:00
Roger G. Coram 8bfb643796 refactor: remove structopt in favour of clap (#591)
* refactor: remove structopt in favour of clap

as per
[`structopt` README](https://github.com/TeXitoi/structopt#maintenance),
it is now in maintenance mode.

migrating to `clap` v3 as per their
[migration docs.](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#300---2021-12-31).

* refactor: upgrade clap to v4

implement `clap` breaking changes as per docs.

* test: add parameterized tests for nmap-command parsing
2024-05-18 14:47:10 +01:00
Roger G. Coram 457c1643ff chore: upgrade dependencies (#590)
- move to the latest versions of direct dependencies.
  - update `rand` usage to use `Range` types.
  - update `cidr_utils` to reflect underlying `cidr` crate.
2024-05-15 07:16:22 +01:00
Roger G. CoramandKhanh Nguyen 4ae4853e1d feat(cli): add custom dns resolver option (#587)
* feat(cli): add custom dns resolver option

* fix: correct clippy lints

* refactor: update resolvers to be Option

use an `Option<String>` rather than a `String`, defaulting to `""`.

* feat(cli): include resolver in config.

* refactor: change resolver chain

- remove extraneous `std::net::` prefixes for already-imported `IpAddr`.
- move derivation to a function:
  - parse input/file as normal;
  - attempt to use the system DNS resolution;
  - fall back to previous CloudFlare behaviour.

---------

Co-authored-by: Khanh Nguyen <[email protected]>
2024-05-10 16:14:16 +01:00
Roger G. Coram d471065dd2 refactor: move address-related functions (#585)
* refactor: move address-related functions

move functions for address-parsing/-resolution to a submodule.

fix #580

* test: add documentation tests
2024-05-09 08:14:42 +01:00
dependabot[bot] 99b00c091c Bump env_logger from 0.8.4 to 0.11.3 (#583)
Bumps [env_logger](https://github.com/rust-cli/env_logger) from 0.8.4 to 0.11.3.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.8.4...v0.11.3)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-05 13:50:57 +01:00
dependabot[bot] af34aa4d07 Bump toml from 0.5.11 to 0.8.12 (#582)
Bumps [toml](https://github.com/toml-rs/toml) from 0.5.11 to 0.8.12.
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.5.11...toml-v0.8.12)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-05 13:50:42 +01:00
Autumn (Bee) 5328bfc8b0 2.2.3 (#581) 2024-05-01 15:49:36 +01:00
dependabot[bot] 2340f94a81 Bump actions/upload-artifact from 4.3.2 to 4.3.3 (#578)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.2 to 4.3.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.3.2...v4.3.3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-27 10:21:23 +01:00
dependabot[bot] dcc558cb43 Bump rustls from 0.21.10 to 0.21.11 (#574)
Bumps [rustls](https://github.com/rustls/rustls) from 0.21.10 to 0.21.11.
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.21.10...v/0.21.11)

---
updated-dependencies:
- dependency-name: rustls
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-21 08:28:38 +01:00
Autumn (Bee) bb2973049c Remove docker build from PRs (#573) 2024-04-21 08:28:05 +01:00
dependabot[bot] a26ea80036 Bump actions/upload-artifact from 4.3.1 to 4.3.2 (#571)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.1 to 4.3.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.3.1...v4.3.2)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-19 16:36:46 +01:00
toofooboo 2643a1d5e1 chore: remove repetitive word (#572)
Signed-off-by: toofooboo <[email protected]>
2024-04-19 16:36:34 +01:00
Roger G. Coram b9337d8267 refactor: make RustScan additionally a library (#562)
* refactor: make RustScan additionally a library

- add `lib.rs` (permitted as per
  [_Packages and Crates_](https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html)).
- refactor `main.rs` to reference the library.
- update module references as required.

* doc: correct documentation issues

- fix some failing doc-tests.
- amend formatting causing misinterpretation as code-samples.
- mark some examples as
  [`compile_fail`](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#attributes)
  as there's no immediate way to instantiate the required `struct`.

* docs: add basic module documentation

- add lib-level docs. including a minimal example.
- add minimal, headline information for each module.
2024-04-14 10:09:21 +01:00
dependabot[bot] e4a097c7dc Bump Swatinem/rust-cache from 1 to 2 (#563)
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 1 to 2.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v1...v2)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 17:58:18 +01:00
dependabot[bot] 15290b2275 Bump actions/download-artifact from 2 to 4 (#564)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 17:58:06 +01:00
dependabot[bot] 6993fb2037 Bump mislav/bump-homebrew-formula-action from 1 to 3 (#565)
Bumps [mislav/bump-homebrew-formula-action](https://github.com/mislav/bump-homebrew-formula-action) from 1 to 3.
- [Release notes](https://github.com/mislav/bump-homebrew-formula-action/releases)
- [Commits](https://github.com/mislav/bump-homebrew-formula-action/compare/v1...v3)

---
updated-dependencies:
- dependency-name: mislav/bump-homebrew-formula-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 17:57:55 +01:00
dependabot[bot] a311726486 Bump actions/setup-python from 4 to 5 (#566)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 17:57:42 +01:00
dependabot[bot] 030e9708f9 Bump actions/upload-artifact from 2.2.4 to 4.3.1 (#567)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.2.4 to 4.3.1.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.2.4...v4.3.1)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 17:57:31 +01:00
Juan Calderon-Perez 7f80dd1678 Upgrade Alpine to 3.19.x (#373)
* Update Dockerfile

Upgrade alpine to 3.13, add ca-certificates and bind-tools.

* Add github/docker to dependabot. Update some of the actions

* Skip Registry login for Pull Requests
2024-04-11 17:19:58 +01:00
Ben (CMNatic) f5a587accf Merge pull request #561 from PsypherPunk/update-docker-workflow
build: update Docker workflow trigger
2024-04-10 19:49:26 +01:00
PsypherPunk 1da08dcb9a build: update Docker workflow trigger
remove the `v` prefix from the triggering tag.
2024-04-10 13:24:55 +01:00
Ben (CMNatic) 6ca22d697c Update Docker Runner (#560) 2024-04-10 10:29:19 +01:00
nullandAutumn ac38ca591d Fixed #527 (#537)
* Fixed #527

* Update mod.rs

---------

Co-authored-by: Autumn (Bee) <[email protected]>
2024-04-10 09:31:48 +01:00
Roger G. Coram f2d9a2e1fa Update release workflow (#559)
* build: remove explicit strip steps

- update `Cargo.toml` to
  [`strip`](https://doc.rust-lang.org/cargo/reference/profiles.html#strip)
  as part of the release profile.
- remove explicit `strip` steps from the release workflow.
- update step name to better reflect `git config` changes.

* build: remove prefix from expected tags

- remove the `v` prefix from the triggering tag (all previous tags lack this).
- update tag-deriving steps to better reflect the expected tag pattern.
- update tag-deriving steps to be consistent in how `GITHUB_REF` is parsed.

* build: make build/OS checks generic

- update GitHub Actions conditions to use
  [`contains`](https://docs.github.com/en/actions/learn-github-actions/expressions#contains)
  to match _all_ related builds.
- update shell conditions to accommodate the same.
2024-04-10 09:13:06 +01:00
Lokendra Singh Rawat e3c05afabb minor change in help section (#318)
Changed this : 
For things like --script '(safe and vuln)' enclose it in quotations marks \"'(safe and vuln)'\"")
to:
For things like --script '(safe and vuln)' enclose it in quotations marks \"'(safe and vuln)'\"
2024-04-10 07:23:31 +01:00
c466e0641e fix help message (#319) (#330)
Co-authored-by: Bee <[email protected]>
Co-authored-by: Autumn (Bee) <[email protected]>
2024-04-10 07:22:38 +01:00
dependabot[bot] 331efa5011 Bump text_placeholder from 0.4.1 to 0.5.0 (#558)
Bumps [text_placeholder](https://github.com/bernardoamc/text-placeholder) from 0.4.1 to 0.5.0.
- [Commits](https://github.com/bernardoamc/text-placeholder/commits)

---
updated-dependencies:
- dependency-name: text_placeholder
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-10 07:16:56 +01:00
dependabot[bot] fa1ddc9bba Bump colored from 2.0.0 to 2.1.0 (#557)
Bumps [colored](https://github.com/mackwic/colored) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/mackwic/colored/releases)
- [Changelog](https://github.com/colored-rs/colored/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mackwic/colored/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: colored
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-10 07:16:23 +01:00
Wuelfhis AsuajeandWuelfhis Asuaje 170f57c0a3 First attempt enabling exclude port list capability Issue #530 (#534)
* First attempt enabling exclude port list capability

* disabling a not desired println! used for debugging purpose

* fixing small typo:  dbg! by debug!

* adding emtpy commit to make CI/CD pass

* running cargo fmt and removing a TODO comment

* Actually running cargo fmt without check LoL

* fixed some clippy error

* fixing one more cargo clippy complain

---------

Co-authored-by: Wuelfhis Asuaje <[email protected]>
2024-04-10 07:15:43 +01:00
dependabot[bot] 6b6b2f267c Bump text_placeholder from 0.4.0 to 0.4.1 (#552)
Bumps [text_placeholder](https://github.com/bernardoamc/text-placeholder) from 0.4.0 to 0.4.1.
- [Commits](https://github.com/bernardoamc/text-placeholder/commits)

---
updated-dependencies:
- dependency-name: text_placeholder
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-09 08:20:02 +01:00
dependabot[bot] 2287965c5c Bump trust-dns-resolver from 0.21.2 to 0.23.2 (#554)
Bumps [trust-dns-resolver](https://github.com/bluejekyll/trust-dns) from 0.21.2 to 0.23.2.
- [Release notes](https://github.com/bluejekyll/trust-dns/releases)
- [Changelog](https://github.com/hickory-dns/hickory-dns/blob/v0.23.2/CHANGELOG.md)
- [Commits](https://github.com/bluejekyll/trust-dns/compare/v0.21.2...v0.23.2)

---
updated-dependencies:
- dependency-name: trust-dns-resolver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-09 08:19:38 +01:00
Roger G. Coram 1ec8ab412e feat(build): add GitHub Action to make release (#427)
* build: move cargo-deb to main release workflow

* build: use absolute paths for deb package

* build: remove Docker builder for deb files

as [requested](https://github.com/RustScan/RustScan/pull/427#issuecomment-2041374743).
2024-04-09 08:19:01 +01:00
Maximiliano Molina 598b5dfd10 fix port range to include end (#518)
* fix port range to include end

* empty

Signed-off-by: Maximiliano Molina <[email protected]>

---------

Signed-off-by: Maximiliano Molina <[email protected]>
2024-04-07 08:10:39 +01:00
fabianbees 1a5ff5bb4b initialize errors HashSet without high initial capacity (#532)
fixes:
- #447
- #523
2024-04-07 08:10:26 +01:00
Jeremiah Gleason 10b3f82bb7 Added more funny quotes. (#526) 2024-04-06 21:58:59 +01:00
Ben (CMNatic) 0e582fdd16 Fix markdown-link-checker workflow (#542)
* Fix markdown-link-checker workflow

Added a configuration file that tells MLC to ignore the URLs in .github\workflows\mlc_config.json as MLC is falsely reporting these as dead

* Update markdown.yml
2024-04-06 21:28:53 +01:00
Ben (CMNatic) 4c933b39a1 Merge pull request #538 from bergabman/master
Fix clippy lint issues for CI/CD pipeline
2024-03-16 01:56:02 +00:00
Ben (CMNatic) a3495b305b Merge branch 'master' into master 2024-03-16 00:31:38 +00:00
Ben (CMNatic) 4bec0a8ea8 Merge pull request #525 from R-Rothrock/master
Fixed #524 - banner formatting
2024-03-16 00:11:55 +00:00
bergabman e86b86d0e0 clippy lint issues 2024-02-13 17:35:35 +01:00
Roan Rothrock 43d3a1ed5a Fixed #524 2023-08-25 16:18:51 -05:00
Thaddeus Thomas 0f65753dcb Update README.md (#520)
* Update README.md

Fixed the issue with the links
closes #516

* Update README.md

1. Fixed the arch Linux link. Closes #519
2. Fixed Arch badge so it's linked to the correct version
3. Cleaned up missing links throughout the document
4. Moved all links other than the contributor's section to the end of the document for easier maintenance
5. Fixed language so it was grammatically correct
2023-08-12 08:30:30 +01:00
LePirlouit 2ab7191a65 🚨 Fix linter warning (#521) 2023-07-10 20:02:23 +01:00
♠️ Thomas Gotwig ♣️andThomas Gotwig d7c07c4c84 📝 Change broken link to tgotwig.dev (#398)
Co-authored-by: Thomas Gotwig <[email protected]>
2023-06-18 19:08:16 +01:00
LePirlouitandAutumn 478851ac4c 🚨 fix linter warnings (#511)
Co-authored-by: Autumn <[email protected]>
2023-06-18 19:07:35 +01:00
Thaddeus Thomas 1c7b080d6f Update README.md (#517)
Fixed the issue with the links
closes #516
2023-06-18 19:06:21 +01:00
Ben (CMNatic) 7dd9352bae Update recommended Docker image version
Version 2.1.1 of RustScan has been uploaded to the DockerHub repo: https://hub.docker.com/layers/rustscan/rustscan/2.1.1/images/sha256-1ef645b90001c560923c2150d20e5509ced243122225dbb9daf7c1c0ac3d21b2?context=repo
2023-04-06 13:27:06 +01:00
Kian-Meng Ang d3fdc0d796 Fix typos (#505)
Found via `typos --format brief`
2023-03-04 18:19:36 +00:00
Laurent Erignoux 77853ad122 Minor documentation table fix for github.io (#491)
* Adding missing paragraph closing in Readme

* Using markdown :-: to center Readme packages table content
2023-02-02 07:40:33 +00:00
Peter Dave Hello 71f21aa259 Update Docker base image from alpine 3.12 to 3.17 (#484)
Alpine Linux v3.12 is end of life about months, the builder base image
is alreayd Alpine v3.17, and Alpine v3.17 is the latest stable release
with about 2 more years support, should be good to ugprade to it.

Signed-off-by: Peter Dave Hello <[email protected]>

Signed-off-by: Peter Dave Hello <[email protected]>
2022-12-30 09:18:49 +00:00
dependabot-preview[bot]andBee bcdb0df1d9 Upgrade to GitHub-native Dependabot (#382)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2022-12-23 11:42:04 +00:00
LeoFVO 5b00fa1727 build and publish docker image in ci (#472)
* feat(docker): build and publish docker image in ci

Signed-off-by: leofvo <[email protected]>

* refactor(docker): updated dockerfile to build release version of rustscan

Signed-off-by: leofvo <[email protected]>
2022-12-20 20:17:08 +00:00
LeoFVO dde7d96256 fix(doc): minor lint fixes (#470)
Signed-off-by: leofvo <[email protected]>

Signed-off-by: leofvo <[email protected]>
2022-12-08 08:01:58 +00:00
LeoFVO 405f05d42c Build CI to auto-distribute releases (#468)
* refactor(ci): update build ci and add cross-compilation

* cron check
* remove fmt
* cross-compile for tests
* lint code
* remove duplicate

Signed-off-by: leofvo <[email protected]>

* fix(code): code lint + fix bad practices

Signed-off-by: leofvo <[email protected]>

* test(windows): remove windows incompatible function for test when running on windows

Signed-off-by: leofvo <[email protected]>

* build(release): add release ci/cd

* github workflow
* cargo.toml improvment

Signed-off-by: leofvo <[email protected]>

Signed-off-by: leofvo <[email protected]>
2022-12-06 08:45:57 +00:00
Bee 9e1cb60a05 Update for ARM; (#464) 2022-11-13 18:54:56 +00:00
autumn skerritt 8045af8cd2 Add release automation file 2022-11-12 16:41:14 +00:00
autumn skerritt 221cf8694f Updating lock file 2022-11-12 16:36:44 +00:00
Bee bd32f4ead4 2.1.1 2022-11-07 10:21:47 +00:00
Artem IvanovandBee 8625f939bf Minor cosmetic changes (#453)
* Minor cosmetic changes

* Minor cosmetic changes

* Update discord link

Co-authored-by: Bee <[email protected]>
2022-11-07 10:16:14 +00:00
Thijs0x57andBee 8f608eaf99 fix links to Docker & Kali wiki (#433)
In the readme there are 2 links to docker & kali, 'Usage' and 'Read the install guide'. These links weren't working.

Co-authored-by: Bee <[email protected]>
2022-11-03 10:08:03 +00:00
NugineandBee f9f2bf6cf8 Upgrade rlimit (#449)
Co-authored-by: Bee <[email protected]>
2022-11-03 09:56:54 +00:00
Callum Haughtey-WilkinsonandBee 6fb1196244 Improve doc for addresses (#457)
Improve documentation for addresses CLI arg to make it
clear that file parsing of addresses is already supported

(#452)

Co-authored-by: Bee <[email protected]>
2022-11-02 15:23:02 +00:00
Callum Haughtey-Wilkinson 61c43dd5d0 Allow CLI customisation of config file path (#456)
Allow CLI customisation of config file path with new
optional argument.

(#437)
2022-11-02 15:17:07 +00:00
Bee 075025113d 2.1.0 release 2022-04-27 13:30:24 +01:00
Bee e3645b5c81 Update Cargo.lock file to support latest version of Rust (#435) 2022-04-26 08:40:56 +01:00
Ryan Montgomery a444ab66e1 Update tui.rs (#396)
added a quote
2021-07-03 23:27:06 +01:00
dependabot-preview[bot]andBrandon 30856350d3 Bump futures from 0.3.7 to 0.3.13 (#358)
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.7 to 0.3.13.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.7...0.3.13)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Brandon <[email protected]>
2021-03-29 08:17:19 +01:00
dependabot-preview[bot]andBrandon 7bff40a526 Bump rlimit from 0.5.2 to 0.5.4 (#360)
Bumps [rlimit](https://github.com/Nugine/rlimit) from 0.5.2 to 0.5.4.
- [Release notes](https://github.com/Nugine/rlimit/releases)
- [Commits](https://github.com/Nugine/rlimit/compare/v0.5.2...v0.5.4)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Brandon <[email protected]>
2021-03-29 08:16:43 +01:00
dependabot-preview[bot]andBrandon a38c6aa13b Bump cidr-utils from 0.5.0 to 0.5.1 (#367)
Bumps [cidr-utils](https://github.com/magiclen/cidr-utils) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/magiclen/cidr-utils/releases)
- [Commits](https://github.com/magiclen/cidr-utils/compare/v0.5.0...v0.5.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Brandon <[email protected]>
2021-03-29 08:16:03 +01:00
dependabot-preview[bot] 9b2c58fee5 Bump anyhow from 1.0.34 to 1.0.40 (#368)
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.34 to 1.0.40.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.34...1.0.40)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-03-29 08:15:46 +01:00
dependabot-preview[bot] 198225a8da Bump serde from 1.0.117 to 1.0.124 (#361)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.117 to 1.0.124.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.117...v1.0.124)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-03-20 18:29:16 +00:00
Thomas de Queiroz Barros 9a9dff422e Partially fix #362: Fix examples (#363)
Include -a to specify addresses
2021-03-20 18:28:59 +00:00
Brandon 227703a57e Update README.md 2021-03-08 19:39:44 +00:00
bergabman 90bbed2a17 Scripting engine extra user argument interpretation error fixed. Scanner engine errors and error handling clarified. (#325) 2020-12-07 12:28:16 +00:00
dependabot-preview[bot] 311cafcdbc Bump env_logger from 0.8.1 to 0.8.2 (#317)
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.1...v0.8.2)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-11-23 22:41:41 +00:00
bee 02f1f6c7d1 fixing cargo lock 2020-11-06 12:32:13 +00:00
bee 2182a1bd01 Merge branch 'master' of github.com:RustScan/RustScan 2020-11-06 01:44:04 +00:00
bee 0a42331dab update logo 2020-11-06 01:43:56 +00:00
Bee a5e5797f9e Delete bump.yml 2020-11-06 00:07:23 +00:00
bee 9f2a752fb4 2.0 2020-11-05 22:26:16 +00:00
bee 57de97bdc4 cargo.lock 2020-11-05 22:25:53 +00:00
dependabot-preview[bot]andBee 846afbdd5a Bump anyhow from 1.0.33 to 1.0.34 (#304)
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.33 to 1.0.34.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.33...1.0.34)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-11-05 12:17:12 +00:00
dependabot-preview[bot]andBee 52bf521a5d Bump async-std from 1.6.5 to 1.7.0 (#306)
Bumps [async-std](https://github.com/async-rs/async-std) from 1.6.5 to 1.7.0.
- [Release notes](https://github.com/async-rs/async-std/releases)
- [Changelog](https://github.com/async-rs/async-std/blob/master/CHANGELOG.md)
- [Commits](https://github.com/async-rs/async-std/compare/v1.6.5...v1.7.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-11-05 12:17:01 +00:00
Beeandbee bef54d1496 Redesign of README (#293)
Updated README

Co-authored-by: bee <[email protected]>
2020-11-05 12:13:47 +00:00
dependabot-preview[bot] 76b3116b42 Bump futures from 0.3.6 to 0.3.7 (#302)
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.6...0.3.7)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-26 19:09:15 +00:00
shahar481andBee 73665ed16e Changed the dns resolving to use std::net::ToSocketAddrs (#264)
* Changed dns resolving library to to_socket_addrs and removed the usage of trust-dns

* Reverted automatic IDE spacing

* Ran cargo fmt on the code

* Made trust-dns a fallback dns resolver and reverted cargo toml and lock

* Reverted cargo.lock

* Ran cargo fmt

* Changed style of err checking

* Fixed errors

* Fixed merging errors

* Changed for CR

Co-authored-by: Bee <[email protected]>
2020-10-24 13:11:18 +01:00
bergabman 21b92a1d1b Improve error handling in scripts init (#300) 2020-10-24 13:06:31 +01:00
Niklas Mohrin f9a7586857 Better enforce clippy lints (#294)
* Clippy deny default lints and warn for clippy::pedantic

* Fix all existing pedantic clippy lints on stable and nightly
2020-10-21 19:46:07 +01:00
eiffel-fl 6c05775394 Add some instructions to create contributing development environment. (#298)
A new Dockerfile "contributing.Dockerfile" was added.
This Dockerfile permits creating a "ready to develop" container image to ease
contributing to RustScan.
The instructions to use it are detailed in contributing.md.
2020-10-21 12:55:03 +01:00
dependabot-preview[bot] 043be7d6af Bump env_logger from 0.7.1 to 0.8.1 (#295)
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.7.1 to 0.8.1.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.7.1...v0.8.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-19 11:44:03 +01:00
allcontributors[bot] 5526657d84 docs: add okrplay as a contributor (#290)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-10-17 23:44:22 +01:00
OskarandBee 859eb0e83a Add tests for rustscan scripting engine (#286) (#289)
* Add tests for rustscan scripting engine (#286)

* Increase test coverage

* Add more scripting tests

Co-authored-by: Bee <[email protected]>
2020-10-17 23:43:03 +01:00
allcontributors[bot]andBee 172ad63553 docs: add niklasmohrin as a contributor (#288)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-10-17 18:22:18 +01:00
Bee ed41af2c80 Merge pull request #287 from niklasmohrin/clippy
Add clippy linting and fix existing warnings
2020-10-17 18:18:31 +01:00
Niklas Mohrin 072d7335fd Additional small if let refactors 2020-10-17 13:48:15 +02:00
Niklas Mohrin 8a11532a25 Add clippy workflow 2020-10-17 13:22:35 +02:00
Niklas Mohrin f057a2113a Fix clippy warnings around under-specific method calls 2020-10-17 13:18:15 +02:00
Niklas Mohrin da6c95f8f1 Fix clippy warnings around return statements that could just be expressions 2020-10-17 13:14:06 +02:00
Niklas Mohrin ea5c120fa7 Fix clippy warnings about syntax 2020-10-17 13:10:44 +02:00
Niklas Mohrin cd86aaf30d Fix clippy warnings around match expressions 2020-10-17 13:03:30 +02:00
Bee d09bfeb37a Merge pull request #242 from bergabman/scripts
Scripting Engine Implementation
2020-10-17 11:02:50 +01:00
bergabman 4614e6bfe9 Scripting Engine Implementation. 2020-10-17 09:22:03 +02:00
allcontributors[bot]andBee 03877d376c docs: add u5surf as a contributor (#285)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-10-16 20:20:20 +01:00
Y.Horie da3f34da79 Fix Rlimit breaking change. (#283) (#284)
* Replace rlimit::rlim with rlimit::RawRlim

Signed-off-by: u5surf <[email protected]>
2020-10-16 20:17:39 +01:00
dependabot-preview[bot]andBee 872eeb6e9e Bump serde from 1.0.116 to 1.0.117 (#278)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.116 to 1.0.117.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.116...v1.0.117)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-10-16 17:02:47 +01:00
eiffel-flandBee 9bbee9d3ed Add tries to scan_socket. (#266)
By default the number of try is 1, it can be set on the command line by using
--tries option.

This should close RustScan/RustScan#38.

Co-authored-by: Bee <[email protected]>
2020-10-16 17:02:19 +01:00
allcontributors[bot] 1debe0035d docs: add niklasmohrin as a contributor (#282)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-10-16 17:01:55 +01:00
allcontributors[bot] cf314b4c63 docs: add eiffel-fl as a contributor (#281)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-10-16 17:01:29 +01:00
Bernardo AraujoandBee 4dcd929ba4 Make address an optional instead of a positional argument (#271)
This has the benefit of making the input flexible and fixing an existing
bug that happens when a single port is specified, see #211.

Other benefits:
  - We are now parsing only failures as a file, reducing the amount of
    attempts to open a file.
  - We check if a file exists before trying to open it.

Fixes #211

Co-authored-by: Bee <[email protected]>
2020-10-16 16:59:12 +01:00
dependabot-preview[bot] 5b35a09b0b Bump toml from 0.5.6 to 0.5.7 (#270)
Bumps [toml](https://github.com/alexcrichton/toml-rs) from 0.5.6 to 0.5.7.
- [Release notes](https://github.com/alexcrichton/toml-rs/releases)
- [Commits](https://github.com/alexcrichton/toml-rs/compare/0.5.6...0.5.7)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-13 12:28:47 +01:00
dependabot-preview[bot] 734595da46 Bump structopt from 0.3.19 to 0.3.20 (#272)
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.19 to 0.3.20.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.19...v0.3.20)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-13 12:25:14 +01:00
allcontributors[bot] 943980ee83 docs: add rootsploit as a contributor (#274)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-10-13 12:24:52 +01:00
Frederik BandBee 61b691eaa4 Update .SRCINFO url (#268)
Update the .SRCINFO file to point to new repo URL

Co-authored-by: Bee <[email protected]>
2020-10-10 12:27:39 +01:00
dependabot-preview[bot] 6dcad646fa Bump structopt from 0.3.18 to 0.3.19 (#267)
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.18 to 0.3.19.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.18...v0.3.19)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-10 12:25:39 +01:00
dependabot-preview[bot]andBee d2c84f5f33 Bump futures from 0.3.5 to 0.3.6 (#265)
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.5...0.3.6)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-10-06 13:21:32 +01:00
Thomas Gotwig 0eaf63683e Fix archives-generation from Makefile 👷‍♂️ (#263) 2020-10-06 13:20:24 +01:00
allcontributors[bot] 06c1d37aea docs: add mattcorbin as a contributor (#261)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-10-04 18:29:32 +01:00
SandroandBee 4d560f4eb5 Fix cosmetic issues, change maintainer to rustscan (#249)
Changing only a few lines does not give you maintainer. Also people might contact the person if they need to reach out about something which is probably not intended.

Co-authored-by: Bee <[email protected]>
2020-10-04 18:03:32 +01:00
Teofilo MonteiroandBee dbc3d510d5 Update documentation to include greppable (#253)
* Update documentation include greppable

* Replace quiet mode for greppable mode

Co-authored-by: Bee <[email protected]>
2020-10-04 16:57:48 +01:00
Hardeep SinghandBee 68e1c8e8b6 Updated the person of README. (#255)
Fixed some minor description corrections in README.

Co-authored-by: Bee <[email protected]>
2020-10-04 16:25:04 +01:00
allcontributors[bot]andBee 15dd31e350 docs: add bofh69 as a contributor (#256)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-10-04 15:42:32 +01:00
Sebastian Andersson b3a64271dc Add integration tests with timeout (#254)
* Add integration tests with timeout

* cargo fmt

* Fix travis command line

* Add extra margins for the timeout values

* Increase the time to scan

Output the time taken after each test
2020-10-03 02:01:31 +01:00
Ben (CMNatic)andBee abb08958cb Update README for instructions for v.10.0 & detail history (#251)
DockerHub now contains every major release from `v1.0.1` to `1.10.0`

Waiting for this README PR to approve before I remove the `v1.9.0` DockerHub tag as it no longer conforms with standards.

Co-authored-by: Bee <[email protected]>
2020-09-30 14:13:55 +01:00
Bee d5935c4ce7 Added HomeBrew Bump + More CI Tests (#252)
* CI and more tests

* included package name
2020-09-30 13:51:10 +01:00
Bee 5c613082fb Bee ci changes (#250)
* 1.10.0 release

* building CI

* building CI
2020-09-29 15:33:09 +01:00
Bee 2868e13db4 Merge branch 'master' into bee-CI-changes 2020-09-29 15:28:25 +01:00
Brandon 31ed2e8914 building CI 2020-09-29 15:24:36 +01:00
Brandon 0426aa83e3 building CI 2020-09-29 15:19:42 +01:00
Brandon 4deb5eff53 1.10.0 release 2020-09-29 12:28:12 +01:00
Brandon 81ad00dc29 1.10.0 release 2020-09-29 00:29:58 +01:00
Bee 64cac6e0fa Added DNS lookup using Google DNS, refactored IP code (#246)
* Added DNS lookup using Google DNS, refactored IP code

* fixed comments & cargo fmt

* Fixed code review comments, added tests, removed unwrap() panics

* Added assertion to test
2020-09-28 21:19:55 +01:00
dependabot-preview[bot] 739e9716fc Bump structopt from 0.3.17 to 0.3.18 (#243)
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.17 to 0.3.18.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.17...v0.3.18)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-24 13:38:47 +01:00
Bee 6bf70f0f9a Fixed output error, Warning! ran when file opened (#237)
Take file of addresses as input
2020-09-23 12:42:13 +01:00
Ben (CMNatic) 57dfb15852 Update Dockerfile to encourage layer caching (#241)
At the moment the Dockerfile brings the entire current directory in as a context for the building container. We can encourage some caching here by only bringing forward the essentials:
`cargo.tml`, `cargo.lock` and the `src`

+ Added a maintainer label
2020-09-23 12:40:51 +01:00
allcontributors[bot]andBee 282065752c docs: add dmitris as a contributor (#232)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Bee <[email protected]>
2020-09-22 12:55:29 +01:00
Brandon 982ae0d926 README updates 2020-09-21 23:19:29 +01:00
Brandon 53f8a15e16 Merge branch 'master' of github.com:RustScan/RustScan into master 2020-09-21 23:19:19 +01:00
Bee fc214a78b4 Increase code coverage (#236)
* Updated code coverage
2020-09-21 17:36:40 +01:00
Brandon 0ae289c25f Merge branch 'master' of github.com:RustScan/RustScan into master 2020-09-21 14:17:52 +01:00
bergabman 9326fc4a0f Refactored test, intorduced default() in test context for structs for easier test writing, Scanner struct quiet changed to greppable. (#235) 2020-09-21 00:00:11 +01:00
Brandon c05ebaf857 Merge branch 'master' of github.com:RustScan/RustScan into master 2020-09-20 15:58:39 +01:00
Ben (CMNatic) 6f8df7e77e Merge pull request #234 from CMNatic/master
Fix version tag (v1.9.0) typo in docker usage
2020-09-20 13:11:35 +01:00
Ben (CMNatic) 488853f40e Merge branch 'master' into master 2020-09-20 13:09:52 +01:00
Ben (CMNatic) 57c1e33650 typo in docker instructions 2020-09-20 13:02:17 +01:00
Ben (CMNatic) 699b578ade Update README for v1.9.0 release (#233)
DockerHub tag for v1.9.0 release has been pushed too
2020-09-20 13:00:30 +01:00
Ben (CMNatic) ebe5a326a8 Update README for v1.9.0 release
DockerHub tag for v1.9.0 release has been pushed too
2020-09-20 12:55:47 +01:00
Brandon abb7a3872c releasing 2020-09-20 12:27:51 +01:00
Dmitry SavintsevandBee f74cb456b1 socket_iterator: use itertools.iproducts for ip x ports set (#231)
Replace the current manual iterator-like implementation
with the call to the itertools.iproduct macro
to generate the cartesian product of the IPs and ports.

stdlib reference:
https://docs.rs/itertools/0.9.0/itertools/macro.iproduct.html

Co-authored-by: Bee <[email protected]>
2020-09-20 12:15:46 +01:00
Brandon 492d2fb3b3 fixed accessible issues 2020-09-20 01:25:41 +01:00
bergabmanandBee af53591ccb Added top ports, fixed accessibility. (#230)
* Refactored scanner struct for accessibility, fixed macros

Co-authored-by: Bee <[email protected]>
2020-09-19 18:24:08 +01:00
Bee 6405b43f5a Merge pull request #229 from dmitris/patch-1
fix typo
2020-09-19 00:54:24 +01:00
Dmitry Savintsev 9a71253697 fix typo 2020-09-18 22:13:33 +02:00
Bee 4d6d57fe2c Merge pull request #226 from RustScan/dependabot/cargo/async-std-1.6.4
Bump async-std from 1.6.3 to 1.6.4
2020-09-18 15:38:36 +01:00
Bee a040ab5521 Merge branch 'master' into dependabot/cargo/async-std-1.6.4 2020-09-18 15:38:29 +01:00
Bee a546aa2ac0 Merge pull request #228 from RustScan/all-contributors/add-bergabman
docs: add bergabman as a contributor
2020-09-18 15:38:04 +01:00
Bee 868e61bb2e Merge branch 'master' into all-contributors/add-bergabman 2020-09-18 15:37:57 +01:00
allcontributors[bot] c4f8ceb336 docs: update .all-contributorsrc [skip ci] 2020-09-18 14:37:46 +00:00
allcontributors[bot] 9d80fb4fa7 docs: update README.md [skip ci] 2020-09-18 14:37:45 +00:00
Bee e659d51976 Merge pull request #225 from bergabman/benchmark
Runtime measurement implementation, better debugging, and better error handling for unreachable hosts.
2020-09-18 15:37:44 +01:00
bergabman 64f4aecacd Runtime measurement implementation, better debugging, and better error handling for unreachable hosts. 2020-09-18 16:14:26 +02:00
dependabot-preview[bot] afe2a9452f Bump async-std from 1.6.3 to 1.6.4
Bumps [async-std](https://github.com/async-rs/async-std) from 1.6.3 to 1.6.4.
- [Release notes](https://github.com/async-rs/async-std/releases)
- [Changelog](https://github.com/async-rs/async-std/blob/master/CHANGELOG.md)
- [Commits](https://github.com/async-rs/async-std/compare/v1.6.3...v1.6.4)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-09-18 06:51:32 +00:00
Bernardo Araujo 4a6e74d507 Merge pull request #224 from CMNatic/cmn-v1.80-docker-instructions
Updated README to reflect v1.8.0 DockerHub tag
2020-09-15 22:12:28 -04:00
Ben (CMNatic) eb905f7e7a Update README.md
Small typos after initial commit to #224
2020-09-16 02:41:11 +01:00
Ben (CMNatic) 561e7fb2f0 Updated README to reflect v1.8.0 DockerHub tag
v1.8.0 is the most recent published version of RustScan, the alpine tag quickly became depreciated - meaning people had to rely on `latest` to get any features made within the last month.

Version tags will build as per major realease i.e. `v1.9.0`
2020-09-16 01:55:12 +01:00
Bee e5d22a0421 Merge pull request #221 from RustScan/ba-fix-no-nmap
Fix behaviour of --no-nmap flag
2020-09-15 00:51:52 +01:00
Bernardo Chaves 33c9388586 Fix behaviour of --no-nmap flag
At some point we forgot to check for this flag before actually running
our post scanning tasks. I've also adjusted some of our messages for
reporting.
2020-09-14 19:30:30 -04:00
Bee 4dfe76737b Merge pull request #216 from RustScan/dependabot/cargo/serde_derive-1.0.116
Bump serde_derive from 1.0.115 to 1.0.116
2020-09-14 14:01:52 +01:00
Bee cc0b344232 Merge branch 'master' into dependabot/cargo/serde_derive-1.0.116 2020-09-14 13:58:43 +01:00
Bee abaf100da9 Merge pull request #217 from RustScan/bee-fix-debug-output
fixed debug log
2020-09-14 13:58:29 +01:00
Bee 43602793e0 Merge branch 'master' into bee-fix-debug-output 2020-09-14 12:23:28 +01:00
Brandon 7b827991c1 cargo fmt 2020-09-14 12:23:09 +01:00
Brandon f4555ecb98 fixed debug log 2020-09-14 12:20:48 +01:00
dependabot-preview[bot] 2fb8a399a7 Bump serde_derive from 1.0.115 to 1.0.116
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.115 to 1.0.116.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.115...v1.0.116)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-09-14 11:05:24 +00:00
Bee e612ddc4e6 Merge pull request #215 from RustScan/dependabot/cargo/serde-1.0.116
Bump serde from 1.0.115 to 1.0.116
2020-09-14 12:04:08 +01:00
dependabot-preview[bot] 8bf75846d3 Bump serde from 1.0.115 to 1.0.116
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.115 to 1.0.116.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.115...v1.0.116)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-09-14 06:57:46 +00:00
Bee bf1cb3a5d0 Merge pull request #208 from RustScan/ba-socket-iterator
Introduce SocketIterator
2020-09-13 00:22:49 +01:00
Bernardo Chaves 01975d7238 Introduce SocketIterator
The goal of this iterator is to generate sockets based on combinations
of IPs and ports in a memory-bounded way, we only consume the next item
of this iterator when a socket has been processed by our scanner.

Before this change we were generating every combination of IP and port
and storing it in a VecDeque, and while this is fine for a small subset
of IPs and ports it can quickly get out of hand with multiple IPs and
a big port range.
2020-09-12 12:24:30 -04:00
Bee 8c4cc77e6b Merge pull request #206 from bergabman/master
Bugfixes
2020-09-11 23:35:23 +01:00
bergabman b0c1ab3177 Logic at adding targets to the FuturesUnordered rolled back to the initial.
In case of batchsize higher than all sockets to scan, we could end up in an infinite loop. Fixed with breaking out of the loop if that's the case.
2020-09-11 19:21:21 +02:00
Bee 6812cc3051 Merge pull request #205 from Martin005/patch-1
Fix incorrect timeout option in README
2020-09-11 13:00:50 +01:00
Martin Chrástek 2800adec34 Fix incorrect timeout option 2020-09-11 13:22:11 +02:00
Bee cf1aa67a21 Merge pull request #204 from RustScan/all-contributors/add-bergabman
docs: add bergabman as a contributor
2020-09-11 01:16:28 +01:00
Bee c9708671e8 Merge branch 'master' into all-contributors/add-bergabman 2020-09-11 01:13:27 +01:00
Bee 461f9aaa6d Merge pull request #203 from bergabman/master
Small improvement in the scanning engine.
2020-09-11 01:12:51 +01:00
allcontributors[bot] 01a74b72df docs: update .all-contributorsrc [skip ci] 2020-09-11 00:01:53 +00:00
allcontributors[bot] d301cf3b20 docs: update README.md [skip ci] 2020-09-11 00:01:52 +00:00
Bee 5e8d45bf01 Merge branch 'master' into master 2020-09-11 01:00:47 +01:00
Brandon bc5b2eea7e added release drafter 2020-09-11 00:59:55 +01:00
bergabman c8a8915682 Remove unnecessary comment.
Fix mistake at adding futures to the initial stream.
2020-09-11 01:48:35 +02:00
bergabman d786e24186 Fix format. 2020-09-11 00:48:23 +02:00
Bee 5b536621e6 Merge branch 'master' into master 2020-09-10 23:45:46 +01:00
bergabman c05f40ae70 Small improvement at an if. 2020-09-10 23:29:07 +02:00
bergabman 24b9f8d8d3 Improved scanner engine to work more efficient and consistent with scanning. 2020-09-10 23:27:28 +02:00
Bee bda392c9a7 Merge pull request #200 from RustScan/ba-add-cidr-support
Add CIDR support
2020-09-10 00:46:19 +01:00
Bernardo Chaves 3836480486 Add CIDR support
Add CIDR support for ips_or_hosts argument. This will allow our users to
specify multiple IPs within a network at once which is pretty
convenient.
2020-09-09 19:21:43 -04:00
Bee 2291ba73d2 Update FUNDING.yml 2020-09-07 23:00:14 +01:00
Bee e0af8a306a Merge pull request #198 from RustScan/all-contributors/add-buermarc
docs: add buermarc as a contributor
2020-09-07 22:22:52 +01:00
Bee cb0f4f7a92 Merge branch 'master' into all-contributors/add-buermarc 2020-09-07 22:17:59 +01:00
Bee 402bea4b06 Merge pull request #195 from buermarc/master
Check '.config/rustscan/config.toml' for config
2020-09-07 22:15:47 +01:00
allcontributors[bot] f44dda0360 docs: update .all-contributorsrc [skip ci] 2020-09-07 21:15:35 +00:00
allcontributors[bot] 965a173032 docs: update README.md [skip ci] 2020-09-07 21:15:34 +00:00
Bee d95cae6677 Merge branch 'master' into master 2020-09-07 21:41:27 +01:00
Bee 2f92d5583a Merge pull request #197 from RustScan/ba-no-nmap-option
Introduce the -no-nmap option
2020-09-07 21:41:09 +01:00
Bee 8d8da79640 Merge branch 'master' into ba-no-nmap-option 2020-09-07 21:29:23 +01:00
Bee e5b4a2f443 Merge branch 'master' into master 2020-09-07 21:23:18 +01:00
Bernardo Araujo a0b877729e Merge pull request #194 from usrGabriel/patch-1
Update README.md
2020-09-07 11:20:25 -04:00
Bernardo Chaves 743fa1cad6 Introduce the -no-nmap option
As the name implies this will allow RustScan to to run the scan without
starting an nmap scan with ports that are found.
2020-09-06 22:22:17 -04:00
mulc a0561d4728 Check '.config/rustscan/config.toml' for config
When reading the config file '$CONFIG_DIR/.config/rustscan/config.toml'
should also be checked. If both '~/.rustscan.toml' and
'$CONFIG_DIR/.config/rustscan/config.toml' exist, then later will be
used.
2020-09-05 18:32:08 +02:00
Gabriel b2a1bd2e7a Update README.md
Typo fix in the Debian / Kali install section.
2020-09-05 12:23:18 -04:00
Brandon 87de96c3c4 Merge pull request #185 from RustScan/ba-add-config-file
Add configuration file
2020-08-30 14:00:07 +01:00
Bernardo Chaves 8e21f3bf8c Add configuration file
This configuration file will be read from the home directory of the
user. Options set within this file will have priority over arguments
from the command line unless the `--no-config` option is passed to the
program.
2020-08-29 18:01:44 -04:00
Brandon 4019d1ff3a Merge pull request #182 from RustScan/all-contributors/add-tim77
docs: add tim77 as a contributor
2020-08-29 12:15:07 +01:00
Brandon c004bd0527 Merge pull request #181 from tim77/tim77-patch-1
Add Fedora/CentOS installation instructions
2020-08-29 11:53:44 +01:00
allcontributors[bot] cdc5bbd924 docs: update .all-contributorsrc [skip ci] 2020-08-29 10:53:35 +00:00
allcontributors[bot] f41213047a docs: update README.md [skip ci] 2020-08-29 10:53:34 +00:00
Artem Polishchuk 2315ef2417 Add Fedora/CentOS installation instructions 2020-08-28 23:33:42 +03:00
Brandon cb87d5b9ce Update README.md 2020-08-28 16:14:10 +01:00
Brandon 92800678cd Merge branch 'master' of github.com:brandonskerritt/RustScan into master 2020-08-28 15:59:05 +01:00
Brandon 8e76a71a4c updated logo 2020-08-28 15:58:42 +01:00
Brandon 07fdea8471 Merge pull request #176 from niklasmohrin/improve-readme
README.md tweaks
2020-08-28 13:50:38 +01:00
Niklas Mohrin 8670bcc35f Move "rustscan -h" and output together 2020-08-28 14:43:50 +02:00
Niklas Mohrin fbba9d16ca Mark code blocks as bash commands in README 2020-08-28 14:43:50 +02:00
Niklas Mohrin 309d1ad660 Remove argument placeholders in docker alias 2020-08-28 14:43:47 +02:00
Brandon ed48161bea added travis token 2020-08-28 11:22:23 +01:00
Brandon f0d1aa2b9a Merge pull request #180 from RustScan/all-contributors/add-SuperSandro2000
docs: add SuperSandro2000 as a contributor
2020-08-28 11:12:35 +01:00
Brandon ac93feddb5 Merge pull request #178 from SuperSandro2000/optimize-docker
Optimize Dockerfile
2020-08-28 11:12:17 +01:00
allcontributors[bot] 1280fa1b47 docs: update .all-contributorsrc [skip ci] 2020-08-28 10:12:08 +00:00
Brandon 6e731aaf93 Merge branch 'master' into optimize-docker 2020-08-28 11:12:08 +01:00
allcontributors[bot] 9230165f8f docs: update README.md [skip ci] 2020-08-28 10:12:07 +00:00
Brandon 818c80041b Merge pull request #177 from RustScan/all-contributors/add-niklasmohrin
docs: add niklasmohrin as a contributor
2020-08-28 11:11:38 +01:00
allcontributors[bot] bce955212a docs: update .all-contributorsrc [skip ci] 2020-08-28 10:11:34 +00:00
allcontributors[bot] 41e0e8905f docs: update README.md [skip ci] 2020-08-28 10:11:33 +00:00
Sandro Jäckel 85f1699724 Prevent cache bustages 2020-08-28 01:31:54 +02:00
Sandro Jäckel bafd0141df Pin Alpine 3.12 to prevent breakages in the future 2020-08-28 01:31:26 +02:00
Sandro Jäckel aba0f3c38c Cleanup Dockerfile 2020-08-28 01:31:08 +02:00
allcontributors[bot] 9e161d4f79 docs: update .all-contributorsrc [skip ci] 2020-08-27 23:12:10 +00:00
allcontributors[bot] 731b4079cf docs: update README.md [skip ci] 2020-08-27 23:12:09 +00:00
Brandon b4edc6cca6 1.8.0 publish 2020-08-28 00:03:02 +01:00
Brandon 4a7cbd701b Merge pull request #175 from RustScan/all-contributors/add-caass
docs: add caass as a contributor
2020-08-27 20:39:46 +01:00
allcontributors[bot] f34ee8f5ef docs: update .all-contributorsrc [skip ci] 2020-08-27 19:36:22 +00:00
allcontributors[bot] 89c763789f docs: update README.md [skip ci] 2020-08-27 19:36:21 +00:00
Brandon 5c48f1173a Merge pull request #140 from remigourdon/docs-pages
Add Travis configuration to publish doc to GitHub pages
2020-08-27 14:02:46 +01:00
Brandon 8d8ca1d4a0 Merge branch 'master' into docs-pages 2020-08-27 14:01:29 +01:00
Brandon 8d8acd61e8 Merge pull request #173 from RustScan/bee-add-submodule
added submodule
2020-08-27 13:33:16 +01:00
Brandon 0ab3e53034 Merge branch 'master' into bee-add-submodule 2020-08-27 13:05:19 +01:00
Brandon 56493859cb added submodule 2020-08-27 12:36:56 +01:00
Brandon 2ef723ed96 Merge branch 'master' into docs-pages 2020-08-27 12:30:33 +01:00
Brandon e9288302ba Merge pull request #172 from RustScan/all-contributors/add-caass
docs: add caass as a contributor
2020-08-27 11:39:35 +01:00
remigourdon 8179511527 Add Travis configuration to publish doc to GitHub pages 2020-08-26 23:22:13 -04:00
allcontributors[bot] fbab4a4020 docs: update .all-contributorsrc [skip ci] 2020-08-26 23:22:13 -04:00
allcontributors[bot] b425d15a98 docs: update README.md [skip ci] 2020-08-26 23:22:13 -04:00
allcontributors[bot] fddda34465 docs: update .all-contributorsrc [skip ci] 2020-08-26 23:39:11 +00:00
allcontributors[bot] 125df4a2ed docs: update README.md [skip ci] 2020-08-26 23:39:10 +00:00
Brandon e670d11223 Merge pull request #170 from RustScan/all-contributors/add-SuperSandro2000
docs: add SuperSandro2000 as a contributor
2020-08-27 00:36:42 +01:00
Brandon 8453320586 Merge pull request #169 from SuperSandro2000/fix-timeout-arg
Convert -T to -t
2020-08-26 17:27:15 +01:00
allcontributors[bot] 99e9c834a9 docs: update .all-contributorsrc [skip ci] 2020-08-26 15:54:45 +00:00
allcontributors[bot] dfbce6a636 docs: update README.md [skip ci] 2020-08-26 15:54:44 +00:00
Sandro Jäckel 916be1e4a2 Convert -T to -t 2020-08-26 17:38:58 +02:00
Brandon 90b4328fb6 Merge pull request #167 from RustScan/all-contributors/add-Phenomite
docs: add Phenomite as a contributor
2020-08-26 16:08:25 +01:00
Brandon 76035d3379 Merge branch 'master' into all-contributors/add-Phenomite 2020-08-26 15:50:08 +01:00
Brandon 4de31ecede Merge pull request #163 from Phenomite/patch-1
2000 milliseconds not seconds
2020-08-26 15:47:50 +01:00
allcontributors[bot] ce9befaa1a docs: update .all-contributorsrc [skip ci] 2020-08-26 14:47:28 +00:00
Brandon 5f6457ed7e Merge branch 'master' into patch-1 2020-08-26 15:47:27 +01:00
allcontributors[bot] 12d3c91983 docs: update README.md [skip ci] 2020-08-26 14:47:27 +00:00
Brandon e0fd7a39dc Merge pull request #164 from RustScan/dependabot/cargo/structopt-0.3.17
Bump structopt from 0.3.16 to 0.3.17
2020-08-26 14:59:31 +01:00
Brandon ff0787e332 Merge branch 'master' into dependabot/cargo/structopt-0.3.17 2020-08-26 14:02:08 +01:00
Brandon 6ce6c0ce9e Merge pull request #166 from RustScan/all-contributors/add-Ferryistaken
docs: add Ferryistaken as a contributor
2020-08-26 14:01:48 +01:00
Brandon edf989ad5d Merge branch 'master' into all-contributors/add-Ferryistaken 2020-08-26 13:35:08 +01:00
Brandon 3fede4c6db Merge pull request #165 from Ferryistaken/fix-message
Fixed small typo in a warning message
2020-08-26 13:34:46 +01:00
allcontributors[bot] 75b310f227 docs: update .all-contributorsrc [skip ci] 2020-08-26 12:34:40 +00:00
allcontributors[bot] 72c6ef1f1d docs: update README.md [skip ci] 2020-08-26 12:34:39 +00:00
Ferry 83b23da32b Fixed small typo in a warning message 2020-08-26 11:00:54 +02:00
dependabot-preview[bot] 3886a07775 Bump structopt from 0.3.16 to 0.3.17
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.16 to 0.3.17.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.16...v0.3.17)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-08-26 06:52:53 +00:00
Phenomite f5064d3d5c 2000 milliseconds not seconds 2020-08-25 18:42:59 -04:00
Brandon 22cbfc5826 Merge pull request #159 from RustScan/bee-add-nmap-ports
updated config file to feature nmap top 1k ports
2020-08-24 16:49:13 +01:00
Brandon a9d729300c Merge branch 'master' into bee-add-nmap-ports 2020-08-24 13:49:10 +01:00
Brandon 4f5dd20e85 Merge pull request #162 from RustScan/ba-reduce-binary-size
Reduce binary size from 2.4MB to 1.9MB
2020-08-24 12:48:45 +01:00
Bernardo Chaves 499ff66f36 Reduce binary size from 2.4MB to 1.9MB
By default, Cargo instructs compilation units to be compiled and optimized
in isolation. LTO instructs the linker to optimize at the link stage.
This can, for example, remove dead code and often times reduces binary size.

By default, when Rust code encounters a situation when it must call panic!(),
it unwinds the stack and produces a helpful backtrace. The unwinding code,
however, does require extra binary size. rustc can be instructed to abort
immediately rather than unwind, which removes the need for this extra unwinding code.

For more information see: https://github.com/johnthagen/min-sized-rust
2020-08-23 18:10:53 -04:00
Brandon 61b87243d9 Merge pull request #161 from RustScan/ba-refactor-port-strategy
Allow randomized order for manual ports
2020-08-22 22:27:37 +01:00
Bernardo Chaves e069991c8d Allow randomized order for manual ports
Before this change we would always scan manually specified ports in
sequential way, this is not the case anymore. This is an important
change since we are planning to introduce a config file with the top 1K
ports and we would like to scan those in a randomized way.
2020-08-21 13:09:41 -04:00
Brandon 85c1cbf445 Merge pull request #160 from RustScan/bee-remove-A
removed -A from nmap
2020-08-20 22:58:39 +01:00
Brandon 5551e64166 updated AUR package in readme 2020-08-20 00:40:41 +01:00
Brandon e0aa1423ad removed -A from nmap 2020-08-20 00:32:37 +01:00
Brandon e609b3617c updated config file to feature nmap top 1k ports 2020-08-20 00:05:45 +01:00
Brandon d0d8380296 Merge pull request #158 from RustScan/ba-add-port-and-range-options
Add --port and --range options
2020-08-19 16:26:39 +01:00
Brandon d66ad34f8c Merge branch 'master' into ba-add-port-and-range-options 2020-08-19 16:02:49 +01:00
Brandon 2670ec43df Merge pull request #156 from spenserblack/exclude-files
Exclude files
2020-08-19 00:05:59 +01:00
Bernardo Chaves 90d0b03ba7 Add --port and --range options
These options are mutually exclusive, this means that when a user
selects manual ports we will ignore ranges and vice-versa.

Manually specifying ports won't allow scan randomization for now.
2020-08-17 20:43:44 -04:00
Spenser Black 57eb3627b3 Use absolute image URLs instead of relative 2020-08-17 10:03:04 -04:00
Spenser Black 7e675b7557 Reduce crate size 2020-08-17 09:30:07 -04:00
Bernardo Araujo fdeaa05f23 Merge pull request #152 from RustScan/ba-add-host-resolution
Add host resolution
2020-08-16 18:35:40 -04:00
Bernardo Araujo 9fbf39f0cc Merge branch 'master' into ba-add-host-resolution 2020-08-16 18:11:27 -04:00
Ben (CMNatic) 14b6ea928d Merge pull request #155 from CMNatic/master
Updated README to use the rustscan dockerhub alpine image
2020-08-16 22:39:10 +01:00
Ben (CMNatic) 9452b1f922 Update README to add a disclaimer about the DockerHub Images
+ Instruct user to use the `alpine` image as it's considered the latest major release as per the release page

+ Formatting instructions
2020-08-16 22:37:51 +01:00
Ben (CMNatic) ed12888e81 Updated README to use the rustscan dockerhub alpine image
+ Added another step to clarify process for Docker as the build will fail if the user is not in the downloaded repo

+ DockerHub has CI with master branch and two images tags `latest` and `alpine` where `alpine` is tagged on feature releases (currently 1.7.1)
2020-08-16 22:28:57 +01:00
Bernardo Chaves f68abcb955 Add host resolution
For now if we can establish a socket on port 80 we can infer the IP of the
host. This might change in the future if we start considering other
ports like 443.
2020-08-16 11:52:11 -04:00
Brandon 4c91e8fb40 Merge pull request #153 from andy5995/docs
docs: fix typo in README.md, link to GitHub flow in contributing doc
2020-08-15 11:08:03 +01:00
andy5995 1d3e831066 docs: fix typo in README.md, link to GitHub flow in contributing doc 2020-08-15 02:05:20 -05:00
dependabot-preview[bot] ff6b1c40db Merge pull request #151 from RustScan/dependabot/cargo/async-std-1.6.3 2020-08-15 00:58:44 +00:00
dependabot-preview[bot] 5573d91a7b Bump async-std from 1.6.2 to 1.6.3
Bumps [async-std](https://github.com/async-rs/async-std) from 1.6.2 to 1.6.3.
- [Release notes](https://github.com/async-rs/async-std/releases)
- [Changelog](https://github.com/async-rs/async-std/blob/master/CHANGELOG.md)
- [Commits](https://github.com/async-rs/async-std/commits/v1.6.3)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-08-14 08:38:10 +00:00
Brandon a8e56eec4b Merge pull request #149 from RustScan/all-contributors/add-cmnatic
docs: add cmnatic as a contributor
2020-08-13 22:56:14 +01:00
Brandon fb75c9d332 Merge branch 'master' into all-contributors/add-cmnatic 2020-08-13 22:43:56 +01:00
Ben (CMNatic) 581ec27cb5 Merge pull request #148 from CMNatic/master
Updated README to include instructions on building the new Dockerfile
2020-08-13 20:25:05 +01:00
allcontributors[bot] 9673c8807d docs: update .all-contributorsrc [skip ci] 2020-08-13 19:24:12 +00:00
allcontributors[bot] 78818d6bc7 docs: update README.md [skip ci] 2020-08-13 19:24:11 +00:00
Ben (CMNatic) d0ff597be6 Updated README to include instructions on building the new Dockerfile 2020-08-13 20:11:58 +01:00
Ben (CMNatic) 516ebe367a Merge pull request #118 from Hydragyrum/feature/create-alpine-based-dockerfile
Feature/create alpine based dockerfile
2020-08-13 19:41:52 +01:00
Ben (CMNatic) 1e9660e4ff Merge branch 'master' into feature/create-alpine-based-dockerfile 2020-08-13 19:32:13 +01:00
Brandon 7b4dda5a19 Merge pull request #147 from RustScan/dependabot/cargo/rlimit-0.4.0
Bump rlimit from 0.3.0 to 0.4.0
2020-08-13 11:40:23 +01:00
dependabot-preview[bot] a20b71191d Bump rlimit from 0.3.0 to 0.4.0
Bumps [rlimit](https://github.com/Nugine/rlimit) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/Nugine/rlimit/releases)
- [Commits](https://github.com/Nugine/rlimit/compare/v0.3.0...v0.4.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-08-13 08:36:23 +00:00
Brandon 18c5dd69e5 Merge pull request #145 from RustScan/all-contributors/add-TGotwig
docs: add TGotwig as a contributor
2020-08-11 19:45:15 +01:00
Brandon 090264ac26 Merge branch 'master' into all-contributors/add-TGotwig 2020-08-11 19:32:11 +01:00
Bernardo Araujo 702681606f Merge pull request #146 from RustScan/bee-fix-spelling
fixed spelling mistake
2020-08-10 20:59:20 -04:00
Brandon c58ac613c9 fixed spelling mistake 2020-08-11 01:47:25 +01:00
Brandon 44b53fb877 Merge pull request #143 from RustScan/all-contributors/add-remigourdon
docs: add remigourdon as a contributor
2020-08-10 21:47:24 +01:00
Brandon 99e72e4a16 Merge branch 'master' into all-contributors/add-remigourdon 2020-08-10 21:12:53 +01:00
Brandon e02073bd97 Merge pull request #144 from TGotwig/master
Add Makefile for cross-compiling to Linux & Mac 👷‍♂️
2020-08-10 21:12:34 +01:00
allcontributors[bot] 59bb72426d docs: update .all-contributorsrc [skip ci] 2020-08-10 19:57:32 +00:00
allcontributors[bot] f48590c238 docs: update README.md [skip ci] 2020-08-10 19:57:31 +00:00
tgotwig a3eb548ae9 Add Makefile for cross-compiling to Linux & Mac 👷‍♂️ 2020-08-10 15:04:06 +02:00
allcontributors[bot] 050a8baf48 docs: update .all-contributorsrc [skip ci] 2020-08-10 12:39:34 +00:00
allcontributors[bot] 9b893dbf71 docs: update README.md [skip ci] 2020-08-10 12:39:33 +00:00
Brandon 8245ccf31e Fixing all contributors 2020-08-10 13:38:53 +01:00
Brandon 301a656006 Merge pull request #138 from RustScan/ba-update-readme-instructions
Update documentation
2020-08-10 13:02:21 +01:00
Bernardo Chaves 1639aadc54 Update documentation
- README
- Port strategies
2020-08-09 12:29:16 -04:00
Brandon c66bb50508 Merge pull request #132 from RustScan/ba-optimize-range-generator
Refactor RangeIterator to not require Option types
2020-08-09 01:13:54 +01:00
Bernardo Chaves b490eb08be Refactor RangeIterator to not require Option types
There's no need to deal with `unwrap` for this specific algorithm,
instead we can rely on simple types to achieve the same result.
2020-08-08 14:08:43 -04:00
Brandon 990e92dcbf Merge pull request #134 from RustScan/bee-add-a11y-mode
Add a11y mode
2020-08-08 13:45:59 +01:00
Brandon 883e89fe5e cargo fmt 2020-08-08 13:26:45 +01:00
Brandon 1b15cc2f71 Merge branch 'master' into bee-add-a11y-mode 2020-08-08 13:24:41 +01:00
Brandon 18b574f6bb Merge pull request #137 from Nugine/fix-typo
Fix typo of "ulimt"
2020-08-08 13:22:12 +01:00
Nugine 3fafee42b9 Fix typo of "ulimt" 2020-08-08 19:54:12 +08:00
Brandon 8b21dfd9a2 Merge pull request #135 from RustScan/ba-add-scan-strategy
Add port scanning strategy
2020-08-08 00:43:07 +01:00
Bernardo Chaves 2f16729c54 Add port scanning strategy
User will be able to pick from:
  - serial: in order to have their ports scanned in ascending order
  - random: in order to have their ports scanned randomly
2020-08-07 18:59:44 -04:00
Brandon 785c2a4de1 fixed tests 2020-08-07 22:28:57 +01:00
Brandon 80cc97bf83 removed perf data 2020-08-07 22:04:33 +01:00
Brandon 7a825dae41 the printopening() would suck in a TTS program 2020-08-07 21:39:53 +01:00
Brandon 751c4daff6 1.7.1 2020-08-07 17:48:37 +01:00
Brandon f6214cfb27 Merge branch 'master' of github.com:brandonskerritt/RustScan 2020-08-07 17:48:10 +01:00
Brandon a92eb80365 updated lock files 2020-08-07 17:30:39 +01:00
Brandon aeab4fb68c Merge pull request #131 from RustScan/bee-colours
Added TUI A11Y colours + Quiet Mode Macros
2020-08-07 17:25:57 +01:00
Brandon 9ab15c9d8b cargo fmt 2020-08-07 17:11:14 +01:00
Brandon 7146c23ed9 cleanup 2020-08-07 17:06:43 +01:00
Brandon f37f2d8f9d switching to master 2020-08-07 16:50:42 +01:00
Brandon 5a3a4d1c0c cargo fmt 2020-08-07 16:36:14 +01:00
Brandon 33e7cd44b6 added quiet mode to macros 2020-08-07 16:33:25 +01:00
Brandon 8288856949 added quotes 2020-08-07 13:21:19 +01:00
Brandon c3b96e262d Merge pull request #130 from RustScan/bee-add-TUI-module
Bee add tui module
2020-08-07 12:53:46 +01:00
Brandon a54868000e cargo format 2020-08-07 12:37:05 +01:00
Brandon 8f4acdf99a cleaned up colours 2020-08-07 12:33:44 +01:00
Brandon c637042906 fixed visual table 2020-08-07 02:08:12 +01:00
Brandon 766164588c fixed spacing 2020-08-07 01:53:14 +01:00
Brandon b2be83c04a added basic TUI interface 2020-08-07 00:52:56 +01:00
Brandon a3654b68eb added basic TUI interface 2020-08-07 00:40:28 +01:00
Brandon 1873a92951 Merge pull request #128 from RustScan/dependabot/cargo/structopt-0.3.16
Bump structopt from 0.3.15 to 0.3.16
2020-08-06 11:25:24 +01:00
dependabot-preview[bot] c7a422b962 Bump structopt from 0.3.15 to 0.3.16
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.15 to 0.3.16.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/commits)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-08-06 08:39:30 +00:00
Bernardo Chaves 0eec9233bd Make use of our new RangeIterator
We now rely on a pseudo random generator to scan our IPs. We also
interleave IP scanning in order to not overwhelm a single IP.
2020-08-06 01:36:36 +01:00
Bernardo Chaves 0f18bb49a3 Add pseudo random port scanning
This is based on the Linear Congruential Generator algorithm which
guarantees we will iterate through an entire range in a pseudo random
manner.

This implementation should be bound in memory by the batch_size
specified by the user, which will be in average 1_000.
2020-08-06 01:36:36 +01:00
Adam Bertrand 8b363571f1 Merge branch 'master' into feature/create-alpine-based-dockerfile 2020-08-05 21:52:34 +02:00
yogendra0sharma e546608ff8 show batch_size to user 2020-08-05 19:12:53 +01:00
yogendra0sharma a7d1952b72 Fix Issue Unneccesary text printed 2020-08-05 19:12:53 +01:00
Hydragyrum 0fa11f6e51 Add a non-privileged user to run rustscan 2020-08-05 18:53:06 +02:00
Adam Bertrand d423f34e7a Merge branch 'master' into feature/create-alpine-based-dockerfile 2020-08-05 18:25:54 +02:00
Brandon 67726cc490 1.6 2020-08-04 23:30:52 +01:00
Brandon d5d39cacd3 Merge pull request #117 from RustScan/ba-implement-multi-ip
Support multiple IPs
2020-08-04 23:21:17 +01:00
Bernardo Chaves 52cbbeeac6 Adjust messages taking into account quiet mode 2020-08-04 17:40:23 -04:00
Hydragyrum e17f9d0bb1 Add newline to dockerfile 2020-08-04 23:18:12 +02:00
Hydragyrum 3329428766 Create a basic Alpine-Based Dockerfile 2020-08-04 23:17:30 +02:00
Bernardo Chaves 23c049413b Support multiple IPs
IPs should be provided in a comma separated list.

Right now every IP will be scanned sequentially and NMAP will run before
the next IP scan starts. This will change on the long term once we
provide randomized scans in order to not overwhelm hosts or trigger
detection systems in place.
2020-08-04 16:17:27 -04:00
Brandon 9858406271 fixing cargo.toml issue 2020-08-04 16:43:14 +01:00
Brandon 6abb3737ec cargo updates 2020-08-04 16:40:32 +01:00
Brandon 65b9cb1659 cargo update 2020-08-04 16:36:48 +01:00
Brandon d2684baead 1.5 2020-08-04 16:36:24 +01:00
Brandon 5a40bc4182 Merge pull request #116 from RustScan/bee-add-section-deb
Bee add section deb #114
2020-08-04 15:09:40 +01:00
Brandon f03f15a6d0 Merge branch 'master' into bee-add-section-deb 2020-08-04 13:30:34 +01:00
Brandon 5f95b34250 deb builder works 2020-08-04 13:01:49 +01:00
Brandon 4bca6ce337 Merge pull request #108 from RustScan/bee-fix-mac-os-ulimit
Bee fix mac os ulimit
2020-08-04 12:57:24 +01:00
Brandon 9740d54912 Merge pull request #112 from RustScan/all-contributors/add-Atul9
docs: add Atul9 as a contributor
2020-08-04 12:55:46 +01:00
Brandon f577cd23bd Merge branch 'master' into all-contributors/add-Atul9 2020-08-04 12:49:57 +01:00
Brandon f16d704c86 Update README.md 2020-08-04 12:45:50 +01:00
Brandon e5368a31db Made it new line 2020-08-04 12:44:50 +01:00
Brandon 01c2580672 Made Docker command shorter 2020-08-04 12:44:14 +01:00
Brandon 200382a731 Update README.md 2020-08-04 12:42:03 +01:00
Brandon 6a000762a5 Merge branch 'master' into all-contributors/add-Atul9 2020-08-04 12:38:56 +01:00
Brandon e9b21338ef Added Docker to README 2020-08-04 12:28:49 +01:00
Brandon bd436221ca Merge branch 'master' into all-contributors/add-Atul9 2020-08-04 12:18:04 +01:00
Brandon 5d16af21f1 Updated 404 links & added emojis 2020-08-04 11:51:15 +01:00
Brandon e331789598 Merge pull request #105 from Atul9/cleanup-readme
Clean up the README file
2020-08-04 11:44:02 +01:00
Brandon bf56b10ff4 Merge branch 'master' into all-contributors/add-Atul9 2020-08-04 11:29:57 +01:00
Brandon 719c38bd32 Update README.md 2020-08-04 11:29:05 +01:00
Atul Bhosale a08fe2456d Rename Community section heading to Contributing [ci skip] 2020-08-04 08:09:49 +05:30
Atul Bhosale db1831c4b8 Replace Homebrew in Readme table with Docker [ci skip] 2020-08-04 08:09:49 +05:30
Atul Bhosale 74e2ff026a Move table of contents higher up [ci skip] 2020-08-04 08:09:49 +05:30
Atul Bhosale 897c1c4091 Move important links under features [ci skip] 2020-08-04 08:09:49 +05:30
Brandon a9340bb622 Merge pull request #108 from RustScan/bee-fix-mac-os-ulimit
Bee fix mac os ulimit
2020-08-03 23:48:00 +01:00
Brandon 9caed66265 accidentally included Vim keybindings lol 2020-08-03 23:09:24 +01:00
Brandon eae6342255 adjusted test names 2020-08-03 22:56:30 +01:00
Brandon 328156c613 changed mac osx tests to fail 2020-08-03 21:36:27 +01:00
Brandon f53f6123bf Merge branch 'bee-fix-mac-os-ulimit' of github.com:brandonskerritt/RustScan into bee-fix-mac-os-ulimit 2020-08-03 21:35:40 +01:00
Brandon 7044174933 fixed code review issues 2020-08-03 21:33:18 +01:00
Brandon 1ede04d539 Merge branch 'master' into bee-fix-mac-os-ulimit 2020-08-03 20:10:19 +01:00
Brandon e56456e779 rustfmt 2020-08-03 20:09:11 +01:00
Brandon 484cf023d7 Merge pull request #113 from RustScan/all-contributors/add-royharoush
docs: add royharoush as a contributor
2020-08-03 20:08:27 +01:00
Brandon 98763d43e0 added more tests to reach 90% code cov 2020-08-03 20:05:59 +01:00
allcontributors[bot] a81c409ed4 docs: update .all-contributorsrc [skip ci] 2020-08-03 17:56:06 +00:00
allcontributors[bot] c0f63e0534 docs: update README.md [skip ci] 2020-08-03 17:56:05 +00:00
allcontributors[bot] 137f8669fe docs: update .all-contributorsrc [skip ci] 2020-08-03 17:55:15 +00:00
allcontributors[bot] c658b0ea70 docs: update README.md [skip ci] 2020-08-03 17:55:14 +00:00
Brandon 1d68c842d9 removed cargo upload 2020-08-03 12:44:07 +01:00
Brandon 6568203f46 Merge pull request #109 from RustScan/bee-auto-deployment
added crates.io publishing
2020-08-03 12:29:43 +01:00
Brandon 0cfe82eb5d remvoed codecov 2020-08-03 12:18:56 +01:00
Brandon 53512039d1 Merge branch 'bee-auto-deployment' of github.com:brandonskerritt/RustScan into bee-auto-deployment 2020-08-03 11:30:51 +01:00
Brandon 7b392f0d6d added codecoverage 2020-08-03 11:30:29 +01:00
Brandon bf67019079 Merge branch 'master' into bee-auto-deployment 2020-08-03 11:26:02 +01:00
Brandon da27b17485 only deploy on master branch 2020-08-03 01:36:36 +01:00
Brandon a528d41ac6 Update .travis.yml 2020-08-03 01:19:05 +01:00
Brandon 7686c25d0d osx now no longer fails ci 2020-08-03 01:18:29 +01:00
Brandon 9cf4177faa mac os doesnt fail ci now 2020-08-03 01:17:45 +01:00
Brandon 647b97b52c added crates.io publishing 2020-08-03 01:14:48 +01:00
Brandon 1b8b0b4478 Cannot fix until opts can be made without arguments 2020-08-03 01:10:03 +01:00
Brandon c6dedc317a maybe ci will show this working? 2020-08-03 00:45:36 +01:00
Brandon 654488cbbc Added ulimit warning, info log, and test 2020-08-03 00:33:49 +01:00
Brandon 81701d4243 automatic ulimit halving 2020-08-03 00:29:42 +01:00
Brandon 97eac2aa33 Merge pull request #106 from bernardoamc/ba-tackle-config
Move config path disclaimer to opening function
2020-08-03 00:19:11 +01:00
Bernardo de Araujo 76ee4666b8 Move config path disclaimer to opening function
This will always be displayed unless the `quiet` flag is specified and
has the added benefit of allowing us to enforce the IP address.
2020-08-02 18:41:08 -04:00
Brandon 7e48f125dc why wont you work :( 2020-08-02 23:00:23 +01:00
Brandon 56482fd8ff increased timeout 2020-08-02 22:53:21 +01:00
Brandon 5e41472814 reducing batch sizes 2020-08-02 22:47:54 +01:00
Brandon d99c811e93 amending for mac os 2020-08-02 22:39:26 +01:00
Brandon ec003e4557 amending for mac os 2020-08-02 22:33:26 +01:00
Brandon 50ca069f20 added many more tests 2020-08-02 22:25:48 +01:00
Brandon 9d2318ab9c trying cmnatic test server 2020-08-02 22:10:08 +01:00
Brandon 9c7916f92a Merge pull request #104 from SanjoAndPanjo/master
Added gh releases, windows support, added up docker service, re-enabled discord webhooks
2020-08-02 21:42:06 +01:00
Brandon 6d053ad199 Update .travis.yml 2020-08-02 21:33:35 +01:00
Brandon 7dedfb5fed fixed travis to not include windows 2020-08-02 21:08:29 +01:00
Sanjo and Panjo 748ad43db0 fixed spacing... damn it 2020-08-02 18:26:26 +02:00
Sanjo and Panjo 75523d03cb added github releases, re-enabled messages to discord on successfull deployment 2020-08-02 18:18:14 +02:00
Brandon 328226838e Merge pull request #103 from RustScan/bee-add-travis-ci
Bee add travis ci
2020-08-02 16:11:10 +01:00
Brandon f78b114486 Merge branch 'master' into bee-add-travis-ci 2020-08-02 16:00:56 +01:00
Brandon 7bb1f7860b dont post to discord on ok build 2020-08-02 15:43:40 +01:00
Brandon 2fd63fa1f3 changing batch size to 100 for testing 2020-08-02 15:13:02 +01:00
Brandon 89047f4b26 added discord webhook 2020-08-02 15:04:25 +01:00
Brandon f659b8dd3d fixing MacOS builds 2020-08-02 15:01:41 +01:00
Brandon 6ab1c526cc added matrix 2020-08-02 14:51:10 +01:00
Brandon b2eac63130 added rustfmt 2020-08-02 14:45:46 +01:00
Brandon cdb55261b2 added cargo test to travisci 2020-08-02 14:31:34 +01:00
Brandon fb666f46bb changed language to rust 2020-08-02 13:53:10 +01:00
Brandon 96659dcd89 added travisci file 2020-08-02 13:52:41 +01:00
Brandon b4f9d9d228 added travisci file 2020-08-02 13:51:05 +01:00
Brandon 30ab9523a2 Merge pull request #97 from RustScan/bee-update-cargo
updated cargo.toml file
2020-08-02 02:20:32 +01:00
Brandon ff2eea2015 Merge branch 'master' into bee-update-cargo 2020-08-02 01:26:10 +01:00
Brandon aef842c2e3 Merge pull request #93 from RustScan/bee-add-app-dirs
Added AppDirs
2020-08-02 01:24:51 +01:00
Brandon 2f9a54e2ba fixed discord link 2020-08-02 01:21:46 +01:00
Brandon dfb451aacc fixed path bug. .config/config.toml -> .config/rustscan/config.toml 2020-08-02 00:16:13 +01:00
Brandon 0cd37b4ffe updated cargo.toml file 2020-08-01 23:12:47 +01:00
Brandon 0c01dc0f17 fixing merge 2020-08-01 22:55:50 +01:00
Brandon b52a990ad0 Merge pull request #95 from RustScan/bee-scheduled-markdown-action
Scheduled markdown action 404 links
2020-08-01 22:47:37 +01:00
Brandon 1c88f98132 fixing rust fmt 2020-08-01 22:45:52 +01:00
Brandon c8404781dc Merge branch 'master' into bee-scheduled-markdown-action 2020-08-01 22:45:29 +01:00
Brandon 6617b2178b added very important emoji to readme 2020-08-01 22:44:06 +01:00
Brandon e2395f8ddc Added distributions to readme, fixed required ip address 2020-08-01 22:43:17 +01:00
Brandon 6ab43bf213 Merge pull request #96 from bernardoamc/ba-reduce-unsig-int
Refactor ulimit and batch_size logic consider the OS architecture
2020-08-01 21:15:39 +01:00
Brandon da3629cc7b Merge branch 'master' into bee-scheduled-markdown-action 2020-08-01 21:08:11 +01:00
Bernardo de Araujo af344becbc Refactor ulimit and batch_size logic consider the OS architecture
RustScan should be able to run on systems with either 32 or 64 bits. In
order to achieve that we should rely on the `rlimit` library to get the
proper unsigned int type from the system.
2020-08-01 15:45:31 -04:00
Brandon 85b7f9fe7a Merge pull request #94 from RustScan/bee-readme-community-additions
Updated readme
2020-08-01 19:34:00 +01:00
Brandon 9d1d064e71 fixed typo 2020-08-01 19:30:33 +01:00
Brandon 343563818f checking to see if CI works 2020-08-01 17:40:59 +01:00
Brandon bc77814d59 checking to see if CI works 2020-08-01 17:37:49 +01:00
Brandon 42b72ea114 added daily 404 link checking 2020-08-01 17:31:46 +01:00
Brandon d73c66482e Updated readme 2020-08-01 17:07:50 +01:00
Brandon b850868265 added appdirs 2020-08-01 13:54:58 +01:00
Brandon c77e45d478 added new github action to check readme for 404s 2020-08-01 13:23:43 +01:00
Brandon 82e3128641 Update README.md 2020-08-01 13:21:53 +01:00
Brandon 679d1a787d Merge pull request #92 from RustScan/dependabot/cargo/colored-2.0.0
Bump colored from 1.9.3 to 2.0.0
2020-08-01 11:42:04 +01:00
dependabot-preview[bot] 813b6753c8 Bump colored from 1.9.3 to 2.0.0
Bumps [colored](https://github.com/mackwic/colored) from 1.9.3 to 2.0.0.
- [Release notes](https://github.com/mackwic/colored/releases)
- [Changelog](https://github.com/mackwic/colored/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mackwic/colored/compare/v1.9.3...v2.0.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-08-01 10:35:53 +00:00
Brandon 51df49836b Merge pull request #91 from bernardoamc/ba-refactor-ip-parsing
Fail early when the specified IP format is not valid
2020-08-01 11:18:53 +01:00
Bernardo de Araujo 2df98016c9 Fail early when the specified IP format is not valid
We can let structopt parse the supplied IP for us and fail early when
that IP address is invalid. We can also let IpAddr let us know when an
IP is an ipv4 or ipv6 without relying on the user to supply this
information to us.
2020-08-01 00:15:19 -04:00
Brandon deb8bb3216 rust fmt 2020-07-31 16:23:28 +01:00
Brandon 6ce8fe1afd trying to fix docs.rs 2020-07-31 14:23:38 +01:00
Brandon 8aa9a44949 updating lock file 2020-07-31 13:34:33 +01:00
Brandon 416602dd02 added ipv6 to readme 2020-07-31 13:34:04 +01:00
Brandon a2e7125e03 updated cargo.toml 2020-07-31 13:33:24 +01:00
Brandon 10acad243c Merge pull request #87 from RustScan/ipv6-support
Ipv6 support
2020-07-31 13:02:56 +01:00
Brandon 5d69339cc7 cargo fmt 2020-07-31 11:33:08 +01:00
Brandon d8fd12694c fixed tests 2020-07-31 11:32:02 +01:00
Brandon 7d4084d06c added ipv6 support to nmap command 2020-07-31 11:21:58 +01:00
Brandon 365be75689 Merge branch 'ipv6-support' of github.com:brandonskerritt/RustScan into ipv6-support 2020-07-31 02:11:28 +01:00
Brandon 5ea316c5db ipv6 is now implemented. Just need to do a final cleanup 2020-07-31 02:11:09 +01:00
Brandon b363529045 ipv6 is now implemented. Just need to do a final cleanup 2020-07-31 01:30:35 +01:00
Brandon ed378f7fc8 Either this doesnt work or my internet is broken 2020-07-31 01:17:38 +01:00
Brandon aa3c591016 added logging module 2020-07-30 23:44:48 +01:00
Brandon ef893fdcb8 Update README.md 2020-07-30 12:49:22 +01:00
Brandon b78a8ad0af edited contributing.md 2020-07-30 12:39:54 +01:00
Brandon 7ad7e34abc Updated comments -> issues bot 2020-07-30 12:24:36 +01:00
Brandon e41393b4ad Update Dockerfile 2020-07-30 11:22:45 +01:00
Brandon 6d72037974 Code finally compiles 2020-07-30 02:17:17 +01:00
Brandon 66486b2467 scanner.rs now works 2020-07-30 01:46:38 +01:00
Brandon 4b085d97f2 added ipv6 testing 2020-07-29 18:11:57 +01:00
Brandon 4785b75f9f 1.3 release 2020-07-29 12:02:01 +01:00
Brandon 3951c25dff end of dya 2020-07-29 01:50:36 +01:00
Brandon 071c437206 sending to smackhack 2020-07-29 00:45:47 +01:00
Brandon 7d351f2025 socketaddr is now ipv4 and ipv6 2020-07-28 23:12:08 +01:00
Brandon 8ce14c5690 Added arguments in structopts for ipv6 2020-07-28 02:23:07 +01:00
Brandon 6cf71a1529 switching branches real quick 2020-07-28 01:07:57 +01:00
Brandon 50c74d63cf Merge pull request #78 from jsegaran/jsegaran/remove_quote_quiet
Remove quote on quiet
2020-07-27 10:26:32 +01:00
Joshua Segaran c1f9be150f Remove quote on quiet 2020-07-26 19:10:52 -07:00
Brandon 0a13100185 Merge pull request #77 from RustScan/adding_testing
Adding testing
2020-07-26 19:44:14 +01:00
Brandon b67aa40eae clippy has an error 2020-07-26 19:43:22 +01:00
Brandon fb3c7c4ce2 added rustfmt to github actions 2020-07-26 19:35:48 +01:00
Brandon 4d4ef5ac51 added testing to CI 2020-07-26 19:33:19 +01:00
Brandon 022cc8725a Merge pull request #75 from bernardoamc/refactor-into-structopts
Refactor code in order to use structopt
2020-07-26 19:14:28 +01:00
Brandon e12a12fd04 merging structopts 2020-07-26 19:14:15 +01:00
Brandon 999634cf9b Merge pull request #76 from Atul9/cargo-fmt
Format code using 'cargo fmt'
2020-07-26 19:10:27 +01:00
Atul Bhosale c45f4d1b86 Format code using 'cargo fmt' 2020-07-26 23:05:59 +05:30
Bernardo de Araujo 3f4c0c32cc Refactor code in order to use structopt
This allows us to not worry about argument parsing anymore since Rust
can automatically infer the parsing logic from the type of our
arguments.
2020-07-26 11:09:16 -04:00
Brandon a3a4cf9587 Merge pull request #73 from bernardoamc/parse-user-args-with-quotes
Use shellwords to parse nmap arguments from user
2020-07-26 15:54:23 +01:00
Brandon e17ec84867 completing merge to master 2020-07-26 15:52:39 +01:00
Brandon 0fbdda51d2 added details to readme and help menu 2020-07-26 15:49:52 +01:00
Brandon 4de017250d Merge pull request #74 from RustScan/remove-advertising-and-readme
Remove advertising and readme updates
2020-07-26 11:49:18 +01:00
Brandon 08cbf08beb adding spacing in deb install section 2020-07-26 11:47:50 +01:00
Brandon e5c51c3980 README updates 2020-07-26 11:43:28 +01:00
Brandon 757653a30b removed advertising from rustscan logo 2020-07-26 11:30:02 +01:00
Bernardo de Araujo c5d02c31f1 Use shellwords to parse nmap arguments from user
We were not considering user arguments with quotes or other special
characters.
2020-07-25 20:56:11 -04:00
Brandon 6906177ec2 Merge pull request #68 from brandonskerritt/all-contributors/add-imlonghao
docs: add imlonghao as a contributor
2020-07-25 16:06:01 +01:00
allcontributors[bot] 276e0d193c docs: update .all-contributorsrc [skip ci] 2020-07-25 15:01:55 +00:00
allcontributors[bot] 965d3d780c docs: update README.md [skip ci] 2020-07-25 15:01:54 +00:00
Brandon 67d34b5036 Updated to include correct AUR link 2020-07-25 15:57:29 +01:00
61 changed files with 7131 additions and 871 deletions

No files matched your search

+1 -1
View File
@@ -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
+204 -1
View File
@@ -56,11 +56,214 @@
"contributions": [
"bug"
]
},
{
"login": "imlonghao",
"name": "imlonghao",
"avatar_url": "https://avatars1.githubusercontent.com/u/4951333?v=4",
"profile": "https://imlonghao.com",
"contributions": [
"bug",
"maintenance"
]
},
{
"login": "royharoush",
"name": "royharoush",
"avatar_url": "https://avatars3.githubusercontent.com/u/8113056?v=4",
"profile": "https://github.com/royharoush",
"contributions": [
"ideas",
"design"
]
},
{
"login": "Atul9",
"name": "Atul Bhosale",
"avatar_url": "https://avatars1.githubusercontent.com/u/3390330?v=4",
"profile": "https://github.com/Atul9",
"contributions": [
"code"
]
},
{
"login": "TGotwig",
"name": "Thomas Gotwig",
"avatar_url": "https://avatars0.githubusercontent.com/u/30773779?v=4",
"profile": "https://tgotwig.me",
"contributions": [
"platform"
]
},
{
"login": "remigourdon",
"name": "Rémi Gourdon",
"avatar_url": "https://avatars3.githubusercontent.com/u/2874133?v=4",
"profile": "https://github.com/remigourdon",
"contributions": [
"doc",
"code"
]
},
{
"login": "cmnatic",
"name": "Ben (CMNatic)",
"avatar_url": "https://avatars3.githubusercontent.com/u/4163116?v=4",
"profile": "https://cmnatic.co.uk",
"contributions": [
"code",
"doc",
"design"
]
},
{
"login": "Ferryistaken",
"name": "Alessandro Ferrari",
"avatar_url": "https://avatars3.githubusercontent.com/u/47927670?v=4",
"profile": "https://github.com/Ferryistaken",
"contributions": [
"content"
]
},
{
"login": "Phenomite",
"name": "Phenomite",
"avatar_url": "https://avatars2.githubusercontent.com/u/8285537?v=4",
"profile": "https://github.com/Phenomite",
"contributions": [
"content"
]
},
{
"login": "SuperSandro2000",
"name": "Sandro",
"avatar_url": "https://avatars2.githubusercontent.com/u/7258858?v=4",
"profile": "https://supersandro.de/",
"contributions": [
"content",
"bug",
"code"
]
},
{
"login": "caass",
"name": "Cass",
"avatar_url": "https://avatars2.githubusercontent.com/u/25358963?v=4",
"profile": "https://swag.lgbt",
"contributions": [
"platform",
"code",
"bug"
]
},
{
"login": "niklasmohrin",
"name": "Niklas Mohrin",
"avatar_url": "https://avatars0.githubusercontent.com/u/47574893?v=4",
"profile": "https://github.com/niklasmohrin",
"contributions": [
"doc",
"code",
"bug"
]
},
{
"login": "tim77",
"name": "Artem Polishchuk",
"avatar_url": "https://avatars0.githubusercontent.com/u/5614476?v=4",
"profile": "https://liberapay.com/Artem4/",
"contributions": [
"platform"
]
},
{
"login": "buermarc",
"name": "buermarc",
"avatar_url": "https://avatars2.githubusercontent.com/u/44375277?v=4",
"profile": "https://github.com/buermarc",
"contributions": [
"code"
]
},
{
"login": "bergabman",
"name": "bergabman",
"avatar_url": "https://avatars1.githubusercontent.com/u/44554109?v=4",
"profile": "https://github.com/bergabman",
"contributions": [
"code",
"bug",
"design"
]
},
{
"login": "dmitris",
"name": "Dmitry Savintsev",
"avatar_url": "https://avatars0.githubusercontent.com/u/31205?v=4",
"profile": "https://github.com/dmitris",
"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"
]
},
{
"login": "u5surf",
"name": "Y.Horie",
"avatar_url": "https://avatars1.githubusercontent.com/u/14180225?v=4",
"profile": "https://github.com/u5surf",
"contributions": [
"code"
]
},
{
"login": "okrplay",
"name": "Oskar",
"avatar_url": "https://avatars3.githubusercontent.com/u/32576280?v=4",
"profile": "https://github.com/okrplay",
"contributions": [
"code",
"test"
]
}
],
"contributorsPerLine": 7,
"projectName": "RustScan",
"projectOwner": "brandonskerritt",
"projectOwner": "RustScan",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
+2
View File
@@ -0,0 +1,2 @@
.git
Dockerfile
+1 -4
View File
@@ -1,4 +1 @@
github: brandonskerritt
patreon: brandonskerritt
ko_fi: hacker
custom: ["https://monzo.me/bee", "https://paypal.me/brandonskerritt"]
github: bee-san
+1 -1
View File
@@ -1,2 +1,2 @@
todo:
keyword: "TODO"
keyword: "// TODO"
+29
View File
@@ -0,0 +1,29 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: anyhow
versions:
- 1.0.38
- 1.0.39
- dependency-name: serde
versions:
- 1.0.123
- dependency-name: futures
versions:
- 0.3.12
- dependency-name: rlimit
versions:
- 0.5.3
+4
View File
@@ -0,0 +1,4 @@
template: |
## What’s Changed
$CHANGES
-32
View File
@@ -1,32 +0,0 @@
on: [push, pull_request]
name: Continuous integration
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
+96
View File
@@ -0,0 +1,96 @@
name: Build
on:
pull_request:
paths-ignore:
- '.github/**'
push:
branches:
- master
paths-ignore:
- '.github/**'
schedule:
- cron: '00 01 * * *'
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test Suite
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: Swatinem/rust-cache@v2
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Run rustdoc lints
uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace --all-features --no-deps --document-private-items
+38
View File
@@ -0,0 +1,38 @@
name: Release - Distribute Docker image
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
# release:
# types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
password: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: rustscan/rustscan
flavor: latest=true
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ contains(fromJson('["push", "release"]'), github.event_name) }} # Publish to docker registry only on push event or new release.
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+21
View File
@@ -0,0 +1,21 @@
name: Check Markdown links
on:
push:
branches:
- master
paths-ignore:
- '.github/**'
schedule:
# Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
- cron: "0 9 * * *"
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
config-file: './.github/workflows/mlc_config.json'
+14
View File
@@ -0,0 +1,14 @@
{
"_comment": "Config for markdown-link-check. Resolves issue #540.",
"ignorePatterns": [
{
"pattern": "^https://github.com/RustScan/RustScan/workflows/Continuous%20integration/badge.svg"
},
{
"pattern": "^https://crates.io/crates/rustscan/"
},
{
"pattern": "^https://bees.substack.com/p/making-hacking-accessible"
}
]
}
+216
View File
@@ -0,0 +1,216 @@
name: Release - Distribute binaries
on:
# If we want to make release using github interface.
# release:
# types: [published]
# If we want to make release by pushing new tag.
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- master
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/release.yml'
env:
BIN_NAME: rustscan
PROJECT_NAME: rustscan
REPO_NAME: RustScan/RustScan
BREW_TAP: RustScan/homebrew-tap
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't fail other jobs if one fails
matrix:
# aarch64-linux is failing due to python3 missing issues during tests. I'm removing it for now.
# build: [x86_64-linux, aarch64-linux, x86_64-macos, aarch64-macos, x86_64-windows, x86_64-win-gnu]
build: [x86_64-linux, x86_64-macos, aarch64-macos, x86_64-windows, x86_64-win-gnu]
include:
- build: aarch64-macos
os: macos-latest
rust: stable
target: aarch64-apple-darwin
cross: true
# - build: aarch64-linux
# os: ubuntu-20.04
# rust: stable
# target: aarch64-unknown-linux-gnu
# cross: true
- build: x86_64-linux
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-gnu
cross: false
- build: x86_64-macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
cross: false
- build: x86_64-windows
os: windows-2019
rust: stable
target: x86_64-pc-windows-msvc
cross: false
- build: x86_64-win-gnu
os: windows-2019
rust: stable-x86_64-gnu
target: x86_64-pc-windows-gnu
cross: false
steps:
- name: Set Git config (windows only)
if: contains(matrix.os, 'windows') # Windows is missing some dependencies
run: |
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1"
git config --global pack.deltaCacheSize "512m"
- name: Install dependencies
if: contains(matrix.build, 'aarch64-linux') # Windows is missing some dependencies
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu python3
- name: Install python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.rust }} toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: test
args: --release --locked --target ${{ matrix.target }}
- name: Build release binary
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --locked --target ${{ matrix.target }}
- name: Calculate tag name
# if: contains(matrix.build, 'linux')
shell: bash
run: |
name=dev
if [[ ${GITHUB_REF} =~ refs/tags/[0-9]+.[0-9]+.[0-9]+ ]]; then
name=${GITHUB_REF#refs/tags/}
fi
echo "TAG=$name" >> $GITHUB_ENV
id: tagname
- name: Build and package artifacts
shell: bash
run: |
mkdir dist
if [[ "${{ matrix.build }}" =~ "windows" ]]; then
cp "target/${{ matrix.target }}/release/$BIN_NAME.exe" "dist/"
else
cp "target/${{ matrix.target }}/release/$BIN_NAME" "dist/"
fi
if [[ "${{ matrix.build }}" =~ "linux" ]]; then
cargo install cargo-deb
cargo deb --target ${{ matrix.target }} --deb-version ${TAG}
cp "target/${{ matrix.target }}/debian/rustscan_${TAG}_amd64.deb" "dist/" || true
fi
- uses: actions/[email protected]
with:
name: bins-${{ matrix.build }}
path: dist
package:
name: Package
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: false
- uses: actions/download-artifact@v4
with:
path: dist
- name: Calculate tag name
# if: contains(matrix.build, 'linux')
shell: bash
run: |
name=dev
if [[ ${GITHUB_REF} =~ refs/tags/[0-9]+.[0-9]+.[0-9]+ ]]; then
name=${GITHUB_REF#refs/tags/}
fi
echo "TAG=$name" >> $GITHUB_ENV
id: tagname
- name: Build archive
shell: bash
run: |
set -ex
rm -rf tmp
mkdir tmp
for dir in dist/bins-* ; do
platform=${dir#"dist/bins-"}
unset exe
if [[ $platform =~ "win" ]]; then
exe=".exe"
fi
pkgname=$PROJECT_NAME-$TAG-$platform
mkdir tmp/$pkgname
cp $dir/$BIN_NAME$exe dist/ || true
mv $dir/$BIN_NAME$exe tmp/$pkgname
chmod +x tmp/$pkgname/$BIN_NAME$exe
if [[ $platform =~ "linux" ]]; then
mv "$dir/rustscan_${TAG}_amd64.deb" dist/ || true
fi
tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
7z a dist/$pkgname.zip tmp/$pkgname
done
- name: Upload binaries to release
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
# - uses: mislav/bump-homebrew-formula-action@v3
# with:
# formula-path: ${{env.PROJECT_NAME}}.rb
# homebrew-tap: ${{ env.BREW_TAP }}
# download-url: 'https://github.com/${{ env.REPO_NAME }}/releases/download/${{ github.ref }}/${{env.PROJECT_NAME}}-${{ github.ref }}-x86_64-macos.tar.xz'
# commit-message: updating formula for ${{ env.PROJECT_NAME }}
# env:
# COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
- run: cargo publish --token ${CRATES_TOKEN}
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'release'
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
+79
View File
@@ -43,3 +43,82 @@ pkg/
# End of https://www.toptal.com/developers/gitignore/api/rust,archlinuxpackages
*.deb
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
.idea/*
.idea
.idea*
settings.json
+3
View File
@@ -0,0 +1,3 @@
[submodule "src/rustscan_scripting_engine"]
path = src/rustscan_scripting_engine
url = https://github.com/RustScan/rustscan_scripting_engine
+38
View File
@@ -0,0 +1,38 @@
language: rust
os:
- linux
- osx
arch:
- amd64
- arm64
services:
- docker
before_install:
- rustup component add rustfmt
rust:
- stable
- beta
jobs:
fast_finish: true
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
- chmod +x send.sh
- "./send.sh failure $WEBHOOK_URL"
after_success: |
if [ -n "${GITHUB_TOKEN}" ]; then
[ "${TRAVIS_BRANCH} " = master ] &&
[ "${TRAVIS_PULL_REQUEST}" = false ] &&
cargo doc &&
echo "<meta http-equiv=refresh content=0;url=rustscan/index.html>" > target/doc/index.html &&
sudo pip install ghp-import &&
ghp-import -n target/doc &&
git push -fq https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
fi
env:
global:
secure: Gf24LG7Hr3Q0drWyPrvISTL35Z57DxdS/wIOo7v+ZdauzY3Qjvv3Lh4TY//C4sdN0g1CLj4yjg7LQOqF4XRdh2Qah7JZPv/i2B5uz9nwjTsoRzmmMWML9VtfT1u53nSFqsNeXbvpmoNG9rfMXcoiyd+Lv+EgniHphDEBlXvS9n9KMcpOi1F2x7bsH0EK37wQYKMTpCCd5TPUPdZou7BJNiZS3ikRLpTRFF7uIN4gYtRH9kU5uBSphWgnJ6eBm2ItzZcUPOgrjAoF4RkmZAzGG4idDh1Qkf3No3nZwT3U5NSk8h7owtJ4oADlRgYqYKCB4YcC9cAKCJgDsyMlKKMkEyagvw1seFnBLCY3ljsW4EklpVEZ0rVqZOx4pTkIaxIxytLTC9pHmdDSnhdhFknOcVAQQWjg+nAZfD07QUeAqUdr0i/vxQoZitvbNY0znzEarycE1waKvwlkiB4gt385U1CBfYldydnOnRKkdtLNrCLClu13HU0djmSXMhojQJhTuNxTHtZAf5fKcWIWwkVbNZ5MNKYjQh4rKufqW3o1iHphB8dfAGsDEPv0RQMtVbu6H4+clCouLkFlxHOIrrOJ5SXQ8cIATPhnJR7y4cSDdRaN0DRLRjeLAIKlbOGBtNuFC+BftocaTY5qN42aKAMqQcT30ycfiLuRVJNiQJ5pkto=
+16 -16
View File
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at brandon@skerritt.blog. All
reported by contacting the project team at our discord via a private message to any of the owners. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
@@ -67,10 +67,10 @@ members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
This Code of Conduct is adapted from the Contributor Covenant homepage, version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
homepage: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
Generated
+1679 -240
View File
File diff suppressed because it is too large. Load diff
+46 -12
View File
@@ -1,25 +1,59 @@
[package]
name = "rustscan"
version = "1.2.0"
authors = ["Bee <brando[email protected]>"]
version = "2.3.0"
authors = ["Autumn <autum[email protected]>"]
edition = "2018"
description = "Faster Nmap Scanning with Rust"
homepage = "https://github.com/brandonskerritt/rustscan"
repository = "https://github.com/brandonskerritt/rustscan"
homepage = "https://github.com/rustscan/rustscan"
repository = "https://github.com/rustscan/rustscan"
license = "MIT"
keywords = ["port", "scanning", "nmap"]
categories = ["command-line-utilities"]
readme="README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
readme = "README.md"
exclude = [
".github/*",
"pictures/*",
"rustscan-debbuilder/*",
]
[dependencies]
colored = "1.9.3"
clap = "2.33.0"
async-std = "1.6.2"
clap = { version = "4.5.8", features = ["derive", "wrap_help"] }
colored = "2.1.0"
async-std = "1.7.0"
futures = "0.3"
rlimit = "0.3.0"
rlimit = "0.10.1"
log = "0.4.22"
env_logger = "0.11.3"
anstream = "=0.6.14"
dirs = "5.0.1"
gcd = "2.0.1"
rand = "0.8.5"
colorful = "0.2.1"
ansi_term = "0.12.1"
toml = "0.8.14"
serde = "1.0.124"
serde_derive = "1.0.116"
cidr-utils = "0.6.1"
itertools = "0.13.0"
hickory-resolver = { version = "0.24.0", features = ["dns-over-rustls"] }
anyhow = "1.0.40"
subprocess = "0.2.6"
text_placeholder = { version = "0.5", features = ["struct_context"] }
[dev-dependencies]
parameterized = "2.0.0"
wait-timeout = "0.2"
[package.metadata.deb]
depends = "$auto, nmap"
section = "rust"
[profile.release]
lto = true
panic = 'abort'
strip = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "rustscan"
path = "src/main.rs"
+25
View File
@@ -0,0 +1,25 @@
# Build Stage
FROM rust:alpine as builder
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 /app/rustscan
COPY Cargo.toml Cargo.lock ./
COPY src/ src/
RUN cargo build --release
# Release Stage
FROM alpine:3.20.1 as release
LABEL author="Hydragyrum <https://github.com/Hydragyrum>"
LABEL author="LeoFVO <https://github.com/LeoFVO>"
RUN addgroup -S rustscan && \
adduser -S -G rustscan rustscan && \
ulimit -n 100000 && \
apk add --no-cache nmap nmap-scripts wget ca-certificates bind-tools
USER rustscan
COPY --from=builder /app/rustscan/target/release/rustscan /usr/local/bin/rustscan
ENTRYPOINT [ "/usr/local/bin/rustscan" ]
+21
View File
@@ -0,0 +1,21 @@
install:
cargo install cross
build:
make build-linux
make build-mac
make shasum
build-linux:
@echo 'Building for Linux... 🐧'
cross build --release --target=x86_64-unknown-linux-musl
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 -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
+178 -238
View File
@@ -1,276 +1,141 @@
<p align="center">
<img src="pictures/rustscan.png"><br>
<u><b> Turns a 17 minutes Nmap scan into 19 seconds. </b></u><br> Find all open ports <b>fast</b> with Rustscan, automatically pipe them into Nmap.
</p>
<p align="center">
<img alt="AUR version" src="https://img.shields.io/aur/version/rustscan-bin">
<img src="https://img.shields.io/badge/Built%20with-Rust-Purple">
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/w/brandonskerritt/rustscan">
</p>
<hr>
<div align="center" markdown="1">
➡️ [Discord][discord] | [Installation Guide][toc-install] | [Usage Guide][usage-guide] ⬅️
<img src="pictures/rustscan.png" height=400px width=400px>
<!--<u>**The Modern Port Scanner.**</u>-->
**Fast, smart, effective.**
![Arch Linux package][badge-1] ![Built with Rust][badge-2] ![GitHub All Releases][badge-3] ![Crates.io][badge-4] ![Discord][badge-5] ![Actions][badge-6]
| <p align="center"><a href="https://crates.io/crates/rustscan">🔧 Cargo (Universal) </a></p> | <p align="center"><a href="https://crates.io/crates/rust_scan"> Arch </a></p> | <p align="center"><a href="https://crates.io/crates/rust_scan"> HomeBrew </a></p> | <p align="center"><a href="https://crates.io/crates/rust_scan"> Kali / Debian </p> |
| ---- | ---- | ---- | --- |
| <p align="center"><img src="pictures/rust.png" /></p> | <p align="center"><img src="pictures/arch.png" /></p> | <p align="center"><img src="pictures/apple.png" /></p> | <p align="center"><img src="pictures/kali.png" /></p> |
| `cargo install rustscan` | `yay -S rustscan-bin` | `brew tap brandonskerritt/rustscan && brew install rustscan` | [Read the install guide](https://github.com/brandonskerritt/RustScan/blob/master/README.md#%EF%B8%8F-debian--kali) |
---
<hr>
| 🐋 `(Recommended)` | 👩‍💻 | 🏗️ | 🔧 |
| :---------------------------------------------------------: | :---------------------------: | :-------------------------: | :-------------------------: |
| [![Docker][DockerPic]][Docker] | [![Kali][Kali1]][Kali/Debian] | [![Arch][Arch]][Arch-Linux] | [![apple][apple]][Homebrew] |
| `docker pull rustscan/rustscan:latest`</br>[Docker][usage-0] | [Link to Documentation][kali] | `yay -S rustscan` | `brew install rustscan` |
---
</div>
# 🤔 What is this?
1. Find ports quickly using Rustscan (**8 seconds at its fastest**).
2. Automatically runs `nmap` on those ports.
3. ???
4. Profit!
<table>
<tr>
<th>Name</th>
<th>⚡ Nmap <b>with RustScan</b> ⚡ </th>
<th>🐢 Nmap 🐢</th>
</tr>
<tr>
<th>Gif</th>
<td><img src="pictures/with_rustscan.gif" alt="The guy she tells you not to worry about"></td>
<td><img src="pictures/without_rustscan.gif" alt="You"></td>
</tr>
<tr>
<th>Time</th>
<td><b>39 seconds</b></td>
<td><b>17 minutes and 41 seconds</b></td>
</tr>
</table>
![fast][speed-1]
<sub><b>Note</b> This is an older gif. RustScan's current top speed is 8 seconds for all 65k ports. This gif is 26 seconds.</sub><br>
RustScans **only** job is to reduce the friction between finding open ports and inputting them into nmap.
The Modern Port Scanner. **Find ports quickly (3 seconds at its fastest)**. Run scripts through our scripting engine (Python, Lua, Shell supported).
# ✨ Features
* Scans all 65k ports in **8 seconds** (on 10k batch size).
* Saves you time by automatically piping it into Nmap. No more manual copying and pasting!
* Does one thing and does it well. **Only** purpose is to improve Nmap, not replace it!
* Let's you choose what Nmap commands to run, or uses the default.
- Scans all 65k ports in **3 seconds**.
- Full scripting engine support. Automatically pipe results into Nmap, or use our scripts (or write your own) to do whatever you want.
- Adaptive learning. RustScan improves the more you use it. No bloated machine learning here, just basic maths.
- The usuals you would expect. IPv6, CIDR, file input and more.
- Automatically pipes ports into Nmap.
## ‼️ Important Links
| <!--Installation Guide--> | <!--Documentation--> | <!--Discord--> |
| :----------------------------------------: | :------------------------------------: | :-------------------------: |
| :book: [Installation Guide][links-table-1] | :books: [Documentation][links-table-2] | :parrot: [Discord][discord] |
## 🙋 Table of Contents
- 📖 [Installation Guide][toc-install]
- 🐋 [Docker Usage][toc-docker-usage]
- 🦜 [Discord][discord]
- 🤸 [Usage][usage-1]
- 🎪 [Community][toc-community]
# 🔭 Why RustScan?
Why spend time running fast scans and manually copying the ports, or waiting for a 20 minute scan to finish when you can just do all 65k ports in less than a minute?
![gif](pictures/8seconds.gif)
RustScan is a modern take on the port scanner. Sleek & fast. All while providing extensive extendability to you.
**RustScan running in 8 seconds and finding all open ports out of 65k.**
Not to mention RustScan uses Adaptive Learning to improve itself over time, making it the best port scanner for **you**.
## 📊 RustScan vs Nmap vs MassScan
## 🧋 Speed
| **Name** | RustScan | Nmap | Masscan |
| ------------------------------------------------------------------------------------------ | -------- | ---- | ------- |
| Fast | ✅ | ❌ | ✅ |
| Actually useful | ❌ | ✅ | ❌ |
| Realises it's not useful, and pipes the only useful data into the only useful port scanner | ✅ | ❌ | ❌ |
![fast][speed-1]
Speed is guaranteed via RustScan. However, if you want to run a slow scan due to stealth, that is possible too.
## 🙋 FAQ
> I think this would be a great port scanner on its own without Nmap!
Firstly, let's talk code.
No. If you want a fast port scanner, use Masscan.
> I have this great idea for a script to get information on ports / hosts
We have tests that check to see if RustScan is significantly slower than the previous version. If it is, the continuous integration fails, and we can't commit code to master unless we make it faster.
Great. Contribute it to Nmap! :D
> Not everyone has nmap installed....
[HyperFine][speed-2] is used to monitor RustScan's performance over time to answer the question, "Are we getting faster? Are we getting slower?".
If you're a pentester, then yes, you have Nmap installed.
Every pull request is reviewed by **one** person, but more often than not, **two** people review it. We test it manually and ensure the code doesn't negatively affect performance.
> I want to contribute!
[Read more here][speed-3].
Great! I'd love some help with this. Read the [contributing.md file](contributing.md) file for more information!
## ⚙️ Extensible
![scripts][extensible-1]
### _RustScan piping results into the custom Python script_
RustScan has a new scripting engine that allows anyone to write scripts in most languages. Python, Lua, and Shell are all supported.
Want to take your found ports and pipe them into Nmap for further analysis? That's possible. Want to run `smb-enum` if SMB is found open? Possible.
The possibilities are endless -- and you can write scripts in whatever language you feel comfortable with.
[Read more here][extensible-2].
## 🌊 Adaptive
![adaptive][adaptive-1]
### _RustScan automatically fine-tunes itself to match the host OS_
RustScan has a cool set of features called "Adaptive Learning". These features "learn" about the environment you are scanning and how _you_ use RustScan to **improve itself over time**.
We use this umbrella term for any feature that fits this criterion. The list constantly changes, so [check out our wiki for more information][adaptive-learning].
## 👩‍🦯 Accessible
![fast][accessible-1]
RustScan is one of the first penetration testing tools that aims to be entirely accessible.
[Most penetration testing tools are not accessible][accessible-2], which negatively affects the whole industry.
RustScan has continuous integration testing that aims to ensure it is accessible, and we are constantly working on ways to improve our accessibility and ensure _everyone_ can use RustScan.
# 📖 Full Installation Guide
**You need Nmap**. If you have Kali Linux or Parrot OS installed, you already have Nmap. If not, [follow the nmap install guide](https://nmap.org/download.html).
The easiest way to install RustScan is to use one of the packages provided for your system, such as HomeBrew or Yay for Arch Linux.
You can find our guide [here][install-1].
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).
## 🦊 Community Distributions
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.
Here are all of RustScan's community distributions.
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.
If you maintain a community distribution and want it listed here, leave an issue / pull request / Discord message or however, you want to let us know.
## 🖥️ Debian / Kali
- [Open Suse][distributions-1]
- [Fedora/CentOS][distributions-2]
Download the .deb file from the releases page:
[https://github.com/brandonskerritt/RustScan/releases](https://github.com/brandonskerritt/RustScan/releases)
Run the commpand `dpkg -i` on the file. Note: sometimes you can double click the file to achieve the same result.
### 🥧 .deb file not working?
The .deb file only works on AMD64 CPUs. If yours is different (such as a Raspberry Pi) or the .deb file doesn't work, it is easy to build the .deb file yourself.
**Note**: It is easier to install Rust and install via Cargo, then it is to build the .deb file. But this is just in case!
1. 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. `cargo install rustscan` if you want the easiest method possible. Otherwise, to build the .deb file `cargo install cargo-deb`
3. Git clone this repo `git clone https://github.com/brandonskerritt/RustScan`
4. cd RustScan (into the git cloned repo) `cd RustScan`
5. Run `cargo deb`
6. Your .deb file is now located in `target/releases/Debian/`
## 🍺 HomeBrew
Tap the brew:
```
brew tap brandonskerritt/rustscan
```
Install it:
```
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
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!
[![Packaging status][rustscan-svg]][repology-1]
# 🤸 Usage
```
rustscan -h
```
We have 2 usage guides. [Basic Usage][usage-1] and [Things you may want to do][usage-2].
```
RustScan 1.2.0
Bee https://github.com/brandonskerritt
Fast Port Scanner built in Rust
WARNING Do not use this program against sensitive infrastructure. The specified server may not be able to handle this
many socket connections at once.
We also have documentation about our config file [here][config-file-here].
USAGE:
rustscan [FLAGS] [OPTIONS] <ip> [command]...
# 🎪 Community
FLAGS:
-h, --help Prints help information
-q, --quiet Quiet mode. Only output the ports. No Nmap. Useful for grep or outputting to a file.
-V, --version Prints version information
[Contributing][community-1] Read this to learn how.
OPTIONS:
-T, --timeout <T> The timeout before a port is assumed to be close. In MS. [default: 1500]
-b, --batch <b> Increases speed of scanning. The batch size for port scanning. Depends on your open file limit
of OS. If you do 65535 it will do every port at the same time. Although, your OS may not
support this. [default: 4500]
-u, --ulimit <u> Automatically ups the ULIMIT with the value you provided.
ARGS:
<ip> The IP address to scan
<command>... The Nmap arguments to run. To use the argument -A, end RustScan's args with '-- -A'. To run
EXAMPLE: 'rustscan -T 1500 127.0.0.1 -- -A -sC'. This argument auto runs nmap {your commands}
-vvv -p $PORTS
```
The format is `rustscan -b 500 -T 1500 192.168.0.1` to scan 192.168.0.1 with 500 batch size with a timeout of 1500ms. The timeout is how long RustScan waits for a response until it assumes the port is closed.
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.
## ⚠️ WARNING
This program, by default, scans 5000 ports at a time (5000 per second).
This may cause damage to a server, or may make it incredibly obvious you are scanning the server.
There are 2 ways to deal with this;
1. Decrease batch size
`rustscan -b 10` will run 10 port scans for 1 second, and then another 10 for 1 second and so on.
2. Increase timeout
`rustscan -T 5000` will mean RustScan waits 5 seconds until it scans the next ports.
You can also use both of these at the same time, to make it as slow or as fast as you want. A fun favourite is 65535 batch size with 1 second timeout. Theoretically, this scans all 65535 ports in 1 second.
**Please** do not use this tool against sensitive servers. It is designed mainly for Capture the Flag events, not real world servers with sensitive data.
## 🚨 Thread Paniced at Main: Too Many Open Files
This is the most common error found in RustScan.
The open file limit is how many open sockets you can have at any given time.
This limit changes from OS to OS.
RustScan does not automatically create defaults (other than 5000) like Nmap does with their -T1, -T2 system.
By figuring out for yourself the optimal batch size, you will know that RustScan is the most optimised port scanner for your system.
There are 2 things you can do:
1. Decrease batch size
2. Increase open file limit
Decreasing batch size slows down the program, so as long as it isn't too drastic, this is a good option.
Run these 3 commands:
```
ulimit -a
ulimit -Hn
ulimit -Sn
```
They will give you an idea on the open file limit of your OS.
If it says "250", run `rustscan -b 240` for a batch size of 240.
Increasing the open file limit increases speed, but poses danger. Although, **opening more file sockets on the specified IP address may damage it**.
To open more, set the ulimit to a higher number:
```
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!
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.
Although, if this breaks anything, please don't blame me.
**Windows Subsystem for Linux**
Windows Subsystem for Linux does not support ulimt (see issue #39).
The best way is to use it on a host computer, in Docker, or in a VM that isn't WSL.
**Automatic Ulimit updating**
We are currently working on automatic Ulimit updating. If it is too high, it will lower itself. If it is too low, it will suggest a higher Ulimit. Watch [this issue](https://github.com/brandonskerritt/RustScan/issues/25) for more.
## 🔌 Nmap Custom Flags
To run your own nmap commands, end the RustScan command with `-- -A` where `--` indicates "end of RustScan flags, please do not parse anything further" and any flags after that will be entered into nmap.
RustScan automatically runs `nmap -vvv -p $PORTS $IP`. To make it run `-A`, execute the command `rustscan 127.0.0.1 -- -A`.
**Note**: due to how Nmap behaves, sometimes you cannot SIGINT ctrl+c to end the scan and it acts like it is running in the background, but printing to STD::OUT. There is nothing I can do about this, unless I create a TTY shell for the sole purpose of running Nmap. Sorry 😓 I'll try to fix in an upcoming release. If any Rust experts want to help, please do!
## 🎯 Increasing speed / accuracy
* 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.
For non-experimental speed increases, slowly increase the batch size until it no longer gets open ports, or it breaks.
* Accuracy (and some speed)
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.
# 🎪 Contributing
Please read the [contributing.md file](contributing.md)
# 💻 Other Hacking Projects By This Author
## 🧮 Ciphey
Ciphey is an automated decryption tool using artifical intelligence & natural language processing.
[Check it out here!](https://github.com/ciphey/ciphey)
## Contributors ✨
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-26-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@@ -280,16 +145,91 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://skerritt.blog"><img src="https://avatars3.githubusercontent.com/u/10378052?v=4" width="100px;" alt=""/><br /><sub><b>Brandon</b></sub></a><br /><a href="#infra-brandonskerritt" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/brandonskerritt/RustScan/commits?author=brandonskerritt" title="Tests">⚠️</a> <a href="https://github.com/brandonskerritt/RustScan/commits?author=brandonskerritt" title="Code">💻</a> <a href="#design-brandonskerritt" title="Design">🎨</a></td>
<td align="center"><a href="https://sakiir.ovh"><img src="https://avatars1.githubusercontent.com/u/9950578?v=4" width="100px;" alt=""/><br /><sub><b>SakiiR</b></sub></a><br /><a href="https://github.com/brandonskerritt/RustScan/commits?author=SakiiR" title="Code">💻</a> <a href="https://github.com/brandonskerritt/RustScan/issues?q=author%3ASakiiR" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://skerritt.blog"><img src="https://avatars3.githubusercontent.com/u/10378052?v=4" width="100px;" alt=""/><br /><sub><b>Brandon</b></sub></a><br /><a href="#infra-brandonskerritt" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/RustScan/RustScan/commits?author=brandonskerritt" title="Tests">⚠️</a> <a href="https://github.com/RustScan/RustScan/commits?author=brandonskerritt" title="Code">💻</a> <a href="#design-brandonskerritt" title="Design">🎨</a></td>
<td align="center"><a href="https://sakiir.ovh"><img src="https://avatars1.githubusercontent.com/u/9950578?v=4" width="100px;" alt=""/><br /><sub><b>SakiiR</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=SakiiR" title="Code">💻</a> <a href="https://github.com/RustScan/RustScan/issues?q=author%3ASakiiR" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/smackhack"><img src="https://avatars2.githubusercontent.com/u/48143394?v=4" width="100px;" alt=""/><br /><sub><b>smackhack</b></sub></a><br /><a href="#ideas-smackhack" title="Ideas, Planning, & Feedback">🤔</a> <a href="#example-smackhack" title="Examples">💡</a></td>
<td align="center"><a href="http://bernardoamc.github.io/"><img src="https://avatars0.githubusercontent.com/u/428984?v=4" width="100px;" alt=""/><br /><sub><b>Bernardo Araujo</b></sub></a><br /><a href="https://github.com/brandonskerritt/RustScan/commits?author=bernardoamc" title="Code">💻</a> <a href="https://github.com/brandonskerritt/RustScan/issues?q=author%3Abernardoamc" title="Bug reports">🐛</a> <a href="#design-bernardoamc" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/Isona"><img src="https://avatars2.githubusercontent.com/u/11759523?v=4" width="100px;" alt=""/><br /><sub><b>Izzy Whistlecroft</b></sub></a><br /><a href="https://github.com/brandonskerritt/RustScan/issues?q=author%3AIsona" title="Bug reports">🐛</a></td>
<td align="center"><a href="http://bernardoamc.github.io/"><img src="https://avatars0.githubusercontent.com/u/428984?v=4" width="100px;" alt=""/><br /><sub><b>Bernardo Araujo</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=bernardoamc" title="Code">💻</a> <a href="https://github.com/RustScan/RustScan/issues?q=author%3Abernardoamc" title="Bug reports">🐛</a> <a href="#design-bernardoamc" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/Isona"><img src="https://avatars2.githubusercontent.com/u/11759523?v=4" width="100px;" alt=""/><br /><sub><b>Izzy Whistlecroft</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/issues?q=author%3AIsona" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://imlonghao.com"><img src="https://avatars1.githubusercontent.com/u/4951333?v=4" width="100px;" alt=""/><br /><sub><b>imlonghao</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/issues?q=author%3Aimlonghao" title="Bug reports">🐛</a> <a href="#maintenance-imlonghao" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/royharoush"><img src="https://avatars3.githubusercontent.com/u/8113056?v=4" width="100px;" alt=""/><br /><sub><b>royharoush</b></sub></a><br /><a href="#ideas-royharoush" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-royharoush" title="Design">🎨</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/Atul9"><img src="https://avatars1.githubusercontent.com/u/3390330?v=4" width="100px;" alt=""/><br /><sub><b>Atul Bhosale</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=Atul9" title="Code">💻</a></td>
<td align="center"><a href="https://tgotwig.dev"><img src="https://avatars0.githubusercontent.com/u/30773779?v=4" width="100px;" alt=""/><br /><sub><b>Thomas Gotwig</b></sub></a><br /><a href="#platform-TGotwig" title="Packaging/porting to new platform">📦</a></td>
<td align="center"><a href="https://github.com/remigourdon"><img src="https://avatars3.githubusercontent.com/u/2874133?v=4" width="100px;" alt=""/><br /><sub><b>Rémi Gourdon</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=remigourdon" title="Documentation">📖</a> <a href="https://github.com/RustScan/RustScan/commits?author=remigourdon" title="Code">💻</a></td>
<td align="center"><a href="https://cmnatic.co.uk"><img src="https://avatars3.githubusercontent.com/u/4163116?v=4" width="100px;" alt=""/><br /><sub><b>Ben (CMNatic)</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=cmnatic" title="Code">💻</a> <a href="https://github.com/RustScan/RustScan/commits?author=cmnatic" title="Documentation">📖</a> <a href="#design-cmnatic" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/Ferryistaken"><img src="https://avatars3.githubusercontent.com/u/47927670?v=4" width="100px;" alt=""/><br /><sub><b>Alessandro Ferrari</b></sub></a><br /><a href="#content-Ferryistaken" title="Content">🖋</a></td>
<td align="center"><a href="https://github.com/Phenomite"><img src="https://avatars2.githubusercontent.com/u/8285537?v=4" width="100px;" alt=""/><br /><sub><b>Phenomite</b></sub></a><br /><a href="#content-Phenomite" title="Content">🖋</a></td>
<td align="center"><a href="https://supersandro.de/"><img src="https://avatars2.githubusercontent.com/u/7258858?v=4" width="100px;" alt=""/><br /><sub><b>Sandro</b></sub></a><br /><a href="#content-SuperSandro2000" title="Content">🖋</a> <a href="https://github.com/RustScan/RustScan/issues?q=author%3ASuperSandro2000" title="Bug reports">🐛</a> <a href="https://github.com/RustScan/RustScan/commits?author=SuperSandro2000" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://swag.lgbt"><img src="https://avatars2.githubusercontent.com/u/25358963?v=4" width="100px;" alt=""/><br /><sub><b>Cass</b></sub></a><br /><a href="#platform-caass" title="Packaging/porting to new platform">📦</a> <a href="https://github.com/RustScan/RustScan/commits?author=caass" title="Code">💻</a> <a href="https://github.com/RustScan/RustScan/issues?q=author%3Acaass" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/niklasmohrin"><img src="https://avatars0.githubusercontent.com/u/47574893?v=4" width="100px;" alt=""/><br /><sub><b>Niklas Mohrin</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=niklasmohrin" title="Documentation">📖</a> <a href="https://github.com/RustScan/RustScan/commits?author=niklasmohrin" title="Code">💻</a> <a href="https://github.com/RustScan/RustScan/issues?q=author%3Aniklasmohrin" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://liberapay.com/Artem4/"><img src="https://avatars0.githubusercontent.com/u/5614476?v=4" width="100px;" alt=""/><br /><sub><b>Artem Polishchuk</b></sub></a><br /><a href="#platform-tim77" title="Packaging/porting to new platform">📦</a></td>
<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>
<td align="center"><a href="https://github.com/u5surf"><img src="https://avatars1.githubusercontent.com/u/14180225?v=4" width="100px;" alt=""/><br /><sub><b>Y.Horie</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=u5surf" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/okrplay"><img src="https://avatars3.githubusercontent.com/u/32576280?v=4" width="100px;" alt=""/><br /><sub><b>Oskar</b></sub></a><br /><a href="https://github.com/RustScan/RustScan/commits?author=okrplay" title="Code">💻</a> <a href="https://github.com/RustScan/RustScan/commits?author=okrplay" title="Tests">⚠️</a></td>
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
<!--Links-->
[Docker]: https://hub.docker.com/r/cmnatic/rustscan "This is the recommended distribution of rustscan"
[kali]: https://github.com/RustScan/RustScan/wiki/Installation-Guide#%EF%B8%8F-debian--kali "Read the install guide"
[Kali/Debian]: https://github.com/RustScan/RustScan/releases "Kali Debian"
[Arch-Linux]: https://archlinux.org/packages/extra/x86_64/rustscan/ "Arch Linux installation of Rustscan"
[Homebrew]: https://crates.io/crates/rustscan/ "Homebrew install of Rustscan"
[usage-1]: https://github.com/RustScan/RustScan/wiki/Usage "Basic Usage of Rustscan"
[usage-0]: https://github.com/RustScan/RustScan/wiki/Installation-Guide#docker-whale "Use Docker Rustscan"
[config-file-here]: https://github.com/RustScan/RustScan/wiki/Config-File "RustScan Configuration File"
[usage-2]: https://github.com/RustScan/RustScan/wiki/Things-you-may-want-to-do-with-RustScan-but-don't-understand-how "Things you may want to do with rustscan but don't know how"
[community-1]: https://github.com/RustScan/RustScan/wiki/Contributing "Learn how to contribute"
[distributions-1]: https://software.opensuse.org/package/rustscan?search_term=rustscan "Open Suse rustscan distribution"
[distributions-2]: https://copr.fedorainfracloud.org/coprs/atim/rustscan/ "Rustscan in Fedora"
[repology-1]: https://repology.org/project/rustscan/versions "Packaging Status"
[install-1]: https://github.com/RustScan/RustScan/wiki/Installation-Guide "Installation guide"
[accessible-2]: https://bees.substack.com/p/making-hacking-accessible "Making Hacking Accessible"
[extensible-2]: https://github.com/RustScan/RustScan/wiki/RustScan-Scripting-Engine "Scripting Engine"
[speed-2]: https://github.com/sharkdp/hyperfine "Hyperfine"
[speed-3]: https://github.com/RustScan/RustScan/wiki/Increasing-Speed-&-Accuracy "Increasing Speed & Accuracy"
[toc-community]: https://github.com/RustScan/RustScan#-community "Community"
[links-table-1]: https://github.com/RustScan/RustScan#-full-installation-guide "Full installation guide"
[links-table-2]: https://rustscan.github.io/RustScan/ "Rustscan"
[discord]: http://discord.skerritt.blog "Discord blog"
[toc-install]: https://github.com/RustScan/RustScan/wiki/Installation-Guide "Installation Guide Wiki"
[toc-docker-usage]: https://github.com/RustScan/RustScan/wiki/Installation-Guide#docker- "Docker Installation Guide Wiki"
[usage-guide]: https://github.com/RustScan/RustScan#-usage
[adaptive-learning]: https://github.com/RustScan/RustScan/wiki/Adaptive-Learning "Adaptive Learning"
<!--Pictures-->
[DockerPic]: https://github.com/RustScan/RustScan/blob/master/pictures/docker.png?raw=true "Docker install"
[Kali1]: https://github.com/RustScan/RustScan/blob/master/pictures/kali.png?raw=true "Kali Picture"
[Arch]: https://github.com/RustScan/RustScan/blob/master/pictures/arch.png?raw=true "Arch Linux"
[Apple]: https://raw.githubusercontent.com/RustScan/RustScan/master/pictures/apple.png?size "Apple"
[rustscan-svg]: https://repology.org/badge/vertical-allrepos/rustscan.svg "Picture of rustscan repology"
[accessible-1]: pictures/accessible.gif "Fast"
[adaptive-1]: pictures/adaptive.gif "Adaptive"
[extensible-1]: pictures/scripts.gif "Scripts"
[speed-1]: pictures/fast.gif "Speed"
[badge-1]: https://img.shields.io/archlinux/v/extra/x86_64/rustscan?style=plastic&logo=archlinux&link=https%3A%2F%2Farchlinux.org%2Fpackages%2Fextra%2Fx86_64%2Frustscan%2F
[badge-2]: https://img.shields.io/badge/Built%20with-Rust-Purple
[badge-3]: https://img.shields.io/github/downloads/rustscan/rustscan/total?label=GitHub%20Downloads
[badge-4]: https://img.shields.io/crates/d/rustscan?label=Cargo%20Downloads
[badge-5]: https://img.shields.io/discord/754001738184392704
[badge-6]: https://github.com/RustScan/RustScan/workflows/Continuous%20integration/badge.svg?branch=master
+1004
View File
File diff suppressed because it is too large. Load diff
+5
View File
@@ -0,0 +1,5 @@
FROM rust
# Install nmap first.
RUN apt-get update -qy && apt-get install -qy nmap
# Then install rustfmt and clippy for cargo.
RUN rustup component add rustfmt clippy
+67 -4
View File
@@ -1,6 +1,69 @@
This is my first Rust project! As such, I expect there are many, many bugs involved or things that can be sped up.
Howdy Space Cow-Person 🤠🌌
If you're looking to get involved, we make use of Good First Issues / Help Wanted tags. Click this link to see all the issues we could use help with!
[https://github.com/brandonskerritt/RustScan/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22](https://github.com/brandonskerritt/RustScan/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)
RustScan is always looking for contributors. Whether that's spelling mistakes or major changes, your help is **wanted** and welcomed here.
Please leave issues / pull requests, I'd love to learn more about this amazing language :)
Before contributing, read our [code of conduct](https://github.com/RustScan/RustScan/blob/master/CODE_OF_CONDUCT.md).
TL;DR if you abuse members of our community you will be **perma-banned** with no chance to get unbanned. No warnings either. 🤗
RustScan has 2 major labels for GitHub issues you should look at:
- Good First issue
These are issues for newcomers to open source!
[https://github.com/RustScan/RustScan/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22](https://github.com/RustScan/RustScan/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
- Help wanted
These are issues that aren't really for newcomers, but we could still do with help!
[https://github.com/RustScan/RustScan/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+label%3A%22help+wanted%22](https://github.com/RustScan/RustScan/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+label%3A%22help+wanted%22)
If you want to, solve the issue or comment on the issue for help.
The flow for contributing to open source software is:
- Fork the repo
- Make changes
- Pull request to the repo
And then comment on the issue that you've done.
RustScan also has some `// TODO`'s in the codebase, which are meant more for the core team but we wouldn't say no to help with these issues.
If you have any feature suggestions or bugs, leave a GitHub issue. We welcome any and all support :D
## Rewarding you
I cannot pay you :-( But, I can place your GitHub profile on the README under `#Contributors` as a thank you! :)
## Contributing development environment
To ease contribution to RustScan, you can use the `contributing.Dockerfile` to create a Docker image ready to build and play with RustScan.
To build it you just need to run:
```bash
you@home:~/RustScan$ docker build -t rustscan_contributing -f contributing.Dockerfile
```
Then you need to run the container with a volume so it can access, _with read and write permissions_, to RustScan files:
```bash
you@home:~/RustScan$ docker run -ti --rm -v "$PWD":/rustscan -w /rustscan rustscan_contributing bash
```
You can now modify RustScan files with your favorite editor, once you want to compile and test your modifications, type the following in the container prompt:
```bash
root@container:/rustscan# cargo build
```
You are now ready to use RustScan:
```bash
root@container:/rustscan# cargo run -- -b 2000 -t 5000 -a 127.0.0.1
```
You can also format, lint with `clippy` and test the code with the following commands:
```bash
root@container:/rustscan# cargo fmt
root@container:/rustscan# cargo clippy
root@container:/rustscan# cargo test
```
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/perl
#tags = ["core_approved", "example",]
#developer = [ "example", "https://example.org" ]
#ports_separator = ","
#call_format = "perl {{script}} {{ip}} {{port}}"
# Sriptfile parser stops at the first blank line with parsing.
# This script will run itself as an argument with the system installed perl interpreter, ports will be concatenated with "," .
# Unused field: trigger_port = "80"
# get total arg passed to this script
my $total = $#ARGV + 1;
my $counter = 1;
# get script name
my $scriptname = $0;
print "Total args passed to $scriptname : $total\n";
# Use loop to print all args stored in an array called @ARGV
foreach my $a(@ARGV) {
print "Arg # $counter : $a\n";
$counter++;
}
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/python3
#tags = ["core_approved", "example",]
#developer = [ "example", "https://example.org" ]
#trigger_port = "80"
#call_format = "python3 {{script}} {{ip}} {{port}}"
# Sriptfile parser stops at the first blank line with parsing.
# This script will run itself as an argument with the system installed python interpreter, only scanning port 80.
# Unused filed: ports_separator = ","
import sys
print('Python script ran with arguments', str(sys.argv))
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
#tags = ["core_approved", "example",]
#developer = [ "example", "https://example.org" ]
#ports_separator = ","
#call_format = "bash {{script}} {{ip}} {{port}}"
# Sriptfile parser stops at the first blank line with parsing.
# This script will run itself as an argument with the system installed bash interpreter, scanning all ports concatenated with "," .
# Unused filed: trigger_port = "80"
# print all arguments passed to the script
echo $@
@@ -0,0 +1,9 @@
#!intentional_blank_line
#tags = ["core_approved", "example"]
#developer = [ "example", "https://example.org" ]
#ports_separator = ","
#call_format = "nmap -vvv -p {{port}} {{ip}}"
# Scriptfile parser stops at the first blank line with parsing.
# This script will run the system installed nmap, ports will be concatenated with "," .
# Unused field: trigger_port = "80"
@@ -0,0 +1,7 @@
#!intentional_blank_line
#tags = "core_approved"
#developer = [ "example", "https://example.org" ]
#ports_separator = ","
#call_format = "nmap -vvv -p {{port}} {{ip}}"
# tags has to be an array, thus this file won't be parsed
View File
Whitespace-only changes.
+6
View File
@@ -0,0 +1,6 @@
127.0.0.1
google.com
example.com
66666666666666.666666666666666666.66666666666666666.6666666666
....
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.radiatorFixtures
+42
View File
@@ -0,0 +1,42 @@
# https://github.com/minimaxir/big-list-of-naughty-strings
­؀؁؂؃؄؅؜۝܏᠎​‌‍‎‏‪‫‬‭‮⁠⁡⁢⁣⁤⁦⁧⁨⁩𑂽𛲠𛲡𛲢𛲣𝅳𝅴𝅵𝅶𝅷𝅸𝅹𝅺󠀁󠀠󠀡󠀢󠀣󠀤󠀥󠀦󠀧󠀨󠀩󠀪󠀫󠀬󠀭󠀮󠀯󠀰󠀱󠀲󠀳󠀴󠀵󠀶󠀷󠀸󠀹󠀺󠀻󠀼󠀽󠀾󠀿󠁀󠁁󠁂󠁃󠁄󠁅󠁆󠁇󠁈󠁉󠁊󠁋󠁌󠁍󠁎󠁏󠁐󠁑󠁒󠁓󠁔󠁕󠁖󠁗󠁘󠁙󠁚󠁛󠁜󠁝󠁞󠁟󠁠󠁡󠁢󠁣󠁤󠁥󠁦󠁧󠁨󠁩󠁪󠁫󠁬󠁭󠁮󠁯󠁰󠁱󠁲󠁳󠁴󠁵󠁶󠁷󠁸󠁹󠁺󠁻󠁼󠁽󠁾󠁿
Ω≈ç√∫˜µ≤≥÷
åß∂ƒ©˙∆˚¬…æ
œ∑´®†¥¨ˆøπ“‘
¡™£¢∞§¶•ªº–≠
¸˛Ç◊ı˜Â¯˘¿
ÅÍÎÏ˝ÓÔÒÚÆ☃
Œ„´‰ˇÁ¨ˆØ∏”’
`⁄€‹›fifl‡°·‚—±
⅛⅜⅝⅞
ЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя
٠١٢٣٤٥٦٧٨٩
⁰⁴⁵
₀₁₂
⁰⁴⁵₀₁₂
ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็
田中さんにあげて下さい
パーティーへ行かないか
和製漢語
部落格
사회과학원 어학연구소
찦차를 타고 온 펲시맨과 쑛다리 똠방각하
社會科學院語學研究所
울란바토르
𠜎𠜱𠝹𠱓𠱸𠲖𠳏
𝐓𝐡𝐞 𝐪𝐮𝐢𝐜𝐤 𝐛𝐫𝐨𝐰𝐧 𝐟𝐨𝐱 𝐣𝐮𝐦𝐩𝐬 𝐨𝐯𝐞𝐫 𝐭𝐡𝐞 𝐥𝐚𝐳𝐲 𝐝𝐨𝐠
𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐 𝖇𝖗𝖔𝖜𝖓 𝖋𝖔𝖝 𝖏𝖚𝖒𝖕𝖘 𝖔𝖛𝖊𝖗 𝖙𝖍𝖊 𝖑𝖆𝖟𝖞 𝖉𝖔𝖌
𝑻𝒉𝒆 𝒒𝒖𝒊𝒄𝒌 𝒃𝒓𝒐𝒘𝒏 𝒇𝒐𝒙 𝒋𝒖𝒎𝒑𝒔 𝒐𝒗𝒆𝒓 𝒕𝒉𝒆 𝒍𝒂𝒛𝒚 𝒅𝒐𝒈
𝓣𝓱𝓮 𝓺𝓾𝓲𝓬𝓴 𝓫𝓻𝓸𝔀𝓷 𝓯𝓸𝔁 𝓳𝓾𝓶𝓹𝓼 𝓸𝓿𝓮𝓻 𝓽𝓱𝓮 𝓵𝓪𝔃𝔂 𝓭𝓸𝓰
𝕋𝕙𝕖 𝕢𝕦𝕚𝕔𝕜 𝕓𝕣𝕠𝕨𝕟 𝕗𝕠𝕩 𝕛𝕦𝕞𝕡𝕤 𝕠𝕧𝕖𝕣 𝕥𝕙𝕖 𝕝𝕒𝕫𝕪 𝕕𝕠𝕘
𝚃𝚑𝚎 𝚚𝚞𝚒𝚌𝚔 𝚋𝚛𝚘𝚠𝚗 𝚏𝚘𝚡 𝚓𝚞𝚖𝚙𝚜 𝚘𝚟𝚎𝚛 𝚝𝚑𝚎 𝚕𝚊𝚣𝚢 𝚍𝚘𝚐
⒯⒣⒠ ⒬⒰⒤⒞⒦ ⒝⒭⒪⒲⒩ ⒡⒪⒳ ⒥⒰⒨⒫⒮ ⒪⒱⒠⒭ ⒯⒣⒠ ⒧⒜⒵⒴ ⒟⒪⒢
ثم نفس سقطت وبالتحديد،, جزيرتي باستخدام أن دنو. إذ هنا؟ الستار وتنصيب كان. أهّل ايطاليا، بريطانيا-فرنسا قد أخذ. سليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو.
+14
View File
@@ -0,0 +1,14 @@
# Test/Example ScriptConfig file
# Tags to filter on scripts. Only scripts containing all these tags will run.
tags = ["core_approved", "example"]
# If it's present then only those scripts will run which has a tag ports = "80". Not yet implemented.
#
# ex.:
# ports = ["80"]
# ports = ["80","81","8080"]
ports = ["80"]
# Only this developer(s) scripts to run. Not yet implemented.
developer = ["example"]
Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

+131
View File
@@ -0,0 +1,131 @@
# The configurations that used for the recording, feel free to edit them
config:
# Specify a command to be executed
# like `/bin/bash -l`, `ls`, or any other commands
# the default is bash for Linux
# or powershell.exe for Windows
command: zsh
# Specify the current working directory path
# the default is the current working directory path
cwd: /home/bee/Documents/RustScan
# Export additional ENV variables
env:
recording: true
# Explicitly set the number of columns
# or use `auto` to take the current
# number of columns of your shell
cols: 107
# Explicitly set the number of rows
# or use `auto` to take the current
# number of rows of your shell
rows: 43
# Amount of times to repeat GIF
# If value is -1, play once
# If value is 0, loop indefinitely
# If value is a positive number, loop n times
repeat: 0
# Quality
# 1 - 100
quality: 100
# Delay between frames in ms
# If the value is `auto` use the actual recording delays
frameDelay: auto
# Maximum delay between frames in ms
# Ignored if the `frameDelay` isn't set to `auto`
# Set to `auto` to prevent limiting the max idle time
maxIdleTime: 2000
# The surrounding frame box
# The `type` can be null, window, floating, or solid`
# To hide the title use the value null
# Don't forget to add a backgroundColor style with a null as type
frameBox:
type: floating
title: Terminalizer
style:
border: 0px black solid
# boxShadow: none
# margin: 0px
# Add a watermark image to the rendered gif
# You need to specify an absolute path for
# the image on your machine or a URL, and you can also
# add your own CSS styles
watermark:
imagePath: null
style:
position: absolute
right: 15px
bottom: 15px
width: 100px
opacity: 0.9
# Cursor style can be one of
# `block`, `underline`, or `bar`
cursorStyle: block
# Font family
# You can use any font that is installed on your machine
# in CSS-like syntax
fontFamily: "Monaco, Lucida Console, Ubuntu Mono, Monospace"
# The size of the font
fontSize: 12
# The height of lines
lineHeight: 1
# The spacing between letters
letterSpacing: 0
# Theme
theme:
background: "transparent"
foreground: "#afafaf"
cursor: "#c7c7c7"
black: "#232628"
red: "#fc4384"
green: "#b3e33b"
yellow: "#ffa727"
blue: "#75dff2"
magenta: "#ae89fe"
cyan: "#708387"
white: "#d5d5d0"
brightBlack: "#626566"
brightRed: "#ff7fac"
brightGreen: "#c8ed71"
brightYellow: "#ebdf86"
brightBlue: "#75dff2"
brightMagenta: "#ae89fe"
brightCyan: "#b1c6ca"
brightWhite: "#f9f9f4"
# Records, feel free to edit them
records:
- delay: 436
content: "\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;bee@beehive:~/Documents/RustScan\a\e]1;..ents/RustScan\a"
- delay: 162
content: "\r\e[0m\e[27m\e[24m\e[J\r\n\e[1m\e[0m\e[1m\e[36mRustScan\e[0m\e[36m\e[39m\e[1m \e[0m\e[1mon \e[0m\e[1m\e[37m\e[1m\e[37m\e[0m\e[37m\e[1m\e[37m\e[35m master\e[0m\e[35m\e[39m\e[1m\e[0m\e[1m\e[0m\e[1m\e[31m [?]\e[0m\e[31m\e[39m\e[1m\e[0m\e[0m\e[39m\e[1m \e[0m\e[1mis \e[0m\e[1m\e[31m\U0001F4E6 vrustscan:1.10.0\e[0m\e[31m\e[39m\e[1m \e[0m\e[1mvia \e[0m\e[1m\e[31m\U0001D5E5 v1.46.0\e[0m\e[31m\e[39m\e[1m \e[0m\r\n\e[1m\e[0m\e[1m\e[32m➜ \e[0m\e[32m\e[39m\e[1m\e[0m\e[K\e[?1h\e=\e[?2004h"
- delay: 471
content: "r\brustscan 127.0.0.1 --accessible --no-nmap --ulimit 5000\e[55D\e[7mr\e[7mu\e[7ms\e[7mt\e[7ms\e[7mc\e[7ma\e[7mn\e[7m \e[7m1\e[7m2\e[7m7\e[7m.\e[7m0\e[7m.\e[7m0\e[7m.\e[7m1\e[7m \e[7m-\e[7m-\e[7ma\e[7mc\e[7mc\e[7me\e[7ms\e[7ms\e[7mi\e[7mb\e[7ml\e[7me\e[7m \e[7m-\e[7m-\e[7mn\e[7mo\e[7m-\e[7mn\e[7mm\e[7ma\e[7mp\e[7m \e[7m-\e[7m-\e[7mu\e[7ml\e[7mi\e[7mm\e[7mi\e[7mt\e[7m \e[7m5\e[7m0\e[7m0\e[7m0\e[27m"
- delay: 269
content: "\e[55D\e[27mr\e[27mu\e[27ms\e[27mt\e[27ms\e[27mc\e[27ma\e[27mn\e[27m \e[27m1\e[27m2\e[27m7\e[27m.\e[27m0\e[27m.\e[27m0\e[27m.\e[27m1\e[27m \e[27m-\e[27m-\e[27ma\e[27mc\e[27mc\e[27me\e[27ms\e[27ms\e[27mi\e[27mb\e[27ml\e[27me\e[27m \e[27m-\e[27m-\e[27mn\e[27mo\e[27m-\e[27mn\e[27mm\e[27ma\e[27mp\e[27m \e[27m-\e[27m-\e[27mu\e[27ml\e[27mi\e[27mm\e[27mi\e[27mt\e[27m \e[27m5\e[27m0\e[27m0\e[27m0\e[?1l\e>\e[?2004l\r\r\n\e]2;rustscan 127.0.0.1 --accessible --no-nmap --ulimit 5000\a\e]1;rustscan\aAutomatically increasing ulimit value to 5000.\r\n"
- delay: 1536
content: "Open 127.0.0.1:38602\r\n"
- delay: 395
content: "Open 127.0.0.1:50078\r\n"
- delay: 450
content: "127.0.0.1 -> [38602,50078]\r\n\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;bee@beehive:~/Documents/RustScan\a\e]1;..ents/RustScan\a"
- delay: 143
content: "\r\e[0m\e[27m\e[24m\e[J\r\n\e[1m\e[0m\e[1m\e[36mRustScan\e[0m\e[36m\e[39m\e[1m \e[0m\e[1mon \e[0m\e[1m\e[37m\e[1m\e[37m\e[0m\e[37m\e[1m\e[37m\e[35m master\e[0m\e[35m\e[39m\e[1m\e[0m\e[1m\e[0m\e[1m\e[31m [?]\e[0m\e[31m\e[39m\e[1m\e[0m\e[0m\e[39m\e[1m \e[0m\e[1mis \e[0m\e[1m\e[31m\U0001F4E6 vrustscan:1.10.0\e[0m\e[31m\e[39m\e[1m \e[0m\e[1mvia \e[0m\e[1m\e[31m\U0001D5E5 v1.46.0\e[0m\e[31m\e[39m\e[1m \e[0m\e[1mtook \e[0m\e[1m\e[33m2s\e[0m\e[33m\e[39m\e[1m \e[0m\r\n\e[1m\e[0m\e[1m\e[32m➜ \e[0m\e[32m\e[39m\e[1m\e[0m\e[K\e[?1h\e=\e[?2004h"
- delay: 563
content: "\e[?2004l\r\r\n"
Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Executable
+1
View File
@@ -0,0 +1 @@
cargo publish && cargo build --release && git add Cargo.lock && git commit -m 'Updating lock file' && gpsup
-20
View File
@@ -1,20 +0,0 @@
FROM rust:latest
RUN git clone https://github.com/brandonskerritt/RustScan
WORKDIR "/RustScan"
RUN git pull --force
RUN cargo install cargo-deb
RUN apt update -y && apt upgrade -y
RUN apt install libc6-dev-i386 -y
RUN git clone --depth=1 https://github.com/raspberrypi/tools /raspberrypi-tools
ENV PATH=/raspberrypi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/:$PATH
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
RUN mkdir /root/.cargo
RUN echo "[target.arm-unknown-linux-gnueabihf]" >> /root/.cargo/config
RUN echo "strip = { path = \"arm-linux-gnueabihf-strip\" }" >> /root/.cargo/config
RUN echo "objcopy = { path = \"arm-linux-gnueabihf-objcopy\" }" >> /root/.cargo/config
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Binary file not shown.
-17
View File
@@ -1,17 +0,0 @@
#!/bin/bash
cd /RustScan
git pull --force
#amd64
cargo deb
#arm64
rustup target add arm-unknown-linux-gnueabihf
cargo deb --target=arm-unknown-linux-gnueabihf
#i386
rustup target add i686-unknown-linux-gnu
cargo deb --target=i686-unknown-linux-gnu
find target/ -name \*.deb -exec cp {} /debs \;
-8
View File
@@ -1,8 +0,0 @@
#!/bin/bash
docker build -t rustscan-builder . || exit
# This creates a volume which binds your currentdirectory/debs to
# the location where the deb files get spat out in the container.
# You don't need to worry about it. Just chmod +x run.sh && ./run.sh and
# you'll get yer .deb file in a few minutes. It runs faster after you've used it the first time.
docker run -v "$(pwd)/debs:/debs" rustscan-builder
+281
View File
@@ -0,0 +1,281 @@
//! Provides functions to parse input IP addresses, CIDRs or files.
use std::fs::{self, File};
use std::io::{prelude::*, BufReader};
use std::net::{IpAddr, SocketAddr, ToSocketAddrs};
use std::path::Path;
use std::str::FromStr;
use cidr_utils::cidr::IpCidr;
use hickory_resolver::{
config::{NameServerConfig, Protocol, ResolverConfig, ResolverOpts},
Resolver,
};
use log::debug;
use crate::input::Opts;
use crate::warning;
/// Parses the string(s) into IP addresses.
///
/// Goes through all possible IP inputs (files or via argparsing).
///
/// ```rust
/// # use rustscan::input::Opts;
/// # use rustscan::address::parse_addresses;
/// let mut opts = Opts::default();
/// opts.addresses = vec!["192.168.0.0/30".to_owned()];
///
/// let ips = parse_addresses(&opts);
/// ```
pub fn parse_addresses(input: &Opts) -> Vec<IpAddr> {
let mut ips: Vec<IpAddr> = Vec::new();
let mut unresolved_addresses: Vec<&str> = Vec::new();
let backup_resolver = get_resolver(&input.resolver);
for address in &input.addresses {
let parsed_ips = parse_address(address, &backup_resolver);
if !parsed_ips.is_empty() {
ips.extend(parsed_ips);
} else {
unresolved_addresses.push(address);
}
}
// 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 {file_path:?} could not be resolved."),
input.greppable,
input.accessible
);
continue;
}
if let Ok(x) = read_ips_from_file(file_path, &backup_resolver) {
ips.extend(x);
} else {
warning!(
format!("Host {file_path:?} could not be resolved."),
input.greppable,
input.accessible
);
}
}
ips
}
/// Given a string, parse it as a host, IP address, or CIDR.
///
/// This allows us to pass files as hosts or cidr or IPs easily
/// Call this every time you have a possible IP-or-host.
///
/// If the address is a domain, we can self-resolve the domain locally
/// or resolve it by dns resolver list.
///
/// ```rust
/// # use rustscan::address::parse_address;
/// # use hickory_resolver::Resolver;
/// let ips = parse_address("127.0.0.1", &Resolver::default().unwrap());
/// ```
pub fn parse_address(address: &str, resolver: &Resolver) -> Vec<IpAddr> {
IpCidr::from_str(address)
.map(|cidr| cidr.iter().map(|c| c.address()).collect())
.ok()
.or_else(|| {
format!("{}:{}", &address, 80)
.to_socket_addrs()
.ok()
.map(|mut iter| vec![iter.next().unwrap().ip()])
})
.unwrap_or_else(|| resolve_ips_from_host(address, resolver))
}
/// Uses DNS to get the IPS associated with host
fn resolve_ips_from_host(source: &str, backup_resolver: &Resolver) -> Vec<IpAddr> {
let mut ips: Vec<IpAddr> = Vec::new();
if let Ok(addrs) = source.to_socket_addrs() {
for ip in addrs {
ips.push(ip.ip());
}
} else if let Ok(addrs) = backup_resolver.lookup_ip(source) {
ips.extend(addrs.iter());
}
ips
}
/// Derive a DNS resolver.
///
/// 1. if the `resolver` parameter has been set:
/// 1. assume the parameter is a path and attempt to read IPs.
/// 2. parse the input as a comma-separated list of IPs.
/// 2. if `resolver` is not set:
/// 1. attempt to derive a resolver from the system config. (e.g.
/// `/etc/resolv.conf` on *nix).
/// 2. finally, build a CloudFlare-based resolver (default
/// behaviour).
fn get_resolver(resolver: &Option<String>) -> Resolver {
match resolver {
Some(r) => {
let mut config = ResolverConfig::new();
let resolver_ips = match read_resolver_from_file(r) {
Ok(ips) => ips,
Err(_) => r
.split(',')
.filter_map(|r| IpAddr::from_str(r).ok())
.collect::<Vec<_>>(),
};
for ip in resolver_ips {
config.add_name_server(NameServerConfig::new(
SocketAddr::new(ip, 53),
Protocol::Udp,
));
}
Resolver::new(config, ResolverOpts::default()).unwrap()
}
None => match Resolver::from_system_conf() {
Ok(resolver) => resolver,
Err(_) => {
Resolver::new(ResolverConfig::cloudflare_tls(), ResolverOpts::default()).unwrap()
}
},
}
}
/// Parses and input file of IPs for use in DNS resolution.
fn read_resolver_from_file(path: &str) -> Result<Vec<IpAddr>, std::io::Error> {
let ips = fs::read_to_string(path)?
.lines()
.filter_map(|line| IpAddr::from_str(line.trim()).ok())
.collect();
Ok(ips)
}
#[cfg(not(tarpaulin_include))]
/// Parses an input file of IPs and uses those
fn read_ips_from_file(
ips: &std::path::Path,
backup_resolver: &Resolver,
) -> Result<Vec<IpAddr>, std::io::Error> {
let file = File::open(ips)?;
let reader = BufReader::new(file);
let mut ips: Vec<IpAddr> = Vec::new();
for address_line in reader.lines() {
if let Ok(address) = address_line {
ips.extend(parse_address(&address, backup_resolver));
} else {
debug!("Line in file is not valid");
}
}
Ok(ips)
}
#[cfg(test)]
mod tests {
use super::{get_resolver, parse_addresses, Opts};
use std::net::Ipv4Addr;
#[test]
fn parse_correct_addresses() {
let mut opts = Opts::default();
opts.addresses = vec!["127.0.0.1".to_owned(), "192.168.0.0/30".to_owned()];
let ips = parse_addresses(&opts);
assert_eq!(
ips,
[
Ipv4Addr::new(127, 0, 0, 1),
Ipv4Addr::new(192, 168, 0, 0),
Ipv4Addr::new(192, 168, 0, 1),
Ipv4Addr::new(192, 168, 0, 2),
Ipv4Addr::new(192, 168, 0, 3)
]
);
}
#[test]
fn parse_correct_host_addresses() {
let mut opts = Opts::default();
opts.addresses = vec!["google.com".to_owned()];
let ips = parse_addresses(&opts);
assert_eq!(ips.len(), 1);
}
#[test]
fn parse_correct_and_incorrect_addresses() {
let mut opts = Opts::default();
opts.addresses = vec!["127.0.0.1".to_owned(), "im_wrong".to_owned()];
let ips = parse_addresses(&opts);
assert_eq!(ips, [Ipv4Addr::new(127, 0, 0, 1),]);
}
#[test]
fn parse_incorrect_addresses() {
let mut opts = Opts::default();
opts.addresses = vec!["im_wrong".to_owned(), "300.10.1.1".to_owned()];
let ips = parse_addresses(&opts);
assert!(ips.is_empty());
}
#[test]
fn parse_hosts_file_and_incorrect_hosts() {
// Host file contains IP, Hosts, incorrect IPs, incorrect hosts
let mut opts = Opts::default();
opts.addresses = vec!["fixtures/hosts.txt".to_owned()];
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);
}
#[test]
fn resolver_default_cloudflare() {
let opts = Opts::default();
let resolver = get_resolver(&opts.resolver);
let lookup = resolver.lookup_ip("www.example.com.").unwrap();
assert!(opts.resolver.is_none());
assert!(lookup.iter().next().is_some());
}
#[test]
fn resolver_args_google_dns() {
let mut opts = Opts::default();
// https://developers.google.com/speed/public-dns
opts.resolver = Some("8.8.8.8,8.8.4.4".to_owned());
let resolver = get_resolver(&opts.resolver);
let lookup = resolver.lookup_ip("www.example.com.").unwrap();
assert!(lookup.iter().next().is_some());
}
}
+94
View File
@@ -0,0 +1,94 @@
//! Provides functionality to capture timing information for scans.
//!
//! # Usage
//!
//! ```rust
//! // Initiate Benchmark vector
//! # use rustscan::benchmark::{Benchmark, NamedTimer};
//! # use log::info;
//! let mut bm = Benchmark::init();
//! // Start named timer with name
//! let mut example_bench = NamedTimer::start("Example Bench");
//! // Stop named timer
//! example_bench.end();
//! // Add named timer to Benchmarks
//! bm.push(example_bench);
//! // Print Benchmark Summary
//! info!("{}", bm.summary());
//! ```
use std::time::Instant;
/// A Benchmark struct to hold NamedTimers with name, start and end Instants,
#[derive(Debug)]
pub struct Benchmark {
named_timers: Vec<NamedTimer>,
}
impl Benchmark {
pub fn init() -> Self {
Self {
named_timers: Vec::new(),
}
}
pub fn push(&mut self, timer: NamedTimer) {
self.named_timers.push(timer);
}
/// Summary of the benchmarks will destruct the vector,
/// formats every element the same way and return
/// a single String with all the available information
/// for easy printing
pub fn summary(&self) -> String {
let mut summary = String::from("\nRustScan Benchmark Summary");
for timer in &self.named_timers {
if timer.start.is_some() && timer.end.is_some() {
let runtime_secs = timer
.end
.unwrap()
.saturating_duration_since(timer.start.unwrap())
.as_secs_f32();
summary.push_str(&format!("\n{0: <10} | {1: <10}s", timer.name, runtime_secs));
}
}
summary
}
}
/// The purpose of NamedTimer is to hold a name,
/// start Instant and end Instant for a specific timer.
/// The given name will be presented in the benchmark summary,
/// start and end Instants will be used for calculating runtime.
#[derive(Debug)]
pub struct NamedTimer {
name: &'static str,
start: Option<Instant>,
end: Option<Instant>,
}
impl NamedTimer {
pub fn start(name: &'static str) -> Self {
Self {
name,
start: Some(Instant::now()),
end: None,
}
}
pub fn end(&mut self) {
self.end = Some(Instant::now());
}
}
#[test]
fn benchmark() {
let mut benchmarks = Benchmark::init();
let mut test_timer = NamedTimer::start("test");
std::thread::sleep(std::time::Duration::from_millis(100));
test_timer.end();
benchmarks.push(test_timer);
benchmarks.push(NamedTimer::start("only_start"));
assert!(benchmarks
.summary()
.contains("\nRustScan Benchmark Summary\ntest | 0."));
assert!(!benchmarks.summary().contains("only_start"));
}
+420
View File
@@ -0,0 +1,420 @@
//! Provides a means to read, parse and hold configuration options for scans.
use clap::{Parser, ValueEnum};
use serde_derive::Deserialize;
use std::collections::HashMap;
use std::fs;
use std::path::PathBuf;
const LOWEST_PORT_NUMBER: u16 = 1;
const TOP_PORT_NUMBER: u16 = 65535;
/// Represents the strategy in which the port scanning will run.
/// - Serial will run from start to end, for example 1 to 1_000.
/// - Random will randomize the order in which ports will be scanned.
#[derive(Deserialize, Debug, ValueEnum, Clone, Copy, PartialEq, Eq)]
pub enum ScanOrder {
Serial,
Random,
}
/// Represents the scripts variant.
/// - none will avoid running any script, only portscan results will be shown.
/// - default will run the default embedded nmap script, that's part of RustScan since the beginning.
/// - custom will read the ScriptConfig file and the available scripts in the predefined folders
#[derive(Deserialize, Debug, ValueEnum, Clone, PartialEq, Eq, Copy)]
pub enum ScriptsRequired {
None,
Default,
Custom,
}
/// Represents the range of ports to be scanned.
#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct PortRange {
pub start: u16,
pub end: u16,
}
#[cfg(not(tarpaulin_include))]
fn parse_range(input: &str) -> Result<PortRange, String> {
let range = input
.split('-')
.map(str::parse)
.collect::<Result<Vec<u16>, std::num::ParseIntError>>();
if range.is_err() {
return Err(String::from(
"the range format must be 'start-end'. Example: 1-1000.",
));
}
match range.unwrap().as_slice() {
[start, end] => Ok(PortRange {
start: *start,
end: *end,
}),
_ => Err(String::from(
"the range format must be 'start-end'. Example: 1-1000.",
)),
}
}
#[derive(Parser, Debug, Clone)]
#[command(
name = "rustscan",
version = env!("CARGO_PKG_VERSION"),
max_term_width = 120,
help_template = "{bin} {version}\n{about}\n\nUSAGE:\n {usage}\n\nOPTIONS:\n{options}",
)]
#[allow(clippy::struct_excessive_bools)]
/// Fast Port Scanner built in Rust.
/// WARNING Do not use this program against sensitive infrastructure since the
/// specified server may not be able to handle this many socket connections at once.
/// - Discord <http://discord.skerritt.blog>
/// - GitHub <https://github.com/RustScan/RustScan>
pub struct Opts {
/// A comma-delimited list or newline-delimited file of separated CIDRs, IPs, or hosts to be scanned.
#[arg(short, long, value_delimiter = ',')]
pub addresses: Vec<String>,
/// A list of comma separated ports to be scanned. Example: 80,443,8080.
#[arg(short, long, value_delimiter = ',')]
pub ports: Option<Vec<u16>>,
/// A range of ports with format start-end. Example: 1-1000.
#[arg(short, long, conflicts_with = "ports", value_parser = parse_range)]
pub range: Option<PortRange>,
/// Whether to ignore the configuration file or not.
#[arg(short, long)]
pub no_config: bool,
/// Custom path to config file
#[arg(short, long, value_parser)]
pub config_path: Option<PathBuf>,
/// Greppable mode. Only output the ports. No Nmap. Useful for grep or outputting to a file.
#[arg(short, long)]
pub greppable: bool,
/// Accessible mode. Turns off features which negatively affect screen readers.
#[arg(long)]
pub accessible: bool,
/// A comma-delimited list or file of DNS resolvers.
#[arg(long)]
pub resolver: Option<String>,
/// 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 at the same time. Although, your OS may not
/// support this.
#[arg(short, long, default_value = "4500")]
pub batch_size: u16,
/// The timeout in milliseconds before a port is assumed to be closed.
#[arg(short, long, default_value = "1500")]
pub timeout: u32,
/// The number of tries before a port is assumed to be closed.
/// If set to 0, rustscan will correct it to 1.
#[arg(long, default_value = "1")]
pub tries: u8,
/// Automatically ups the ULIMIT with the value you provided.
#[arg(short, long)]
pub ulimit: Option<u64>,
/// The order of scanning to be performed. The "serial" option will
/// scan ports in ascending order while the "random" option will scan
/// ports randomly.
#[arg(long, value_enum, ignore_case = true, default_value = "serial")]
pub scan_order: ScanOrder,
/// Level of scripting required for the run.
#[arg(long, value_enum, ignore_case = true, default_value = "default")]
pub scripts: ScriptsRequired,
/// Use the top 1000 ports.
#[arg(long)]
pub top: bool,
/// The Script arguments to run.
/// To use the argument -A, end RustScan's args with '-- -A'.
/// Example: 'rustscan -t 1500 -a 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)'\"
#[arg(last = true)]
pub command: Vec<String>,
/// A list of comma separated ports to be excluded from scanning. Example: 80,443,8080.
#[arg(short, long, value_delimiter = ',')]
pub exclude_ports: Option<Vec<u16>>,
/// UDP scanning mode, finds UDP ports that send back responses
#[arg(long)]
pub udp: bool,
}
#[cfg(not(tarpaulin_include))]
impl Opts {
pub fn read() -> Self {
let mut opts = Opts::parse();
if opts.ports.is_none() && opts.range.is_none() {
opts.range = Some(PortRange {
start: LOWEST_PORT_NUMBER,
end: TOP_PORT_NUMBER,
});
}
opts
}
/// Reads the command line arguments into an Opts struct and merge
/// values found within the user configuration file.
pub fn merge(&mut self, config: &Config) {
if !self.no_config {
self.merge_required(config);
self.merge_optional(config);
}
}
fn merge_required(&mut self, config: &Config) {
macro_rules! merge_required {
($($field: ident),+) => {
$(
if let Some(e) = &config.$field {
self.$field = e.clone();
}
)+
}
}
merge_required!(
addresses, greppable, accessible, batch_size, timeout, tries, scan_order, scripts,
command, udp
);
}
fn merge_optional(&mut self, config: &Config) {
macro_rules! merge_optional {
($($field: ident),+) => {
$(
if config.$field.is_some() {
self.$field = config.$field.clone();
}
)+
}
}
// Only use top ports when the user asks for them
if self.top && config.ports.is_some() {
let mut ports: Vec<u16> = Vec::with_capacity(config.ports.as_ref().unwrap().len());
for entry in config.ports.as_ref().unwrap().keys() {
ports.push(entry.parse().unwrap());
}
self.ports = Some(ports);
}
merge_optional!(range, resolver, ulimit, exclude_ports);
}
}
impl Default for Opts {
fn default() -> Self {
Self {
addresses: vec![],
ports: None,
range: None,
greppable: true,
batch_size: 0,
timeout: 0,
tries: 0,
ulimit: None,
command: vec![],
accessible: false,
resolver: None,
scan_order: ScanOrder::Serial,
no_config: true,
top: false,
scripts: ScriptsRequired::Default,
config_path: None,
exclude_ports: None,
udp: false,
}
}
}
/// Struct used to deserialize the options specified within our config file.
/// These will be further merged with our command line arguments in order to
/// generate the final Opts struct.
#[cfg(not(tarpaulin_include))]
#[derive(Debug, Deserialize)]
pub struct Config {
addresses: Option<Vec<String>>,
ports: Option<HashMap<String, u16>>,
range: Option<PortRange>,
greppable: Option<bool>,
accessible: Option<bool>,
batch_size: Option<u16>,
timeout: Option<u32>,
tries: Option<u8>,
ulimit: Option<u64>,
resolver: Option<String>,
scan_order: Option<ScanOrder>,
command: Option<Vec<String>>,
scripts: Option<ScriptsRequired>,
exclude_ports: Option<Vec<u16>>,
udp: Option<bool>,
}
#[cfg(not(tarpaulin_include))]
#[allow(clippy::doc_link_with_quotes)]
impl Config {
/// Reads the configuration file with TOML format and parses it into a
/// Config struct.
///
/// # Format
///
/// addresses = ["127.0.0.1", "127.0.0.1"]
/// ports = [80, 443, 8080]
/// greppable = true
/// scan_order: "Serial"
/// exclude_ports = [8080, 9090, 80]
/// udp = false
///
pub fn read(custom_config_path: Option<PathBuf>) -> Self {
let mut content = String::new();
let config_path = custom_config_path.unwrap_or_else(default_config_path);
if config_path.exists() {
content = match fs::read_to_string(config_path) {
Ok(content) => content,
Err(_) => String::new(),
}
}
let config: Config = match toml::from_str(&content) {
Ok(config) => config,
Err(e) => {
println!("Found {e} in configuration file.\nAborting scan.\n");
std::process::exit(1);
}
};
config
}
}
/// Constructs default path to config toml
pub fn default_config_path() -> PathBuf {
let Some(mut config_path) = dirs::home_dir() else {
panic!("Could not infer config file path.");
};
config_path.push(".rustscan.toml");
config_path
}
#[cfg(test)]
mod tests {
use clap::{CommandFactory, Parser};
use parameterized::parameterized;
use super::{Config, Opts, PortRange, ScanOrder, ScriptsRequired};
impl Config {
fn default() -> Self {
Self {
addresses: Some(vec!["127.0.0.1".to_owned()]),
ports: None,
range: None,
greppable: Some(true),
batch_size: Some(25_000),
timeout: Some(1_000),
tries: Some(1),
ulimit: None,
command: Some(vec!["-A".to_owned()]),
accessible: Some(true),
resolver: None,
scan_order: Some(ScanOrder::Random),
scripts: None,
exclude_ports: None,
udp: Some(false),
}
}
}
#[test]
fn verify_cli() {
Opts::command().debug_assert();
}
#[parameterized(input = {
vec!["rustscan", "--addresses", "127.0.0.1"],
vec!["rustscan", "--addresses", "127.0.0.1", "--", "-sCV"],
vec!["rustscan", "--addresses", "127.0.0.1", "--", "-A"],
vec!["rustscan", "-t", "1500", "-a", "127.0.0.1", "--", "-A", "-sC"],
vec!["rustscan", "--addresses", "127.0.0.1", "--", "--script", r#""'(safe and vuln)'""#],
}, command = {
vec![],
vec!["-sCV".to_owned()],
vec!["-A".to_owned()],
vec!["-A".to_owned(), "-sC".to_owned()],
vec!["--script".to_owned(), "\"'(safe and vuln)'\"".to_owned()],
})]
fn parse_trailing_command(input: Vec<&str>, command: Vec<String>) {
let opts = Opts::parse_from(input);
assert_eq!(vec!["127.0.0.1".to_owned()], opts.addresses);
assert_eq!(command, opts.command);
}
#[test]
fn opts_no_merge_when_config_is_ignored() {
let mut opts = Opts::default();
let config = Config::default();
opts.merge(&config);
assert_eq!(opts.addresses, vec![] as Vec<String>);
assert!(opts.greppable);
assert!(!opts.accessible);
assert_eq!(opts.timeout, 0);
assert_eq!(opts.command, vec![] as Vec<String>);
assert_eq!(opts.scan_order, ScanOrder::Serial);
}
#[test]
fn opts_merge_required_arguments() {
let mut opts = Opts::default();
let config = Config::default();
opts.merge_required(&config);
assert_eq!(opts.addresses, config.addresses.unwrap());
assert_eq!(opts.greppable, config.greppable.unwrap());
assert_eq!(opts.timeout, config.timeout.unwrap());
assert_eq!(opts.command, config.command.unwrap());
assert_eq!(opts.accessible, config.accessible.unwrap());
assert_eq!(opts.scan_order, config.scan_order.unwrap());
assert_eq!(opts.scripts, ScriptsRequired::Default);
}
#[test]
fn opts_merge_optional_arguments() {
let mut opts = Opts::default();
let mut config = Config::default();
config.range = Some(PortRange {
start: 1,
end: 1_000,
});
config.ulimit = Some(1_000);
config.resolver = Some("1.1.1.1".to_owned());
opts.merge_optional(&config);
assert_eq!(opts.range, config.range);
assert_eq!(opts.ulimit, config.ulimit);
assert_eq!(opts.resolver, config.resolver);
}
}
+58
View File
@@ -0,0 +1,58 @@
//! This crate exposes the internal functionality of the
//! [RustScan](https://rustscan.github.io/RustScan) port scanner.
//!
//! ## Example: perform a scan against localhost
//!
//! The core scanning behaviour is managed by
//! [`Scanner`](crate::scanner::Scanner) which in turn requires a
//! [`PortStrategy`](crate::port_strategy::PortStrategy):
//!
//! ```rust
//! use async_std::task::block_on;
//! use std::{net::IpAddr, time::Duration};
//!
//! use rustscan::input::{PortRange, ScanOrder};
//! use rustscan::port_strategy::PortStrategy;
//! use rustscan::scanner::Scanner;
//!
//! fn main() {
//! let addrs = vec!["127.0.0.1".parse::<IpAddr>().unwrap()];
//! let range = PortRange {
//! start: 1,
//! end: 1_000,
//! };
//! let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
//! let scanner = Scanner::new(
//! &addrs,
//! 10,
//! Duration::from_millis(100),
//! 1,
//! true,
//! strategy,
//! true,
//! vec![9000],
//! false,
//! );
//!
//! let scan_result = block_on(scanner.run());
//!
//! println!("{:?}", scan_result);
//! }
//! ```
#![allow(clippy::needless_doctest_main)]
pub mod tui;
pub mod input;
pub mod scanner;
pub mod port_strategy;
pub mod benchmark;
pub mod scripts;
pub mod address;
pub mod udp_packets;
+335 -179
View File
@@ -1,207 +1,363 @@
mod scanner;
use scanner::Scanner;
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::doc_markdown, clippy::if_not_else, clippy::non_ascii_literal)]
use clap::{App, Arg, AppSettings};
use colored::*;
use std::time::Duration;
use std::process::{exit, Command};
use std::convert::TryInto;
use rustscan::benchmark::{Benchmark, NamedTimer};
use rustscan::input::{self, Config, Opts, ScriptsRequired};
use rustscan::port_strategy::PortStrategy;
use rustscan::scanner::Scanner;
use rustscan::scripts::{init_scripts, Script, ScriptFile};
use rustscan::{detail, funny_opening, output, warning};
use colorful::{Color, Colorful};
use futures::executor::block_on;
use rlimit::Resource;
use rlimit::{setrlimit, getrlimit};
use std::collections::HashMap;
use std::net::IpAddr;
use std::string::ToString;
use std::time::Duration;
use rustscan::address::parse_addresses;
extern crate colorful;
extern crate dirs;
// Average value for Ubuntu
#[cfg(unix)]
const DEFAULT_FILE_DESCRIPTORS_LIMIT: u64 = 8000;
// Safest batch size based on experimentation
const AVERAGE_BATCH_SIZE: u16 = 3000;
#[macro_use]
extern crate log;
#[cfg(not(tarpaulin_include))]
#[allow(clippy::too_many_lines)]
/// Faster Nmap scanning with Rust
/// If you're looking for the actual scanning, check out the module Scanner
fn main() {
let matches = App::new("RustScan")
.author("Bee https://github.com/brandonskerritt")
.about("Fast Port Scanner built in Rust\nWARNING Do not use this program against sensitive infrastructure. The specified server may not be able to handle this many socket connections at once.")
.version("1.2.0")
.setting(AppSettings::TrailingVarArg)
env_logger::init();
let mut benchmarks = Benchmark::init();
let mut rustscan_bench = NamedTimer::start("RustScan");
// IP address is a required argument
.arg(Arg::with_name("ip")
.required(true)
.index(1)
.long("ip-address")
.help("The IP address to scan"))
.arg(Arg::with_name("b")
.short("b")
.long("batch")
.takes_value(true)
.default_value("4500")
.help("Increases speed of scanning. The batch size for port scanning. Depends on your open file limit of OS. If you do 65535 it will do every port at the same time. Although, your OS may not support this."))
.arg(Arg::with_name("T")
.short("T")
.long("timeout")
.takes_value(true)
.default_value("1500")
.help("The timeout before a port is assumed to be close. In MS."))
.arg(Arg::with_name("q")
.short("-q")
.long("quiet")
.takes_value(false)
.help("Quiet mode. Only output the ports. No Nmap. Useful for grep or outputting to a file."))
.arg(Arg::with_name("u")
.short("u")
.long("ulimit")
.help("Automatically ups the ULIMIT with the value you provided.")
.takes_value(true))
.arg(
Arg::with_name("command")
.help("The Nmap arguments to run. To use the argument -A, end RustScan's args with '-- -A'. To run EXAMPLE: 'rustscan -T 1500 127.0.0.1 -- -A -sC'. This argument auto runs nmap {your commands} -vvv -p $PORTS ")
.takes_value(true)
.multiple(true),
)
.get_matches();
let mut opts: Opts = Opts::read();
let config = Config::read(opts.config_path.clone());
opts.merge(&config);
debug!("Main() `opts` arguments are {:?}", opts);
let ip = matches.value_of("ip").unwrap_or("None");
let ulimit_arg = matches.value_of("u").unwrap_or("None");
let quiet = if matches.is_present("q") { true } else { false };
let command_matches= matches.values_of("command");
let command_run: String = match command_matches {
// We use the user supplied args
Some(_x) => {
// TODO x is the same as below, use that instead
matches.values_of("command").unwrap().collect::<Vec<_>>().join(" ")
let scripts_to_run: Vec<ScriptFile> = match init_scripts(opts.scripts) {
Ok(scripts_to_run) => scripts_to_run,
Err(e) => {
warning!(
format!("Initiating scripts failed!\n{e}"),
opts.greppable,
opts.accessible
);
std::process::exit(1);
}
// we default
None => "-A -vvv".to_string()
};
let mut batch_size: u64 = matches
.value_of("b")
.unwrap_or("None")
.parse::<u64>()
.unwrap();
debug!("Scripts initialized {:?}", &scripts_to_run);
if !quiet {
print_opening();
if !opts.greppable && !opts.accessible {
print_opening(&opts);
}
// checks ulimit
let ips: Vec<IpAddr> = parse_addresses(&opts);
// change ulimit size
if !(ulimit_arg == "None") {
let limit = ulimit_arg.parse::<u64>().unwrap();
if !quiet{
println!("Automatically upping ulimit to {}", ulimit_arg);
}
let uresult = setrlimit(Resource::NOFILE, limit, limit);
match uresult {
Ok(_) => {}
Err(_) => {println!("ERROR. Failed to set Ulimit.")}
}
}
let (x, _) = getrlimit(Resource::NOFILE).unwrap();
// if maximum limit is lower than batch size
// automatically re-adjust the batch size
if x < batch_size.into() {
if !quiet{
println!("{}", "WARNING: Your file description limit is lower than selected batch size. Please considering upping this (how to is on the README). NOTE: this may be dangerous and may cause harm to sensitive servers. Automatically reducing Batch Size to match your limit, this process isn't harmful but reduces speed.".red());
// TODO this is a joke please fix
// if the OS supports high file limits like 8000
// but the user selected a batch size higher than this
// reduce to a lower number
// basically, ubuntu is 8000
// but i can only get it to work on < 5k in testing
// 5k is default, so 3000 seems safe
if x > 8000{
batch_size = 3000
}
else {
let ten: u64 = 100;
batch_size = x - ten;
}
}
}
// else if the ulimit is higher than batch size
// tell the user they can increase batch size
// if the user set ulimit arg they probably know what they are doing so don't print this
else if x + 2 > batch_size.into() && (ulimit_arg == "None"){
if !quiet{
// TODO this is a joke please fix
let one: u64 = 1;
println!("Your file description limit is higher than the batch size. You can potentially increase the speed by increasing the batch size, but this may cause harm to sensitive servers. Your limit is {}, try batch size {}.", x, x - one);
}
}
// the user has asked to automatically up the ulimit
// gets timeout
let duration_timeout =
matches
.value_of("T")
.unwrap_or("None")
.parse::<u64>()
.unwrap();
// 65535 + 1 because of 0 indexing
let scanner = Scanner::new(ip, 1, 65536, batch_size.try_into().unwrap(), Duration::from_millis(duration_timeout), quiet);
let scan_result = block_on(scanner.run());
// prints ports and places them into nmap string
let nmap_str_ports: Vec<String> = scan_result.into_iter().map(|port| port.to_string()).collect();
// if no ports are found, suggest running with less
if nmap_str_ports.is_empty() {
panic!("{} Looks like I didn't find any open ports. This is usually caused by a high batch size.
\n*I used {} threads, consider lowering to {} with {} or a comfortable number lfor your system.
\n Alternatively, increase the timeout if your ping is high. Rustscan -T 2000 for 2000 second timeout.", "ERROR".red(), batch_size, (batch_size / 2).to_string().green(), "'rustscan -b <batch_size> <ip address>'".green());
}
// Tells the user we are now switching to Nmap
if !quiet{
println!(
"{}",
"Starting nmap.".blue(),
if ips.is_empty() {
warning!(
"No IPs could be resolved, aborting scan.",
opts.greppable,
opts.accessible
);
std::process::exit(1);
}
// nmap port style is 80,443. Comma seperated with no spaces.
let ports_str = nmap_str_ports.join(",");
#[cfg(unix)]
let batch_size: u16 = infer_batch_size(&opts, adjust_ulimit_size(&opts));
// if quiet mode is on, return ports and exit
if quiet{
println!("{:?}", ports_str);
exit(1);
#[cfg(not(unix))]
let batch_size: u16 = AVERAGE_BATCH_SIZE;
// Added by wasuaje - 01/26/2024:
// exclude_ports is an exclusion port list
//
// Added by brendanglancy - 5/19/2024:
// udp is an option to do a udp scan
let scanner = Scanner::new(
&ips,
batch_size,
Duration::from_millis(opts.timeout.into()),
opts.tries,
opts.greppable,
PortStrategy::pick(&opts.range, opts.ports, opts.scan_order),
opts.accessible,
opts.exclude_ports.unwrap_or_default(),
opts.udp,
);
debug!("Scanner finished building: {:?}", scanner);
let mut portscan_bench = NamedTimer::start("Portscan");
let scan_result = block_on(scanner.run());
portscan_bench.end();
benchmarks.push(portscan_bench);
let mut ports_per_ip = HashMap::new();
for socket in scan_result {
ports_per_ip
.entry(socket.ip())
.or_insert_with(Vec::new)
.push(socket.port());
}
let string_format = format!("{} {} {} {} {} {}", command_run, "-Pn", "-vvv", "-p", &ports_str, ip);
if !quiet{
println!("The Nmap command to be run is {}", string_format);
for ip in ips {
if ports_per_ip.contains_key(&ip) {
continue;
}
// If we got here it means the IP was not found within the HashMap, this
// means the scan couldn't find any open ports for it.
let x = format!("Looks like I didn't find any open ports for {:?}. This is usually caused by a high batch size.
\n*I used {} batch size, consider lowering it with {} or a comfortable number for your system.
\n Alternatively, increase the timeout if your ping is high. Rustscan -t 2000 for 2000 milliseconds (2s) timeout.\n",
ip,
opts.batch_size,
"'rustscan -b <batch_size> -a <ip address>'");
warning!(x, opts.greppable, opts.accessible);
}
let command_list = string_format.split_whitespace();
let vec = command_list.collect::<Vec<&str>>();
// Runs the nmap command and spawns it as a process.
let mut child = Command::new("nmap")
.args(&vec)
.spawn()
.expect("failed to execute nmap process");
let mut script_bench = NamedTimer::start("Scripts");
for (ip, ports) in &ports_per_ip {
let vec_str_ports: Vec<String> = ports.iter().map(ToString::to_string).collect();
child.wait().expect("failed to wait on nmap process");
// nmap port style is 80,443. Comma separated with no spaces.
let ports_str = vec_str_ports.join(",");
// if option scripts is none, no script will be spawned
if opts.greppable || opts.scripts == ScriptsRequired::None {
println!("{} -> [{}]", &ip, ports_str);
continue;
}
detail!("Starting Script(s)", opts.greppable, opts.accessible);
// Run all the scripts we found and parsed based on the script config file tags field.
for mut script_f in scripts_to_run.clone() {
// This part allows us to add commandline arguments to the Script call_format, appending them to the end of the command.
if !opts.command.is_empty() {
let user_extra_args = &opts.command.join(" ");
debug!("Extra args vec {:?}", user_extra_args);
if script_f.call_format.is_some() {
let mut call_f = script_f.call_format.unwrap();
call_f.push(' ');
call_f.push_str(user_extra_args);
output!(
format!("Running script {:?} on ip {}\nDepending on the complexity of the script, results may take some time to appear.", call_f, &ip),
opts.greppable,
opts.accessible
);
debug!("Call format {}", call_f);
script_f.call_format = Some(call_f);
}
}
// Building the script with the arguments from the ScriptFile, and ip-ports.
let script = Script::build(
script_f.path,
*ip,
ports.clone(),
script_f.port,
script_f.ports_separator,
script_f.tags,
script_f.call_format,
);
match script.run() {
Ok(script_result) => {
detail!(script_result.to_string(), opts.greppable, opts.accessible);
}
Err(e) => {
warning!(&format!("Error {e}"), opts.greppable, opts.accessible);
}
}
}
}
// To use the runtime benchmark, run the process as: RUST_LOG=info ./rustscan
script_bench.end();
benchmarks.push(script_bench);
rustscan_bench.end();
benchmarks.push(rustscan_bench);
debug!("Benchmarks raw {:?}", benchmarks);
info!("{}", benchmarks.summary());
}
fn print_opening() {
let s = "
_____ _ _____
| __ \\ | | / ____|
| |__) | _ ___| |_| (___ ___ __ _ _ __
| _ / | | / __| __|\\___ \\ / __/ _` | '_ \\
| | \\ \\ |_| \\__ \\ |_ ____) | (_| (_| | | | |
|_| \\_\\__,_|___/\\__|_____/ \\___\\__,_|_| |_|
Faster nmap scanning with rust.";
println!(
"{} \n {} \n {}",
s.green(),
"Automated Decryption Tool - https://github.com/ciphey/ciphey".green(),
"Creator https://github.com/brandonskerritt".green()
/// Prints the opening title of RustScan
#[allow(clippy::items_after_statements, clippy::needless_raw_string_hashes)]
fn print_opening(opts: &Opts) {
debug!("Printing opening");
let s = format!(
"{}\n{}\n{}\n{}\n{}",
r#".----. .-. .-. .----..---. .----. .---. .--. .-. .-."#,
r#"| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| |"#,
r#"| .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ |"#,
r#"`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'"#,
r#"The Modern Day Port Scanner."#
);
println!("{}", s.gradient(Color::Green).bold());
let info = format!(
"{}\n{}\n{}\n{}",
r#"________________________________________"#,
r#": http://discord.skerritt.blog :"#,
r#": https://github.com/RustScan/RustScan :"#,
r#" --------------------------------------"#
);
println!("{}", info.gradient(Color::Yellow).bold());
funny_opening!();
let config_path = opts
.config_path
.clone()
.unwrap_or_else(input::default_config_path);
detail!(
format!("The config file is expected to be at {config_path:?}"),
opts.greppable,
opts.accessible
);
}
#[cfg(unix)]
fn adjust_ulimit_size(opts: &Opts) -> u64 {
use rlimit::Resource;
if let Some(limit) = opts.ulimit {
if Resource::NOFILE.set(limit, limit).is_ok() {
detail!(
format!("Automatically increasing ulimit value to {limit}."),
opts.greppable,
opts.accessible
);
} else {
warning!(
"ERROR. Failed to set ulimit value.",
opts.greppable,
opts.accessible
);
}
}
let (soft, _) = Resource::NOFILE.get().unwrap();
soft
}
#[cfg(unix)]
fn infer_batch_size(opts: &Opts, ulimit: u64) -> u16 {
use std::convert::TryInto;
let mut batch_size: u64 = opts.batch_size.into();
// Adjust the batch size when the ulimit value is lower than the desired batch size
if ulimit < batch_size {
warning!("File limit is lower than default batch size. Consider upping with --ulimit. May cause harm to sensitive servers",
opts.greppable, opts.accessible
);
// When the OS supports high file limits like 8000, but the user
// selected a batch size higher than this we should reduce it to
// a lower number.
if ulimit < AVERAGE_BATCH_SIZE.into() {
// ulimit is smaller than aveage batch size
// user must have very small ulimit
// decrease batch size to half of ulimit
warning!("Your file limit is very small, which negatively impacts RustScan's speed. Use the Docker image, or up the Ulimit with '--ulimit 5000'. ", opts.greppable, opts.accessible);
info!("Halving batch_size because ulimit is smaller than average batch size");
batch_size = ulimit / 2;
} else if ulimit > DEFAULT_FILE_DESCRIPTORS_LIMIT {
info!("Batch size is now average batch size");
batch_size = AVERAGE_BATCH_SIZE.into();
} else {
batch_size = ulimit - 100;
}
}
// When the ulimit is higher than the batch size let the user know that the
// batch size can be increased unless they specified the ulimit themselves.
else if ulimit + 2 > batch_size && (opts.ulimit.is_none()) {
detail!(format!("File limit higher than batch size. Can increase speed by increasing batch size '-b {}'.", ulimit - 100),
opts.greppable, opts.accessible);
}
batch_size
.try_into()
.expect("Couldn't fit the batch size into a u16.")
}
#[cfg(test)]
mod tests {
#[cfg(unix)]
use super::{adjust_ulimit_size, infer_batch_size};
use super::{print_opening, Opts};
#[test]
#[cfg(unix)]
fn batch_size_lowered() {
let mut opts = Opts::default();
opts.batch_size = 50_000;
let batch_size = infer_batch_size(&opts, 120);
assert!(batch_size < opts.batch_size);
}
#[test]
#[cfg(unix)]
fn batch_size_lowered_average_size() {
let mut opts = Opts::default();
opts.batch_size = 50_000;
let batch_size = infer_batch_size(&opts, 9_000);
assert!(batch_size == 3_000);
}
#[test]
#[cfg(unix)]
fn batch_size_equals_ulimit_lowered() {
// because ulimit and batch size are same size, batch size is lowered
// to ULIMIT - 100
let mut opts = Opts::default();
opts.batch_size = 50_000;
let batch_size = infer_batch_size(&opts, 5_000);
assert!(batch_size == 4_900);
}
#[test]
#[cfg(unix)]
fn batch_size_adjusted_2000() {
// ulimit == batch_size
let mut opts = Opts::default();
opts.batch_size = 50_000;
opts.ulimit = Some(2_000);
let batch_size = adjust_ulimit_size(&opts);
assert!(batch_size == 2_000);
}
#[test]
#[cfg(unix)]
fn test_high_ulimit_no_greppable_mode() {
let mut opts = Opts::default();
opts.batch_size = 10;
opts.greppable = false;
let batch_size = infer_batch_size(&opts, 1_000_000);
assert!(batch_size == opts.batch_size);
}
#[test]
fn test_print_opening_no_panic() {
let mut opts = Opts::default();
opts.ulimit = Some(2_000);
// print opening should not panic
print_opening(&opts);
}
}
+140
View File
@@ -0,0 +1,140 @@
//! Provides a means to hold configuration options specifically for port scanning.
mod range_iterator;
use crate::input::{PortRange, ScanOrder};
use rand::seq::SliceRandom;
use rand::thread_rng;
use range_iterator::RangeIterator;
/// Represents options of port scanning.
///
/// Right now all these options involve ranges, but in the future
/// it will also contain custom lists of ports.
#[derive(Debug)]
pub enum PortStrategy {
Manual(Vec<u16>),
Serial(SerialRange),
Random(RandomRange),
}
impl PortStrategy {
pub fn pick(range: &Option<PortRange>, ports: Option<Vec<u16>>, order: ScanOrder) -> Self {
match order {
ScanOrder::Serial if ports.is_none() => {
let range = range.as_ref().unwrap();
PortStrategy::Serial(SerialRange {
start: range.start,
end: range.end,
})
}
ScanOrder::Random if ports.is_none() => {
let range = range.as_ref().unwrap();
PortStrategy::Random(RandomRange {
start: range.start,
end: range.end,
})
}
ScanOrder::Serial => PortStrategy::Manual(ports.unwrap()),
ScanOrder::Random => {
let mut rng = thread_rng();
let mut ports = ports.unwrap();
ports.shuffle(&mut rng);
PortStrategy::Manual(ports)
}
}
}
pub fn order(&self) -> Vec<u16> {
match self {
PortStrategy::Manual(ports) => ports.clone(),
PortStrategy::Serial(range) => range.generate(),
PortStrategy::Random(range) => range.generate(),
}
}
}
/// Trait associated with a port strategy. Each PortStrategy must be able
/// to generate an order for future port scanning.
trait RangeOrder {
fn generate(&self) -> Vec<u16>;
}
/// As the name implies SerialRange will always generate a vector in
/// ascending order.
#[derive(Debug)]
pub struct SerialRange {
start: u16,
end: u16,
}
impl RangeOrder for SerialRange {
fn generate(&self) -> Vec<u16> {
(self.start..=self.end).collect()
}
}
/// As the name implies RandomRange will always generate a vector with
/// a random order. This vector is built following the LCG algorithm.
#[derive(Debug)]
pub struct RandomRange {
start: u16,
end: u16,
}
impl RangeOrder for RandomRange {
// Right now using RangeIterator and generating a range + shuffling the
// vector is pretty much the same. The advantages of it will come once
// we have to generate different ranges for different IPs without storing
// actual vectors.
//
// Another benefit of RangeIterator is that it always generate a range with
// a certain distance between the items in the Array. The chances of having
// port numbers close to each other are pretty slim due to the way the
// algorithm works.
fn generate(&self) -> Vec<u16> {
RangeIterator::new(self.start.into(), self.end.into()).collect()
}
}
#[cfg(test)]
mod tests {
use super::PortStrategy;
use crate::input::{PortRange, ScanOrder};
#[test]
fn serial_strategy_with_range() {
let range = PortRange { start: 1, end: 100 };
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Serial);
let result = strategy.order();
let expected_range = (1..=100).into_iter().collect::<Vec<u16>>();
assert_eq!(expected_range, result);
}
#[test]
fn random_strategy_with_range() {
let range = PortRange { start: 1, end: 100 };
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let mut result = strategy.order();
let expected_range = (1..=100).into_iter().collect::<Vec<u16>>();
assert_ne!(expected_range, result);
result.sort_unstable();
assert_eq!(expected_range, result);
}
#[test]
fn serial_strategy_with_ports() {
let strategy = PortStrategy::pick(&None, Some(vec![80, 443]), ScanOrder::Serial);
let result = strategy.order();
assert_eq!(vec![80, 443], result);
}
#[test]
fn random_strategy_with_ports() {
let strategy = PortStrategy::pick(&None, Some((1..10).collect()), ScanOrder::Random);
let mut result = strategy.order();
let expected_range = (1..10).into_iter().collect::<Vec<u16>>();
assert_ne!(expected_range, result);
result.sort_unstable();
assert_eq!(expected_range, result);
}
}
+133
View File
@@ -0,0 +1,133 @@
use gcd::Gcd;
use rand::Rng;
use std::convert::TryInto;
pub struct RangeIterator {
active: bool,
normalized_end: u32,
normalized_first_pick: u32,
normalized_pick: u32,
actual_start: u32,
step: u32,
}
/// An iterator that follows the `Linear Congruential Generator` algorithm.
///
/// For more information: <https://en.wikipedia.org/wiki/Linear_congruential_generator>
impl RangeIterator {
/// Receives the start and end of a range and normalize
/// these values before selecting a coprime for the end of the range
/// which will server as the step for the algorithm.
///
/// For example, the range `1000-2500` will be normalized to `0-1500`
/// before going through the algorithm.
pub fn new(start: u32, end: u32) -> Self {
let normalized_end = end - start + 1;
let step = pick_random_coprime(normalized_end);
// Randomly choose a number within the range to be the first
// and assign it as a pick.
let mut rng = rand::thread_rng();
let normalized_first_pick = rng.gen_range(0..normalized_end);
Self {
active: true,
normalized_end,
step,
normalized_first_pick,
normalized_pick: normalized_first_pick,
actual_start: start,
}
}
}
impl Iterator for RangeIterator {
type Item = u16;
// The next step is always bound by the formula: N+1 = (N + STEP) % TOP_OF_THE_RANGE
// It will only stop once we generate a number equal to the first generated number.
fn next(&mut self) -> Option<Self::Item> {
if !self.active {
return None;
}
let current_pick = self.normalized_pick;
let next_pick = (current_pick + self.step) % self.normalized_end;
// If the next pick is equal to the first pick this means that
// we have iterated through the entire range.
if next_pick == self.normalized_first_pick {
self.active = false;
}
self.normalized_pick = next_pick;
Some(
(self.actual_start + current_pick)
.try_into()
.expect("Could not convert u32 to u16"),
)
}
}
/// The probability that two random integers are coprime to one another
/// works out to be around 61%, given that we can safely pick a random
/// number and test it. Just in case we are having a bad day and we cannot
/// pick a coprime number after 10 tries we just return "end - 1" which
/// is guaranteed to be a coprime, but won't provide ideal randomization.
///
/// We pick between "lower_range" and "upper_range" since values too close to
/// the boundaries, which in these case are the "start" and "end" arguments
/// would also provide non-ideal randomization as discussed on the paragraph
/// above.
fn pick_random_coprime(end: u32) -> u32 {
let range_boundary = end / 4;
let lower_range = range_boundary;
let upper_range = end - range_boundary;
let mut rng = rand::thread_rng();
let mut candidate = rng.gen_range(lower_range..upper_range);
for _ in 0..10 {
if end.gcd(candidate) == 1 {
return candidate;
}
candidate = rng.gen_range(lower_range..upper_range);
}
end - 1
}
#[cfg(test)]
mod tests {
use super::RangeIterator;
#[test]
fn range_iterator_iterates_through_the_entire_range() {
let result = generate_sorted_range(1, 10);
let expected_range = (1..=10).into_iter().collect::<Vec<u16>>();
assert_eq!(expected_range, result);
let result = generate_sorted_range(1, 100);
let expected_range = (1..=100).into_iter().collect::<Vec<u16>>();
assert_eq!(expected_range, result);
let result = generate_sorted_range(1, 1000);
let expected_range = (1..=1000).into_iter().collect::<Vec<u16>>();
assert_eq!(expected_range, result);
let result = generate_sorted_range(1, 65_535);
let expected_range = (1..=65_535).into_iter().collect::<Vec<u16>>();
assert_eq!(expected_range, result);
let result = generate_sorted_range(1000, 2000);
let expected_range = (1000..=2000).into_iter().collect::<Vec<u16>>();
assert_eq!(expected_range, result);
}
fn generate_sorted_range(start: u32, end: u32) -> Vec<u16> {
let range = RangeIterator::new(start, end);
let mut result = range.into_iter().collect::<Vec<u16>>();
result.sort_unstable();
result
}
}
-98
View File
@@ -1,98 +0,0 @@
use async_std::io;
use async_std::net::TcpStream;
use colored::*;
use std::time::Duration;
use std::{
net::{SocketAddr, Shutdown},
io::ErrorKind,
};
use async_std::prelude::*;
use futures::stream::FuturesUnordered;
pub struct Scanner {
host: String,
start: u64,
end: u64,
batch_size: u64,
timeout: Duration,
quiet: bool,
}
impl Scanner {
pub fn new(host: &str, start: u64, end: u64, batch_size: u64, timeout: Duration, quiet: bool) -> Self {
Self {
host: host.to_owned(),
start,
end,
batch_size,
timeout,
quiet
}
}
pub async fn run(&self) -> Vec<u64> {
let ports: Vec<u64> = (self.start..self.end).collect();
let mut open_ports: std::vec::Vec<u64> = Vec::new();
for range in ports.chunks(self.batch_size as usize) {
let mut ports = self.scan_range(range).await;
open_ports.append(&mut ports);
}
open_ports
}
async fn scan_range(&self, range: &[u64]) -> Vec<u64> {
let mut ftrs = FuturesUnordered::new();
for port in range {
ftrs.push(self.scan_port(port));
}
let mut open_ports: Vec<u64> = Vec::new();
while let Some(result) = ftrs.next().await {
match result {
Ok(port) => open_ports.push(port),
_ => {}
}
}
open_ports
}
async fn scan_port(&self, port: &u64) -> io::Result<u64> {
let addr = format!("{}:{}", self.host , port);
match addr.parse() {
Ok(sock_addr) => match self.connect(sock_addr).await {
Ok(stream_result) => {
match stream_result.shutdown(Shutdown::Both) {
_ => {}
}
if !self.quiet {
println!("Open {}", port.to_string().purple());
}
Ok(*port)
}
Err(e) => match e.kind() {
ErrorKind::Other => {
eprintln!("{:?}", e); // in case we get too many open files
panic!("Too many open files. Please reduce batch size. The default is 5000. Try -b 2500.");
}
_ => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
},
},
Err(e) => {
eprintln!("Unable to convert to socket address {:?}", e);
panic!("Unable to convert to socket address");
}
}
}
async fn connect(&self, addr: SocketAddr) -> io::Result<TcpStream> {
let stream = io::timeout(self.timeout, async move { TcpStream::connect(addr).await }).await?;
Ok(stream)
}
}
+508
View File
@@ -0,0 +1,508 @@
//! Core functionality for actual scanning behaviour.
use crate::port_strategy::PortStrategy;
use crate::udp_packets::udp_payload::cust_payload;
use log::debug;
mod socket_iterator;
use socket_iterator::SocketIterator;
use async_std::net::TcpStream;
use async_std::prelude::*;
use async_std::{io, net::UdpSocket};
use colored::Colorize;
use futures::stream::FuturesUnordered;
use std::{
collections::HashSet,
net::{IpAddr, Shutdown, SocketAddr},
num::NonZeroU8,
time::Duration,
};
/// The class for the scanner
/// IP is data type IpAddr and is the IP address
/// 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.
/// greppable is whether or not RustScan should print things, or wait until the end to print only the ip and open ports.
/// Added by wasuaje - 01/26/2024:
/// exclude_ports is an exclusion port list
#[cfg(not(tarpaulin_include))]
#[derive(Debug)]
pub struct Scanner {
ips: Vec<IpAddr>,
batch_size: u16,
timeout: Duration,
tries: NonZeroU8,
greppable: bool,
port_strategy: PortStrategy,
accessible: bool,
exclude_ports: Vec<u16>,
udp: bool,
}
// Allowing too many arguments for clippy.
#[allow(clippy::too_many_arguments)]
impl Scanner {
pub fn new(
ips: &[IpAddr],
batch_size: u16,
timeout: Duration,
tries: u8,
greppable: bool,
port_strategy: PortStrategy,
accessible: bool,
exclude_ports: Vec<u16>,
udp: bool,
) -> Self {
Self {
batch_size,
timeout,
tries: NonZeroU8::new(std::cmp::max(tries, 1)).unwrap(),
greppable,
port_strategy,
ips: ips.iter().map(ToOwned::to_owned).collect(),
accessible,
exclude_ports,
udp,
}
}
/// Runs scan_range with chunk sizes
/// If you want to run RustScan normally, this is the entry point used
/// Returns all open ports as `Vec<u16>`
/// Added by wasuaje - 01/26/2024:
/// Filtering port against exclude port list
pub async fn run(&self) -> Vec<SocketAddr> {
let ports: Vec<u16> = self
.port_strategy
.order()
.iter()
.filter(|&port| !self.exclude_ports.contains(port))
.copied()
.collect();
let mut socket_iterator: SocketIterator = SocketIterator::new(&self.ips, &ports);
let mut open_sockets: Vec<SocketAddr> = Vec::new();
let mut ftrs = FuturesUnordered::new();
let mut errors: HashSet<String> = HashSet::new();
for _ in 0..self.batch_size {
if let Some(socket) = socket_iterator.next() {
ftrs.push(self.scan_socket(socket));
} else {
break;
}
}
debug!("Start scanning sockets. \nBatch size {}\nNumber of ip-s {}\nNumber of ports {}\nTargets all together {} ",
self.batch_size,
self.ips.len(),
&ports.len(),
(self.ips.len() * ports.len()));
while let Some(result) = ftrs.next().await {
if let Some(socket) = socket_iterator.next() {
ftrs.push(self.scan_socket(socket));
}
match result {
Ok(socket) => open_sockets.push(socket),
Err(e) => {
let error_string = e.to_string();
if errors.len() < self.ips.len() * 1000 {
errors.insert(error_string);
}
}
}
}
debug!("Typical socket connection errors {:?}", errors);
debug!("Open Sockets found: {:?}", &open_sockets);
open_sockets
}
/// Given a socket, scan it self.tries times.
/// Turns the address into a SocketAddr
/// Deals with the `<result>` type
/// If it experiences error ErrorKind::Other then too many files are open and it Panics!
/// Else any other error, it returns the error in Result as a string
/// If no errors occur, it returns the port number in Result to signify the port is open.
/// This function mainly deals with the logic of Results handling.
/// # Example
///
/// ```compile_fail
/// scanner.scan_socket(socket)
/// ```
///
/// Note: `self` must contain `self.ip`.
async fn scan_socket(&self, socket: SocketAddr) -> io::Result<SocketAddr> {
if self.udp {
let payload = cust_payload(socket.port());
let tries = self.tries.get();
for _ in 1..=tries {
match self.udp_scan(socket, &payload, self.timeout).await {
Ok(true) => return Ok(socket),
Ok(false) => continue,
Err(e) => return Err(e),
}
}
return Ok(socket);
}
let tries = self.tries.get();
for nr_try in 1..=tries {
match self.connect(socket).await {
Ok(tcp_stream) => {
debug!(
"Connection was successful, shutting down stream {}",
&socket
);
if let Err(e) = tcp_stream.shutdown(Shutdown::Both) {
debug!("Shutdown stream error {}", &e);
}
self.fmt_ports(socket);
debug!("Return Ok after {} tries", nr_try);
return Ok(socket);
}
Err(e) => {
let mut error_string = e.to_string();
assert!(!error_string.to_lowercase().contains("too many open files"), "Too many open files. Please reduce batch size. The default is 5000. Try -b 2500.");
if nr_try == tries {
error_string.push(' ');
error_string.push_str(&socket.ip().to_string());
return Err(io::Error::new(io::ErrorKind::Other, error_string));
}
}
};
}
unreachable!();
}
/// Performs the connection to the socket with timeout
/// # Example
///
/// ```compile_fail
/// # use std::net::{IpAddr, Ipv6Addr, SocketAddr};
/// let port: u16 = 80;
/// // ip is an IpAddr type
/// let ip = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
/// let socket = SocketAddr::new(ip, port);
/// scanner.connect(socket);
/// // returns Result which is either Ok(stream) for port is open, or Er for port is closed.
/// // Timeout occurs after self.timeout seconds
/// ```
///
async fn connect(&self, socket: SocketAddr) -> io::Result<TcpStream> {
let stream = io::timeout(
self.timeout,
async move { TcpStream::connect(socket).await },
)
.await?;
Ok(stream)
}
/// Binds to a UDP socket so we can send and recieve packets
/// # Example
///
/// ```compile_fail
/// # use std::net::{IpAddr, Ipv6Addr, SocketAddr};
/// let port: u16 = 80;
/// // ip is an IpAddr type
/// let ip = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
/// let socket = SocketAddr::new(ip, port);
/// scanner.udp_bind(socket);
/// // returns Result which is either Ok(stream) for port is open, or Err for port is closed.
/// // Timeout occurs after self.timeout seconds
/// ```
///
async fn udp_bind(&self, socket: SocketAddr) -> io::Result<UdpSocket> {
let local_addr = match socket {
SocketAddr::V4(_) => "0.0.0.0:0".parse::<SocketAddr>().unwrap(),
SocketAddr::V6(_) => "[::]:0".parse::<SocketAddr>().unwrap(),
};
UdpSocket::bind(local_addr).await
}
/// Performs a UDP scan on the specified socket with a payload and wait duration
/// # Example
///
/// ```compile_fail
/// # use std::net::{IpAddr, Ipv6Addr, SocketAddr};
/// # use std::time::Duration;
/// let port: u16 = 123;
/// // ip is an IpAddr type
/// let ip = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
/// let socket = SocketAddr::new(ip, port);
/// let payload = vec![0, 1, 2, 3];
/// let wait = Duration::from_secs(1);
/// let result = scanner.udp_scan(socket, payload, wait).await;
/// // returns Result which is either Ok(true) if response received, or Ok(false) if timed out.
/// // Err is returned for other I/O errors.
async fn udp_scan(
&self,
socket: SocketAddr,
payload: &[u8],
wait: Duration,
) -> io::Result<bool> {
match self.udp_bind(socket).await {
Ok(udp_socket) => {
let mut buf = [0u8; 1024];
udp_socket.connect(socket).await?;
udp_socket.send(payload).await?;
match io::timeout(wait, udp_socket.recv(&mut buf)).await {
Ok(size) => {
debug!("Received {} bytes", size);
self.fmt_ports(socket);
Ok(true)
}
Err(e) => {
if e.kind() == io::ErrorKind::TimedOut {
Ok(false)
} else {
Err(e)
}
}
}
}
Err(e) => {
println!("Err E binding sock {:?}", e);
Err(e)
}
}
}
/// Formats and prints the port status
fn fmt_ports(&self, socket: SocketAddr) {
if !self.greppable {
if self.accessible {
println!("Open {socket}");
} else {
println!("Open {}", socket.to_string().purple());
}
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::input::{PortRange, ScanOrder};
use async_std::task::block_on;
use std::{net::IpAddr, time::Duration};
#[test]
fn scanner_runs() {
// Makes sure the program still runs and doesn't panic
let addrs = vec!["127.0.0.1".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 1,
end: 1_000,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
false,
);
block_on(scanner.run());
// if the scan fails, it wouldn't be able to assert_eq! as it panicked!
assert_eq!(1, 1);
}
#[test]
fn ipv6_scanner_runs() {
// Makes sure the program still runs and doesn't panic
let addrs = vec!["::1".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 1,
end: 1_000,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
false,
);
block_on(scanner.run());
// if the scan fails, it wouldn't be able to assert_eq! as it panicked!
assert_eq!(1, 1);
}
#[test]
fn quad_zero_scanner_runs() {
let addrs = vec!["0.0.0.0".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 1,
end: 1_000,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
false,
);
block_on(scanner.run());
assert_eq!(1, 1);
}
#[test]
fn google_dns_runs() {
let addrs = vec!["8.8.8.8".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 400,
end: 445,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
false,
);
block_on(scanner.run());
assert_eq!(1, 1);
}
#[test]
fn infer_ulimit_lowering_no_panic() {
// Test behaviour on MacOS where ulimit is not automatically lowered
let addrs = vec!["8.8.8.8".parse::<IpAddr>().unwrap()];
// mac should have this automatically scaled down
let range = PortRange {
start: 400,
end: 600,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
false,
);
block_on(scanner.run());
assert_eq!(1, 1);
}
#[test]
fn udp_scan_runs() {
// Makes sure the program still runs and doesn't panic
let addrs = vec!["127.0.0.1".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 1,
end: 1_000,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
true,
);
block_on(scanner.run());
// if the scan fails, it wouldn't be able to assert_eq! as it panicked!
assert_eq!(1, 1);
}
#[test]
fn udp_ipv6_runs() {
// Makes sure the program still runs and doesn't panic
let addrs = vec!["::1".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 1,
end: 1_000,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
true,
);
block_on(scanner.run());
// if the scan fails, it wouldn't be able to assert_eq! as it panicked!
assert_eq!(1, 1);
}
#[test]
fn udp_quad_zero_scanner_runs() {
let addrs = vec!["0.0.0.0".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 1,
end: 1_000,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
true,
);
block_on(scanner.run());
assert_eq!(1, 1);
}
#[test]
fn udp_google_dns_runs() {
let addrs = vec!["8.8.8.8".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 100,
end: 150,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random);
let scanner = Scanner::new(
&addrs,
10,
Duration::from_millis(100),
1,
true,
strategy,
true,
vec![9000],
true,
);
block_on(scanner.run());
assert_eq!(1, 1);
}
}
+75
View File
@@ -0,0 +1,75 @@
use itertools::{iproduct, Product};
use std::net::{IpAddr, SocketAddr};
pub struct SocketIterator<'s> {
// product_it is a cartesian product iterator over
// the slices of ports and IP addresses.
//
// The IP/port order is intentionally reversed here since we want
// the itertools::iproduct! macro below to generate the pairs with
// all the IPs for one port before moving on to the next one
// ("hold the port, go through all the IPs, then advance the port...").
// See also the comments in the iterator implementation for an example.
product_it:
Product<Box<std::slice::Iter<'s, u16>>, Box<std::slice::Iter<'s, std::net::IpAddr>>>,
}
/// An iterator that receives a slice of IPs and ports and returns a Socket
/// for each IP and port pair until all of these combinations are exhausted.
/// The goal of this iterator is to go over every IP and port combination
/// without generating a big memory footprint. The alternative would be
/// generating a vector containing all these combinations.
impl<'s> SocketIterator<'s> {
pub fn new(ips: &'s [IpAddr], ports: &'s [u16]) -> Self {
let ports_it = Box::new(ports.iter());
let ips_it = Box::new(ips.iter());
Self {
product_it: iproduct!(ports_it, ips_it),
}
}
}
#[allow(clippy::doc_link_with_quotes)]
impl<'s> Iterator for SocketIterator<'s> {
type Item = SocketAddr;
/// Returns a socket based on the combination of one of the provided
/// IPs and ports or None when these combinations are exhausted. Every
/// IP will have the same port until a port is incremented.
///
/// let it = SocketIterator::new(&["127.0.0.1", "192.168.0.1"], &[80, 443]);
/// it.next(); // 127.0.0.1:80
/// it.next(); // 192.168.0.1:80
/// it.next(); // 127.0.0.1:443
/// it.next(); // 192.168.0.1:443
/// it.next(); // None
fn next(&mut self) -> Option<Self::Item> {
self.product_it
.next()
.map(|(port, ip)| SocketAddr::new(*ip, *port))
}
}
#[cfg(test)]
mod tests {
use super::SocketIterator;
use std::net::{IpAddr, SocketAddr};
#[test]
fn goes_through_every_ip_port_combination() {
let addrs = vec![
"127.0.0.1".parse::<IpAddr>().unwrap(),
"192.168.0.1".parse::<IpAddr>().unwrap(),
];
let ports: Vec<u16> = vec![22, 80, 443];
let mut it = SocketIterator::new(&addrs, &ports);
assert_eq!(Some(SocketAddr::new(addrs[0], ports[0])), it.next());
assert_eq!(Some(SocketAddr::new(addrs[1], ports[0])), it.next());
assert_eq!(Some(SocketAddr::new(addrs[0], ports[1])), it.next());
assert_eq!(Some(SocketAddr::new(addrs[1], ports[1])), it.next());
assert_eq!(Some(SocketAddr::new(addrs[0], ports[2])), it.next());
assert_eq!(Some(SocketAddr::new(addrs[1], ports[2])), it.next());
assert_eq!(None, it.next());
}
}
+494
View File
@@ -0,0 +1,494 @@
//! Scripting Engine to run scripts based on tags.
//!
//! This module serves to filter and run the scripts selected by the user.
//!
//! A new commandline and configuration file option was added.
//!
//! ## `--scripts`
//!
//! ### `default`
//!
//! This is the default behavior, like as it was from the beginning of RustScan.
//!
//! The user do not have to chose anything for this. This is the only script
//! embedded in RustScan running as default.
//!
//! ### `none`
//!
//! The user have to use the `--scripts none` commandline argument or `scripts =
//! "none"` in the config file.
//!
//! None of the scripts will run, this replaces the removed `--no-nmap` option.
//!
//! ### `custom`
//!
//! The user have to use the `--scripts custom` commandline argument or
//! `scripts = "custom"` in the config file.
//!
//! RustScan will look for the script configuration file in the user's home
//! dir: `home_dir/.rustscan_scripts.toml`
//!
//! The config file have 3 optional fields: `tag`, `developer` and `port`. Just
//! the `tag` field will be used forther in the process.
//!
//! RustScan will also look for available scripts in the user's home dir:
//! `home_dir/.rustscan_scripts` and will try to read all the files, and parse
//! them into a vector of [`ScriptFile`].
//!
//! Filtering on tags means the tags found in the `rustscan_scripts.toml` file
//! will also have to be present in the [`ScriptFile`], otherwise the script
//! will not be selected.
//!
//! All of the `rustscan_script.toml` tags have to be present at minimum in a
//! [`ScriptFile`] to get selected, but can be also more.
//!
//! Config file example:
//!
//! - `fixtures/test_rustscan_scripts.toml`
//!
//! Script file examples:
//!
//! - `fixtures/test_script.py`
//! - `fixtures/test_script.pl`
//! - `fixtures/test_script.sh`
//! - `fixtures/test_script.txt`
//!
//! `call_format` in script files can be of 2 variants:
//!
//! One is where all of the possible tags `{{script}}`, `{{ip}}` and `{{port}}`
//! are there.
//!
//! - The `{{script}}` part will be replaced with the scriptfile full path
//! gathered while parsing available scripts.
//! - The `{{ip}}` part will be replaced with the ip we got from the scan.
//! - The `{{port}}` part will be reaplced with the ports separated with the
//! `ports_separator` found in the script file
//!
//! And when there is only `{{ip}}` and `{{port}}` is in the format, only those
//! will be replaced with the arguments from the scan.
//!
//! This makes it easy to run a system installed command like `nmap`, and give
//! any kind of arguments to it.
//!
//! If the format is different, the script will be silently discarded and will
//! not run. With the `Debug` option it's possible to see where it goes wrong.
#![allow(clippy::module_name_repetitions)]
use crate::input::ScriptsRequired;
use anyhow::{anyhow, Result};
use log::debug;
use serde_derive::{Deserialize, Serialize};
use std::collections::HashSet;
use std::convert::TryInto;
use std::fs::{self, File};
use std::io::{self, prelude::*};
use std::net::IpAddr;
use std::path::PathBuf;
use std::string::ToString;
use subprocess::{Exec, ExitStatus};
use text_placeholder::Template;
static DEFAULT: &str = r#"tags = ["core_approved", "RustScan", "default"]
developer = [ "RustScan", "https://github.com/RustScan" ]
ports_separator = ","
call_format = "nmap -vvv -p {{port}} {{ip}}"
"#;
#[cfg(not(tarpaulin_include))]
pub fn init_scripts(scripts: ScriptsRequired) -> Result<Vec<ScriptFile>> {
let mut scripts_to_run: Vec<ScriptFile> = Vec::new();
match scripts {
ScriptsRequired::None => Ok(scripts_to_run),
ScriptsRequired::Default => {
let default_script =
toml::from_str::<ScriptFile>(DEFAULT).expect("Failed to parse Script file.");
scripts_to_run.push(default_script);
Ok(scripts_to_run)
}
ScriptsRequired::Custom => {
let Some(scripts_dir_base) = dirs::home_dir() else {
return Err(anyhow!("Could not infer scripts path."));
};
let script_paths = match find_scripts(scripts_dir_base) {
Ok(script_paths) => script_paths,
Err(e) => return Err(anyhow!(e)),
};
debug!("Scripts paths \n{:?}", script_paths);
let parsed_scripts = parse_scripts(script_paths);
debug!("Scripts parsed \n{:?}", parsed_scripts);
let script_config = match ScriptConfig::read_config() {
Ok(script_config) => script_config,
Err(e) => return Err(anyhow!(e)),
};
debug!("Script config \n{:?}", script_config);
// Only Scripts that contain all the tags found in ScriptConfig will be selected.
if script_config.tags.is_some() {
let config_hashset: HashSet<String> =
script_config.tags.unwrap().into_iter().collect();
for script in &parsed_scripts {
if script.tags.is_some() {
let script_hashset: HashSet<String> =
script.tags.clone().unwrap().into_iter().collect();
if config_hashset.is_subset(&script_hashset) {
scripts_to_run.push(script.clone());
} else {
debug!(
"\nScript tags does not match config tags {:?} {}",
&script_hashset,
script.path.clone().unwrap().display()
);
}
}
}
}
debug!("\nScript(s) to run {:?}", scripts_to_run);
Ok(scripts_to_run)
}
}
}
pub fn parse_scripts(scripts: Vec<PathBuf>) -> Vec<ScriptFile> {
let mut parsed_scripts: Vec<ScriptFile> = Vec::with_capacity(scripts.len());
for script in scripts {
debug!("Parsing script {}", &script.display());
if let Some(script_file) = ScriptFile::new(script) {
parsed_scripts.push(script_file);
}
}
parsed_scripts
}
#[derive(Clone, Debug)]
#[allow(dead_code)]
pub struct Script {
// Path to the script itself.
path: Option<PathBuf>,
// Ip got from scanner.
ip: IpAddr,
// Ports found with portscan.
open_ports: Vec<u16>,
// Port found in ScriptFile, if defined only this will run with the ip.
trigger_port: Option<String>,
// Character to join ports in case we want to use a string format of them, for example nmap -p.
ports_separator: Option<String>,
// Tags found in ScriptFile.
tags: Option<Vec<String>>,
// The format how we want the script to run.
call_format: Option<String>,
}
#[derive(Serialize)]
struct ExecPartsScript {
script: String,
ip: String,
port: String,
}
#[derive(Serialize)]
struct ExecParts {
ip: String,
port: String,
}
impl Script {
pub fn build(
path: Option<PathBuf>,
ip: IpAddr,
open_ports: Vec<u16>,
trigger_port: Option<String>,
ports_separator: Option<String>,
tags: Option<Vec<String>>,
call_format: Option<String>,
) -> Self {
Self {
path,
ip,
open_ports,
trigger_port,
ports_separator,
tags,
call_format,
}
}
// Some variables get changed before read, and compiler throws warning on warn(unused_assignments)
#[allow(unused_assignments)]
pub fn run(self) -> Result<String> {
debug!("run self {:?}", &self);
let separator = self.ports_separator.unwrap_or_else(|| ",".into());
let mut ports_str = self
.open_ports
.iter()
.map(ToString::to_string)
.collect::<Vec<String>>()
.join(&separator);
if let Some(port) = self.trigger_port {
ports_str = port;
}
let mut final_call_format = String::new();
if let Some(call_format) = self.call_format {
final_call_format = call_format;
} else {
return Err(anyhow!("Failed to parse execution format."));
}
let default_template: Template = Template::new(&final_call_format);
let mut to_run = String::new();
if final_call_format.contains("{{script}}") {
let exec_parts_script: ExecPartsScript = ExecPartsScript {
script: self.path.unwrap().to_str().unwrap().to_string(),
ip: self.ip.to_string(),
port: ports_str,
};
to_run = default_template.fill_with_struct(&exec_parts_script)?;
} else {
let exec_parts: ExecParts = ExecParts {
ip: self.ip.to_string(),
port: ports_str,
};
to_run = default_template.fill_with_struct(&exec_parts)?;
}
debug!("\nScript format to run {}", to_run);
execute_script(&to_run)
}
}
#[cfg(not(tarpaulin_include))]
fn execute_script(script: &str) -> Result<String> {
debug!("\nScript arguments {}", script);
let process = Exec::shell(script);
match process.capture() {
Ok(c) => {
let es = match c.exit_status {
ExitStatus::Exited(c) => c.try_into().unwrap(),
ExitStatus::Signaled(c) => c.into(),
ExitStatus::Other(c) => c,
ExitStatus::Undetermined => -1,
};
if es != 0 {
return Err(anyhow!("Exit code = {}", es));
}
Ok(c.stdout_str())
}
Err(error) => {
debug!("Command error {}", error.to_string());
Err(anyhow!(error.to_string()))
}
}
}
pub fn find_scripts(mut path: PathBuf) -> Result<Vec<PathBuf>> {
path.push(".rustscan_scripts");
if path.is_dir() {
debug!("Scripts folder found {}", &path.display());
let mut files_vec: Vec<PathBuf> = Vec::new();
for entry in fs::read_dir(path)? {
let entry = entry?;
files_vec.push(entry.path());
}
Ok(files_vec)
} else {
Err(anyhow!("Can't find scripts folder {}", path.display()))
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct ScriptFile {
pub path: Option<PathBuf>,
pub tags: Option<Vec<String>>,
pub developer: Option<Vec<String>>,
pub port: Option<String>,
pub ports_separator: Option<String>,
pub call_format: Option<String>,
}
impl ScriptFile {
fn new(script: PathBuf) -> Option<ScriptFile> {
let real_path = script.clone();
let mut lines_buf = String::new();
if let Ok(file) = File::open(script) {
for mut line in io::BufReader::new(file).lines().skip(1).flatten() {
if line.starts_with('#') {
line.retain(|c| c != '#');
line = line.trim().to_string();
line.push('\n');
lines_buf.push_str(&line);
} else {
break;
}
}
} else {
debug!("Failed to read file: {}", &real_path.display());
return None;
}
debug!("ScriptFile {} lines\n{}", &real_path.display(), &lines_buf);
match toml::from_str::<ScriptFile>(&lines_buf) {
Ok(mut parsed) => {
debug!("Parsed ScriptFile{} \n{:?}", &real_path.display(), &parsed);
parsed.path = Some(real_path);
// parsed_scripts.push(parsed);
Some(parsed)
}
Err(e) => {
debug!("Failed to parse ScriptFile headers {}", e.to_string());
None
}
}
}
}
#[derive(Debug, Deserialize, Clone)]
pub struct ScriptConfig {
pub tags: Option<Vec<String>>,
pub ports: Option<Vec<String>>,
pub developer: Option<Vec<String>>,
}
#[cfg(not(tarpaulin_include))]
impl ScriptConfig {
pub fn read_config() -> Result<ScriptConfig> {
let Some(mut home_dir) = dirs::home_dir() else {
return Err(anyhow!("Could not infer ScriptConfig path."));
};
home_dir.push(".rustscan_scripts.toml");
let content = fs::read_to_string(home_dir)?;
let config = toml::from_str::<ScriptConfig>(&content)?;
Ok(config)
}
}
#[cfg(test)]
mod tests {
use super::{find_scripts, parse_scripts, Script, ScriptFile};
// Function for testing only, it inserts static values into ip and open_ports
// Doesn't use impl in case it's implemented in the super module at some point
fn into_script(script_f: ScriptFile) -> Script {
Script::build(
script_f.path,
"127.0.0.1".parse().unwrap(),
vec![80, 8080],
script_f.port,
script_f.ports_separator,
script_f.tags,
script_f.call_format,
)
}
#[test]
fn find_and_parse_scripts() {
let scripts = find_scripts("fixtures/".into()).unwrap();
let scripts = parse_scripts(scripts);
assert_eq!(scripts.len(), 4);
}
#[test]
#[should_panic]
fn find_invalid_folder() {
let _scripts = find_scripts("Cargo.toml".into()).unwrap();
}
#[test]
#[should_panic]
fn open_script_file_invalid_headers() {
ScriptFile::new("fixtures/.rustscan_scripts/test_script_invalid_headers.txt".into())
.unwrap();
}
#[test]
#[should_panic]
fn open_script_file_invalid_call_format() {
let mut script_f =
ScriptFile::new("fixtures/.rustscan_scripts/test_script.txt".into()).unwrap();
script_f.call_format = Some("qwertyuiop".to_string());
let script: Script = into_script(script_f);
let _output = script.run().unwrap();
}
#[test]
#[should_panic]
fn open_script_file_missing_call_format() {
let mut script_f =
ScriptFile::new("fixtures/.rustscan_scripts/test_script.txt".into()).unwrap();
script_f.call_format = None;
let script: Script = into_script(script_f);
let _output = script.run().unwrap();
}
#[test]
#[should_panic]
fn open_nonexisting_script_file() {
ScriptFile::new("qwertyuiop.txt".into()).unwrap();
}
#[test]
fn parse_txt_script() {
let script_f =
ScriptFile::new("fixtures/.rustscan_scripts/test_script.txt".into()).unwrap();
assert_eq!(
script_f.tags,
Some(vec!["core_approved".to_string(), "example".to_string()])
);
assert_eq!(
script_f.developer,
Some(vec![
"example".to_string(),
"https://example.org".to_string()
])
);
assert_eq!(script_f.ports_separator, Some(",".to_string()));
assert_eq!(
script_f.call_format,
Some("nmap -vvv -p {{port}} {{ip}}".to_string())
);
}
#[test]
#[cfg(unix)]
fn run_bash_script() {
let script_f = ScriptFile::new("fixtures/.rustscan_scripts/test_script.sh".into()).unwrap();
let script: Script = into_script(script_f);
let output = script.run().unwrap();
// output has a newline at the end by default, .trim() trims it
assert_eq!(output.trim(), "127.0.0.1 80,8080");
}
#[test]
fn run_python_script() {
let script_f = ScriptFile::new("fixtures/.rustscan_scripts/test_script.py".into()).unwrap();
let script: Script = into_script(script_f);
let output = script.run().unwrap();
// output has a newline at the end by default, .trim() trims it
assert_eq!(
output.trim(),
"Python script ran with arguments ['fixtures/.rustscan_scripts/test_script.py', '127.0.0.1', '80,8080']"
);
}
#[test]
#[cfg(unix)]
fn run_perl_script() {
let script_f = ScriptFile::new("fixtures/.rustscan_scripts/test_script.pl".into()).unwrap();
let script: Script = into_script(script_f);
let output = script.run().unwrap();
// output has a newline at the end by default, .trim() trims it
assert_eq!(output.trim(), "Total args passed to fixtures/.rustscan_scripts/test_script.pl : 2\nArg # 1 : 127.0.0.1\nArg # 2 : 80,8080");
}
}
+105
View File
@@ -0,0 +1,105 @@
//! Utilities for terminal output during scanning.
/// Terminal User Interface Module for RustScan
/// Defines macros to use
#[macro_export]
macro_rules! warning {
($name:expr) => {
println!("{} {}", ansi_term::Colour::Red.bold().paint("[!]"), $name);
};
($name:expr, $greppable:expr, $accessible:expr) => {
// if not greppable then print, otherwise no else statement so do not print.
if !$greppable {
if $accessible {
// Don't print the ascii art
println!("{}", $name);
} else {
println!("{} {}", ansi_term::Colour::Red.bold().paint("[!]"), $name);
}
}
};
}
#[macro_export]
macro_rules! detail {
($name:expr) => {
println!("{} {}", ansi_term::Colour::Blue.bold().paint("[~]"), $name);
};
($name:expr, $greppable:expr, $accessible:expr) => {
// if not greppable then print, otherwise no else statement so do not print.
if !$greppable {
if $accessible {
// Don't print the ascii art
println!("{}", $name);
} else {
println!("{} {}", ansi_term::Colour::Blue.bold().paint("[~]"), $name);
}
}
};
}
#[macro_export]
macro_rules! output {
($name:expr) => {
println!(
"{} {}",
RGansi_term::Colour::RGB(0, 255, 9).bold().paint("[>]"),
$name
);
};
($name:expr, $greppable:expr, $accessible:expr) => {
// if not greppable then print, otherwise no else statement so do not print.
if !$greppable {
if $accessible {
// Don't print the ascii art
println!("{}", $name);
} else {
println!(
"{} {}",
ansi_term::Colour::RGB(0, 255, 9).bold().paint("[>]"),
$name
);
}
}
};
}
#[macro_export]
macro_rules! funny_opening {
// prints a funny quote / opening
() => {
use rand::seq::SliceRandom;
let quotes = vec![
"Nmap? More like slowmap.🐢",
"🌍HACK THE PLANET🌍",
"Real hackers hack time ⌛",
"Please contribute more quotes to our GitHub https://github.com/rustscan/rustscan",
"😵 https://admin.tryhackme.com",
"0day was here ♥",
"I don't always scan ports, but when I do, I prefer RustScan.",
"RustScan: Where scanning meets swagging. 😎",
"To scan or not to scan? That is the question.",
"RustScan: Because guessing isn't hacking.",
"Scanning ports like it's my full-time job. Wait, it is.",
"Open ports, closed hearts.",
"I scanned my computer so many times, it thinks we're dating.",
"Port scanning: Making networking exciting since... whenever.",
"You miss 100% of the ports you don't scan. - RustScan",
"Breaking and entering... into the world of open ports.",
"TCP handshake? More like a friendly high-five!",
"Scanning ports: The virtual equivalent of knocking on doors.",
"RustScan: Making sure 'closed' isn't just a state of mind.",
"RustScan: allowing you to send UDP packets into the void 1200x faster than NMAP",
"Port scanning: Because every port has a story to tell.",
"I scanned ports so fast, even my computer was surprised.",
"Scanning ports faster than you can say 'SYN ACK'",
"RustScan: Where '404 Not Found' meets '200 OK'.",
"RustScan: Exploring the digital landscape, one IP at a time.",
"TreadStone was here 🚀",
"With RustScan, I scan ports so fast, even my firewall gets whiplash 💨",
];
let random_quote = quotes.choose(&mut rand::thread_rng()).unwrap();
println!("{}\n", random_quote);
};
}
+279
View File
@@ -0,0 +1,279 @@
pub mod udp_payload {
// const MAX_PAYLOAD_IPV4: usize = 65507; // 65,535 - 20 (IP header) - 8 (UDP header)
// const MAX_PAYLOAD_IPV6: usize = 65527; // 65,535 - 40 (IPv6 header) - 8 (UDP header)
/// From [RFC 768](https://www.rfc-editor.org/rfc/rfc768.txt)
/// We send blank UDP packets, unless the port is determined to be special.
///
/// ```text
/// HEADER Handled by the OS
/// 0 1 2 3
/// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | Source Port | Destination Port |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | Length | Checksum |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// We append the data, based on the port the the header
/// DATA
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | Data (based on port) |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// ```
///
/// # Fields
///
/// - **Source Port**: The source port number.
/// - **Destination Port**: The destination port number.
/// - **Length**: The length of the UDP header and data.
/// - **Checksum**: The checksum for error-checking.
/// - **Data**: The payload data, which can vary based on the port.
#[allow(clippy::match_single_binding)]
pub fn cust_payload(dst_prt: u16) -> Vec<u8> {
match dst_prt {
// 53 => craft_dns_query_packet(),
// 67 => craft_dhcpc_packet(),
// 123 => craft_ntp_packet(),
// 161 => craft_snmp_packet(),
_ => vec![],
}
}
pub fn craft_snmptrap_packet() -> Vec<u16> {
let version = vec![0x30, 0x82]; // SNMP version
let community_string = vec![0x04, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63]; // Community string "public"
let pdu_type = vec![0xa4, 0x82]; // PDU type for SNMP Trap
let enterprise_oid = vec![0x06, 0x09, 0x2b, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]; // Enterprise OID
// Combine the components into a single SNMP Trap packet
[version, community_string, pdu_type, enterprise_oid].concat()
}
/// From [RFC 1592](https://www.rfc-editor.org/rfc/rfc1592.txt)
/// Crafts an SNMP packet based on the structure from RFC 1592.
///
/// RFC 1592 defines the structure of an SNMP packet as follows
/// - **ASN.1 header**: 0x30
/// - **PDU length**: 37 + length of community name
/// - **SNMP version**: 0x02 0x01 0x00 (integer, length=1, value=0)
/// - **Community name**: A string of varying length
/// - **SNMP GET request**: 0xa0 0x1c (request type=0xa0, length=0x1c)
/// - **SNMP request ID**: 0x02 0x01 0x01 (integer, length=1, ID=1)
/// - **SNMP error status**: 0x02 0x01 0x00 (integer, length=1, error=0)
/// - **SNMP index**: 0x02 0x01 0x00 (integer, length=1, index=0)
/// - **VarBind list**: 0x30 0x11 (length=0x11)
/// - **VarBind**: 0x30 0x0f (length=0x0f)
/// - **Object ID**: 0x06 0x0b (length=0x0b)
/// - **Object instance**: 1.3.6.1.4.1.2.2.1.1.1.0
/// - **Null value**: 0x05 0x00 (length=0)
///
/// The PDU length formula:
/// ```text
/// PDU_length = length of version field and string tag (4 bytes)
/// + length of community length field (1 byte)
/// + length of community name (depends...)
/// + length of SNMP GET request (32 bytes)
/// ```
///
/// # Returns
///
/// A `Vec<u8>` representing the crafted SNMP packet.
pub fn craft_snmp_packet() -> Vec<u8> {
// TODO all versions of snmp
let v1 = vec![0x30, 0x29, 0x02, 0x01, 0x00];
let community_string = vec![0x04, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63];
let pdu_type = vec![0xa0, 0x1c];
let request_id = vec![0x02, 0x04, 0x7a, 0x69, 0x67, 0x71];
let error_status = vec![0x02, 0x01, 0x00];
let error_index = vec![0x02, 0x01, 0x00];
let variable_bindings = vec![
0x30, 0x0e, 0x30, 0x0c, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00,
0x05, 0x00,
];
let _basic_snmp = [
0x30, 0x26, 0x02, 0x01, 0x01, 0x04, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0xa0,
0x19, 0x02, 0x04, 0x71, 0x64, 0xfe, 0xf1, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x30,
0x0b, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x06, 0x01, 0x02, 0x01, 0x05, 0x00,
];
[
v1,
community_string,
pdu_type,
request_id,
error_status,
error_index,
variable_bindings,
]
.concat()
}
/// Constructs a DHCP packet based on the RFC 1541 Dynamic Host Configuration Protocol specification.
///
///
/// # Returns
///
/// A `Vec<u8>` representing the DHCP packet.
///
/// This function crafts a DHCP Discover packet with the following fields:
/// - **op**: BOOTREQUEST (1)
/// - **htype**: Ethernet (1)
/// - **hlen**: 6
/// - **hops**: 0
/// - **xid**: Random transaction ID
/// - **secs**: 0
/// - **flags**: 0x8000 (Broadcast)
/// - **ciaddr**: 0.0.0.0
/// - **yiaddr**: 0.0.0.0
/// - **siaddr**: 0.0.0.0
/// - **giaddr**: 0.0.0.0
/// - **chaddr**: 00:00:00:00:00:00 (Client MAC address)
/// - **sname**: Not given
/// - **file**: Not given
/// - **options**: DHCP options
pub fn craft_dhcpc_packet() -> Vec<u8> {
let mut packet = Vec::with_capacity(240);
// BOOTP message type: Boot Request (1)
packet.push(0x01);
// Hardware type: Ethernet (10Mb) (1)
packet.push(0x01);
// Hardware address length: 6
packet.push(0x06);
// Hops: 0
packet.push(0x00);
// Transaction ID: random (0x3903F326)
packet.extend(&[0x39, 0x03, 0xF3, 0x26]);
// Seconds elapsed: 0
packet.extend(&[0x00, 0x00]);
// Bootp flags: 0x8000 (Broadcast) (0x8000)
packet.extend(&[0x80, 0x00]);
// Client IP address: 0.0.0.0
packet.extend(&[0x00, 0x00, 0x00, 0x00]);
// Your (client) IP address: 0.0.0.0
packet.extend(&[0x00, 0x00, 0x00, 0x00]);
// Next server IP address: 0.0.0.0
packet.extend(&[0x00, 0x00, 0x00, 0x00]);
// Relay agent IP address: 0.0.0.0
packet.extend(&[0x00, 0x00, 0x00, 0x00]);
// Client MAC address: 00:00:00:00:00:00
packet.extend(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
// Client hardware address padding: 00000000000000000000
packet.extend(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
// Server host name not given
packet.extend(&[0x00; 64]);
// Boot file name not given
packet.extend(&[0x00; 128]);
// Magic cookie: DHCP
packet.extend(&[0x63, 0x82, 0x53, 0x63]);
// DHCP Message Type: DHCP Discover (1)
packet.extend(&[0x35, 0x01, 0x01]);
// DHCP Option: Parameter Request List
packet.extend(&[0x37, 0x04, 0x01, 0x03, 0x06, 0x2a]);
// End Option
packet.push(0xff);
packet
}
/// Constructs a DNS query packet.
///
/// The structure of the DNS packet is as follows:
///
/// ```text
/// +---------------------+
/// | Header |
/// +---------------------+
/// | Question | the question for the name server
/// +---------------------+
/// | Answer | RRs answering the question
/// +---------------------+
/// | Authority | RRs pointing toward an authority
/// +---------------------+
/// | Additional | RRs holding additional information
/// +---------------------+
/// ```
///
/// The function builds a DNS query packet with the following fields:
/// - **Header**: Contains the transaction ID and flags.
/// - **Question**: Specifies the query (e.g., the domain name to look up).
/// - **Answer**: Resource records that answer the question (empty for a query).
/// - **Authority**: Resource records that point toward an authority (empty for a query).
/// - **Additional**: Resource records holding additional information (empty for a query).
///
/// # Returns
///
/// A `Vec<u8>` representing the DNS query packet.
pub fn craft_dns_query_packet() -> Vec<u8> {
let mut packet = Vec::new();
// Transaction ID: Random
packet.extend(&[0x12, 0x34]);
// Flags: Standard query
packet.extend(&[0x01, 0x00]);
// Header ^
// Questions: 1
packet.extend(&[0x00, 0x01]);
// Answer RRs: 0
packet.extend(&[0x00, 0x00]);
// Authority RRs: 0
packet.extend(&[0x00, 0x00]);
// Additional RRs: 0
packet.extend(&[0x00, 0x00]);
// Query: www.google.com
let query_name = "www.google.com";
for part in query_name.split('.') {
packet.push(part.len() as u8);
packet.extend(part.as_bytes());
}
packet.push(0); // End of query name
// Query Type: A (host address)
packet.extend(&[0x00, 0x01]);
// Query Class: IN (internet)
packet.extend(&[0x00, 0x01]);
packet
}
/// Creates the simplest NTP packet possible
/// 0x1b followed by 47 0s, (Version = 3, Mode = 3)
pub fn craft_ntp_packet() -> Vec<u8> {
let mut packet = vec![0u8; 48];
packet[0] = 0x1b;
packet
}
// TODO add more packets for the top 1000 ports
// `sort -r -k3 /usr/share/nmap/nmap-services | grep udp | head -n 1000`
// There has to be a better way to structure this, maybe internal crate for packet payload
// creation
}
+163
View File
@@ -0,0 +1,163 @@
/*
* 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;
#[cfg(not(tarpaulin_include))]
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().unwrap();
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),
);
}
#[test]
#[ignore]
fn udp_scan_localhost() {
let timeout = super::Duration::from_secs(25);
super::run_rustscan_with_timeout(&["--greppable", "127.0.0.1", "--udp"], timeout);
}
#[test]
#[ignore]
fn udp_scan_google_com() {
super::run_rustscan_with_timeout(
&[
"--udp",
"--greppable",
"-u",
"5000",
"-b",
"2500",
"google.com",
],
super::Duration::from_secs(28),
);
}
#[test]
#[ignore]
fn udp_scan_example_com() {
super::run_rustscan_with_timeout(
&[
"--udp",
"--greppable",
"-u",
"5000",
"-b",
"2500",
"example.com",
],
super::Duration::from_secs(28),
);
}
#[test]
#[ignore]
fn udp_scan_rustscan_cmnatic_co_uk() {
super::run_rustscan_with_timeout(
&[
"--udp",
"--greppable",
"-u",
"5000",
"-b",
"2500",
"rustscan.cmnatic.co.uk",
],
super::Duration::from_secs(26),
);
}
}