Library citrixxml

This module was written by Patrik Karlsson and facilitates communication with the Citrix XML Service. It is not feature complete and is missing several functions and parameters.

The library makes little or no effort to verify that the parameters submitted to each function are compliant with the DTD

As all functions handling requests take their parameters in the form of tables, additional functionality can be added while not breaking existing scripts

Details regarding the requests/responses and their parameters can be found in the NFuse.DTD included with Citrix MetaFrame/Xenapp

This code is based on the information available in: NFuse.DTD - Version 5.0 (draft 1) 24 January 2008

Source: https://svn.nmap.org/nmap/nselib/citrixxml.lua

Functions

decode_xml_document (xmldata)

Decodes html-entities to chars eg. &#32; => <space> Note that only decimal references of ASCII characters are supported. Named and hexadecimal references are left untouched, and so are codepoints greater than 255.

parse_appdata_response (xmldata)

Parses the appdata XML response

parse_capabilities_response (response)

Parses the response from the request_capabilities request

parse_server_data_response (response)

Parses the response from the request_server_data request

parse_server_farm_data_response (response)

Parses the response from the request_server_farm_data request

parse_validate_credentials_response (response)

Parses the response from request_validate_credentials

request_appdata (host, port, params)

Sends a request for application data to the Citrix XML service

request_capabilities (host, port)

Request capability information

request_protocol_info (host, port, params)

Request information about the Citrix protocol

request_reconnect_session_data (host, port, params)

Sends a request to reconnect session data

request_server_data (host, port, params)

Request information about the Citrix protocol

request_server_farm_data (host, port)

Request information about the Citrix Server Farm

request_validate_credentials (host, port, params)

Tries to validate user credentials against the XML service

send_citrix_xml_request (host, port, xmldata)

Sends the request to the server using the http lib

Functions

decode_xml_document (xmldata)

Decodes html-entities to chars eg. &#32; => <space> Note that only decimal references of ASCII characters are supported. Named and hexadecimal references are left untouched, and so are codepoints greater than 255.

Parameters

xmldata
string to convert

Return value:

string with XML character references replaced with the corresponding characters
parse_appdata_response (xmldata)

Parses the appdata XML response

Parameters

xmldata
string response from request_appdata

Return value:

table containing nestled tables closely resembling the DOM model of the XML response
parse_capabilities_response (response)

Parses the response from the request_capabilities request

Parameters

response
string with the XML response

Return value:

table containing the server capabilities
parse_server_data_response (response)

Parses the response from the request_server_data request

Parameters

response
string with the XML response

Return value:

table containing the server names
parse_server_farm_data_response (response)

Parses the response from the request_server_farm_data request

Parameters

response
string with the XML response

Return value:

table containing server farm names
parse_validate_credentials_response (response)

Parses the response from request_validate_credentials

Parameters

response
string with the XML response

Return value:

table containing the results
request_appdata (host, port, params)

Sends a request for application data to the Citrix XML service

Consult the NFuse.DTD for a complete list of supported parameters This function does NOT implement all the supported parameters

Supported parameters are Scope, ServerType, ClientType, DesiredDetails

Parameters

host
string or host table which is to be queried
port
number or port table of the XML service
params
table with parameters

Return value:

string HTTP response data
request_capabilities (host, port)

Request capability information

Consult the NFuse.DTD for a complete list of supported parameters This function implements all the supported parameters described in: Version 5.0 (draft 1) 24 January 2008

Parameters

host
string or host table which is to be queried
port
number or port table of the XML service

Return value:

string HTTP response data
request_protocol_info (host, port, params)

Request information about the Citrix protocol

Consult the NFuse.DTD for a complete list of supported parameters This function implements all the supported parameters described in: Version 5.0 (draft 1) 24 January 2008

Parameters

host
string or host table which is to be queried
port
number or port table of the XML service
params
table with parameters

Return value:

string HTTP response data
request_reconnect_session_data (host, port, params)

Sends a request to reconnect session data

Consult the NFuse.DTD for a complete list of supported parameters This function does NOT implement all the supported parameters

Parameters

host
string or host table which is to be queried
port
number or port table of the XML service
params
table with parameters
request_server_data (host, port, params)

Request information about the Citrix protocol

Consult the NFuse.DTD for a complete list of supported parameters This function implements all the supported parameters described in: Version 5.0 (draft 1) 24 January 2008

Parameters

host
string or host table which is to be queried
port
number or port table of the XML service
params
table with parameters

Return value:

string HTTP response data
request_server_farm_data (host, port)

Request information about the Citrix Server Farm

Consult the NFuse.DTD for a complete list of supported parameters This function implements all the supported parameters described in: Version 5.0 (draft 1) 24 January 2008

Parameters

host
string or host table of the remote server
port
number or port table of the remote server

Return value:

string HTTP response data
request_validate_credentials (host, port, params)

Tries to validate user credentials against the XML service

Consult the NFuse.DTD for a complete list of supported parameters This function implements all the supported parameters described in: Version 5.0 (draft 1) 24 January 2008

Parameters

host
string or host table which is to be queried
port
number or port table of the XML service
params
table with parameters

Return value:

string HTTP response data
send_citrix_xml_request (host, port, xmldata)

Sends the request to the server using the http lib

Parameters

host
string or host table of the remote server
port
number or port table of the remote server
xmldata
string, the HTTP data part of the request as XML

Return value:

string with the response body