Skip to content

Instantly share code, notes, and snippets.

@v-sukt
Created September 17, 2019 06:45
Show Gist options
  • Save v-sukt/37bb4080256089516d8edd8d83abc89b to your computer and use it in GitHub Desktop.
Save v-sukt/37bb4080256089516d8edd8d83abc89b to your computer and use it in GitHub Desktop.
#!/bin/bash
curr_time=$(($(date +%s) * 1000)) # current millis - for exact value use https://currentmillis.com language examples
username="myusername"
read -s -p "Password:" pass_val
echo
# This is for a sample gateway 192.168.10.1:8090 which acepts login via login.xml
# we can get a command for this with F12/developertools|options for firefox chrome and click such file
# then get the curl request posted earlier - for encoding url use --data-urlencode option rest is simple
curl 'http://192.168.60.1:8090/login.xml' \
-H 'Origin: http://192.168.60.1:8090' \
-H 'DNT: 1' -H 'Accept-Encoding: gzip, deflate' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.137 Safari/537.36 Vivaldi/2.7.1628.33' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: */*' -H 'Referer: http://192.168.60.1:8090/' \
-H 'Connection: keep-alive' \
--data $'mode=191&producttype=0' \
--data-urlencode "username=${username}" \
--data-urlencode "password=${pass_val}" \
--data-urlencode "a=${curr_time}" \
--compressed --insecure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment