zgrab2/schemas
2018-03-29 10:17:39 -04:00
..
__init__.py merge master 2018-03-26 11:31:35 -04:00
bacnet.py port BACNet from zgrab 2018-03-21 16:27:28 -04:00
dnp3.py port DNP3 scanner 2018-03-21 16:52:53 -04:00
fox.py port fox scanner from zgrab 2018-03-22 15:33:42 -04:00
ftp.py run pycodestyle on schemas/ftp.py 2018-02-12 11:58:33 -05:00
http.py Port http from zgrab (#31) 2018-02-09 13:45:50 -05:00
imap.py add basic IMAP scanning 2018-03-15 14:35:35 -04:00
modbus.py fix schema 2018-03-21 11:00:22 -04:00
mssql.py Add MSSQL zgrab2 module (#38) 2018-02-02 14:52:03 -05:00
mysql.py golint and godocs for mysql module (#56) 2018-02-12 10:42:45 -05:00
ntp.py Add NTP zgrab2 module (#39) 2018-02-07 12:25:46 -05:00
oracle.py address @dadrian's comments -- clean up schema, fix godoc formatting 2018-03-26 11:25:04 -04:00
pop3.py port POP3 2018-03-15 13:10:10 -04:00
postgres.py Implements postgres zgrab2 module (#30) 2018-01-15 14:24:57 -05:00
README.md add ssh integration tests (#26) 2017-12-19 10:09:43 -05:00
redis.py Add redis zgrab2 module (#53) 2018-02-13 13:25:47 -05:00
siemens.py add siemens s7 scanner 2018-03-22 17:06:44 -04:00
smb.py PEP8 updates; fix NTLM typo 2018-03-16 14:39:06 -04:00
smtp.py Add integration tests; Post PR comment updates: stray further from original ZGrab input/output in favor of more zgrab2-like input/output; make QUIT optional (default off). 2018-03-15 11:07:18 -04:00
ssh.py add H field to xssh server signature to allow signature verification (#95) 2018-03-29 10:17:39 -04:00
telnet.py TelnetOptions get encoded to name/value, not String(name) 2018-03-14 10:59:41 -04:00
zcrypto.py add serverKeyExchange digest to zcrypto schema (#96) 2018-03-29 09:42:48 -04:00
zgrab2.py Scanner modules return the protocol ID, scan returns the protocol in the results. 2018-03-12 13:36:11 -04:00

ZGrab 2.0 schemas for zschema

Validating

integration_tests.sh automatically validates output from the integration tests; to manually validate a zgrab2 result, you can follow these steps:

  1. Get zschema (e.g. git clone https://github.com/zmap/zschema)
  2. Run the zschema validator:
    1. Run the zschema module's main function
    2. Pass it the validate command
    3. Give the path to the zgrab2 schema schemas/__init__.py:zgrab2
    4. Pass in the zgrab2 JSON file to validate
    • echo 127.0.0.1 | ./cmd/zgrab2/zgrab2 mysql > output.json
      PYTHONPATH=/path/to/zschema python -m zschema validate schemas/__init__.py:zgrab2 output.json
      

Adding new module schemas

There are two steps to adding a new zgrab2 module schema:

  1. Add the module a. Register the response type with the zgrab2 schema
  2. Register the module in __init__.py

Add the module

Create your python file; if your protocol identifier (the default name in the result table) is my_protocol, name the file my_protocol.py (this allows a static schema validation from protocol_name to protocol_schema; unfortunately, this means that multiple scans on a single host, or scans using custom identifiers, will not validate).

Your module should include a SubRecord that extends from zgrab2.base_scan_response, specifically, overridding the result field. See schemas/mysql.py for an example.

Register the module

In schemas/__init__.py, add an import for your module (e.g. import my_protocol). This will ensure that the module code is executed and that the response type is registered with the zgrab2 module.