示例#1
0
文件: main.py 项目: hueskye/easypass
def main():
    # Parse command line arguments.
    if len(sys.argv) < 4:
        usage_and_exit()

    pass_size = int(sys.argv[1])
    reg_type = sys.argv[2]
    reg_fname = sys.argv[3]

    # Stuff we need to generate a password.
    reg = None
    if reg_type == 'nnet':
        reg = nnet.load(reg_fname)
    elif reg_type == 'svm':
        reg = svm.load(reg_fname)
    elif reg_type == 'knn':
        reg = knn.load(reg_fname)
    else:
        usage_and_exit()

    feature_fun = features.transform_all
    all_chars = ''.join(util.NORMAL_LAYOUT)
    scorer = passgen.Scorer(reg, feature_fun, util.layout_mapping())

    # Generate and print a password.
    print passgen.generate(scorer, all_chars, pass_size, 4)
示例#2
0
    def generate(self, widget=None, data=None):
        '''
        Wrapper function for the password generation
        '''
        salt = self.saltentry.get_text()
        string = self.stringentry.get_text()

        if salt == "" or string == "":
            return
        else:
            self.passentry.set_text(passgen.generate(salt, string))
            self.nameentry.set_text(passgen.generate_name(salt, string))
            self.passfield.show()
            self.namefield.show()
            self.saltentry.set_text("")
            self.stringentry.set_text("")
示例#3
0
def gen(event):
    vpa, vpA, vp0, vpx = 0, 0, 0, 0

    var_len = int(ent_text_len.get())
    password = ''
    if var0.get() == 1:
        vpa = 1
    if var1.get() == 1:
        vpA = 1
    if var2.get() == 1:
        vp0 = 1
    if var3.get() == 1:
        vpx = 1
    password = generate(var_len, vpa, vpA, vp0, vpx)
    ent_text_pass.set(password)
    print(password)
    return 0
示例#4
0
import passgen

print('Generating.')

with open('example_passphrases.txt', 'w') as output:
    for i in range(20):
        output.write(passgen.generate() + '\n')

print('Done.')