Example #1
0
def ls(message, params='.'):
    """
    Return the contents of the current, or specified directory.
    Flags accepted.
    """
    cmd = cmd_builder('ls', params)
    cmd_runner(cmd, message)
Example #2
0
def exec_cmd(message, cmd):
    """
    Run any shell command on the host machine. This can be very risky.
    But, also enables one to run exactly what they want to on the host
    machine, regardless of OS type.
    """
    if len(cmd.split(' ')) > 1:
        cmd = cmd_builder(cmd.split(' ')[0], str(cmd.split(' ', 1)[1]))
    cmd_runner(cmd, message)
Example #3
0
def get_external_ip(message):
    """The bot will respond with the host machine's external IP."""
    cmd = ["dig", "+short", "myip.opendns.com", "@resolver1.opendns.com"]
    cmd_runner(cmd, message)
Example #4
0
def traceroute(message, params):
    """Perform a traceroute against the specified host."""
    cmd = cmd_builder('traceroute', params)
    cmd_runner(cmd, message)
Example #5
0
def ping(message, params):
    """Ping specified host specified times. Flags accepted."""
    cmd = cmd_builder('ping', params)
    cmd_runner(cmd, message)
Example #6
0
def rm(message, params):
    """Delete specified file or directory. Flags accepted."""
    cmd = cmd_builder('rm', params)
    cmd_runner(cmd, message)
Example #7
0
def mkdir(message, params):
    """Create a new directory in the specified path. Flags accepted."""
    cmd = cmd_builder('mkdir', params)
    cmd_runner(cmd, message)