Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos and small improvements #182

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions extras/language/luci
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,3 @@ config internal 'ccache'
config internal 'themes'
option xiaoqiang '/xiaoqiang'
option OpenWrt '/luci-static/openwrt.org'

config 5 'debuglevel'

12 changes: 6 additions & 6 deletions remote_command_execution_vulnerability.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ def get_stok(router_ip_address):
try:
r0 = requests.get("http://{router_ip_address}/cgi-bin/luci/web".format(router_ip_address=router_ip_address))
except:
print ("Xiaomi router not found...")
print ("Xiaomi router not found.")
return None
try:
try:
mac = re.findall(r'deviceId = \'(.*?)\'', r0.text)[0]
key = re.findall(r'key: \'(.*)\',', r0.text)[0]
except:
print ("Xiaomi router not found...")
print ("Unable to find deviceId or key.")
return None
key = re.findall(r'key: \'(.*)\',', r0.text)[0]
nonce = "0_" + mac + "_" + str(int(time.time())) + "_" + str(random.randint(1000, 10000))
router_password = input("Enter router admin password: ")
account_str = hashlib.sha1((router_password + key).encode('utf-8')).hexdigest()
Expand All @@ -67,8 +67,8 @@ def get_stok(router_ip_address):

stok = get_stok(router_ip_address) or input("You need to get the stok manually, then input the stok here: ")
print("""There two options to provide the files needed for invasion:
1. Use a local TCP file server runing on random port to provide files in local directory `script_tools`.
2. Download needed files from remote github repository. (choose this option only if github is accessable inside router device.)""")
1. Use a local TCP file server running on random port to provide files in local directory `script_tools`.
2. Download needed files from remote github repository. (choose this option only if github is accessible inside router device.)""")
use_local_file_server = (input("Which option do you prefer? (default: 1)") or "1") == "1"

# From https://blog.securityevaluators.com/show-mi-the-vulns-exploiting-command-injection-in-mi-router-3-55c6bcb48f09
Expand Down
7 changes: 4 additions & 3 deletions set_english.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import os
import ftplib

router_ip_address = input("Router IP address: ")
# router_ip_address = '192.168.0.21'
router_ip_address = "miwifi.com"
# router_ip_address = "192.168.31.1"
router_ip_address = input("Router IP address: [press enter for using the default '{}']".format(router_ip_address)) or router_ip_address

session = ftplib.FTP(router_ip_address,'root','')

# Uploading a lenguage file will not succeed as the filesystem is ro
# Uploading a language file will not succeed as the filesystem is ro
# languageFile = open('extras/language/i18n/base.en.lmo','rb')
# session.storbinary('STOR /usr/lib/lua/luci/i18n/base.en.lmo', languageFile)
# languageFile.close()
Expand Down
2 changes: 1 addition & 1 deletion tcp_file_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run(self):
self.server_thread = threading.Thread(target=self.server.serve_forever)
self.server_thread.daemon = True
self.server_thread.start()
print("local file server is runing on {}:{}. root='{}'".format(self.ip, self.port, self.server.root_dir))
print("local file server is running on {}:{}. root='{}'".format(self.ip, self.port, self.server.root_dir))

def __exit__(self, exc_type, exc_val, exc_tb):
self.server.shutdown()
Expand Down