import
subprocess
print
(u
)
def
comd():
choices
=
[
"连接远程服务器至工作目录"
,
"将当前二进制文件上传至服务器「并打开shell」"
,
"将当前二进制文件上传至服务器「并启动GDB调试」"
,
"将当前二进制文件上传至服务器「并使用socat开启题目」"
]
selected_option
=
askChoice(
"远端调试插件 By:Cha111Ng1"
,
"选择一个功能:"
, choices, "")
print
(
"[+]选择的功能为:"
+
selected_option)
return
selected_option
def
updata_vps(comd):
current_program
=
getCurrentProgram()
program_name
=
current_program.getDomainFile().getName()
file_location
=
current_program.getExecutablePath()
if
comd
=
=
"连接远程服务器至工作目录"
:
command_to_execute
=
"ssh -t -p 2222 cha111ng1@kmac.local \'cd /home/cha111ng1/tools/ctf;/bin/bash\'\n"
elif
comd
=
=
"将当前二进制文件上传至服务器「并打开shell」"
:
command_to_execute
=
"scp -P 2222 "
+
file_location
+
" cha111ng1@kmac.local:/home/cha111ng1/tools/ctf "
+
"&& ssh -t -p 2222 cha111ng1@kmac.local \'cd /home/cha111ng1/tools/ctf&&chmod +x "
+
program_name
+
";/bin/bash\'\n"
elif
comd
=
=
"将当前二进制文件上传至服务器「并启动GDB调试」"
:
command_to_execute
=
"scp -P 2222 "
+
file_location
+
" cha111ng1@kmac.local:/home/cha111ng1/tools/ctf "
+
"&& ssh -t -p 2222 cha111ng1@kmac.local \'cd /home/cha111ng1/tools/ctf&&chmod +x "
+
program_name
+
"&&gdb "
+
program_name
+
";/bin/bash\'\n"
elif
comd
=
=
"将当前二进制文件上传至服务器「并使用socat开启题目」"
:
command_to_execute
=
"scp -P 2222 "
+
file_location
+
" cha111ng1@kmac.local:/home/cha111ng1/tools/ctf "
+
"&& ssh -t -p 2222 cha111ng1@kmac.local \'cd /home/cha111ng1/tools/ctf&&chmod +x "
+
program_name
+
"&&socat TCP-LISTEN:1337,reuseaddr,fork EXEC:./"
+
program_name
+
";/bin/bash\'\n"
print
(
"[+]远程题目地址:nc 60.204.151.115 1337"
)
print
(
"[+]执行的命令为:"
+
command_to_execute)
applescript
=
f
subprocess.call([
'osascript'
,
'-e'
, applescript])
print
(
"[+]执行完毕\n"
)
try
:
print
(
"[+]启动远端调试插件..."
)
updata_vps(comd())
except
Exception as e:
print
(
"[x]请检查网络连接情况"
)
print
(
"An error occurred:"
, e)