Skip to content

Instantly share code, notes, and snippets.

@GWuk
Last active September 16, 2023 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GWuk/9d3b13f31fc7d139781c12c706820823 to your computer and use it in GitHub Desktop.
Save GWuk/9d3b13f31fc7d139781c12c706820823 to your computer and use it in GitHub Desktop.
get list of SMS from ZTE MF831 and ask to delete per id
import requests
import json
import base64
url = 'http://192.168.0.1/goform/goform_get_cmd_process?isTest=false&cmd=sms_data_total&page=0&data_per_page=500&mem_store=1&tags=10&order_by=order+by+id+desc'
s = requests.Session()
s.headers.update({'Host': '192.168.0.1'})
s.headers.update({'Referer': 'http://192.168.0.1/index.html'})
r = s.get(url)
t = r.text
t = t.replace('""31321""','"31321"')
j = json.loads(t)
for m in j['messages']:
print(m['id'] + " (" + m['number'] + "):")
# print(m['content'])
print(base64.b16decode(m['content']).decode('iso-8859-1').encode('utf-8'))
print("\n")
id = raw_input("Delete SMS id: ")
if id != '':
id = raw_input("Again: delete SMS id: ")
if id != '':
url = 'http://192.168.0.1/goform/goform_set_cmd_process'
payload = {'isTest': 'false', 'goformId': 'DELETE_SMS', 'msg_id': id, 'notCallback': 'true'}
s.post(url, data=payload)
#curl -s 'http://192.168.0.1/goform/goform_get_cmd_process?isTest=false&cmd=sms_data_total&page=0&data_per_page=500&mem_store=1&tags=10&order_by=order+by+id+desc' -H 'Host: 192.168.0.1' -H 'Referer: http://192.168.0.1/index.html'
#curl -s 'http://192.168.0.1/goform/goform_set_cmd_process' -H 'Host: 192.168.0.1' -H 'Referer: http://192.168.0.1/index.html' --compressed --data 'isTest=false&goformId=DELETE_SMS&msg_id=7&notCallback=true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment