1 Star 0 Fork 0

sklink/openipc_ipctool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github
cmake
example
include
scripts
src
tools
binwalk.py
make_images.sh
requirements.txt
telnet_upload.py
upgrade_bundle.py
.clang-format
.gitignore
CMakeLists.txt
LICENSE
README.md
contributors.md
克隆/下载
telnet_upload.py 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/python3
import os, sys, telnetlib, _thread, urllib.request
arm = "https://github.com/openipc/ipctool/releases/download/latest/ipctool"
mips = "https://github.com/openipc/ipctool/releases/download/latest/ipctool-mips32"
port = 23
name = "ipctool"
size = 200
path = "/tmp/ipctool"
def transfer():
code = "rm -f " + path + "\n"
t.write(code.encode())
for index in range(0, len(file), size):
data = file[index : index + size]
text = "\\x".join(["{:02x}".format(x) for x in data])
code = "echo -ne '\\x" + text.strip() + "' >> " + path + "\n"
t.write(code.encode())
code = "chmod 755 " + path + "\n"
t.write(code.encode())
code = path + "\n"
t.write(code.encode())
def interact():
_thread.start_new_thread(t.listener, ())
while True:
line = sys.stdin.readline()
if line.strip() == "transfer":
transfer()
else:
t.write(line.encode())
if len(sys.argv) < 2:
print("Usage:", sys.argv[0], "[host] [port]")
exit()
host = sys.argv[1]
if len(sys.argv) > 2:
port = sys.argv[2]
try:
urllib.request.urlretrieve(arm, name)
file = open(name, "rb").read()
except:
print("Cannot download or access", name)
exit()
print("Connect to:", host + ":" + str(port))
try:
t = telnetlib.Telnet(host, port, timeout=5)
except:
print("Cannot connect to host")
else:
interact()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sklink/openipc_ipctool.git
git@gitee.com:sklink/openipc_ipctool.git
sklink
openipc_ipctool
openipc_ipctool
master

搜索帮助