Context
I am connected to a remote web server via port forwarding, I want to run a command on my local machine while connected
cutycapt --url=localhost:9000 --out=test.png --min-width=1366 --min-heigh=768
on my local machine to capture the web page presented via the web server (which has no graphical interface)
I've created a script that connects to the server, runs the command above but a 5.9kb blank png is returned, I believe the command is running on the web server rather than my own machine
Code
~$ cat Segment1.2v.py
import paramiko
import time
import os
hosts_file = open('/etc/hosts')
IPs = []
for x in hosts_file:
if "AN-54-Private" in x:
IPs.append(x[:10])
hosts_file.close()
def DoBash(TARGET):
os.system('cutycapt --url=localhost:9000 --out=test.png --min-width=1366 --min-heigh=768')
time.sleep(15)
return
test_file = open('IPs.txt')
for x in test_file:
TARGET = x
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(TARGET, username='nigel', key_filename='/home/Lima/.ssh/Alpha.ssh')
print('Connected')
DoBash(TARGET)