Skip to content

Instantly share code, notes, and snippets.

@akpotter
Last active February 7, 2022 04:25
Show Gist options
  • Select an option

  • Save akpotter/0fd0cee473c80dd77fdff37337a533d4 to your computer and use it in GitHub Desktop.

Select an option

Save akpotter/0fd0cee473c80dd77fdff37337a533d4 to your computer and use it in GitHub Desktop.
#!/usr/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:upnporg:serviceId:WANIPConnection.1#GetGenericPortMappingEntry"><NewPortMappingIndex>'
soap_tail='</NewPortMappingIndex></u:GetGenericPortMappingEntry></s:Body></s:Envelope>'
for i in `seq 0 10`; do
payload=$soap_head$i$soap_tail
curl -H 'Content-Type: "text/xml;charset=UTF-8"' -H 'SOAPACTION: "urn:schemasupnp-org:service:WANIPConnection:1#GetGenericPortMappingEntry"' --data "$payload" "$url"
echo ""
done
@akpotter
Copy link
Author

@MrCsabaToth
Copy link

The original code by Akamai has seq 1 10000. Is 0 10 repetition enough?

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