-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathsftp.py
31 lines (24 loc) · 836 Bytes
/
sftp.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
#!/usr/bin/env python3
import os
import json
import subprocess as subp
R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
def sftp():
sftp_conf_path = os.getcwd() + '/conf/sftp.conf'
sftp.server_ip = input(G + '[+]' + C + ' SFTP Server IP : ' + W)
print(G + '[+]' + C + ' Reading SFTP Credentials from ' + W + sftp_conf_path)
with open(sftp_conf_path) as sftp_conf:
reader = sftp_conf.read()
reader = reader.split(':')
sftp.sftp_user = reader[0].strip()
sftp.sftp_pass = reader[1].strip()
print(G + '[+]' + C + ' Starting SFTP Server...' + W)
distro = subp.Popen(['uname', '-r'], stdout = subp.PIPE)
distro = distro.communicate()[0].decode()
if 'ARCH' in distro:
subp.call(['systemctl', 'start', 'sshd.service'])
else:
subp.call(['systemctl', 'start', 'ssh.service'])