Commit Graph

490 Commits

Author SHA1 Message Date
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
justinbastress
808dd3e528 ssh schema updates (re #176) (#187) 2019-02-23 10:47:11 -08:00
justinbastress
377e647417
Merge pull request #186 from zmap/jb/jp-fix
use jp on path (and get/build it if not available)
2019-01-28 09:59:11 -05:00
justinbastress
a137e76c73
Merge branch 'master' into jb/jp-fix 2019-01-25 16:54:16 -05:00
justinbastress
cd5d402a8d
Merge pull request #188 from zmap/jb/integration-test-venv
use a virtualenv to install zschema
2019-01-25 16:52:32 -05:00
Justin Bastress
aa2d162c9c re: @codyprime's comments in #188 2019-01-25 16:32:53 -05:00
Justin Bastress
369cb29d78 mkdir zgrab-output 2019-01-25 16:05:00 -05:00
Justin Bastress
45d3516729 install zschema 2019-01-25 15:47:00 -05:00
Justin Bastress
3400be2b3c use a virtualenv to install zschema 2019-01-25 13:33:28 -05:00
justinbastress
9f19df743e
Merge pull request #176 from sdnewhop/master
SSH: Add banner grabbing
2019-01-23 15:25:29 -05:00
justinbastress
4a6dfdbcc4
Merge pull request #146 from zmap/jb/fixSNI
TLS SNI fixes / API cleanup
2019-01-23 13:43:31 -05:00
Justin Bastress
108ce0a0ab use jp on path (and get/build it if not available) 2019-01-18 13:33:23 -05:00