# -*- coding: cp949 -*-
# hash.py                                        
# Md5, SHA, Base64에 관하여 동작하는 스크립트 입니다   
# 한번에 여러 값을 동시에 hash 할 수 있습니다.
# Made By MaJ3stY                            


from hashlib import *
from base64 import *
import sys


if __name__ == "__main__":
    print '''
              HI! You want to Service choice
              1. Md5 hash
              2. Sha1 hash
              3. Sha224 hash
              4. Sha256 hash
              5. Sha384 hash
              6. Sha512 hash
              7. Base64 Encode
              8. Base64 Decode
              9. World Exit

    usage : python [file] [strings 1] [string 2] 
        ex) python %s strings1, strings2\n''' % sys.argv[0]
    s = 1

    while s:
        try:
            ch = input("Number Choice >>> ")
            s = 0
        except:
            print "\nPlease, Choice Number"
            
    
    if ch == 1:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Md5 hash >>> " + md5(sys.argv[i]).hexdigest()
             except: print "Input Strings"
    elif ch == 2:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Sha1 hash >>> " + sha1(sys.argv[i]).hexdigest()
             except: print "Input Strings"
    elif ch == 3:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Sha224 hash >>> " + sha224(sys.argv[i]).hexdigest()
             except: print "Input Strings"
    elif ch == 4:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Sha256 hash >>> " + sha256(sys.argv[i]).hexdigest()
             except: print "Input Strings"
    elif ch == 5:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Sha384 hash >>> " + sha384(sys.argv[i]).hexdigest()
             except: print "Input Strings"
    elif ch == 6:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Sha512 hash >>> " + sha512(sys.argv[i]).hexdigest()
             except: print "Input Strings"
    elif ch == 7:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Base64 Encode >>> " + b64encode(sys.argv[i])
             except: print "Input Strings"
    elif ch == 8:
        for i in range(1, len(sys.argv)):
             try: print "\n%s" % sys.argv[i] + " Base64 Decode >>> " + b64decode(sys.argv[i])
             except: print "Input Strings"
    elif ch == 9:
        print "Bye, See you again!"
        sys.exit()


[그림 - 실행화면]

코딩 환경 : Win7 SP1 Python 2.7.2

'[+] 유틸리티' 카테고리의 다른 글

Registry (9)에서 쓰였던 python 스크립트  (0) 2012.01.06
ROT-13 Script  (0) 2011.12.15
Hash Script  (0) 2011.12.14
BozoCrack  (0) 2011.12.02
Technote 7 취약점 점검 툴  (2) 2011.01.03

+ Recent posts