mitmproxy/test/helper_tools/loggrep.py

18 lines
413 B
Python
Raw Normal View History

2021-05-11 14:03:39 +00:00
#!/usr/bin/env python3
import fileinput
2021-06-09 21:59:44 +00:00
import re
2022-11-29 13:28:41 +00:00
import sys
2021-05-11 14:03:39 +00:00
if __name__ == "__main__":
if len(sys.argv) < 3:
print(f"Usage: {sys.argv[0]} port filenames")
sys.exit()
port = sys.argv[1]
matches = False
for line in fileinput.input(sys.argv[2:]):
if re.search(r"^\[|(\d+\.){3}", line):
2021-05-11 14:03:39 +00:00
matches = port in line
if matches:
print(line, end="")