-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·27 lines (21 loc) · 729 Bytes
/
test.py
File metadata and controls
executable file
·27 lines (21 loc) · 729 Bytes
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
import os
from NikGapps.helper.Cmd import Cmd
from NikGapps.helper.upload.CmdUpload import CmdUpload
# upload = CmdUpload('13', 'stable', True)
# print(upload.successful_connection)
# upload.create_directory_structure("A/B/C")
import pexpect
import socket
hostname = socket.gethostname()
ip_address = socket.gethostbyname(hostname)
print(f"Hostname: {hostname}")
print(f"IP Address: {ip_address}")
password = os.environ.get('SF_PWD')
child = pexpect.spawn('sftp nikhilmenghani@frs.sourceforge.net') # replace with your user and host
i = child.expect(["Password", "yes/no", pexpect.TIMEOUT, pexpect.EOF], timeout=120)
print(i)
print(child.before)
print(child)
child.sendline(str(password))
print(child.before)
print(child)