Commit Graph

585 Commits

Author SHA1 Message Date
Tim Schumacher a7ad9a27d2 Combine to single option 2020-09-17 14:08:02 -04:00
Tim Schumacher 40ebf2ae9c Spelling 2020-09-17 13:21:03 -04:00
Tim Schumacher 7c61e14cfc Fix test 2020-09-17 12:15:07 -04:00
Tim Schumacher f96339b30b Add BodyHashAlgorithm option 2020-09-17 11:31:31 -04:00
Tim Schumacher 8f4f1bb1ec Types 2020-09-17 11:08:26 -04:00
Tim Schumacher 30e6cdb73f Add BodyHash field with hash type prefix 2020-09-17 11:04:27 -04:00
Tim Schumacher 4775cf85f4 Add option to compute http BodySHA256 on decoded BodyText 2020-09-17 10:13:52 -04:00
Benjamin Wireman 6eaaa2fa00
add implicit tls bool to smtp (#266)
https://github.com/zmap/zgrab2/pull/266
2020-06-02 09:06:27 -04:00
Elliot Cubit 457d8a090b
Ecubit/fix false positives (#262)
* telnet module should not return success when it finds something other than telnet

* telnet module should not return success when it finds something other than telnet

* Adds verification step for POP3 banners

* Add validation for IMAP banners & fix some formatting problems

* Verify SMTP banners exist and are successful

* Add check for is_dnp3 flag which seems to be working as expected

* Fix dropping SCAN_APPLICATION_ERROR in IMAP

* Fix dropping SCAN_APPLICATION_ERROR in POP3

* Fix dropping SCAN_APPLICATION_ERROR in SMTP

* Add protocol and blacklist indicators to email protocols

Co-authored-by: Elliot Cubit <elliotcubit@elliots-mbp.lan>
2020-06-01 14:26:24 -04:00
Jeff Cody 475c10307a
Merge pull request #264 from zmap/jcody/ftp-implicit-tls-opt
ftp: Add support for implicit TLS
2020-05-29 16:56:06 -04:00
Jeff Cody f6fbfc53c8
ftp: Add support for implicit TLS
The command line option `--implicit-tls` will attempt connecting via
TLS before intiating the FTP handshake.
2020-05-29 16:10:53 -04:00
Benjamin Wireman cfd48de9d6
Fix panics in Modbus scanner (#265)
* Check message and body length in in GetModbusResponse()

* add timeout to waiting when PSQL container to start

https://github.com/zmap/zgrab2/pull/265
2020-05-29 13:07:47 -04:00
Jeff Cody 2d92ae75e3
Merge pull request #261 from zmap/jcody/zgrab2-http-sig-override
http/tls: Add option to override SignatureAndHashes
2020-05-08 18:03:21 -04:00
Jeff Cody 76d09b59c5
http/tls: Add option to override SignatureAndHashes
So that we can advertise a slightly more expansive default set of
signature/hash algorithms in the signature_algorithms extension of
the TLS Client Hello, provide an option to use a pre-defined override.

This also splits up the TLS connection helper in tls.go, so that the
tls.Config can be modified by a scanner module.
2020-05-08 17:32:33 -04:00
Benjamin Wireman d2e503881f
Allow for programaitc access of ssh result types (#260)
https://github.com/zmap/zgrab2/pull/260
2020-03-31 15:56:44 -04:00
Benjamin Wireman 145470af50
Merge pull request #258 from zmap/bw/http_encodings
https://github.com/zmap/zgrab2/pull/258
2020-03-24 10:52:39 -04:00
bwireman 8395d72fee use DetermineEncoding To try and translate page to UTF8 if possible 2020-03-21 10:51:04 -04:00
David Adrian 7922a73983 Add VSCode to gitignore 2020-03-19 14:41:21 -04:00
David Adrian 351f826d8a
Extract the creation and Marshal of a Grab object (#256)
This allows these steps to be reusable outside of the context of the
grabTarget function.

https://github.com/zmap/zgrab2/pull/256
2020-03-17 11:50:54 -04:00
Jeff Cody 0bd36c5267
modules/http: Add option to suppress errors when max redirects exceeded (#253)
If the --max-redirects value is exceeded, we return
SCAN_APPLICATION_ERROR with "Too many redirect" as the error message.

Add an option to suppress this error, and return success even if we
exceed the maximum specified number of redirects.
2020-02-28 13:56:18 -05:00
Jeff Cody 909643c227
HTTP Module: Keep scanner.config immutable during scans (#245)
The Scanner.config struct is a configuration for all instances of
Scanner.  Scanner.Scan() is called concurrently by multiple worker
goroutines; while Scanner is dereferenced before the call, the config
struct is a pointer, and so modifications to it will affect all other
running scans done with that Scanner.

Make sure we treat it as immutable during anything invoked by
Scanner.Scan() in the http module.

https://github.com/zmap/zgrab2/pull/245
2020-02-19 14:31:12 -05:00
David Adrian b2bf9cbc41
Remove dependency on config in output.go (#250)
Refactor the output handlers to take the necessary writers as arguments.

https://github.com/zmap/zgrab2/pull/250
2020-02-18 15:46:36 -05:00
David Adrian ef33737c05
Merge pull request #251 from zmap/dadrian/no-global-monitor
https://github.com/zmap/zgrab2/pull/251
2020-02-18 15:46:07 -05:00
David Adrian 178d984996 Fix synchronization for Monitor
The goroutine running the monitor isn't actually closed. This PR updates
the API to allow that Goroutine to properly block program exit. This can
be leveraged as we continue to make the configuration non-global.
2020-02-18 14:57:46 -05:00
David Adrian 6848e3ae60 Remove reference to global config in monitor.go
This updates MakeMonitor() to take the channel size as a parameter,
instead of reading it from the global `config` object. Unfortunately,
the caller of MakeMonitor() doesn't actually have access to the global,
since it's in a different package (bin vs the root package). Luckily,
there doesn't appear to be a reason to have a buffer in this channel.
This updates the caller to pass a hardcoded size of 1.
2020-02-18 13:43:19 -05:00
David Adrian 11425ac78b
Add Description() to ScanModule (#248)
This abstracts more of the help text into the ScanModule definition,
removing some more of the need for `zgrab2.AddCommand()`

https://github.com/zmap/zgrab2/pull/248
2020-02-18 10:24:04 -05:00
David Adrian 320f7aa144
Add ModuleSet object (#247)
Eventually this can be used to replace AddCommand, allowing the use of a
non-global config object.

https://github.com/zmap/zgrab2/pull/247
2020-02-18 10:23:43 -05:00
Julian Kornberger f5b169cbd4
Trim SMTP response (#237)
this avoids to have \r\n in the error message
2020-02-03 16:52:37 -08:00
Meteorite c3ef8dcd8b
add option to stop scanning host after first successful protocol (#242) 2020-02-03 16:45:08 -08:00
Jeff Cody d9885ed26c
Merge pull request #240 from zmap/jcody/http-custom-resolver
Add the ability to use a custom (fake) DNS resolver
2020-02-02 21:04:06 -05:00
Jeff Cody 0b6845eed8
Update header comment for fake_resolver.go 2020-01-31 23:08:58 -05:00
Jeff Cody 82da88e34d
Let HTTP scanner use the custom resolver
If both an IP address and a domain are specified for a scan, have the
HTTP scanner use a fake resolver in the DialContext, so that we always
scan the intended IP and Domain name pair.

However, make sure redirects still function as normal, so only use our
fake resolver if the domain name matches the original targeted domain
name.

In addition, the custom resolver is only used if the network specified
is one that supports domain names.
2020-01-31 14:40:36 -05:00
Jeff Cody 3bb649f175
Add custom fake resolver
This adds a custom resolver, that will always resolve to the specified
ip address.  The intended usage is for when doing name-based scans,
but have a specified IP address as well.  This will provide a resolver
that can be added to a Dialer, that will cause all DNS lookups to match
the specified IP address.
2020-01-29 18:55:05 -05:00
Jeff Cody d12c70e5de Honor port override when composing URL (#233)
Commit a38194a added an optional port override as part of the
scan target.  The HTTP and IPP modules, however, still compose
the URL (and select http vs https) by ignoring the override.

This checks for the override, and if present uses the scan target
port.  Otherwise, it falls back to the config port.

https://github.com/zmap/zgrab2/pull/233
2019-11-20 10:14:18 -05:00
Zakir Durumeric 4c1161b29e
Cablej master (#232)
* Add support to HTTP for setting local interface

* Add net import

* use correct flag

* better CLI flag name

* Remove logged `\n`

* Remove extranneous if statement
2019-11-19 08:31:15 -08:00
thegwan dd478522e9
Merge pull request #228 from thegwan/helloonly-fix
prevent running key exchange if hello-only flag set
2019-11-02 11:51:07 -07:00
thegwan 31645233a5 reduce code duplication 2019-10-23 17:45:40 +00:00
David Adrian 86e24ff81f Attempt to fix CI 2019-10-22 20:25:54 +00:00
thegwan 422cdc7b9f prevent running key exchange if hello-only flag set 2019-10-21 08:31:57 +00:00
David Adrian 8427a23db1
Add support for importing the ZGrab2 main (#224)
Move ZGrab2's main function to a library, and call it in cmd/zgrab2
after importing all of our modules. Consumes of ZGrab2 as a library can
use the same approach to provide custom sets of modules, without having
to hack the build system or reimplement main.

https://github.com/zmap/zgrab2/pull/224
2019-09-25 08:51:31 -04:00
David Adrian dda796c8da
Add support for Go modules (#223)
This pins dependencies via go mod init. Regular builds should still
work, so this won't affect CI. It overrides the default set of deps for
ZFlags, to point to v1.4.0-beta.1. This gets the ParseCommandLine
function.
2019-09-24 13:55:05 -04:00
cy 0b6d1d994d fixed bug for io.EOF on fox moudle (#207)
fox read with  io.EOF ,but the data  has been returned

https://github.com/zmap/zgrab2/pull/207
2019-09-23 20:51:09 -04:00
Benjamin Wireman 30aaee1c25
Merge pull request #218 from zmap/redis_schema_fix
fix schema in redis for nonexistent_response being required
2019-09-06 11:58:16 -04:00
bwireman 27e6033b03 fix schema in redis for nonexistent_response being required 2019-09-06 11:00:30 -04:00
David Adrian 99e5b4c7e3
Merge pull request #216 from zmap/jcody/scantarget-port
Allow applications to specify port via `ScanTarget{}`
2019-08-21 15:07:14 -07:00
Jeff Cody fb49609733
Remove `GetPort()` from modules
The previous patch allows the port to be specified in the
`ScanTarget{}`.

Since the port option in the Config may not be the port currently being
scanned, delete the `GetPort()` function provided by each module.

The `GetPort()` function is also not used.  While we could just change
the meaning of this function, to mean "Return the port in the Config",
it is probably better to go ahead and just remove all references to it
as there are no users.
2019-08-21 14:55:14 -04:00
Jeff Cody a38194a7fd
Add `port` to ScanTarget{} that overrides Config
The port field is tied to the configuration of each instance of
`Scanner` struct.  However, applications using zgrab2 scan modules may
want to specify specific ports to scan, without needing to initialize a
whole new module.

This patch adds a pointer to a uint describing a port to `ScanTarget{}`.
If that is nil, the specified port will override the port in the Config.
2019-08-21 14:53:56 -04:00
Zakir Durumeric 28cde1a5a6
Add SSH Client Hello Only flag (#215) 2019-08-15 17:01:24 -07:00
Ricky Diaz Gomez 24d44b6282
Merge pull request #211 from zmap/ricky/redis
ricky/redis scanner
2019-07-09 11:01:45 -04:00
Ricky Diaz Gomez e23894590d Redis: Removed the tests that test the --mappings and --custom-commands
flags for the Redis scanner.
2019-07-08 10:23:18 -04:00