회원 로그인
|
랜덤 패스워드 생성
랜덤 패스워드 생성
변수 righthand, lefthand의 조합으로 패스워드 길이(변수 passwordLength) 만큼 랜덤으로 패스워드를 출력한다.
출처> http://code.activestate.com/recipes/473852/history/1
https://github.com/pedroma/scripts/blob/master/generator.py
변수 righthand, lefthand의 조합으로 패스워드 길이(변수 passwordLength) 만큼 랜덤으로 패스워드를 출력한다.
#!/usr/bin/env python """ A simple script for making random passwords, WITHOUT 1,l,O,0. Because those characters are hard to tell the difference between in some fonts. """ #Import Modules import sys from random import Random rng = Random() righthand = '12345!@#$%qwertasdfgzxcvbQWERTASDFGZXCVB' lefthand = '67890^&*()yuiophjknmYUIPHJKLNM' allchars = righthand + lefthand try: passwordLength = int(sys.argv[1]) except: #user didn't specify a length. that's ok, just use 8 passwordLength = 12 try: alternate_hands = sys.argv[2] == 'alt' if not alternate_hands: print "USAGE:" print sys.argv[0], "[length of password]", print "[alt (if you want the password to alternate hands]" except: alternate_hands = False for i in range(passwordLength): if not alternate_hands: sys.stdout.write( rng.choice(allchars) ) else: if i%2: sys.stdout.write( rng.choice(lefthand) ) else: sys.stdout.write( rng.choice(righthand) )
출처> http://code.activestate.com/recipes/473852/history/1
https://github.com/pedroma/scripts/blob/master/generator.py
- random_password_r01.py (1KB) (0)
댓글 0개
| 엮인글 0개
285개(10/15페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
105 | [Python] zipfile 모듈 | 푸딩뱃살 | 4638 | 2015.09.15 10:17 |
104 | [PHP] array 배열 / sort 정렬 | 푸딩뱃살 | 3460 | 2015.09.02 21:11 |
103 | [PHP] function 함수 | 푸딩뱃살 | 2372 | 2015.08.14 22:28 |
102 | [PHP] while, do, foreach 반복문 | 푸딩뱃살 | 4997 | 2015.08.14 22:25 |
101 | [PHP] if ~ else 조건문 | 푸딩뱃살 | 2578 | 2015.08.14 22:13 |
100 | [PHP] PHP 기초 (에러,주석,변수,연산자) | 푸딩뱃살 | 3251 | 2015.07.08 00:43 |
99 | [C#] override와 new | 푸딩뱃살 | 3235 | 2015.05.14 01:34 |
98 | [C#] 다형성 | 푸딩뱃살 | 2585 | 2015.05.08 15:42 |
97 | [C#] 인터페이스 상속 | 푸딩뱃살 | 2645 | 2015.05.08 14:35 |
96 | [C#] 인터페이스 (Interface) | 푸딩뱃살 | 2577 | 2015.05.07 23:52 |
95 | [C#] 추상 클래스 | 푸딩뱃살 | 3302 | 2015.05.07 22:45 |
>> | [Python] 랜덤 패스워드 생성 | 푸딩뱃살 | 4288 | 2015.03.24 02:34 |
93 | [PHP] php 5.5.x로 업데이트로 인한 preg_replace() 오류 | 푸딩뱃살 | 2738 | 2015.03.14 02:15 |
92 | [PHP] php 5.5.x로 업데이트로 인한 mysql_connect() 오류 | 푸딩뱃살 | 6109 | 2015.03.14 02:01 |
91 | [PHP] PHP Warning: Cannot modity header information ~ PH | 푸딩뱃살 | 2789 | 2015.03.05 15:41 |
90 | [C#] 참조 전달 ref와 값 전달 out | 푸딩뱃살 | 6871 | 2015.02.26 00:10 |
89 | [VisualStudio] Visual Studio Express 2013 Windows Desktop 설치 | 푸딩뱃살 | 2991 | 2015.02.17 03:12 |
88 | [C#] 구조체 | 푸딩뱃살 | 3627 | 2015.01.07 14:17 |
87 | [C#] 오버라이드 (override) | 푸딩뱃살 | 4253 | 2014.11.21 02:17 |
86 | [C#] 이름의 은폐 new | 푸딩뱃살 | 3414 | 2014.11.21 02:13 |