English [HackIM 2016] [Misc 300 – Know India] Write Up

Description

How well you know about India?

52.91.163.151:10101

Resolution

This challenge was not hard at all, it was just really… boring.
By connecting onto the server, we’ve got a prompt that asks us a question about India (capital, official language,etc) :

  • If we answer correctly, the server asks us another question.
  • If the answer is not correct, the connection is killed and we have to start again from the beginning.

From time to time, questions changed, so we wrote a script that can handle any question order or new questions easily.
The only difficult thing was to find the good anwsers on google.

The flag was flag{saare__jahan__se__achcha}

Here is the script. You can check it a bit, but it’s not very useful ^^


import socket

def getAnswer(q):
if 'Primary Official language of Puducherry' in q:
return "tamil"
if 'Primary Official language of Arunachal Pradesh' in q:
return "english"
if "worlds biggest gathering of humans" in q:
return "kumbh mela"
if "Nick name of Bengaluru" in q:
return "electronic city of india"
if "Nick name of Nasik" in q:
return "wine capital of india"
if "Nick name of Jodhpur" in q:
return "blue city"
if "Final destination of river Ravi" in q:
return "chenab"
if "Nick name of Surat" in q:
return "diamond city of india"
if "What is the capital of state : Uttarakhand" in q:
return "dehradun"
if "Nick name of Tiruchirappalli" in q:
return "rock fort city"
if "Primary Official language of Delhi" in q:
return "hindi"
if "What is the official name of India" in q:
return "republic of india"
if "Nick name of Allahabad" in q:
return "abode of the god"
if "Primary Official language of Nagaland" in q:
return "english"
if "What is the capital of state : Andaman and Nicobar Islands" in q:
return "port blair"
if "Nick name of Bhimavaram" in q:
return "second bardoli of india"
if "What is the capital of state : Haryana" in q:
return "chandigarh"
if "What is the capital of state : Tripura" in q:
return "agartala"
if "Nick name of Tirunelveli" in q:
return "city of paddy fields"
if "Nick name of Guwahati" in q:
return "gateway of north east india"
if "Nick name of Dibrugarh" in q:
return "tea city of india"
if "Nick name of Ahmedabad" in q:
return "boston of india"
if "Primary Official language of Andaman and Nicobar Islands" in q:
return "hindi"
if "Nick name of Asansol" in q:
return "land of black diamond"
if "Primary Official language of Chhattisgarh" in q:
return "hindi"
if "Primary Official language of Chandigarh" in q:
return "english"
if "Nick name of Chennai" in q:
return "gateway of south india"
if "What is the capital of state : Sikkim" in q:
return "gangtok"
if "Nick name of Kollam" in q:
return "prince of arabian sea"
if "Primary Official language of Tamil Nadu" in q:
return "tamil"
if "Nick name of Jaipur" in q:
return "pink city"
if "Primary Official language of Uttar Pradesh" in q:
return "hindi"
if "Nick name of Prayag" in q:
return "abode of the god"
if "Nick name of Thiruvananthapuram" in q:
return "evergreen city of india"
if "Primary Official language of Manipur" in q:
return "meiteilon"
if "Primary Official language of Bihar" in q:
return "hindi"
if "Primary Official language of Daman and Diu" in q:
return "konkani"
if "Nick name of Mangalore" in q:
return "rome of the east"
if "Primary Official language of Punjab" in q:
return "punjabi"
if "Primary Official language of Andhra Pradesh" in q:
return "telugu"
if "What is the capital of state : Gujarat" in q:
return "gandhinagar"
if "What is the capital of state : Meghalaya" in q:
return "shillong"
if "How many candidates contested for Modakurichi assembly seat in the Tamil Nadu state elections in 1996" in q:
return "1033"
if "Final destination of river Kosi" in q:
return "ganga"
if "Floating post office with PIN 19001 is located in" in q:
return "dal lake"
return None

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("52.91.163.151", 10101))
while (1):

buf = s.recv(1024)
if buf:
print(buf)
if (getAnswer(buf)):
print(getAnswer(buf))
s.send(getAnswer(buf))

Leave a Reply

Your email address will not be published. Required fields are marked *