Bruteforce 용 사전 파일 생성 시 예제 코드 입니다.
#!C:\Python27\Python.exe
#-*- coding:utf-8 -*-
import itertools
alpha = '123'
'''
111
112
113
122
123
133
222
223
233
333
'''
for s in itertools.combinations_with_replacement(alpha, 3):
output = ''.join(s)
print output
'''
123
132
213
231
312
321
'''
for s in itertools.permutations(alpha, 3):
output = ''.join(s)
print output
'''
111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
'''
length = 3
for s in itertools.product(alpha, repeat=length):
output = ''.join(s)
print output
참고로 combinations_with_replacement() 함수는 Python 2.7 버전에서 추가된거 같네요.