代码拉取完成,页面将自动刷新
#!/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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。