Fix file creation

This commit is contained in:
Neale Pickett 2018-07-16 14:07:31 -06:00
parent c0f7e96117
commit 2c8405045a
1 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ except ImportError:
import netarch.py_pcap as pcap import netarch.py_pcap as pcap
import os import os
import cgi import cgi
import urllib import urllib.parse
from netarch import unpack, hexdump from netarch import unpack, hexdump
from netarch.trilobytes import TriloBytes from netarch.trilobytes import TriloBytes
@ -698,11 +698,11 @@ class Session:
fn = '%d-%s~%d-%s~%d---%s' % (frame.time, fn = '%d-%s~%d-%s~%d---%s' % (frame.time,
frame.src_addr, frame.sport, frame.src_addr, frame.sport,
frame.dst_addr, frame.dport, frame.dst_addr, frame.dport,
urllib.quote(fn, '')) urllib.parse.quote(fn, ''))
fullfn = os.path.join(self.basename, fn) fullfn = os.path.join(self.basename, fn)
fullfn2 = os.path.join(self.basename2, fn) fullfn2 = os.path.join(self.basename2, fn)
print(' writing %s' % (fn,)) print(' writing %s' % (fn,))
fd = open(fullfn, 'w') fd = open(fullfn, 'wb')
try: try:
os.unlink(fullfn2) os.unlink(fullfn2)
except OSError: except OSError: