Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsdiscover returns 0 results #66

Open
n1mda opened this issue Dec 2, 2024 · 2 comments
Open

wsdiscover returns 0 results #66

n1mda opened this issue Dec 2, 2024 · 2 comments

Comments

@n1mda
Copy link

n1mda commented Dec 2, 2024

I run wsdiscover without arguments, it returns an empty result:

Discovered:

I specify -c capture_log.xml to capture the messages, and the file contains the discovery broadcast message followed by multiple responses from services. Here is an truncated example:

1 SEND 239.255.255.250:3702
<?xml version="1.0" ?>
<s:Envelope xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
        <s:Header>
                <a:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</a:Action>
                <a:MessageID>urn:uuid:1e405209-ed76-48c9-97fe-c8ba94908c48</a:MessageID>
                <a:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</a:To>
        </s:Header>
        <s:Body>
                <d:Probe>
                        <d:Scopes>onvif://www.onvif.org</d:Scopes>
                </d:Probe>
        </s:Body>
</s:Envelope>

2 RECV 192.168.68.66:3702
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl"><SOAP-ENV:Header><wsa:MessageID>urn:uuid:1e405209-ed76-48c9-97fe-c8ba94908c48</wsa:MessageID><wsa:RelatesTo>urn:uuid:1e405209-ed76-48c9-97fe-c8ba94908c48</wsa:RelatesTo><wsa:To SOAP-ENV:mustUnderstand="true">urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To><wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</wsa:Action></SOAP-ENV:Header><SOAP-ENV:Body><wsdd:ProbeMatches><wsdd:ProbeMatch><wsa:EndpointReference><wsa:Address>uuid:3fa1fe68-b915-4053-a3e1-98254a6c2e8e</wsa:Address><wsa:ReferenceProperties></wsa:ReferenceProperties><wsa:PortType>ttl</wsa:PortType></wsa:EndpointReference><wsdd:Types>tdn:NetworkVideoTransmitter tds:Device</wsdd:Types><wsdd:Scopes>onvif://www.onvif.org/name/VIGI-C455 onvif://www.onvif.org/hardware/VIGI-C455 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/G onvif://www.onvif.org/Profile/T onvif://www.onvif.org/location/Hong%20Kong onvif://www.onvif.org/type/NetworkVideoTransmitter</wsdd:Scopes><wsdd:XAddrs>http://192.168.68.66:2020/onvif/device_service</wsdd:XAddrs><wsdd:MetadataVersion>1</wsdd:MetadataVersion></wsdd:ProbeMatch></wsdd:ProbeMatches></SOAP-ENV:Body></SOAP-ENV:Envelope>

I specify one of the scopes with --scope, e.g. onvif://www.onvif.org/Profile/Streaming or onvif://www.onvif.org but the result are the same, the discovered services are not returned.

-loglevel DEBUG gives no extra output.

What is required to get the services back from ws-discovery?

@wpyoga
Copy link
Contributor

wpyoga commented Dec 11, 2024

Look at the MessageID. This is the MessageID in the Probe message:

<a:MessageID>urn:uuid:1e405209-ed76-48c9-97fe-c8ba94908c48</a:MessageID>

The ProbeMatches reply message has the same ID, and its purported MessageID is even the same as the message ID it RelatesTo:

<wsa:MessageID>urn:uuid:1e405209-ed76-48c9-97fe-c8ba94908c48</wsa:MessageID>
<wsa:RelatesTo>urn:uuid:1e405209-ed76-48c9-97fe-c8ba94908c48</wsa:RelatesTo>

The reply should have had its own unique MessageID, and its RelatesTo message ID is actually correct.

I have seen this behavior during my testing. wsdiscover has logic to ignore incoming messages whose MessageID match one of its own Probe messages. I've edited the sources locally to skip this logic, and it can actually discover my cameras.

I suspect this might be a common theme among some newer Chinese cameras. It might be useful to add new logic (a toggle option) in order to ignore the incoming MessageID and just use the RelatesTo component. I may be able to contribute some code in the near future.

Edit: It looks like Home Assistant uses this package, and that's why it's not discovering some cameras home-assistant/core#132780

@wpyoga
Copy link
Contributor

wpyoga commented Dec 23, 2024

Hi @n1mda , can you please test the latest master branch and see if the workaround works? It works on my side after PR #75 was merged.

Btw this issue is a duplicate of #38 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants