Пример #1
0
def openConsole(ip, username, password):
    clientIp = cgi.escape(os.environ["REMOTE_ADDR"])
    bodyContent = ""
    bodyContent += 'Your machine IP is %s <br>' % (str(clientIp))
    try:
        cl = SSHClient(clientIp)
        cl.enableSSH(ip, username)
        return {'status': 'success', 'data': 'SSH Successfull'}
    except Exception as e:
        return {
            'status':
            'error',
            'data':
            'Could not connect to remote machine. Make sure the plugin is running in your machine, Cause : %s'
            % str(e)
        }
Пример #2
0
#
#Author Pradeep CH
#
__author__ = 'Pradeep CH'
__version__ = '1.0.0'

# Create instance of FieldStorage
form = cgi.FieldStorage()
clientIp = cgi.escape(os.environ["REMOTE_ADDR"])

bodyContent = ''  #html.getBackButton('/pat/ssh/remotessh.htm')

# Get mode from fields
un = form.getvalue('username')
ip = form.getvalue('ip')

if not ip or not un:
    bodyContent += 'IP and Username required.'
else:
    bodyContent += 'Your machine IP is %s <br>' % (str(clientIp))
    try:
        cl = SSHClient(clientIp)
        cl.enableSSH(ip, un)
        bodyContent += 'SSH successfull'
    except Exception as e:
        bodyContent += 'Could not connect to remote machine. Make sure the PAT plugin is running in your machine, Cause : %s' % str(
            e)
#print html
html.printHeader('Authetication Validation')
html.printBodyContent(bodyContent)