-
Notifications
You must be signed in to change notification settings - Fork 0
/
turnitin.py
45 lines (35 loc) · 1.11 KB
/
turnitin.py
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
44
45
"""
turnitin.py
Easily move files from your computer to the CS servers.
python turnitin.py -f /path/2/file
Required things: python 2.7, and the follow packages: argparse, scp, paramiko
Run as superuser
Carson Harmon, [email protected]
"""
#for the ssh handle
import paramiko
#grab file input path easily
import argparse
#to hide the password characters
import getpass
#for scp
from scp import SCPClient
#argparse block to grab stdin
parser = argparse.ArgumentParser()
parser.add_argument("-f", metavar="f", help="File path")
args = parser.parse_args()
#define target host and port
cs_server = "128.10.12.13"
sshport = 22
#create ssh object.
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
#user credientals
user = raw_input("What is your career account username? ")
print "You won't see the characters as you type in your password, but its working I swear"
pswd = getpass.getpass("Password: ")
#start ssh session
ssh.connect(cs_server, username=user, password=pswd, allow_agent=False, look_for_keys=False)
#SCP files
scp = SCPClient(ssh.get_transport())
scp.put(args.f, "/homes/" + user)