Updated mitm6.py to include logging capabilities
Added an option (-o) to allow outputting the results of mitm6 into a log file. I find this to be very useful for my scenario since tee'ing the output of mitm6 doesn't seem to actually do anything until mitm6 closes. For my use case, I need to monitor mitm6's output in realtime and terminate it depending on conditions.
I had to modify line 32 to say if config.outfile is not None:. And then add line 53 area to be:
else:
self.outfile = None
You may consider adding a UTC timestamp by default into the outfile. I prefer %Y-%M-%DT%h:%m:%sZ (e.g., 2022-08-11T12:04:01Z) which is ISO 8601 compliant. This way if someone were to pushback on what time/date something happened, I can provide the exact timeline for them. I used to previously do the below until I realized tee doesn't work with mitm6 (but works with other tools):
(date && sudo mitm6 ...) 2>&1 | tee -a 'mitm6.txt'
You may consider adding a UTC timestamp by default into the outfile. I prefer
%Y-%M-%DT%h:%m:%sZ(e.g.,2022-08-11T12:04:01Z) which is ISO 8601 compliant. This way if someone were to pushback on what time/date something happened, I can provide the exact timeline for them. I used to previously do the below until I realizedteedoesn't work with mitm6 (but works with other tools):(date && sudo mitm6 ...) 2>&1 | tee -a 'mitm6.txt'
Exactly. Thanks for this information and the change above. I've made updated my local copy as well to include this.