Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save quikilr/a7902a05488595292b78775b008bbe70 to your computer and use it in GitHub Desktop.

Select an option

Save quikilr/a7902a05488595292b78775b008bbe70 to your computer and use it in GitHub Desktop.

Revisions

  1. @Flangvik Flangvik revised this gist Feb 3, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #!/usr/bin/env python
    # Super dirty python3 scripts that alerts Cobalt Strike operator using pushover when a new IP is found amoung network interface on beacon
    # CNA for triggering this : https://gist.github.com/Flangvik/c31b26129743be699133dc9dab9c02c5
    # Aggressor script for triggering this : https://gist.github.com/Flangvik/c31b26129743be699133dc9dab9c02c5
    import argparse
    from datetime import datetime
    from base64 import b64encode,b64decode
  2. @Flangvik Flangvik revised this gist Feb 3, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #!/usr/bin/env python
    # Super dirty python3 scripts that alerts Cobalt Strike operator using pushover when a new IP is found amoung network interface on beacon

    # CNA for triggering this : https://gist.github.com/Flangvik/c31b26129743be699133dc9dab9c02c5
    import argparse
    from datetime import datetime
    from base64 import b64encode,b64decode
  3. @Flangvik Flangvik created this gist Feb 3, 2022.
    44 changes: 44 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    #!/usr/bin/env python
    # Super dirty python3 scripts that alerts Cobalt Strike operator using pushover when a new IP is found amoung network interface on beacon

    import argparse
    from datetime import datetime
    from base64 import b64encode,b64decode
    from pushover import init, Client
    from os import path

    parser = argparse.ArgumentParser(description='beacon info')
    parser.add_argument('--user')
    parser.add_argument('--data')
    parser.add_argument('--computer')
    args = parser.parse_args()

    #Replace the below keys, pushover.net
    pushover_user_key = "<redacted>"
    pushover_app_key = "<redacted>"


    beaconuser = args.user
    computer = args.computer
    data = args.data

    def pushovernotifications(user):
    init(pushover_app_key)
    Client(pushover_user_key).send_message("VPN!", title=user)

    didCsvExists = path.exists("/<fullpath>/ip_logs_all_beacons.csv")

    f = open("/<fullpath>/ip_logs_all_beacons.csv", "a+")

    if not didCsvExists:
    f.write("Type;Timestamp;User;Hostname;IP\n")
    ipAdresser = b64decode(data).decode('UTF-16LE').split('\n')
    for ip in ipAdresser:
    if ip:
    f.write("LOG;%s;%s;%s;%s\n" % (datetime.utcnow().strftime("%d/%m/%Y %H:%M:%S"),beaconuser, computer, ip.split()[0]))
    #Edit this based on the subnet of your beacons "home network"
    if(ip.split('.')[0] != "192"):
    pushovernotifications(beaconuser)
    f.write("ALERT;%s;%s;%s;%s\n" % (datetime.utcnow().strftime("%d/%m/%Y %H:%M:%S"),beaconuser, computer, ip.split()[0]))

    f.close()