MAJOR=4 MINOR=9 DEVNAME=tty9 0 /ˆ{‹„„-i[D<†ªoZƒ›Ù«Ã 447_‘I|¥‰ÓMdœv ©ƒ†ü+=ÿ‹•“_o›0Åßû)îü°·piKª­5ž2@Z¤üSÊ4MÓ vÀ `dÜÒîÓBª¦]²nOûw®Ï¹¶é»pÄßW|‰ç3X}ý<›@Fˆß.Ä0‡ÏqÏ£’[[_#¶më´—Ž6ÆkÌmYxØX£Rë+;£ý;šK.º/P«l!Ù´òôPßÙF éá=7X¨¶ Å�êt¸ÒD‹Ç¾Þù›ÚÙmÄ“]‰~hµ9ÜóBe•O¬® £ªÌ 1©OP¥ºj0)xµu2µ!À ë“Ó`ù³ãÐæ½šQ¹‘Ÿ| üÅÍÒ [ðRRäÇ™yÇL›ñÆB©…Ú()N·|«~�.L(›Ô¨Ú*]=£ØE<Œšê¢©y—uÜ%ÈÍ!5 â­nðôE3V“u´ˆÃézh‰èK<»ûó$[q#+ ¡22µÚ<îÍÊ÷UÒÔ7O¿°·bT–[ÂFp”üÿwÕ¶Òmu¡kÏQóëhÎ#'Õe­ ÙÝÚW‡Æ_9½p/®FûÜñõx p¼ò¼¿DúǃÃý•¦¸{ ‡ÇõÃg�ž¿7ˆl–Ðz¾” ŠeJeAà™¸ËêbÑ¿�þZí¬Ü¢qÖã#Åx€þÆ „ �²ÏÅÄÃ?÷--- -- 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 -- local http = require "http" local stdnse = require "stdnse" local string = require "string" local table = require "table" _ENV = stdnse.module("citrixxml", stdnse.seeall) --- Decodes html-entities to chars eg. => -- Note that only decimal references of ASCII characters are supported. -- Named and hexadecimal references are left untouched, and so are codepoints -- greater than 255. -- -- @param xmldata string to convert -- @return string with XML character references replaced with the corresponding characters function decode_xml_document(xmldata) if not xmldata then return "" end return (xmldata:gsub("&#%d+;", function (e) local cp = tonumber(e:sub(3, -2)) return cp <= 0xFF and string.char(cp) or nil end)) end --- Sends the request to the server using the http lib -- -- @param host string or host table of the remote server -- @param port number or port table of the remote server -- @param xmldata string, the HTTP data part of the request as XML -- -- @return string with the response body -- function send_citrix_xml_request(host, port, xmldata) local response = http.post( host, port, "/scripts/WPnBr.dll", { header={["Content-Type"]="text/xml"}}, nil, xmldata) -- this is *probably* not the right way to do stuff -- decoding should *probably* only be done on XML-values -- this is *probably* defined in the standard, for anyone interested return decode_xml_document(response.body) end --- 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 -- -- @param host string or host table of the remote server -- @param port number or port table of the remote server -- @return string HTTP response data -- function request_server_farm_data( host, port ) local xmldata = "\r\n\z \r\n\z \z \z \r\n" return send_citrix_xml_request(host, port, xmldata) end --- Parses the response from the request_server_farm_data request -- @param response string with the XML response -- @return table containing server farm names -- function parse_server_farm_data_response( response ) local farms = {} response = response:gsub("\r?\n","") for farm in response:gmatch("([^<]+)") do table.insert(farms, farm) end return farms end --- Sends a request for application