Commit Graph

501 Commits

Author SHA1 Message Date
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
Ricky Diaz Gomez
cbb32a2abd
Merge pull request #208 from zmap/ricky/redis
[CEN-1492] ricky/redis
2019-06-28 16:48:52 -04:00
Ricky Diaz Gomez
98b142ec2e Redis: Made major, minor, and patchlevel be pointers to ints so that they're correctly omitted 2019-06-28 16:30:12 -04:00
Ricky Diaz Gomez
67fbf1facb Redis: Store the major, minor, and patchlevel as ints as well as the whole version as a string 2019-06-28 15:54:11 -04:00
Ricky Diaz Gomez
7c651c0be5 Redis: Updated setting suffix -- zero value is already empty string 2019-06-25 12:57:40 -04:00
Ricky Diaz Gomez
31788624f2 Redis: Added max file size check 2019-06-25 11:57:47 -04:00
Ricky Diaz Gomez
4bae7a74dd Redis: Quoted the docker-run.sh file path within test.sh 2019-06-25 10:57:46 -04:00
Ricky Diaz Gomez
41df4251b6 Redis: Removed break statement when iterating through INFO response 2019-06-21 16:37:55 -04:00
Ricky Diaz Gomez
2495ff6a8c Redis: Changed casing of 'redis' within schema 2019-06-21 16:16:14 -04:00
Ricky Diaz Gomez
bcaf844200 Redis: Made check so that if line_prefix_suffix only contains prefix, adds empty string to suffix index 2019-06-21 16:14:13 -04:00
Ricky Diaz Gomez
d6059c655d Redis: Updated the testdata 2019-06-20 17:30:01 -04:00
Ricky Diaz Gomez
f71548ed94 Redis: Missed an old bool check 2019-06-20 17:14:30 -04:00
Ricky Diaz Gomez
84ffc2c667 Redis: Updated the break condition when looking for fields within info_response 2019-06-20 12:17:26 -04:00
Ricky Diaz Gomez
f3184857b4 Redis: Updated testdata 2019-06-19 16:15:52 -04:00
Ricky Diaz Gomez
4446024636 Redis: Changed commandMappings to map[string]string, fixed QUIT err=io.EOF bug, and capture redis_mode now 2019-06-19 16:06:43 -04:00
Ricky Diaz Gomez
d9ccfe88f6 Redis: Updated testdata 2019-06-19 13:02:20 -04:00
Ricky Diaz Gomez
e12f32b521 Redis: Now gather the OS the server is running 2019-06-19 09:51:40 -04:00
Ricky Diaz Gomez
5be58b2b0d Redis: Actually send the custom commands and store the responses. Also updated the zschema 2019-06-17 17:32:51 -04:00
Ricky Diaz Gomez
f0d9070733 Redis: Takes JSON/YAML file that allows for renaming of commands 2019-06-17 15:23:56 -04:00
Jeff Cody
043ca87528
Merge pull request #206 from codyprime/jcody/smbv1-fix
SMB1 Probing
2019-06-10 17:53:42 -04:00
Jeff Cody
b69c22c532
SMB: Probe for SMB1 in addition to SMB2
If the probe for SMB2 fails, close the connection and then try probing
for SMB1 as a backup.

Since there are more SMB2 servers in the wild, that is the first
attempt.
2019-06-10 17:17:20 -04:00
Jeff Cody
1232ca4e60
SMB: Add Negotiation Req & Response for v1
Send SMB1 header, and Negotiation Request message for SMB1.

This brings the zgrab2 smb1 scanner to parity with the zgrab smb1
scanner, with presence detection via smbv1_support.

We check the ProtocolID in the raw data response, for two reasons:

1. Even if the full unmarshal fails for the message, we will log
   that it is an smbv1 server

2. We need to add more response types structs, because the format
   is different for various SMB1 dialects.

The negotiation response v1 structure is for the SMB1 "NT LM 0.12"
dialect, and is essentially placeholder for now for future parsing.

TODO: Unmarshal into the appropriate message struct based on
SMB1 dialect, and parse dialect and capabilities, and return those
results.
2019-06-10 17:17:20 -04:00
Jeff Cody
f2b76412fb
SMB: Combine 'GetSMBLog()' and 'GetSMBBanner()'
These two functions are largely duplicates, and only differ in the
boolean option passed to LoggedNegotiateProtocol().  Combine the
functions, and just take that option in as an argument to pass along.
2019-06-07 16:54:26 -04:00
Jeff Cody
c0f5084a6a
Merge pull request #205 from codyprime/jcody/lib-smbfix
SMB: Bounds check slice index before access
2019-06-05 14:02:20 -04:00
Jeff Cody
2e67991362
SMB: Bounds check slice index before access
The smb library bounds checks for a message size that is too large, but
does not check for a message size that is way too small.  Error out if
the message size is not at least as large as the ProtocolID 4-byte
preamble.

This fixes slice out of bound panics when checking the buffer for the
protID string for certain hosts.

Signed-off-by: Jeff Cody <jcody@censys.io>
2019-06-04 22:26:27 -04:00
Jeff Cody
f2ba12c61d
Merge pull request #204 from codyprime/smb-enhance
SMB 2 Capabilities & Version parsing
2019-05-30 16:51:41 -04:00
Jeff Cody
6e38ec3e72
SMB: Fix typos in schema (PR204 review)
@justinbastress noted a couple of typos in the schema file, and
suggested a doc addition.
2019-05-29 16:15:04 -04:00
Jeff Cody
37bb923ce4
SMB: Parse capabilties flags for the server
This parses the capabilities flags for the server, masking off invalid
flags based on dialect.

While both the NegotiationLogs and SessionSetupLog contain capabilities
flags, we extract the flags from the NegotiationLogs to represent the
server, as it is explicitly stated in [MS-SMB2] that those are the ones
that represent the capabilities of the server.
2019-05-24 15:47:22 -04:00
Jeff Cody
79a96f08ae
SMB: Parse SMB Versions and Dialects.
This parses the SMB Version response, and the dialect, to determine the
full SMB version.  This is done in accordance to "[MS-SMB2] - v20190430"
from Microsoft, Section 2.2.4.
2019-05-24 15:47:10 -04:00
Jeff Cody
2e71f25c85
SMB: Omit Negotiation adn Session logs if empty
Currently, we will output 'null' json fields for either of
these logs if they are not present; instead, let's just omit
them entirely.
2019-05-24 15:33:25 -04:00
Jeff Cody
da90d489b1
SMB: Formatting, line-wrap comments 2019-05-23 13:45:18 -04:00
AnthraX1
bcc4b05d6c Add custom regexp banner grabber (#199)
https://github.com/zmap/zgrab2/pull/199
2019-04-11 17:29:34 -04:00
justinbastress
9c9a8fb2c1
Merge pull request #192 from zmap/benvds/fixSNI
Use Target Domain name in SNI when using HTTP
2019-03-02 10:18:44 -05:00
Benjamin VanderSloot
93f30ef698 Use Target Domain name in SNI when using HTTP
Previous addition of GetTLSConfigForTarget (811eb38) did not modify
HTTP module to use SNI. This let to the very cryptic unknown-error:
remote error: internal error. Some servers give Fatal alerts when
they don't get an SNI extension. Discovered on a `Pagely-ARES/1.3.21`
Server
2019-03-01 21:29:22 -05:00
cindyxkuang
c1da0fffea --root-cas implementation (#189) 2019-02-23 10:47:30 -08:00