Exemple #1
0
def main():
    console = Console(prompt="firewall", prompt_delim=">")
    show = Command("show", help="Show command helper")
    setup = Command("setup", help="Setup options")


    console.loop()
Exemple #2
0
def main():
    console = Console("RouterA")
    enable = Enable("enable", help="Enter enable mode")
    ping = PingCommand('ping', help="Ping destination ip. Ex: ping 8.8.8.8")
    traceroute = TraceRouteCommand(
        'traceroute',
        help="Trace route to destination ip. Ex: traceroute 8.8.8.8")
    console.addChild(enable)
    console.addChild(ping)
    console.addChild(traceroute)
    console.loop()
Exemple #3
0
def main():
    console = Console("RouterA")
    enable = Enable("enable", help="Enter enable mode")
    ping = PingCommand('ping', help="Ping destination ip. Ex: ping 8.8.8.8")
    traceroute = TraceRouteCommand('traceroute', help="Trace route to destination ip. Ex: traceroute 8.8.8.8")
    console.addChild(enable)
    console.addChild(ping)
    console.addChild(traceroute)
    console.loop()
Exemple #4
0
def main():
    console = Console("marvin", ">")
    notebook = NotebookSDK("notebook")
    dryrun = DryRunSDK("dryrun")

    console.addChild(notebook)
    console.addChild(dryrun)
    console.loop()
Exemple #5
0
 def __init__(self, name, help='No help provided', dynamic_args=False):
     Console.__init__(self)
     self.name = name
     self.childs = {}
     self.dynamic_args = dynamic_args
     self.help = help
Exemple #6
0
def main():
    console = Console("root@dev:~", '#')
    ls = LS("ls")
    bash = Bash("bash")
    top = Top("top")
    console.addChild(ls)
    console.addChild(bash)
    console.addChild(top)
    console.addChild(Command('show')).addChild(Command('disk')).addChild(DiskIO('io'))
    console.loop()
Exemple #7
0
def main():
    console = Console(prompt="firewall", prompt_delim=">")
    show = Command("show", help="Show command helper")
    setup = Command("setup", help="Setup options")

    console.loop()
Exemple #8
0
 def  __init__(self, name, help='No help provided', dynamic_args=False):
     Console.__init__(self)
     self.name = name
     self.childs = {}
     self.dynamic_args = dynamic_args
     self.help = help
Exemple #9
0

class ShowMacAddressTableCommand(Command):
    def run(self, line):
        call("./show-mac-address-table.sh")


class ShowCommand(Command):
    def args(self):
        return ["interface", "mac-address-table"]

    def run(self, line):
        print "Command is not complete"


# MAIN CODE
console = Console(prompt="VDSCLI ", prompt_delim="#")

# show tree
show_command = ShowCommand("show",
                           help="show configurations",
                           dynamic_args=True)
showInterface_command = ShowInterfaceCommand("interface")
showMacAddressTable_command = ShowMacAddressTableCommand("mac-address-table")

console.addChild(show_command)
show_command.addChild(showInterface_command)
show_command.addChild(showMacAddressTable_command)

console.loop()
Exemple #10
0
def main():
    console = Console("root@dev:~", '#')
    ls = LS("ls")
    bash = Bash("bash")
    top = Top("top")
    console.addChild(ls)
    console.addChild(bash)
    console.addChild(top)
    console.addChild(Command('show')).addChild(Command('disk')).addChild(
        DiskIO('io'))
    console.loop()
Exemple #11
0
- ASIGNAR INTERFAZ DE ADMIN EN LA VLAN 20
	S1(config)# interface vlan 20
	S1(config)# ip address 192.168.1.3 255.255.255.

- ENRUTAMIENTO ENTRE VLAN
	vyos@vyos# set interface ethernet eth0 vif 10 address 192.168.0.1/24
'''

from ishell.command import Command
from ishell.console import Console
from ishell.utils import _print

import subprocess
import getpass

console = Console("S1@LisaSwitch:~", '#')
user_name = "S1@LisaSwitch:~"
array_history = []
array_vlan_id = []
array_vlan_name = []


class Colors:
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'
Exemple #12
0
 def test_console_has_empty_welcome_message(self):
     """Console should has an empty welcome message."""
     c = Console()
     assert c.welcome_message is None
Exemple #13
0
 def test_console_has_prompt(self):
     """Console should have a default prompt string."""
     c = Console()
     assert c.prompt == "Prompt"
     assert c.prompt_delim == ">"
Exemple #14
0
        return parse_to_table(r.json())
    except (ValueError, TypeError) as e:
        print 'Error', e


class GetCommand(Command):
    def run(self, line):
        params = line.split()
        data = get(table=params[1], row=params[2])
        if data:
            print_table(data)


class ScanCommand(Command):
    def run(self, line):
        params = line.split()
        prefix = params[2] if len(params) >= 3 else ''
        limit = params[3] if len(params) >= 4 else 100
        data = scan(table=params[1], row_prefix=prefix, limit=limit)
        if data:
            print_table(data)


get_command = GetCommand("get", help="Get a row")
scan_command = ScanCommand("scan", help="Scan rows")

console = Console(prompt="", prompt_delim="hqlsh>")
console.addChild(get_command)
console.addChild(scan_command)
console.loop()
Exemple #15
0
 def test_console_has_welcome_message(self):
     """Console should have a welcome message."""
     c = Console(welcome_message='welcome message')
     assert c.welcome_message == "welcome message"

set_command = SetCommand('set',
                         help='Set an option (i.e., "set num_answers=3"',
                         dynamic_args=True)
unset = UnsetCommand('unset',
                     help='Revert an option to its default value',
                     dynamic_args=True)
options = OptionsCommand('options',
                         help='Show the current option values',
                         dynamic_args=True)
results = ResultsCommand('results',
                         help='Show the results from the last module run')

# Build the console
fd_console = Console(prompt='\nFeatherDuster', prompt_delim='>')

fd_console.addChild(import_sample)
fd_console.addChild(console)
fd_console.addChild(export)
fd_console.addChild(use)
fd_console.addChild(analyze)
fd_console.addChild(autopwn)
fd_console.addChild(search)
fd_console.addChild(samples)
fd_console.addChild(modules)
fd_console.addChild(run)
fd_console.addChild(options)
fd_console.addChild(set_command)
fd_console.addChild(unset)
fd_console.addChild(results)
Exemple #17
0
 def test_console_creation(self):
     """Console must be created."""
     c = Console()
     assert isinstance(c, Console)
      if len(line_split) != 2:
         print 'Usage: unset <option>'
         return False
      option = line_split[1]
      feathermodules.current_options[option] = feathermodules.selected_attack['options'][option]
   def args(self):
      return feathermodules.selected_attack['options'].keys()


set_command = SetCommand('set', help='Set an option (i.e., "set num_answers=3"', dynamic_args=True)
unset = UnsetCommand('unset', help='Revert an option to its default value', dynamic_args=True)
options = OptionsCommand('options', help='Show the current option values', dynamic_args=True)


# Build the console
fd_console = Console(prompt='\nFeatherDuster', prompt_delim='>')

fd_console.addChild(import_sample)
fd_console.addChild(use)
fd_console.addChild(analyze)
fd_console.addChild(autopwn)
fd_console.addChild(search)
fd_console.addChild(samples)
fd_console.addChild(modules)
fd_console.addChild(run)
fd_console.addChild(options)
fd_console.addChild(set_command)
fd_console.addChild(unset)


#--------
Exemple #19
0
from .list_commands import *
from .overview_commands import *
from .peek_commands import *
from .populate_commands import *
from .put_commands import *
from .stats_commands import *
from .uptime_commands import *
from .version_commands import *
from .whoami_commands import *

from .base import BaseCommand
from .util import apply_command_chains

from .__version__ import __version__

console = Console(prompt="beanstalkctl", prompt_delim=">")


class HelpCommand(BaseCommand):
    __cmd__ = 'help'
    __help__ = 'print this help message'

    def run(self, line):
        console.print_childs_help()


def main():
    args = docopt(__doc__, version='.'.join(__version__))

    command_chains = {
        'help': HelpCommand,