본문 바로가기

Python

Python ksg_code.py

# -*- coding: cp949 -*-

import md5

import os,sys,time

import requests

import urllib

import hashlib

from base64 import b64encode, b64decode



def kbase64(code):

    

    print("- - - - - - - - - Plain & Reverse Code - - - - - - - - -")


    print("CODE is : "+code)


    print("Encode base64 : "+b64encode(code))


    try:


        print("Decode base64 : "+b64decode(code))


    except:


        print("!....... Base64 Decode Error")





def kUTF8(code):


    print("\n- - - - - - - - - UTF8 - - - - - - - - -")


    print("CODE is : "+code)    


    try:


        print("Encode UTF-8 : "+code.encode("UTF-8",errors='strict'))


    except:


         print("!....... UTF-8 Encode Error")


    try:


        print("Decode UTF-8 : "+code.decode("UTF-8"))


    except:


        print("!....... UTF-8 Decode Error")




    


def kMD5(code):


    print("\n- - - - - - - - - MD5 - - - - - - - - -")


    print("CODE is : "+code)


    result=str(md5.new(code).digest().encode("hex"))


    print ("MD5 hash is : ",result , ", len : ",str(len(result)))


    print ("Decrypt here : http://md5.web-max.ca/")


def kSHA(code):


    print("\n- - - - - - - - - SHA - - - - - - - - -")


    print("CODE is : "+code)


    result=str(hashlib.sha1(code).hexdigest())

    print ("SHA1 hash is : ",result , ", len : "+str(len(result)))

    result=str(hashlib.sha224(code).hexdigest())

    print ("SHA224 hash is : ",result,", len : "+str(len(result)))

    result=str(hashlib.sha256(code).hexdigest())

    print ("SHA256 hash is : ",result , ", len : "+str(len(result)))

    result=str(hashlib.sha384(code).hexdigest())

    print ("SHA384 hash is : ",result , ", len : "+str(len(result)))

    result=str(hashlib.sha512(code).hexdigest())

    print ("SHA512 hash is : ",result , ", len : "+str(len(result)))

    result=str(hashlib.sha1(code).hexdigest())

    print ("SHA1 hash is : ",result , ", len : "+str(len(result)))

    print ("\nDecrypt here : http://md5.web-max.ca/")


def kROT13(code):

    print("\n- - - - - - - - - ROT13 With hack-me - - - - - - - - -")

    site="http://hack-me.org/cracker.php"

    headers = {

    'Accept': '*/*',

    'Referer': 'http://hack-me.org/?p=crack',

    'Accept-Language': 'ko-KR',

    'Accept-Encoding': 'gzip, deflate',

    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko',

    'Connection': 'Keep-Alive',

    'DNT': '1',

    'Host': 'hack-me.org',

    'I-LOVE-HACKME':'This Service is so good, so i borrow this web service..',

    'Cookie': 'PHPSESSID=bppu8g7f3rg8lqmq5kt6dhdu32'

    }

    payload={'plaintext':code,'type':'rot'}

    r=requests.get(site,params=payload,headers=headers)

    print(r.text)

    


    

def kshow():

    print("Base64는 인코딩된 문자열은 알파벳 대소문자와 숫자, 그리고 \"+\", \"/\" 기호 64개로 이루어지며, \"=\"는 끝을 알리는 코드로 쓰인다.")

    print("MD5는 32길이이며 레인보우 테이블, 브루트포싱에 쉽게 노출되어있다.")

    print("피들러 Ctrl+E 강추 !!!")


if __name__=="__main__":


    kshow()


    code=raw_input("CODE : ")

    choice=raw_input("HASH On(y/n) : ")



    #base64 


    kbase64(code)


    kbase64(code[::-1])




    #UTF-8


   


    kUTF8(code)


    #MD5 ENCODER

    if choice.lower()=="y":

        kMD5(code)


    

    #SHA

    if choice.lower()=="y":

        kSHA(code)

    #ROT13

    kROT13(code)

    


    """



    URL




    f = { 'eventName' : 'myEvent', 'eventDescription' : "cool event"}


    print urllib.urlencode(f)


    """



'Python' 카테고리의 다른 글

web6  (0) 2014.09.21
Pip 설치  (0) 2014.09.18
Python AES  (0) 2014.09.15
Python get, post 값 전달하기  (0) 2014.09.14
Python 할 일 추천기  (0) 2014.09.14