|
@ -5,29 +5,16 @@ from mitmproxy import ctx, http |
|
|
import argparse |
|
|
import argparse |
|
|
|
|
|
|
|
|
class Injector: |
|
|
class Injector: |
|
|
''' |
|
|
|
|
|
def load(self, loader): |
|
|
|
|
|
loader.add_option( |
|
|
|
|
|
"scr_url", str, "", "script_url to inject" |
|
|
|
|
|
) |
|
|
|
|
|
''' |
|
|
|
|
|
def __init__(self, path): |
|
|
def __init__(self, path): |
|
|
self.path = path |
|
|
self.path = path |
|
|
|
|
|
|
|
|
def response(self, flow: http.HTTPFlow) -> None: |
|
|
def response(self, flow: http.HTTPFlow) -> None: |
|
|
#print("hola hola hola") |
|
|
|
|
|
#print(self.path) |
|
|
|
|
|
|
|
|
|
|
|
if self.path: |
|
|
if self.path: |
|
|
html = BeautifulSoup(flow.response.content, "html.parser") |
|
|
html = BeautifulSoup(flow.response.content, "html.parser") |
|
|
print(self.path) |
|
|
print(self.path) |
|
|
print(flow.response.headers["content-type"]) |
|
|
print(flow.response.headers["content-type"]) |
|
|
if flow.response.headers["content-type"] == 'text/html': |
|
|
if flow.response.headers["content-type"] == 'text/html': |
|
|
print("uuuuuu") |
|
|
|
|
|
print(flow.response.headers["content-type"]) |
|
|
print(flow.response.headers["content-type"]) |
|
|
print("asdf asdf asdf asdf asdf") |
|
|
|
|
|
print("-----") |
|
|
|
|
|
print("mmmmm") |
|
|
|
|
|
script = html.new_tag( |
|
|
script = html.new_tag( |
|
|
"script", |
|
|
"script", |
|
|
src=self.path, |
|
|
src=self.path, |
|
@ -41,5 +28,3 @@ def start(): |
|
|
parser.add_argument("path", type=str) |
|
|
parser.add_argument("path", type=str) |
|
|
args = parser.parse_args() |
|
|
args = parser.parse_args() |
|
|
return Injector(args.path) |
|
|
return Injector(args.path) |
|
|
|
|
|
|
|
|
#addons = [Injector()] |
|
|
|