Created
August 6, 2016 11:55
-
-
Save shinshin86/83543f825cb4bae676b04c185f934c3b to your computer and use it in GitHub Desktop.
It was create to solve to SECCON2015 online CTF - Excercise (After)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
def create_dict(c,p): | |
dic ={} | |
for i in range(len(c)): | |
dic[c[i]] = p[i] | |
return dic | |
def q_replace(q, dic2): | |
answer = "" | |
for i in range(len(q)): | |
answer += dic2[q[i]] | |
return answer | |
if __name__ == '__main__': | |
argvs = sys.argv | |
argc = len(argvs) | |
# If the number of arguments is not correct... | |
if (argc != 4): | |
print("Argument is not corrext...") | |
print(" ** HOW TO USE ** ") | |
print(" python caesar_cipher.py [Cipher] [Plain] [Quiz] ") | |
print(" **************** ") | |
quit() | |
dic2 = create_dict(argvs[1],argvs[2]) | |
print(" ** Answer ** ") | |
print(q_replace(argvs[3], dic2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment