def get(self, *args, **kwargs):
     ''' Optionally order by argument; defaults to date/time '''
     order = self.get_argument('order_by', '').lower()
     if order == 'prize':
         sheep = WallOfSheep.all_order_value()
     elif order == 'length':
         sheep = sorted(WallOfSheep.all())
     else:
         sheep = WallOfSheep.all_order_created()
     leaderboard = WallOfSheep.leaderboard()
     self.render('scoreboard/wall_of_sheep.html',
         leaderboard=leaderboard,
         flock=sheep,
     )
 def theft(self, victim, destination, amount):
     ''' Successfully cracked a password '''
     victim.team.money -= abs(amount)
     value = int(abs(amount) * 0.85)
     password = self.get_argument('password', '')
     destination.money += value
     dbsession.add(destination)
     dbsession.add(victim.team)
     user = self.get_current_user()
     sheep = WallOfSheep(
         preimage=unicode(password),
         cracker_id=user.id,
         victim_id=victim.id,
         value=value,
     )
     dbsession.add(sheep)
     dbsession.flush()
     self.event_manager.cracked_password(user, victim, password, value)
     return value
Exemple #3
0
 def theft(self, victim, destination, amount, preimage):
     ''' Successfully cracked a password '''
     victim.team.money -= abs(amount)
     value = int(abs(amount) * 0.85)
     destination.money += value
     dbsession.add(destination)
     dbsession.add(victim.team)
     user = self.get_current_user()
     sheep = WallOfSheep(
         preimage=unicode(preimage),
         cracker_id=user.id,
         victim_id=victim.id,
         value=value,
     )
     dbsession.add(sheep)
     dbsession.flush()
     event1, event2 = self.event_manager.create_cracked_password_events(
         user, victim, preimage, value)
     self.new_events.append(event1)
     self.new_events.append(event2)
     return value
Exemple #4
0
 def get(self, *args, **kwargs):
     wall_of_sheep = WallOfSheep.get_all()
     self.render("wall_of_sheep/view.html", wall = wall_of_sheep)