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<code> - containing a minimal XML parser written by Vasiliy Kulikov. * <code>TagProcessor
- Contains processing code for common tagsXMPP- containing the low-level functions used to
Helper- containing the main interface for script
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> Version 0.2 Created 07/19/2011 - v0.1 - Created by Patrik Karlsson Revised 07/22/2011 - v0.2 - Added TagProcessors and two new auth mechs: CRAM-MD5 and LOGIN <patrik@cqure.net> |
Copyright© Same as Nmap--See http://nmap.org/book/man-legal.html
Source: http://nmap.org/svn/nselib/xmpp.lua
Functions
| close (self) |
Closes the connection to the server |
| connect (self) |
Connects to the XMPP server and starts the initial communication |
| connect (self) |
Connects to the XMPP server and starts the initial communication |
| disconnect (self) |
Disconnects the socket from the server |
| getAuthMechs (self) |
Retrieves the available authentication mechanisms |
| getAuthMechs (self) |
Retrieves the available authentication mechanisms |
| login (self, username, password, mech) |
Login to the XMPP server |
| login (self, username, password, mech) |
Login to the XMPP server |
| new (self, host, port, options) |
Creates a new Helper instance |
| new (self, host, port, options) |
Creates a new Helper instance |
| receive_tag (self, tag, close) |
Receives a XML tag from the server |
| send (self, data) |
Sends data to XMPP server |
Functions
- close (self)
-
Closes the connection to the server
Parameters
- self:
- connect (self)
-
Connects to the XMPP server and starts the initial communication
Parameters
- self:
Return values:
- status true on success, false on failure
- err string containing an error message is status is false
- connect (self)
-
Connects to the XMPP server and starts the initial communication
Parameters
- self:
Return values:
- status true on success, false on failure
- err string containing an error message is status is false
- disconnect (self)
-
Disconnects the socket from the server
Parameters
- self:
Return value:
status true on success, false on failure - getAuthMechs (self)
-
Retrieves the available authentication mechanisms
Parameters
- self:
Return value:
table containing all available authentication mechanisms - getAuthMechs (self)
-
Retrieves the available authentication mechanisms
Parameters
- self:
Return value:
table containing all available authentication mechanisms - login (self, username, password, mech)
-
Login to the XMPP server
Parameters
- self:
- username: string
- password: string
-
mech:
string containing a supported authentication mechanism
(@see
getAuthMechs)
- login (self, username, password, mech)
-
Login to the XMPP server
Parameters
- self:
- username: string
- password: string
-
mech:
string containing a supported authentication mechanism
(@see
getAuthMechs)
- new (self, host, port, options)
-
Creates a new Helper instance
Parameters
- self:
- host: table as receieved by the action function
- port: table as receieved by the action function
-
options:
table containing options, currently supported
timeout- sets the socket timeoutservername- sets the server name to use in communication with the server.
- new (self, host, port, options)
-
Creates a new Helper instance
Parameters
- self:
- host: table as receieved by the action function
- port: table as receieved by the action function
-
options:
table containing options, currently supported
timeout- sets the socket timeoutservername- sets the server name to use in communication with the server.
- 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
- send (self, data)
-
Sends data to XMPP server
Parameters
- self:
- data: string containing data to send to server
Return values:
- status true on success false on failure
- err string containing error message




