mitmproxy/test/helper_tools/loggrep.py
Maximilian Hils d47eb7556a fix #4630
2021-06-09 23:59:44 +02:00

18 lines
412 B
Python
Executable File

#!/usr/bin/env python3
import fileinput
import sys
import re
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.match(r"^\[|(\d+\.){3}", line):
matches = port in line
if matches:
print(line, end="")