New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python3 port of ndiff #1807
Python3 port of ndiff #1807
Conversation
7838418
to
fe8dc17
Compare
Would be nice to have for the next release, since Python 2 will be EOL in a couple weeks. |
Thanks for porting this @BryanQuigley! Flake8 is flagging the https://docs.python.org/3.6/library/functools.html#functools.cmp_to_key Line 429 in fe8dc17
Besides that, worked as expected in Python 3.6! import ndiff
filename_a = "test-scans/random-1.xml"
filename_b = "test-scans/random-2.xml"
scan_a = ndiff.Scan()
scan_a.load_from_file(filename_a)
scan_b = ndiff.Scan()
scan_b.load_from_file(filename_b)
# Text
fh = open("text_output.txt", "w")
diff = ndiff.ScanDiffText(scan_a, scan_b, fh)
cost = diff.output()
# XML
fh_xml = open("xml_output.xml", "w")
diff = ndiff.ScanDiffXML(scan_a, scan_b, fh_xml)
cost = diff.output() |
fe8dc17
to
f5a4989
Compare
Been a bit, but I think we replaced all the cmp bits before this, so removing this last one - seems to work. Thanks for the feedback -also updated because there have been other code commits... |
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Ported all python scrips in ndiff/ except setup.py Some hints on cmp taken from nmap#1484 Minor tweaks to Makefile to support python3, but unsure if there is a better way to do that. Seperated .travis.yml commands for easier debugging where it breaks. This closes the easy half of nmap#1176 Resolves: nmap#1484
f5a4989
to
82f8b1a
Compare
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
The ndiff package provided by Nmap relies on python2; moreover, there have been pending pull requests to move ndiff to python3 for over two years with very little engagement by the maintainers (nmap/nmap#1807). Remove the option to select ndiff altogether, it is replaced by python-pyndiff, which provides the same functionality (and more) as the ndiff provided by nmap, and is compatible with python3. Signed-off-by: Adam Duskett <aduskett@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Update to 7.80 * Add "full" variants for nmap and ncat that support Lua scripts (and OpenSSL) * Replace libcxx fix with upstream patch[1] (CHANGELOG change was removed) * Switch ndiff to use Python 3 (using a patch from Debian[2], which comes from an upstream PR[3] plus a port of ndiff/setup.py) [1]: nmap/nmap@ea4e2d6 [2]: https://salsa.debian.org/pkg-security-team/nmap/-/blob/0510c602dd45f4dc0b06a6f422a9b0855564ddbb/debian/patches/0004-Python3-port-of-ndiff.patch [3]: nmap/nmap#1807 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Ports everything except for setup.py