artyom_h31

Untitled

Oct 13th, 2020 (edited)
1,955
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import re
  3. import matplotlib.pyplot as plt
  4.  
  5. pattern = re.compile("cwnd:(\d+)")
  6.  
  7. with open("sslog.txt") as input_file, open("cwnd.txt", "w") as output_file:
  8.     while True:
  9.         ip = input_file.readline()
  10.         info = input_file.readline()
  11.         if not ip or not info: #  EOF
  12.             break
  13.         if "reno" not in info: #  Take only data connection
  14.             continue
  15.         for match in re.finditer(pattern, info):
  16.             output_file.write(match.group(1) + "\n")
  17.  
Advertisement
Add Comment
Please, Sign In to add comment