Srinivas11789 / PcapXray

:snowflake: PcapXray - A Network Forensics Tool - To visualize a Packet Capture offline as a Network Diagram including device identification, highlight important communication and file extraction
GNU General Public License v2.0
1.66k stars 276 forks source link

Modernize Python 2 code to get ready for Python 3 #5

Closed cclauss closed 5 years ago

cclauss commented 6 years ago

Make the minimal, safe changes required to convert the repo's code to be syntax compatible with both Python 2 and Python 3. There may be other changes required to complete a port to Python 3 but this PR is a minimal, safe first step.

Run: futurize --stage1 -w */.py

See Stage 1: "safe" fixes http://python-future.org/automatic_conversion.html#stage-1-safe-fixes
Srinivas11789 commented 5 years ago

Looks great. Thanks for your contribution @cclauss. I have picked your commit while working on another branch. Merged into the latest release https://github.com/Srinivas11789/PcapXray/commit/e84f065607c86db06c727fa9431d449355fd68e7

cclauss commented 5 years ago

Looks great! See #33 Just change is not to != in three locations...

flake8 testing of https://github.com/Srinivas11789/PcapXray on Python 3.7.1

$ flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics

./Source/Module/legacy/pcapReader.py:109:12: F632 use ==/!= to compare str, bytes, and int literals
        if ipaddress is not "":
           ^
./Source/Module/legacy/pcapReader.py:111:12: F632 use ==/!= to compare str, bytes, and int literals
        if protocol is not "":
           ^
./Source/Module/legacy/pcapReader.py:113:12: F632 use ==/!= to compare str, bytes, and int literals
        if port is not "":
           ^
3     F632 use ==/!= to compare str, bytes, and int literals
3
Srinivas11789 commented 5 years ago

Sure. These are changed in the legacy files. Corrected! https://github.com/Srinivas11789/PcapXray/commit/9c2d77fa3eabab1b5c07be50a80e895c613117d8.