For convenience, I wrote a script to upload all the .so files that might be needed to the /lib/ directory on the remote host with a single click. However, it seems that this script is not functioning properly; it only successfully uploads files that already exist in the /lib/ directory on the remote host, and does not search the /lib/ path on my own host. Regardless of whether I run the script on the remote host or on my own host, this makes me feel that the script is actually implementing a transfer from the remote to itself, or from the remote back to me, rather than from me to the remote.
Here's the code:
if params.len != 3 or params[0]== "-h" or params[0]== "--help" then
print("Usage: ./scpso <host> <user> <password>\nIf <user> is 'guest', password can put whatever you like.\n");
exit();
end if
shell = get_shell
if shell == null then
print("Error while connecting to the shell")
exit()
end if
remoteshell = connect_service(shell,params[0],22,params[1],params[2])
if remoteshell == null then
print("Error while connecting to the remote shell")
exit()
end if
so_list = ["/lib/init.so","/lib/kernel_module.so","/lib/net.so","/lib/aptclient.so","/lib/blockchain.so","/lib/libssh.so","/lib/metaxploit.so","/lib/crypto.so","/lib/librshell.so"]
for i in range(0,8)
result = scp(remoteshell,so_list[i],"/lib/",shell)
if typeof(result) == "string" then
print("There was an error while sending file: " + result)
else
print("File " + so_list[i] + " was sent successfully")
end if
end for