社工密码生成

看了大量报告就知道一个短小精悍的字典有多重要。
本来想写根据键盘布局设置的密码字典的,类似

  • qwerty

  • qwer1234

  • q1w2e3r4

  • qazwsx

  • qwer!@#

  • asdf8888

  • ......
    CSDN_TOP_5K来看,这种根据键盘布局设置的密码应该是最高频的一类密码,至少在程序猿界是这样的。

但是这种密码太灵活了,没写出来,只好写了个简单的。
只写了两种属性组合方式,生日+密码和配偶+关键词,以后再添加有用的组合。

#! /usr/bin/env python
# coding: utf-8
'''
社工字典生成
date: 2017/6/17
'''
import string

global pwdList
pwdList = []

# 目标属性
class Person:
    NAME = "han tie gun"
    BIRTHDAY = "1926 08 17"
    PARTNER = 'wang gang dan'
    LOVE_KEYS = ['520', '1314', '5201314', '1314520', '2920184', 'love']
    SYMBOL = ['!', '@', '#', '_', '-', ',', '.', '!@#', '$%^']

# 属性拓展
def get_name(name):
    nameList = []
    nameList.append(string.capwords(name).replace(' ', ''))     # 声母大写
    nameList.append(name.capitalize().replace(' ', ''))     # 首字母大写
    nameList.append(''.join(name.split()[0:1]))    # 姓
    nameList.append(''.join(name.split()[0:1]).capitalize())    # 姓首字母大写
    nameList.append(''.join(name.split()[1:]))  # 名
    jianping = [one[0:1] for one in name.split(' ')]    # 简拼
    jianping = ''.join(jianping)
    nameList.append(jianping)
    nameList.append(jianping.upper())
    return nameList

def get_birthday(day):
    dayList = []
    dayList.append(day.replace(' ', ''))    # 年月日
    dayList.append(day.replace(' ', '')[0:6])   # 年月
    dayList.append(day.replace(' ', '')[4:])    # 月日
    dayList.append(day.replace(' ', '')[0:4])   # 年
    return dayList

def get_partner(partner):
    partnerList = get_name(partner)
    return partnerList

def get_lovekeys(keys):
    lovekeysList = keys
    return lovekeysList

def get_symbol(symbols):
    return symbols

nameList = get_name(Person.NAME)
birthdayList = get_birthday(Person.BIRTHDAY)
partnerList = get_partner(Person.PARTNER)
lovekeys = get_lovekeys(Person.LOVE_KEYS)
symbolList = get_symbol(Person.SYMBOL)

# 属性组合
# 姓名+生日组合
def name_birthday(nameList, birthdayList, symbolList):
    pwdList.extend(nameList)
    pwdList.extend(birthdayList)
    for name in nameList:
        for day in birthdayList:
            for symbol in symbolList:
                pwdList.append(name + day)
                pwdList.append(day + name)
                pwdList.append(name + symbol + day)
                pwdList.append(day + symbol + day)

# 配偶+lovekey组合
def partner_lovekey(partnerList, lovekeys, symbolList):
    for partner in partnerList:
        for love in lovekeys:
            for symbol in symbolList:
                pwdList.append(partner + love)
                pwdList.append(love + partner)
                pwdList.append(partner + symbol + love)
                pwdList.append(love + symbol + partner)

def savefile(pwdList):
    filename = "result.txt"
    with open(filename, "w+") as f:
        for line in pwdList:
            f.write(line + '\n')
    print "\r\n[*] Generated %d lines" % len(pwdList)
    print "[*] The results saved as %s" % filename
if __name__ == '__main__':
    name_birthday(nameList, birthdayList, symbolList)
    partner_lovekey(partnerList, lovekeys, symbolList)
    pwdList = list(set(pwdList))
    savefile(pwdList)

1.png

最近又刚发发现某大佬写的利器,感觉应该很好用,基本上我想要的功能都有,伏地膜-。-

标签: none

添加新评论