Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
Last active March 14, 2023 23:50
Show Gist options
  • Save jfeilbach/0781b1777c48a1e41bbf31a186e04fb2 to your computer and use it in GitHub Desktop.
Save jfeilbach/0781b1777c48a1e41bbf31a186e04fb2 to your computer and use it in GitHub Desktop.
Bash script to dump UPnP NAT entries
#!/bin/bash
url=$1
soap_head=’<?xml version=”1.0” encoding=”utf-8”?><s:Envelope s:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/” xmlns:s=”http://schemas. xmlsoap.org/soap/envelope/”><s:Body><u:GetGenericPortMappingEntry xmlns:u=”urn:upnp- org:serviceId:WANIPConnection.1#GetGenericPortMappingEntry”><NewPortMappingIndex>’ soap_tail=’</NewPortMappingIndex></u:GetGenericPortMappingEntry></s:Body></ s:Envelope>’
for i in `seq 1 1000`; do
payload=$soap_head$i$soap_tail
curl -H ‘Content-Type: “text/xml;charset=UTF-8”’ -H ‘SOAPACTION: “urn:schemas-
upnp-org:service:WANIPConnection:1#GetGenericPortMappingEntry”’ --data “$payload” “$url”
echo “” done
@jfeilbach
Copy link
Author

jfeilbach commented Apr 16, 2018

$ ./brute_upnproxy.sh http://192.168.1.1:2048/etc/linuxigd/gatedesc.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment