mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
--memo-limit - limit failed attempts to find new generated requests to N
This commit is contained in:
parent
bd1f7ebb5c
commit
956149c126
@ -34,6 +34,10 @@ def go_pathoc():
|
|||||||
metavar = "HOST:PORT",
|
metavar = "HOST:PORT",
|
||||||
help="Issue an HTTP CONNECT to connect to the specified host."
|
help="Issue an HTTP CONNECT to connect to the specified host."
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--memo-limit", dest='memolimit', default=5000, type=int, metavar="N",
|
||||||
|
help='Stop if we do not find a valid request after N attempts.'
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-m", dest='memo', action="store_true", default=False,
|
"-m", dest='memo', action="store_true", default=False,
|
||||||
help="""
|
help="""
|
||||||
|
@ -222,9 +222,14 @@ class Pathoc(tcp.TCPClient):
|
|||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
memo = set([])
|
memo = set([])
|
||||||
|
trycount = 0
|
||||||
try:
|
try:
|
||||||
cnt = 0
|
cnt = 0
|
||||||
while 1:
|
while 1:
|
||||||
|
if trycount > args.memolimit:
|
||||||
|
print >> sys.stderr, "Memo limit exceeded..."
|
||||||
|
return
|
||||||
|
|
||||||
cnt += 1
|
cnt += 1
|
||||||
if args.random:
|
if args.random:
|
||||||
playlist = [random.choice(args.requests)]
|
playlist = [random.choice(args.requests)]
|
||||||
@ -251,8 +256,10 @@ def main(args):
|
|||||||
newlist.append(spec)
|
newlist.append(spec)
|
||||||
playlist = newlist
|
playlist = newlist
|
||||||
if not playlist:
|
if not playlist:
|
||||||
|
trycount += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
trycount = 0
|
||||||
try:
|
try:
|
||||||
p.connect(args.connect_to)
|
p.connect(args.connect_to)
|
||||||
except (tcp.NetLibError, PathocError), v:
|
except (tcp.NetLibError, PathocError), v:
|
||||||
|
Loading…
Reference in New Issue
Block a user