def http_assembler(PCAP):
    print "[*] Loading PCAP file..."
    p = rdpcap(PCAP)
    print "[*] Loading sessions..."
    sessions = p.sessions()
    for session in sessions:
        http_payload = ''
        for packet in sessions[session]:
            try:
                if packet[TCP].dport == 80 or packet[TCP].sport == 80:
                    http_payload += str(packet[TCP].payload)
            except:
                pass

        headers = get_http_headers(http_payload)

        if headers is None:
		continue

	html = find_html(headers, http_payload)

	if html is not None:
		js = find_js(http_payload)
		
		if js:
		 	print "[*] JavaScript detected"
			t = time.time()
			try:
    				os.makedirs(JS_DIR)
			except __HOLE__:
   				if os.path.exists(JS_DIR):
        				pass
    				else:
        				raise
			print "[*] Writing html file %s-%d.html to %s folder" %(PCAP, t, JS_DIR)
			file_name = '%s-%d.html' %(PCAP, t)
			fd = open('%s/%s' % (JS_DIR, file_name), 'wb')
			fd.write(html)
			fd.close()
			time.sleep(1)
    return
dataset/ETHPy150Open mertsarica/hack4career/codes/eval-finder.py/http_assembler