Commit Graph

553 Commits

Author SHA1 Message Date
AG
3c55bbe861
Specify arbitrary HTTP headers (#284)
* Add support for specifying arbitrary HTTP headers

* * (Minor, Comment) Fix incorrect comment, replace with more helpful (and accurate) comment
* (Minor, Linting) Rename raw_hash => rawHash, 4 occurences (linter)
* (Minor, Linting) Rename s -> scanner, 1 occurence (linter)
* (Sanity Checking) Prevent duplicate custom headers
* (Sanity Checking) Prevent attempts to set known immutable headers (host, content-length)

* Add --custom-header-delimeter for convenience, in practice, quoting the header values that contain comma can be problematic

* Make the separator consistent for both custom-headers-names and custom-headers-values. It's just weird having them be different :>

* Spelling delimiter correctly would probably help...

* Update modules/http/scanner.go

Co-authored-by: engn33r <engn33r@users.noreply.github.com>

Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
Co-authored-by: Zakir Durumeric <zakird@gmail.com>
Co-authored-by: engn33r <engn33r@users.noreply.github.com>
2021-06-06 11:17:33 -07:00
AG
5e9507cacf
[BUGFIX] Set SNI on each redirect to avoid handshake failures / incorrect server name (#306)
* Set SNI explicitly, in case it's a redirect (fix for #300)

* Fix the SNI issue correctly, using the host portion of addr, while respecting --server-name and --no-sni

* Clean up double error logging pointed out by dadrien

* Comply with RFC4366, do not set SNI server name for IP address

Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
https://github.com/zmap/zgrab2/pull/306
2021-04-09 13:36:07 -06:00
David Adrian
4e047842a6 stm: go get -u, fix compile errors 2021-04-06 16:49:27 -06:00
AG
0eb497e803
Add support for specifying the "PortableCiphers" cipher-suite list added in https://github.com/zmap/zcrypto/pull/238 (#302)
Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
2021-04-06 16:44:47 -06:00
Elliot Cubit
17a5257565
Add NativeOS, NTLM, and GroupName to SMBv1 results (#286)
* add smbv1 session setup scan

* remove unused values

* rename os_name to native_os to match smb documentation

* remove superfluous comment

* update zschema to include new SMB fields

* improve clarity on bounds checking for SMBv1 requests
2021-03-15 09:23:55 -04:00
vl4deee11
d3d2a3746a
Fix null results in fox module (#294)
Co-authored-by: vl4deee11 <boi4enkovlad@yandex.ru>
Co-authored-by: vl4deee11 <boi4chenkovlad@yandex.ru>
Co-authored-by: vl4deee11 <boi4enkovlad@yandex>
2021-03-12 19:49:37 -07:00
vl4deee11
0d51d0d401
fix issue 288 (#289)
Co-authored-by: vl4deee11 <boi4enkovlad@yandex.ru>
2021-03-05 09:42:32 -07:00
David Adrian
31126e97ab fix compilation error introduced by #244 merge 2021-03-04 09:03:34 -07:00
Jack Cable
a9fc785eb0
Add option to flush after each line of input (#244) 2021-03-02 10:10:19 -07:00
Elliot Cubit
3c17bf32e8
Fix SMB scanner marshaller panic (#299) 2021-02-11 14:44:36 -05:00
aspacewalz
d25b7ad901
fix for smtp module (#297)
The SMTP module was matching on "STMP" when verifying the contents of the scan response. This PR fixes the typo and adds a test for the VerifySMTPContents() function.
2021-02-05 07:29:14 -05:00
Benjamin Wireman
d9ed4f141d
improves http body decoding and enforces max length (#295)
https://github.com/zmap/zgrab2/pull/295
2021-02-03 10:56:32 -05:00
Jeff Cody
3613392bf0
telnet: Optionally return result even on error (#277)
Even if the server does not respond to the telnet commands, the
banner may have useful information.  Add the option "--force-banner"
so that the banner string may be returned even on failure.
2020-10-30 10:06:46 -04:00
grace-murphy
8aa9230e29
[DATA-970] Increase buffer size in FTP scanner (#279) 2020-10-21 14:25:43 -04:00
justinbastress
dae700ea10
Merge pull request #275 from twschum/http-decoded-hash
Add option to compute http BodySHA256 on decoded BodyText

NOTE: CI errors are preexisting pop3 issues
2020-09-18 11:39:12 -04:00
Tim Schumacher
66c842d234 Put body_length behind flag to zschema 2020-09-18 11:01:46 -04:00
Tim Schumacher
c034bb26a1 Use hash setting on getCheckRedirect 2020-09-17 17:14:23 -04:00
Tim Schumacher
fc82b6b673 Capture BodyTextLength 2020-09-17 15:01:27 -04:00
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