def do_broadcast(self, ignore): ''' Send a broadcast notification Usage: broadcast ''' title = raw_input(PROMPT + "Title: ") message = raw_input(PROMPT + "Message: ") Notifier.broadcast_success(title, message)
def create_cracked_password_events(self, cracker, victim, password, value): user_msg = "Your password '%s' was cracked by %s." % (password, cracker.handle) evt_id = Notifier.user_warning(victim, "Security Breach", user_msg) event1 = (self.push_user_notification, {"event_uuid": evt_id, "team_id": victim.team.id, "user_id": victim.id}) message = "%s hacked %s's bank account and stole $%d" % (cracker.handle, victim.team.name, value) evt_id = Notifier.broadcast_custom("Password Cracked", message, cracker.avatar) event2 = (self.push_broadcast_notification, {"event_uuid": evt_id}) return event1, event2
def create_purchased_item_event(self, user, item): """ Callback when a team purchases an item """ self.refresh_scoreboard() message = "%s purchased %s from the black market." % (user.handle, item.name) evt_id = Notifier.team_success(user.team, "Upgrade Purchased", message) self.push_broadcast_notification(evt_id) message2 = "%s unlocked %s." % (user.team.name, item.name) evt_id2 = Notifier.broadcast_warning("Team Upgrade", message2) return (self.push_broadcast_notification, {"event_uuid": evt_id2})
def purchased_item(self, user, item): ''' Callback when a team purchases an item ''' self.refresh_scoreboard() message = "%s purchased %s from the black market." % ( user.handle, item.name, ) evt_id = Notifier.team_success(user.team, "Upgrade Purchased", message) self.push_broadcast_notification(evt_id) message2 = "%s unlocked %s." % (user.team.name, item.name,) evt_id2 = Notifier.broadcast_warning("Team Upgrade", message2) self.push_broadcast_notification(evt_id2)
def score_team(box, team): ''' Executed as a thread: scores a single team ''' auth = AuthenticateReporter(box, team) auth.check_validity() if auth.confirmed_access is not None: award_money(box, team, auth) else: team.boxes.remove(box) dbsession.add(team) dbsession.flush() message = "Lost communication with bot on %s." % box.name Notifier.team_warning("Lost Access", message)
def cracked_password(self, cracker, victim, password, value): user_msg = "Your password '%s' was cracked by %s." % ( password, cracker.handle, ) evt_id = Notifier.user_warning(victim, "Security Breach", user_msg) self.push_user_notification(evt_id, victim.team.id, victim.id) message = "%s hacked %s's bank account and stole $%d" % ( cracker.handle, victim.team.name, value, ) evt_id = Notifier.broadcast_custom("Password Cracked", message, cracker.avatar ) self.push_broadcast_notification(evt_id)
def cracked_password(self, cracker, victim, password, value): user_msg = "Your password '%s' was cracked by %s." % ( password, cracker.handle, ) evt_id = Notifier.user_warning(victim, "Security Breach", user_msg) self.push_user_notification(evt_id, victim.team.id, victim.id) message = "%s hacked %s's bank account and stole $%d" % ( cracker.handle, victim.team.name, value, ) evt_id = Notifier.broadcast_custom("Password Cracked", message, cracker.avatar) self.push_broadcast_notification(evt_id)
def create_purchased_item_event(self, user, item): ''' Callback when a team purchases an item ''' self.refresh_scoreboard() message = "%s purchased %s from the black market." % ( user.handle, item.name, ) evt_id = Notifier.team_success(user.team, "Upgrade Purchased", message) self.push_broadcast_notification(evt_id) message2 = "%s unlocked %s." % ( user.team.name, item.name, ) evt_id2 = Notifier.broadcast_warning("Team Upgrade", message2) return (self.push_broadcast_notification, {'event_uuid': evt_id2})
def swat_player(self, user, target): message("%s called the SWAT team on %s." % ( user.handle, target.handle, )) evt_id = Notifier.broadcast_warning("Player Arrested!", message) self.push_broadcast_notification(evt_id)
def team_file_share(self, user, file_upload): ''' Callback when a team file share is created ''' message = "%s has shared a file called '%s'" % ( user.handle, file_upload.file_name, ) evt_id = Notifier.team_success(user.team, "File Share", message) self.push_team_notification(evt_id, user.team.id)
def create_flag_capture_event(self, user, flag): ''' Callback for when a flag is captured ''' self.refresh_scoreboard() evt_id = Notifier.broadcast_success("Flag Capture", "%s has captured '%s'." % (user.team.name, flag.name,) ) return (self.push_broadcast_notification, {'event_uuid': evt_id})
def flag_capture(self, user, flag): ''' Callback for when a flag is captured ''' self.refresh_scoreboard() evt_id = Notifier.broadcast_success("Flag Capture", "%s has captured '%s'." % (user.team.name, flag.name,) ) self.push_broadcast_notification(evt_id)
def create_swat_player_event(self, user, target): message("%s called the SWAT team on %s." % ( user.handle, target.handle, )) evt_id = Notifier.broadcast_warning("Player Arrested!", message) return (self.push_broadcast_notification, {'event_uuid': evt_id})
def create_joined_team_event(self, user): ''' Callback when a user joins a team''' message = "%s has joined your team." % user.handle evt_id = Notifier.team_success(user.team, "New Team Member", message) return (self.push_team_notification, { 'event_uuid': evt_id, 'team_id': user.team.id })
def create_paste_bin_event(self, user, paste): ''' Callback when a pastebin is created ''' message = "%s posted to the team paste-bin" % user.handle evt_id = Notifier.team_success(user.team, "Text Share", message) return (self.push_team_notification, { 'event_uuid': evt_id, 'team_id': user.team.id })
def create_flag_capture_event(self, user, flag): ''' Callback for when a flag is captured ''' self.refresh_scoreboard() evt_id = Notifier.broadcast_success( "Flag Capture", "%s has captured '%s'." % ( user.team.name, flag.name, )) return (self.push_broadcast_notification, {'event_uuid': evt_id})
def create_unlocked_level_event(self, user, level): ''' Callback for when a team unlocks a new level ''' self.refresh_scoreboard() message = "%s unlocked level #%d." % ( user.team.name, level.number, ) evt_id = Notifier.broadcast_success("Level Unlocked", message) return (self.push_broadcast_notification, {'event_uuid': evt_id})
def unlocked_level(self, user, level): ''' Callback for when a team unlocks a new level ''' self.refresh_scoreboard() message = "%s unlocked level #%d." % ( user.team.name, level.number, ) evt_id = Notifier.broadcast_success("Level Unlocked", message) self.push_broadcast_notification(evt_id)
def flag_capture(self, user, flag): ''' Callback for when a flag is captured ''' self.refresh_scoreboard() evt_id = Notifier.broadcast_success( "Flag Capture", "%s has captured '%s'." % ( user.team.name, flag.name, )) self.push_broadcast_notification(evt_id)
def create_team_file_share_event(self, user, file_upload): ''' Callback when a team file share is created ''' message = "%s has shared a file called '%s'" % ( user.handle, file_upload.file_name, ) evt_id = Notifier.team_success(user.team, "File Share", message) return (self.push_team_notification, { 'event_uuid':evt_id, 'team_id':user.team.id })
def create_cracked_password_events(self, cracker, victim, password, value): user_msg = "Your password '%s' was cracked by %s." % ( password, cracker.handle, ) evt_id = Notifier.user_warning(victim, "Security Breach", user_msg) event1 = (self.push_user_notification, { 'event_uuid': evt_id, 'team_id': victim.team.id, 'user_id': victim.id }) message = "%s hacked %s's bank account and stole $%d" % ( cracker.handle, victim.team.name, value, ) evt_id = Notifier.broadcast_custom("Password Cracked", message, cracker.avatar) event2 = (self.push_broadcast_notification, {'event_uuid': evt_id}) return event1, event2
def create_team_file_share_event(self, user, file_upload): ''' Callback when a team file share is created ''' message = "%s has shared a file called '%s'" % ( user.handle, file_upload.file_name, ) evt_id = Notifier.team_success(user.team, "File Share", message) return (self.push_team_notification, { 'event_uuid': evt_id, 'team_id': user.team.id })
def paste_bin(self, user, paste): ''' Callback when a pastebin is created ''' message = "%s posted to the team paste-bin" % user.handle evt_id = Notifier.team_success(user.team, "Text Share", message) self.push_team_notification(evt_id, user.team.id)
def create_unlocked_level_event(self, user, level): ''' Callback for when a team unlocks a new level ''' self.refresh_scoreboard() message = "%s unlocked level #%d." % (user.team.name, level.number,) evt_id = Notifier.broadcast_success("Level Unlocked", message) return (self.push_broadcast_notification, {'event_uuid': evt_id})
def create_swat_player_event(self, user, target): message("%s called the SWAT team on %s." % (user.handle, target.handle,)) evt_id = Notifier.broadcast_warning("Player Arrested!", message) return (self.push_broadcast_notification, {'event_uuid': evt_id})
def lost_bot(self, bot): message = "Lost communication with bot on %s" % (bot.box.name,) evt_id = Notifier.team_warning(bot.team, "Botnet", message) self.push_team_notification(evt_id)
def new_bot(self, bot): message = "New bot connected to botnet from %s " % (bot.box.name,) evt_id = Notifier.team_success(bot.team, "Botnet", message) self.push_team_notification(evt_id)
def joined_team(self, user): ''' Callback when a user joins a team''' message = "%s has joined your team." % user.handle evt_id = Notifier.team_success(user.team, "New Team Member", message) self.push_team_notification(evt_id, user.team.id)
def unlocked_level(self, user, level): ''' Callback for when a team unlocks a new level ''' self.refresh_scoreboard() message = "%s unlocked level #%d." % (user.team.name, level.number,) evt_id = Notifier.broadcast_success("Level Unlocked", message) self.push_broadcast_notification(evt_id)
def swat_player(self, user, target): message("%s called the SWAT team on %s." % (user.handle, target.handle,)) evt_id = Notifier.broadcast_warning("Player Arrested!", message) self.push_broadcast_notification(evt_id)