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 xmpp

A XMPP (Jabber) library, implementing a minimal subset of the protocol enough to do authentication brute-force.

The XML parsing of tags isn't optimal but there's no other easy way (nulls or line-feeds) to match the end of a message. The parse_tag method in the XML class was borrowed from the initial xmpp.nse script written by Vasiliy Kulikov.

The library consist of the following classes:

  • XML - containing a minimal XML parser written by
Vasiliy Kulikov.
  • TagProcessor - Contains processing code for common tags
  • XMPP - containing the low-level functions used to
communicate with the Jabber server.
  • Helper - containing the main interface for script
writers

The following sample illustrates how to use the library to authenticate to a XMPP sever:

local helper = xmpp.Helper:new(host, port, options)
local status, err = helper:connect()
status, err = helper:login(user, pass, "DIGEST-MD5")

Author:
Patrik Karlsson <patrik@cqure.net>

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

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

Functions

Helper.close (self)

Closes the connection to the server

Helper.connect (self)

Connects to the XMPP server and starts the initial communication

Helper.getAuthMechs (self)

Retrieves the available authentication mechanisms

Helper.login (self, username, password, mech)

Login to the XMPP server

Helper.new (self, host, port, options)

Creates a new Helper instance

XML.parse_tag (s)

Parse an XML tag

XMPP.connect (self)

Connects to the XMPP server

XMPP.disconnect (self)

Disconnects the socket from the server

XMPP.getAuthMechs (self)

Retrieves the available authentication mechanisms

XMPP.login (self, username, password, mech)

Logs in to the XMPP server

XMPP.new (self, host, port, options)

Creates a new instance of the XMPP class

XMPP.receive_tag (self, tag, close)

Receives a XML tag from the server

XMPP.send (self, data)

Sends data to XMPP server

Tables

XML.tag

XML tag table



Functions

Helper.close (self)

Closes the connection to the server

Parameters

  • self:
Helper.connect (self)

Connects to the XMPP server and starts the initial communication

Parameters

  • self:

Return values:

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

Retrieves the available authentication mechanisms

Parameters

  • self:

Return value:

table containing all available authentication mechanisms
Helper.login (self, username, password, mech)

Login to the XMPP server

Parameters

  • self:
  • username: string
  • password: string
  • mech: string containing a supported authentication mechanism

Return values:

  1. status true on success, false on failure
  2. err string containing error message if status is false

See also:

Helper.new (self, host, port, options)

Creates a new Helper instance

Parameters

  • self:
  • host: table as received by the action function
  • port: table as received by the action function
  • options: table containing options, currently supported
    • timeout - sets the socket timeout
    • servername - sets the server name to use in
    communication with the server.
XML.parse_tag (s)

Parse an XML tag

Parameters

  • s: String containing the XML tag

Return value:

XML tag table

See also:

XMPP.connect (self)

Connects to the XMPP server

Parameters

  • self:

Return values:

  1. status true on success, false on failure
  2. err string containing an error message if status is false
XMPP.disconnect (self)

Disconnects the socket from the server

Parameters

  • self:

Return values:

  1. status true on success, false on failure
  2. error message if status is false
XMPP.getAuthMechs (self)

Retrieves the available authentication mechanisms

Parameters

  • self:

Return value:

table containing all available authentication mechanisms
XMPP.login (self, username, password, mech)

Logs in to the XMPP server

Parameters

  • self:
  • username: string
  • password: string
  • mech: string containing a supported authentication mechanism

Return values:

  1. status true on success, false on failure
  2. err string containing error message if status is false
XMPP.new (self, host, port, options)

Creates a new instance of the XMPP class

Parameters

  • self:
  • host: table as received by the action function
  • port: table as received by the action function
  • options: table containing options, currently supported
    • timeout - sets the socket timeout
    • servername - sets the server name to use in
    communication with the server.
    • starttls - start TLS handshake even if it is optional.
XMPP.receive_tag (self, tag, close)

Receives a XML tag from the server

Parameters

  • self:
  • tag: [optional] if unset, receives the next available tag if set, reads until the given tag has been found
  • close: [optional] if set, matches a closing tag

Return values:

  1. true on success, false on error
  2. The XML tag table, or error message

See also:

XMPP.send (self, data)

Sends data to XMPP server

Parameters

  • self:
  • data: string containing data to send to server

Return values:

  1. status true on success false on failure
  2. err string containing error message

Tables

XML.tag

XML tag table

Fields
  • name: The tag name
  • attrs: The tag attributes as a key-value table
  • start: True if this was an opening tag.
  • contents: The contents of the tag
  • finish: true if the tag was closed.

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 ]