Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ('________________________________________________________________________________________ ')
- print ('[ _______ _______ _______ _______ _______ _______ _ _________]')
- print ('[ ( ____ \ ( ____ \ ( ____ ) ( ____ \ ( ____ ) ( ____ \ ( ( /| \__ __/]')
- print ('[ | ( \/ | ( \/ | ( )| | ( \/ | ( )| | ( \/ | \ ( | ) ( ]')
- print ('[ | (_____ | (__ | (____)| | (__ | (____)| | (__ | \ | | | | ]')
- print ('[ (_____ ) | __) | __) | __) | _____) | __) | (\ \) | | | ]')
- print ('[ ) | | ( | (\ ( | ( | ( | ( | | \ | | | ]')
- print ('[ /\____) | | (____/\ | ) \ \__ | (____/\ | ) | (____/\ | ) \ | | | ]')
- print ('[ \_______) (_______/ |/ \__/ (_______/ |/ (_______/ |/ )_) )_( ]')
- print ('[_______________________________________________________________________________________]')
- from pexpect import pxssh
- from docopt import docopt
- from getpass import getpass
- from colorama import Fore, Style, 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:
- s = pxssh.pxssh() #s assigned as a class variable for the "pxssh" module.
- s.login(self.host, self.user, self.password) #Calling the method "s.login".
- return s
- except Exception as e:
- print (Fore.RED + '[-] Connection Failed' + Fore.RESET)
- print (e)
- anykey = input('')
- exit
- mainMenu()
- def send_command(self, cmd): #Defining the "send_command".
- self.session.sendline(cmd)
- self.session.prompt()
- return self.session.before
- def botNet_command(command, serpent): #Defineing the botNet command.
- for client in botNet: #The commands are executed for clients in the 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():
- g = getpass #I'm using the "Getpass" module to prevent any of the following user inputs from being Echoed.
- ip = g(prompt=Style.DIM + 'SRP Shell:') #This is where the I"P address" is entered.
- host = g(prompt=Style.DIM + 'SRP Shell:') #This is where the "host" is entered.
- psw = g(prompt=Style.DIM + 'SRP Shell:' ) #This is where the "Password" is entered.
- srpnt = g(prompt=Style.DIM + 'SRP Shell:') #This is where the botnet commands are entered.
- botNet = []
- add_client('ip', 'host', 'password', botNet)
- botNet_command('cmd', botNet)
- def SRP_Shell(): # Defining "SRP Shell". This allows the SRP Shell to be used directly to execute commands remotely.
- g = getpass # Variable for the getpass module.
- try:
- while True:
- cmd = krypt(prompt=Style.DIM + 'SRP Shell:') #This is the SRP Shell, protected from Echo by getpass.
- print ()
- except KeyboardInterrupt: #Except KeyInterrupt as the method to get to the main menu.
- pass #The pass statement is used to pass anything that isn't the KeyboardInterrupt. Allowing the SRP Shell to be used as long as needed.
- mainMenu()
- def mainMenu():
- print ()
- print (Style.DIM + 'Available Commands')
- print ('==================')
- print()
- print (Style.DIM + 'Commands Description')
- print('-------- -----------')
- print (Style.DIM + '1. Add Client adds client to Botnet')
- print (Style.DIM + '2. Manage Clients manage clients in Botnet')
- print (Style.DIM + '3. Options option\'s menu')
- print (Style.DIM + '4. SRP Shell Serpent Shell, to execute commands')
- print (Style.DIM + '5. Interact interacts with one/all clients')
- print (Style.DIM + '6. List lists all clients within database')
- print (Style.DIM + '7. Sysinfol displays system info of clients in Botnet')
- print (Style.DIM + '8. Exit exits the system)
- print ()
- g = getpass
- while True: #A While loop to control the menu driven interface.
- try:
- selection=int(krypt(prompt=Style.DIM + 'SRP Shell:'))
- print()
- if selection == 1:
- main()
- break
- elif selection == 2:
- ManageClient()
- break
- elif selection == 3:
- options()
- break
- elif selection == 4:
- SRP_Shell()
- break
- elif selection == 5:
- Interact()
- break
- elif selection == 6:
- Lists()
- break
- elif selection == 7:
- Sysinfo()
- break
- elif selection == 8:
- break
- print(Fore.RED + 'Error' + Fore.RESET)
- mainMenu()
- except ValueError:
- print (Fore.RED + 'Error' + Fore.RESET)
- exit
- mainMenu()
- if __name__ == '__main__':
- init()
- docopt(__doc__, version = Style.DIM + 'Serpent.py VER.-1.0')
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement