Пример #1
0
 def __init__(self):
     
     ##--Holds all of the individual DataList objects for iterating though them when it comes time to save the data
     self.master_data_list = []
     
     ######################################################
     ##Init Base Structures
     ######################################################
     config = {
         'Name':'Base Structure',
         'Comments':'Standard base structures as defined by the original PCFG Paper, with some renaming to prevent naming collisions. Examples are A4D2 from the training word "pass12"',
         'Directory':'Grammar',
         'Filenames':'Grammar.txt',
         'Inject_type':'Wordlist',
         'Function':'Transparent',
         'Is_terminal':'False',
         'Replacements': json.dumps([
             {'Transition_id':'A','Config_id':'BASE_A'},
             {'Transition_id':'D','Config_id':'BASE_D'},
             {'Transition_id':'O','Config_id':'BASE_O'},
             {'Transition_id':'K','Config_id':'BASE_K'},
             {'Transition_id':'X','Config_id':'BASE_X'},
         ]),
     }     
     self.base_structure = DataList(type= ListType.FLAT, config_name= 'START', config_data = config)
     self.master_data_list.append(self.base_structure)
     
     ########################################################
     ##Init Alpha structures
     ########################################################
     config = {
         'Name':'A',
         'Comments':'(A)lpha letter replacements for base structure. Aka "pass12" = A4D2, so this is the A4. Note, this is encoding specific so non-ASCII characters may be considered alpha. For example Cyrillic characters will be considered alpha characters',
         'Directory':'Alpha',
         'Filenames' : '.txt',
         'Inject_type':'Wordlist',
         'Function':'Shadow',
         'Is_terminal':'False',
         'Replacements': json.dumps([
             {'Transition_id':'Capitalization','Config_id':'CAPITALIZATION'},
         ]),
     }     
     self.letter_structure = DataList(type= ListType.LENGTH, config_name= 'BASE_A', config_data = config)
     self.master_data_list.append(self.letter_structure)
     
     #########################################################
     ##Init Digits
     #########################################################
     config = {
         'Name':'D',
         'Comments':'(D)igit replacement for base structure. Aka "pass12" = L4D2, so this is the D2',
         'Directory':'Digits',
         'Filenames' : '.txt',
         'Inject_type':'Copy',
         'Function':'Copy',
         'Is_terminal':'True', 
     }
     self.digit_structure = DataList(type= ListType.LENGTH, config_name = 'BASE_D', config_data = config)
     self.master_data_list.append(self.digit_structure)
     
     #########################################################
     ##Init Special
     #########################################################
     config = {
         'Name':'O',
         'Comments':'(O)ther character replacement for base structure. Aka "pass$$" = L4S2, so this is the S2',
         'Directory':'Other',
         'Filenames' : '.txt',
         'Inject_type':'Copy',
         'Function':'Copy',
         'Is_terminal':'True', 
     }
     self.special_structure = DataList(type= ListType.LENGTH, config_name = 'BASE_O', config_data = config)
     self.master_data_list.append(self.special_structure)
     
     #########################################################
     ##Init Capitalization
     #########################################################
     config = {
         'Name':'Capitalization',
         'Comments':'Capitalization Masks for words. Aka LLLLUUUU for passWORD',
         'Directory':'Capitalization',
         'Filenames' : '.txt',
         'Inject_type':'Copy',
         'Function':'Capitalization',
         'Is_terminal':'True', 
     }
     self.cap_structure = DataList(type= ListType.LENGTH, config_name = 'CAPITALIZATION', config_data = config)
     self.master_data_list.append(self.cap_structure)
     
     ###########################################################
     ##Init Keyboard
     ###########################################################
     config = {
         'Name':'K',
         'Comments':'(K)eyboard replacement for base structure. Aka "test1qaz2wsx" = L4K4K4, so this is the K4s',
         'Directory':'Keyboard',
         'Filenames' : '.txt',
         'Inject_type':'Copy',
         'Function':'Copy',
         'Is_terminal':'True', 
     }
     self.keyboard_structure = DataList(type= ListType.LENGTH, config_name = 'BASE_K', config_data = config)
     self.master_data_list.append(self.keyboard_structure)
     
     ############################################################
     ##Init Context Sensitive Values
     ############################################################
     config = {
         'Name':'X',
         'Comments':'conte(X)t sensitive replacements to the base structure. This is mostly a grab bag of things like #1 or ;p',
         'Directory':'Context',
         'Filenames' : '.txt',
         'Inject_type':'Copy',
         'Function':'Copy',
         'Is_terminal':'True', 
     }
     self.context_structure = DataList(type= ListType.LENGTH, config_name = 'BASE_X', config_data = config)
     self.master_data_list.append(self.context_structure)
     
     
     ##Number of passwords that were rejected
     ##Used for record keeping and debugging
     self.num_rejected_passwords = 0
     
     ##Number of valid passwords trained on
     ##Used for record keeping and debugging
     self.valid_passwords = 0