Class: SMBClient

smb.SMBClient

SMBClient is a client for SMB servers. Internally client uses github.com/zmap/zgrab2/lib/smb/smb driver. github.com/projectdiscovery/go-smb2 driver

Example

const smb = require('nuclei/smb');
const client = new smb.SMBClient();

Table of contents

Constructors

Methods

Constructors

constructor

new SMBClient(): SMBClient

Returns

SMBClient

Defined in

smb.ts:17

Methods

ConnectSMBInfoMode

ConnectSMBInfoMode(host, port): SMBLog

ConnectSMBInfoMode tries to connect to provided host and port and discovery SMB information Returns handshake log and error. If error is not nil, state will be false

Parameters

NameType
hoststring
portnumber

Returns

SMBLog

Example

const smb = require('nuclei/smb');
const client = new smb.SMBClient();
const info = client.ConnectSMBInfoMode('acme.com', 445);
log(to_json(info));

Defined in

smb.ts:31


DetectSMBGhost

DetectSMBGhost(host, port): boolean

DetectSMBGhost tries to detect SMBGhost vulnerability by using SMBv3 compression feature. If the host is vulnerable, it returns true.

Parameters

NameType
hoststring
portnumber

Returns

boolean

Example

const smb = require('nuclei/smb');
const isSMBGhost = smb.DetectSMBGhost('acme.com', 445);

Defined in

smb.ts:84


ListSMBv2Metadata

ListSMBv2Metadata(host, port): ServiceSMB

ListSMBv2Metadata tries to connect to provided host and port and list SMBv2 metadata. Returns metadata and error. If error is not nil, state will be false

Parameters

NameType
hoststring
portnumber

Returns

ServiceSMB

Example

const smb = require('nuclei/smb');
const client = new smb.SMBClient();
const metadata = client.ListSMBv2Metadata('acme.com', 445);
log(to_json(metadata));

Defined in

smb.ts:49


ListShares

ListShares(host, port, user): string[]

ListShares tries to connect to provided host and port and list shares by using given credentials. Credentials cannot be blank. guest or anonymous credentials can be used by providing empty password.

Parameters

NameType
hoststring
portnumber
userstring

Returns

string[]

Example

const smb = require('nuclei/smb');
const client = new smb.SMBClient();
const shares = client.ListShares('acme.com', 445, 'username', 'password');
	for (const share of shares) {
		  log(share);
	}

Defined in

smb.ts:69