Add first version of dropper script
parent
5d7188d46e
commit
0a1ae9c4be
@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import paramiko, socket, sys, termios, tty, select
|
||||||
|
|
||||||
|
|
||||||
|
def posix_shell(chan):
|
||||||
|
oldtty = termios.tcgetattr(sys.stdin)
|
||||||
|
|
||||||
|
try:
|
||||||
|
tty.setraw(sys.stdin.fileno())
|
||||||
|
tty.setcbreak(sys.stdin.fileno())
|
||||||
|
chan.settimeout(0.0)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
r, w, e = select.select([chan, sys.stdin], [], [])
|
||||||
|
if chan in r:
|
||||||
|
try:
|
||||||
|
buff = chan.recv(1024)
|
||||||
|
if len(buff) == 0:
|
||||||
|
print '\r\nYou have been logged out of your container.\r\n',
|
||||||
|
break
|
||||||
|
sys.stdout.write(buff)
|
||||||
|
sys.stdout.flush()
|
||||||
|
except socket.timeout:
|
||||||
|
pass
|
||||||
|
if sys.stdin in r:
|
||||||
|
buff = sys.stdin.read(1)
|
||||||
|
if len(buff) == 0:
|
||||||
|
break
|
||||||
|
chan.send(buff)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, oldtty)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ssh = paramiko.SSHClient()
|
||||||
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
|
|
||||||
|
sshkey = paramiko.RSAKey.from_private_key_file('/etc/cvm/key')
|
||||||
|
|
||||||
|
ssh.connect('cvm-vz.cryto.net', username='root', pkey=sshkey)
|
||||||
|
|
||||||
|
chan = ssh.invoke_shell()
|
||||||
|
posix_shell(chan)
|
||||||
|
|
||||||
|
chan.close()
|
||||||
|
ssh.close()
|
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* CVM is more free software. It is licensed under the WTFPL, which
|
||||||
|
* allows you to do pretty much anything with it, without having to
|
||||||
|
* ask permission. Commercial use is allowed, and no attribution is
|
||||||
|
* required. We do politely request that you share your modifications
|
||||||
|
* to benefit other developers, but you are under no enforced
|
||||||
|
* obligation to do so :)
|
||||||
|
*
|
||||||
|
* Please read the accompanying LICENSE document for the full WTFPL
|
||||||
|
* licensing text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require("rewrite.php");
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue