Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pexpect import pxssh
- from docopt import docopt
- from colorama import Fore, init
- class Client: #Creating "Client" as a class.
- def __init__(self, host, user, password): #Defiing the initializer, while taking four arguements.
- self.host = host
- self.user = user
- self.password = password
- self.session = self.connect()
- def connect(self):
- try:
- x = pxssh.pxssh() #The letter "x" is assigned as a class variable for the pxssh module.
- x.login(self.host, self.user, self.password) #Calling the method "x.login".
- return x
- except Exception as e:
- print (Fore.RED + '[-] Error Connecting' + Fore.RESET)
- print (e)
- def send_command(self, cmd): #Defining the "send_command".
- self.session.sendline(cmd)
- self.session.prompt()
- return self.session.before
- def botnet_command(command, botnet): #Defineing the "botnet_command".
- for client in botnet: #The commands are executed for "client in botnet".
- output = client.send_command(command)
- print (Fore.GREEN + '[*] Output from ' + client.host + Fore.RESET)
- print ('[+] ' + output + '\n')
- def add_client(host, user, password, botnet): # Defining function to allow "client" to be added.
- client = Client(host, user, password)
- botnet.append(client)
- def main():
- botnet = []
- add_client('127.0.0.1', 'root', 'Shady1000!', botnet)
- add_client('10.10.10.120', 'root', 'toor', botnet)
- add_client('10.10.10.130', 'root', 'toor', botnet)
- botnet_command('uname -v', botnet)
- if __name__ == '__main__':
- init()
- docopt(__doc__, version='Serpent.py VER.-1.0')
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement