Showing posts with label HackIM Writeup. Show all posts
Showing posts with label HackIM Writeup. Show all posts

Monday, 27 January 2014

HackIM Programming 100 WriteUp

HackIM 2014 
Write Up for The Programming 100
I wrote a simple python program for this.
By this we can get the 20 spam words, which we have to submit to the server running at 23.23.190.204:2002

import math
dic = {'a':1,'c':9,'e':25,'f':36,'h':64,'i':81,'j':100,'l':144,'m':169,'n':196,'o':225,'p':256,'s':361,'t':400,'u':441,'v':484}
f = open("/home/knc/Desktop/email64k.txt",'r') #some (email) word dictionary
r = f.read().split("\n")
dic1={}


def ispalindrome(x):  #palindrome check
    z = str(x) 
    l=len(z)/2 
    if z[:l]==z[-l:][::-1]: 
        return 1     
    return 0

def is_prime(num):    #prime number check
    for j in range(2,int(math.sqrt(num)+1)):
        if (num % j) == 0:
             return False
    return True

for i in r:             #Calculating value of the word
    s=0
    for j in i:
        if j in dic:
            s += dic[j]
            dic1[i]=s
        else:
            s=0
            dic1[i]=s
            break

for spam_word in dic1:
    if dic1[k]!=0:
        if(ispalindrome(str(dic1[k]))and(is_prime(dic1[k]))): #prime palindrome Check
            print spam_word


After Successful Submission of 20 spam words!..

We got the flag:: f94b50f9972398811e7d76928d2e87d4