droe / sslsplit

Transparent SSL/TLS interception
https://www.roe.ch/SSLsplit
BSD 2-Clause "Simplified" License
1.75k stars 328 forks source link

log2pcap.py may not work with Python 2.6.6 #182

Closed ybonnamy closed 6 years ago

ybonnamy commented 6 years ago

Hi,

i have to use log2pcap.py with Python 2.6.6 , and i have the following issue :

  File "/root/sslsplit-0.5.0/extra/log2pcap.py.orig", line 207, in <module>
    netemu.add(logentry)
  File "/root/sslsplit-0.5.0/extra/log2pcap.py.orig", line 178, in add
    self.connstate[conn5tuple].syn()
  File "/root/sslsplit-0.5.0/extra/log2pcap.py.orig", line 90, in syn
    seq=self.src_seq)
  File "/root/sslsplit-0.5.0/extra/log2pcap.py.orig", line 65, in _write_packet
    pkt.time = (self.tm - datetime.datetime(1970, 1, 1)).total_seconds()
AttributeError: 'datetime.timedelta' object has no attribute 'total_seconds'

i had to change this in order to have the pcap :


# diff /root/sslsplit-0.5.0/extra/log2pcap.py.orig /root/sslsplit-0.5.0/extra/log2pcap.py
65c65
<             pkt.time = (self.tm - datetime.datetime(1970, 1, 1)).total_seconds()
---
>             pkt.time = (self.tm - datetime.datetime(1970, 1, 1)).seconds

Regards,

Yann.

droe commented 6 years ago

Yes, total_seconds was added in Python 2.7, thanks for your report.

Note that Python 2.6 has not been maintained since 2013. The only portability changes I would want to make to these scripts is to move them forward to Python 3.x, not backward to Python 2.6.