smb~ SMBClient

SMBClient is a client for SMB servers.

Constructor

new SMBClient()

Methods

ConnectSMBInfoMode(host, port) → {SMBLog}

ConnectSMBInfoMode tries to connect to provided host and port and discover SMB information
Parameters:
NameTypeDescription
hoststringThe host to connect to.
portstringThe port to connect to.
Throws:
- The error encountered during the connection.
Type
error
Returns:
- The log of the SMB handshake.
Type: 
SMBLog
Example
let m = require('nuclei/smb');
let c = m.SMBClient();
let log = c.ConnectSMBInfoMode('localhost', '445');

DetectSMBGhost(host, port) → {boolean}

DetectSMBGhost tries to detect SMBGhost vulnerability by using SMBv3 compression feature.
Parameters:
NameTypeDescription
hoststringThe host to connect to.
portstringThe port to connect to.
Throws:
- The error encountered during the detection.
Type
error
Returns:
- The result of the SMBGhost vulnerability detection.
Type: 
boolean
Example
let m = require('nuclei/smb');
let c = m.SMBClient();
let isVulnerable = c.DetectSMBGhost('localhost', '445');

ListSMBv2Metadata(host, port) → {ServiceSMB}

ListSMBv2Metadata tries to connect to provided host and port and list SMBv2 metadata.
Parameters:
NameTypeDescription
hoststringThe host to connect to.
portstringThe port to connect to.
Throws:
- The error encountered during the listing.
Type
error
Returns:
- The metadata of the SMBv2 service.
Type: 
ServiceSMB
Example
let m = require('nuclei/smb');
let c = m.SMBClient();
let metadata = c.ListSMBv2Metadata('localhost', '445');

ListShares(host, port, user, password) → {Array.<string>}

ListShares tries to connect to provided host and port and list shares by using given credentials.
Parameters:
NameTypeDescription
hoststringThe host to connect to.
portstringThe port to connect to.
userstringThe username for authentication.
passwordstringThe password for authentication.
Throws:
- The error encountered during the listing.
Type
error
Returns:
- The list of shares.
Type: 
Array.<string>
Example
let m = require('nuclei/smb');
let c = m.SMBClient();
let shares = c.ListShares('localhost', '445', 'user', 'password');