-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathconn
More file actions
executable file
·46 lines (35 loc) · 1.06 KB
/
conn
File metadata and controls
executable file
·46 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
import os, sys
import getpass
# Import conn Lib
import __init__
from record import record_videos
# set linux tab
#if os.path.isfile(os.path.expanduser('~/.ssh/known_hosts')):
# cmd = '''complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" %s''' % sys.argv[0]
# os.system(cmd)
def usage():
print
print '''\033[;32m connection remote hostname operator and record all infomation.
Usage: %s hostname or ip
%s user@hostname:port
%s by 919953500@qq.com
\033[0m''' % (sys.argv[0],sys.argv[0],sys.argv[0])
sys.exit()
@record_videos
def run(username, hostname, port):
print hostname, 'closed.'
# currently username
username = getpass.getuser()
if len(sys.argv) > 1:
hostname = sys.argv[1]
if hostname.find('@') >= 0:
username, hostname = hostname.split('@')
else:
usage()
sys.exit(1)
port = 22
if hostname.find(':') >= 0:
hostname, portstr = hostname.split(':')
port = int(portstr)
run(username, hostname, port)