コード例 #1
0
def runcommand(command, randomuri, implant_id):

    if command == "creds":
        creds, hashes = parse_creds(get_creds())
        startup(
            user, "\nCredentials Compromised: \n%s\nHashes Compromised: \n%s" %
            (creds, hashes))

    elif command.startswith("creds ") and "-add " in command:
        p = re.compile(r"-domain=([^\s]*)")
        domain = re.search(p, command)
        if domain: domain = domain.group(1)
        p = re.compile(r"-username=([^\s]*)")
        username = re.search(p, command)
        if username: username = username.group(1)
        p = re.compile(r"-password=([^\s]*)")
        password = re.search(p, command)
        if password: password = password.group(1)
        p = re.compile(r"-hash=([^\s]*)")
        hash = re.search(p, command)
        if hash: hash = hash.group(1)
        if not domain or not username:
            startup(user, "Please specify a domain and username")
        if password and hash:
            startup(user, "Please specify a password or a hash, but not both")
        if not password and not hash:
            startup(user, "Please specify either a password or a hash")
        insert_cred(domain, username, password, hash)
        startup(user, "Credential added successfully")

    elif command.startswith("creds ") and "-search " in command:
        username = command.replace("creds ", "")
        username = username.replace("-search ", "")
        username = username.strip()
        creds, hashes = parse_creds(get_creds_for_user(username))
        startup(
            user, "Credentials Compromised: \n%s\nHashes Compromised: \n%s" %
            (creds, hashes))

    elif command.startswith('label-implant'):
        label = command.replace('label-implant', '').strip()
        update_label(label, randomuri)
        return

    implant_type = get_implanttype(randomuri)

    if implant_type.startswith("Python"):
        handle_py_command(command, user, randomuri, startup, implant_id,
                          commandloop)

    elif implant_type.startswith("C#"):
        handle_sharp_command(command, user, randomuri, startup, implant_id,
                             commandloop)

    else:
        handle_ps_command(command, user, randomuri, startup,
                          createdaisypayload, createproxypayload, implant_id,
                          commandloop)
コード例 #2
0
def runcommand(command, randomuri):
  if command:
    try:
      last = get_lastcommand()
      if last:
        if last != command:
          new_commandhistory(command)
      else:
        new_commandhistory(command)
    except Exception as e:
      pass

  implant_type = get_implanttype(randomuri)
  if implant_type == "OSX":
    handle_py_command(command, user, randomuri, startup)

  elif implant_type == "C#":
    handle_sharp_command(command, user, randomuri, startup) 
      
  else:
    handle_ps_command(command, user, randomuri, startup, createdaisypayload, createproxypayload)
    return