Commit 8553797cc63702506f3edb71397da1d884dab3b4
1 parent
8c59b3e4
oleid: fixed print and bytes strings for Python 3 - issue #62
Showing
1 changed file
with
4 additions
and
3 deletions
oletools/oleid.py
| @@ -41,6 +41,7 @@ http://www.decalage.info/python/oletools | @@ -41,6 +41,7 @@ http://www.decalage.info/python/oletools | ||
| 41 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 41 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 42 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 42 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 43 | 43 | ||
| 44 | +from __future__ import print_function | ||
| 44 | 45 | ||
| 45 | #------------------------------------------------------------------------------ | 46 | #------------------------------------------------------------------------------ |
| 46 | # CHANGELOG: | 47 | # CHANGELOG: |
| @@ -48,7 +49,7 @@ http://www.decalage.info/python/oletools | @@ -48,7 +49,7 @@ http://www.decalage.info/python/oletools | ||
| 48 | # 2014-11-29 v0.02 PL: - use olefile instead of OleFileIO_PL | 49 | # 2014-11-29 v0.02 PL: - use olefile instead of OleFileIO_PL |
| 49 | # - improved usage display with -h | 50 | # - improved usage display with -h |
| 50 | # 2014-11-30 v0.03 PL: - improved output with prettytable | 51 | # 2014-11-30 v0.03 PL: - improved output with prettytable |
| 51 | -# 2016-10-25 v0.50 PL: - fixed print for Python 3 | 52 | +# 2016-10-25 v0.50 PL: - fixed print and bytes strings for Python 3 |
| 52 | 53 | ||
| 53 | __version__ = '0.50' | 54 | __version__ = '0.50' |
| 54 | 55 | ||
| @@ -89,7 +90,7 @@ def detect_flash (data): | @@ -89,7 +90,7 @@ def detect_flash (data): | ||
| 89 | """ | 90 | """ |
| 90 | #TODO: report | 91 | #TODO: report |
| 91 | found = [] | 92 | found = [] |
| 92 | - for match in re.finditer('CWS|FWS', data): | 93 | + for match in re.finditer(b'CWS|FWS', data): |
| 93 | start = match.start() | 94 | start = match.start() |
| 94 | if start+8 > len(data): | 95 | if start+8 > len(data): |
| 95 | # header size larger than remaining data, this is not a SWF | 96 | # header size larger than remaining data, this is not a SWF |
| @@ -112,7 +113,7 @@ def detect_flash (data): | @@ -112,7 +113,7 @@ def detect_flash (data): | ||
| 112 | # Read SWF into buffer. If compressed read uncompressed size. | 113 | # Read SWF into buffer. If compressed read uncompressed size. |
| 113 | swf = data[start:start+size] | 114 | swf = data[start:start+size] |
| 114 | compressed = False | 115 | compressed = False |
| 115 | - if 'CWS' in header: | 116 | + if b'CWS' in header: |
| 116 | compressed = True | 117 | compressed = True |
| 117 | # compressed SWF: data after header (8 bytes) until the end is | 118 | # compressed SWF: data after header (8 bytes) until the end is |
| 118 | # compressed with zlib. Attempt to decompress it to check if it is | 119 | # compressed with zlib. Attempt to decompress it to check if it is |