Home page logo
/
Zenmap screenshot
Intro Reference Guide Book Install Guide
Download Changelog Zenmap GUI Docs
Bug Reports OS Detection Propaganda Related Projects
In the Movies In the News
Example Nmap output

Library smb2

Implements the Server Message Block (SMB) protocol version 2 and 3.

The implementation extends smb.lua to support SMB dialects 2.02, 2.10, 3.0, 3.02 and 3.11. This is a work in progress and not all commands are implemented yet. Features/functionality will be added as the scripts get updated. I tried to be consistent with the current implementation of smb.lua but some fields may have changed name or don't exist anymore.

Author:

  • Paulino Calderon <paulino@calderonpale.com>

Copyright© Same as Nmap--See https://nmap.org/book/man-legal.html

Source: https://svn.nmap.org/nmap/nselib/smb2.lua

Functions

negotiate_v2 (smb, overrides)

Sends SMB2_COM_NEGOTIATE command for a SMB2/SMB3 connection. This function works for dialects 2.02, 2.10, 3.0, 3.02 and 3.11.

smb2_encode_header_sync (smb, command, overrides)

Creates a SMB2 SYNC header packet.

smb2_read (smb, read_data)

Reads the next SMB2 packet from the socket, and parses it into the header and data. Netbios handling based taken from smb.lua.

smb2_send (smb, header, data, overrides)

Sends a SMB2 packet



Functions

negotiate_v2 (smb, overrides)

Sends SMB2_COM_NEGOTIATE command for a SMB2/SMB3 connection. This function works for dialects 2.02, 2.10, 3.0, 3.02 and 3.11.

Packet structure: https://msdn.microsoft.com/en-us/library/cc246543.aspx

Parameters

  • smb: The associated SMB connection object.
  • overrides: Overrides table.

Return value:

(status, dialect) If status is true, the negotiated dialect is returned as the second value. Otherwise if status is false, the error message is returned.
smb2_encode_header_sync (smb, command, overrides)

Creates a SMB2 SYNC header packet.

SMB2 Packet Header - SYNC:

Parameters

  • smb: The SMB object associated with the connection.
  • command: The SMB2 command to execute.
  • overrides: Overrides table.

Return value:

header The encoded SMB2 SYNC header.
smb2_read (smb, read_data)

Reads the next SMB2 packet from the socket, and parses it into the header and data. Netbios handling based taken from smb.lua.

Parameters

  • smb: The SMB object associated with the connection
  • read_data: [optional] Return data section. Set to false if you only need the header. Default: true

Return value:

(status, header, data) If status is true, the header, and data are all the raw arrays of bytes. If status is false, header contains an error message and data is undefined.
smb2_send (smb, header, data, overrides)

Sends a SMB2 packet

Parameters

  • smb: The SMB object associated with the connection
  • header: The header encoded with smb_encode_sync_header.
  • data: The data.
  • overrides: Overrides table.

Return values:

  1. Boolean Status.
  2. An error message if status is false.

Nmap Site Navigation

Intro Reference Guide Book Install Guide
Download Changelog Zenmap GUI Docs
Bug Reports OS Detection Propaganda Related Projects
In the Movies In the News
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]