aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple/script_arguments.py
blob: 84292eb996e4367c2b9b0b84b966a2aa80de29ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import argparse


class Replacer:
    def __init__(self, src, dst):
        self.src, self.dst = src, dst

    def response(self, flow):
        flow.response.replace(self.src, self.dst)


def load(l):
    parser = argparse.ArgumentParser()
    parser.add_argument("src", type=str)
    parser.add_argument("dst", type=str)
    args = parser.parse_args()
    l.boot_into(Replacer(args.src, args.dst))