Ejemplo n.º 1
0
    def __init__(self, game, name, start):
        self.game = game
        self.name = name
        self.status = 'in'  # other status values are 'out' and 'won'
        self.own = {start:1}
        self.log = []

        # knowledge system
        self.min_accounts = ddict(lambda :ddict(str)) # [machine][player] = #
        self.max_accounts = ddict(lambda :ddict(str)) 
        self.oss = ddict(str)      # [machine] = OS string
        # True = Patched, False = Vulnerable, undef = unknown
        self.patches = ddict(lambda :ddict(str)) # patches[machine][expl#] = True, False, undef
        self.traced = []   # list of players
        
        E = set([])
        while len(E)<20:
            E.add(random.choice(self.game.state.OSs)[0]+str(hackattack_util.pick_exp_int()))
        self.players_expl = list(E)

        if self.name == 'Player 0':
            # show title screen until someone hits a key
            print "HACK ATTACK!\n\n"

            # look at http://www.network-science.de/ascii/ for more fonts
            # I like o8, poison.  This is smslant
            
            print '''
               __ __         __     ___  __  __           __  
              / // /__ _____/ /__  / _ |/ /_/ /____ _____/ /__
             / _  / _ `/ __/  '_/ / __ / __/ __/ _ `/ __/  '_/
            /_//_/\_,_/\__/_/\_\ /_/ |_\__/\__/\_,_/\__/_/\_\ 
            '''

            raw_input("\n\n\nPress enter to begin.")
Ejemplo n.º 2
0
 def start_round(self):
     s = self.game.state
     # for each player (if they haven't lost)
     ## are you ready? screen
     raw_input("\n"*100 + "Ready {}? ".format(s.players_names[s.player]))
         
     
     ## check for a new exploit
     if random.random() <= 1. / 6:
     
         ne = random.choice(self.game.state.OSs)[0] + str(hackattack_util.pick_exp_int())
         #self.players_expl.append(ne)
             
         while ne in self.players_expl:
             ne = random.choice(self.game.state.OSs)[0] + str(hackattack_util.pick_exp_int())
             
         self.players_expl.append(ne)#[s.player]
         self.say({'text':'You found a new exploit! ' + ne, 'type':'new exploit',
                   'exploit':ne})