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

Library iscsi

An iSCSI library implementing written by Patrik Karlsson <patrik@cqure.net> The library currently supports target discovery and login.

The implementation is based on packetdumps and the iSCSI RFC

The library contains the protocol message pairs in Packet E.g. LoginRequest and LoginResponse

Each request can be "serialized" to a string using: tostring(request). All responses can be read and instantiated from the socket by calling: local status,resp = Response.fromSocket(sock)

In addition the library has the following classes:

  • Packet
** A class containing the request and response packets
  • Comm
** A class used to send and receive packet between the library and server ** The class handles some of the packet "counting" and value updating
  • KVP
** A key/value pair class that holds key value pairs
  • Helper
** A class that wraps the Comm and Packet classes ** The purpose of the class is to provide easy access to common iSCSI task

Author:
"Patrik Karlsson <patrik@cqure.net>"

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

Source: http://nmap.org/svn/nselib/iscsi.lua

Functions

__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

add (self, key, value)

Adds a key/value pair

calcResponse (identifier, challenge, secret)

Calculate a CHAP - response

close (self)

Disconnects the socket from the server

connect (self)

Connects to the iSCSI target

discoverTargets (self)

Attempts to discover accessible iSCSI targets on the remote server

exchange (self, out_packet, in_class)

Sends a packet and retrieves the response

fromSocket (s)

Creates a LogoutResponse with data read from the socket

fromSocket (s)

Creates a LogoutResponse with data read from the socket

fromSocket (s)

Creates a LogoutResponse with data read from the socket

get (self, key)

Gets all values for a specific key

getErrorCode (self)

Returns the error code

getErrorMessage (self)

Returns the error message

login (self, target_name, username, password, auth_method)

Authenticate to the iSCSI service

logout (self)

Logs out from the iSCSI target

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

new (self, host, port)

Creates a new instance of the Helper class

setContinue (self, b)

Sets the continue bit of the TextRequest

setContinue (self, b)

Sets the continue bit of the TextRequest

setCSG (self, csg)

Sets the CSG values

setFinal (self, b)

Sets the final bit of the TextRequest

setNSG (self, nsg)

Sets the NSG values

setTransit (self, b)

Sets the transit bit



Functions

__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

Parameters

  • self:

Return value:

string containing all key/value pairs
__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

Parameters

  • self:

Return value:

string containing all key/value pairs
__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

Parameters

  • self:

Return value:

string containing all key/value pairs
__tostring (self)

Returns all key value pairs as string delimited by \0 eg. "key1=val1\0key2=val2\0"

Parameters

  • self:

Return value:

string containing all key/value pairs
add (self, key, value)

Adds a key/value pair

Parameters

  • self:
  • key: string containing the key name
  • value: string containing the value
calcResponse (identifier, challenge, secret)

Calculate a CHAP - response

Parameters

  • identifier: number containing the CHAP identifier
  • challenge: string containing the challenge
  • secret: string containing the users password

Return value:

response string containing the CHAP response
close (self)

Disconnects the socket from the server

Parameters

  • self:
connect (self)

Connects to the iSCSI target

Parameters

  • self:

Return values:

  1. status true on success, false on failure
  2. err string containing error message is status is false
discoverTargets (self)

Attempts to discover accessible iSCSI targets on the remote server

Parameters

  • self:

Return values:

  1. status true on success, false on failure
  2. targets table containing discovered targets each table entry is a target table with name and addr. err string containing an error message is status is false
exchange (self, out_packet, in_class)

Sends a packet and retrieves the response

Parameters

  • self:
  • out_packet: instance of a packet to send
  • in_class: class of the packet to read

Return values:

  1. status true on success, false on failure
  2. r decoded instance of in_class
fromSocket (s)

Creates a LogoutResponse with data read from the socket

Parameters

  • s:

Return values:

  1. status true on success, false on failure
  2. instance of LogoutResponse err string containing error message
fromSocket (s)

Creates a LogoutResponse with data read from the socket

Parameters

  • s:

Return values:

  1. status true on success, false on failure
  2. instance of LogoutResponse err string containing error message
fromSocket (s)

Creates a LogoutResponse with data read from the socket

Parameters

  • s:

Return values:

  1. status true on success, false on failure
  2. instance of LogoutResponse err string containing error message
get (self, key)

Gets all values for a specific key

Parameters

  • self:
  • key: string containing the name of the key to retrieve

Return value:

values table containing all values for the specified key
getErrorCode (self)

Returns the error code

Parameters

  • self:
getErrorMessage (self)

Returns the error message

Parameters

  • self:
login (self, target_name, username, password, auth_method)

Authenticate to the iSCSI service

Parameters

  • self:
  • target_name: string containing the name of the iSCSI target
  • username: string containing the username
  • password: string containing the password
  • auth_method: string containing either "None" or "Chap"

Return values:

  1. status true on success false on failure
  2. response containing the loginresponse or err string containing an error message if status is false
logout (self)

Logs out from the iSCSI target

Parameters

  • self:

Return value:

status true on success, false on failure
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
new (self, host, port)

Creates a new instance of the Helper class

Parameters

  • self:
  • host: table as received by the script action function
  • port: table as received by the script action function

Return value:

o instance of Helper
setContinue (self, b)

Sets the continue bit of the TextRequest

Parameters

  • self:
  • b:
setContinue (self, b)

Sets the continue bit of the TextRequest

Parameters

  • self:
  • b:
setCSG (self, csg)

Sets the CSG values

Parameters

  • self:
  • csg: number containing the new NSG value
setFinal (self, b)

Sets the final bit of the TextRequest

Parameters

  • self:
  • b:
setNSG (self, nsg)

Sets the NSG values

Parameters

  • self:
  • nsg: number containing the new NSG value
setTransit (self, b)

Sets the transit bit

Parameters

  • self:
  • b: boolean containing the new transit value

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 ]