Library wsdd
A library that enables scripts to send Web Service Dynamic Discovery probes and perform some very basic decoding of responses. The library is in no way a full WSDD implementation it's rather the result of some packet captures and some creative coding.
The "general" probe was captured of the wire of a Windows 7 box while connecting to the network. The "wcf" probe was captured from a custom tool tool performing WCF discovery in .NET 4.0.
More information about the protocol can be found here:
- http://docs.oasis-open.org/ws-dd/discovery/1.1/os/wsdd-discovery-1.1-spec-os.pdf
- http://specs.xmlsoap.org/ws/2005/04/discovery/ws-discovery.pdf
The library contains the following classes
Comm
Helper
Comm class using functions with a more descriptive name.
Util
Decoders
The following code snipplet shows how the library can be used:
local helper = wsdd.Helper:new() helper:setMulticast(true) return stdnse.format_output( helper:discoverDevices() )
Author:
| "Patrik Karlsson <patrik@cqure.net>" |
Copyright© Same as Nmap--See http://nmap.org/book/man-legal.html
Source: http://nmap.org/svn/nselib/wsdd.lua
Functions
| ['error'] (data) |
Decodes an error message received from the service |
| ['general'] (data) |
Decodes a general probe response |
| ['wcf'] (data) |
Decodes a wcf probe response |
| discoverDevices (self) |
Sends a general probe to attempt to discover WSDD supporting devices |
| discoverServices (self, probename) |
Sends a probe, receives and decodes a probematch |
| discoverWCFServices (self) |
Sends a probe that attempts to discover WCF web services |
| generateUUID () |
Creates a UUID |
| getProbeByName (name) |
Retrieves a probe from the probes table by name |
| new (self, host, port) |
Creates a new helper instance |
| new (self, host, port) |
Creates a new helper instance |
| recvProbeMatches (self) |
Receives one or more responses for a Probe |
| sendProbe (self) |
Sends a probe over the wire |
| setMulticast (self, mcast) |
Instructs the helper to use unconnected sockets supporting multicast |
| setProbe (self, probe) |
Sets a probe from the |
| setTimeout (self, timeout) |
Sets the timeout for socket reads |
| setTimeout (self, timeout) |
Sets the timeout for socket reads |
Functions
- ['error'] (data)
-
Decodes an error message received from the service
Parameters
- data: string containing the response as received over the wire
Return values:
- status true on success, false on failure
- err string containing the error message
- ['general'] (data)
-
Decodes a general probe response
Parameters
- data: string containing the response as received over the wire
Return values:
- status true on success, false on failure
- response table containing the following fields
msgid,xaddrs,typeserr string containing the error message
- ['wcf'] (data)
-
Decodes a wcf probe response
Parameters
- data: string containing the response as received over the wire
Return values:
- status true on success, false on failure
- response table containing the following fields
msgid,xaddrs,typeserr string containing the error message
- discoverDevices (self)
-
Sends a general probe to attempt to discover WSDD supporting devices
Parameters
- self:
Return values:
- status true on success, false on failure
- matches table containing responses, suitable for printing using
the
stdnse.format_outputfunction
- discoverServices (self, probename)
-
Sends a probe, receives and decodes a probematch
Parameters
- self:
-
probename:
string containing the name of the probe to send
check
probesfor available probes
Return values:
- status true on success, false on failure
- matches table containing responses, suitable for printing using
the
stdnse.format_outputfunction
- discoverWCFServices (self)
-
Sends a probe that attempts to discover WCF web services
Parameters
- self:
Return values:
- status true on success, false on failure
- matches table containing responses, suitable for printing using
the
stdnse.format_outputfunction
- generateUUID ()
-
Creates a UUID
Return value:
uuid string containing a uuid - getProbeByName (name)
-
Retrieves a probe from the probes table by name
Parameters
- name: string containing the name of the probe to retrieve
Return value:
probe table containing the probe or nil if not found - new (self, host, port)
-
Creates a new helper instance
Parameters
- self:
- host: string containing the host name or ip
- port: number containing the port to connect to
Return value:
o a new instance of Helper - new (self, host, port)
-
Creates a new helper instance
Parameters
- self:
- host: string containing the host name or ip
- port: number containing the port to connect to
Return value:
o a new instance of Helper - recvProbeMatches (self)
-
Receives one or more responses for a Probe
Parameters
- self:
Return value:
table containing decoded responses suitable forstdnse.format_output - sendProbe (self)
-
Sends a probe over the wire
Parameters
- self:
Return value:
status true on success, false on failure - setMulticast (self, mcast)
-
Instructs the helper to use unconnected sockets supporting multicast
Parameters
- self:
- mcast: boolean true if multicast is to be used, false otherwise
- setProbe (self, probe)
-
Sets a probe from the
probestable to sendParameters
- self:
-
probe:
table containing a probe from
probes
- setTimeout (self, timeout)
-
Sets the timeout for socket reads
Parameters
- self:
- timeout:
- setTimeout (self, timeout)
-
Sets the timeout for socket reads
Parameters
- self:
- timeout:


