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:

The library contains the following classes

  • Comm
** A class that handles most communication
  • Helper
** The helper class wraps the Comm class using functions with a more descriptive name.
  • Util
** The Util class contains a number of static functions mainly used to convert data.
  • Decoders
** The Decoders class contains static functions used for decoding probe matches

The following code snippet 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 https://nmap.org/book/man-legal.html

Source: https://svn.nmap.org/nmap/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 probes table to send

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:

  1. status true on success, false on failure
  2. 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:

  1. status true on success, false on failure
  2. response table containing the following fields msgid, xaddrs, types err 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:

  1. status true on success, false on failure
  2. response table containing the following fields msgid, xaddrs, types err string containing the error message
discoverDevices (self)

Sends a general probe to attempt to discover WSDD supporting devices

Parameters

self
 

Return values:

  1. status true on success, false on failure
  2. matches table containing responses, suitable for printing using the stdnse.format_output function
discoverServices (self, probename)

Sends a probe, receives and decodes a probematch

Parameters

self
 
probename
string containing the name of the probe to send check probes for available probes

Return values:

  1. status true on success, false on failure
  2. matches table containing responses, suitable for printing using the stdnse.format_output function
discoverWCFServices (self)

Sends a probe that attempts to discover WCF web services

Parameters

self
 

Return values:

  1. status true on success, false on failure
  2. matches table containing responses, suitable for printing using the stdnse.format_output function
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 for stdnse.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 probes table to send

Parameters

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