Start to learn hacking !

Tuesday, February 5, 2013

Nullcon HackIM 2013

Programming 


Q1. calculate 150000th fibonacci series, and flag is sum of the alternate numbers from answers.

Nullcon HackIM 2013

Python code:
Run it give input as 150000.



Q2: The link given is giving a blank page by default. But during an interval it will show the answer. Better to run a continues wget request to this URL and check the files after the specified duration.

lazy baba

I just ran the following and checked after few hours so there were many files with the answer !

lazy baba answer

Q3
So our folks wanted to work on binomial series but they understood incorrectly so they made a series of this type.
if series is for 10 numbers
10/1 + 9/2 + 8/3 ..... 1/10 = 22.218
round to 2 decimal place = 22.21
now they did calculated this series for 31337 numbers can you help these guys in finding the number again.

harmony in series

 Answer

Harmony


Q4 Funky Test !

Question - interpret and give answer.
start reading from left
if digit then add the digit.
if x then remove it and go back 2 places
if y then remove and go front 2 places
example : 12y34x56 answer is 14
how : 1 + 2 + 5 + 6 = 14

12y34x5612345678910xy0981235432x4765893x219532y875439664y3x2345688x754312x2456x7876554x43y324x6778y7643223457789494x98696763y15348798y765341y1878979

funky text

Answer
funky-answer

Q5 Copy Paste a string within 2 seconds - the string will change for each request.
copy paste Sample page:
copy paste



Answer:- I ran the following code after running burpsuite - and checked the burpsuite response and key/answer was there. there may be lots of other ways to do this...
copy-paste-answer


All the code for those who like to copy paste and run it.
Q1.
 #!/usr/bin/python
import sys
def main():
  print "\nHow many?"
  n = int(sys.stdin.readline())
  fibonacci(n)
def fibonacci(n):
  a,b = 0,1
  j = 0
  acc = 0
  for i in range(0,n):
    if j == 1:
     acc += a
     j = 0
    else:
     j = 1
    a,b, = b,a+b
  print acc  
main()


Q2.
#!/bin/bash
while [ 1 ]
do
wget -U "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130114 Firefox/17.0" http://ctf.nullcon.net/challenges/programming/answer.php
done


Q3.
#!/usr/bin/python
import sys
from decimal import *
import decimal
n=31337
sum=0
for j in range (1,31337):
  sum += (decimal.Decimal(n) / decimal.Decimal(j))
  n = n - 1
print sum


Q4.
#!/usr/bin/python
import sys
a=['1', '2', 'y', '3', '4', 'x', '5', '6', '1', '2', '3', '4', '5', '6', '7', '8', '9', '1', '0', 'x', 'y', '0', '9', '8', '1', '2', '3', '5', '4', '3', '2', 'x', '4', '7', '6', '5', '8', '9', '3', 'x', '2', '1', '9', '5', '3', '2', 'y', '8', '7', '5', '4', '3', '9', '6', '6', '4', 'y', '3', 'x', '2', '3', '4', '5', '6', '8', '8', 'x', '7', '5', '4', '3', '1', '2', 'x', '2', '4', '5', '6', 'x', '7', '8', '7', '6', '5', '5', '4', 'x', '4', '3', 'y', '3', '2', '4', 'x', '6', '7', '7', '8', 'y', '7', '6', '4', '3', '2', '2', '3', '4', '5', '7', '7', '8', '9', '4', '9', '4', 'x', '9', '8', '6', '9', '6', '7', '6', '3', 'y', '1', '5', '3', '4', '8', '7', '9', '8', 'y', '7', '6', '5', '3', '4', '1', 'y', '1', '8', '7', '8', '9', '7', '9']
i = 0
sum = 0
while i < len(a):
 if a[i] == "x":
  a.pop(i)
  i = i - 2
  i = i + 1
 elif a[i] == "y":
  a.pop(i)
  i = i + 3
 else:
  sum = sum + int (a[i] )
  i = i + 1
print sum


Q5.
#!/bin/bash
 curl -x 127.0.0.1:8080  -o tempfile -A "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130114 Firefox/17.0" -c cookie http://ctf.nullcon.net/challenges/programming/challenge.php
head -5 tempfile | tail -1 > tempfile2
sed -i 's/\&nbsp\;/ /g' tempfile2
sed -i 's/<span><\/span>//g' tempfile2
sed -i 's/<\/p>/ /g' tempfile2
echo "answer="$(cat tempfile2)"&submit=Submit" > postfile
sed -i 's/ /\+/g' postfile
curl -x 127.0.0.1:8080  -X POST -d @postfile  -A "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130114 Firefox/17.0" --cookie  cookie  http://ctf.nullcon.net/challenges/programming/challenge.php



*** This posted here as a reference***

1 comment: