I'm trying to find a way to get my router to report back my WAN IP using UPnP/SSDP, but so far I have been unable to even get a list of UPnP supporting internet access devices on my network. Here's the request I'm sending:
$ cat request.txt M-SEARCH * HTTP/1.1 HOST: 188.8.131.52:1900 MAN: "ssdp:discover" MX: 3 ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
With the command:
$ nc -uvv 184.108.40.206 1900 < request.txt Connection to 220.127.116.11 1900 port [udp/ssdp] succeeded!
I just get the connnection succeded message and then nothing...
Could anyone give me any pointers (no memory addresses please!) as to what I'm doing wrong?
Update: Ok so I tried using
tcpdump to get responses here's what I got:
$ sudo tcpdump -vv -A -s 0 -i en1 udp port 1900 and host 18.104.22.168 … NOTIFY * HTTP/1.1 Host: 22.214.171.124:1900 Cache-Control: max-age=60 Location: http://192.168.1.1:1780/InternetGatewayDevice.xml NTS: ssdp:alive Server: POSIX, UPnP/1.0 linux/126.96.36.199 NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1 …
I guess the next step is to parse the output of tcpdump and filter out all responses that don't contain the
NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1 header then make the actual SOAP request to the router.