Nmap Development mailing list archives
Re: Making zenmap, ndiff, neat and nping compatible with 2to3
From: David Fifield <david () bamsoftware com>
Date: Wed, 25 Jan 2017 12:36:22 -0800
On Wed, Jan 25, 2017 at 11:29:16AM +0000, Varunram Ganesh wrote:
I tried to make the existing python2 code be compatible with python3 via 2to3. However, I have a few issues with the Makefile. Any idea as to what to do?
I looked over the diff and it mostly seems all right. Could you send a record of the commands you ran in order to make these changes? This change looks wrong (in nping/nping-dev/ipv6fp.py and elsewhere): - addr=raw_input(" |_ Target's IPv6 address: ") + addr=eval(input(" |_ Target's IPv6 address: ")) Did 2to3 really make this change? python2's raw_eval does not eval. This is a dangerous change if done anywhere that is exposed to untrusted input, so we need to understand how it got there. In nping/nping-dev/ipv6fp.py, I think changes like this are wrong: - packet=eth_hdr/packet + packet=old_div(eth_hdr,packet) Here, '/' does not represent division, but rather a magic Scapy operator for combining protocol layers. Maybe old_div will still do the right thing (by calling __div__), but the change shouldn't be necessary. It's probably best to leave ipv6fp.py untouched as it's only a historical script now. I don't know much about 2to3, but is old_div really required here, where it's two floats being divided? I thought the division changes in python3 only had to do with integers. - progress.set_fraction(float(os['accuracy']) / 100.0) + progress.set_fraction(old_div(float(os['accuracy']), 100.0)) _______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Making zenmap, ndiff, neat and nping compatible with 2to3 Varunram Ganesh (Jan 25)
- Re: Making zenmap, ndiff, neat and nping compatible with 2to3 David Fifield (Jan 25)
- Re: Making zenmap, ndiff, neat and nping compatible with 2to3 Varunram Ganesh (Jan 25)
- Re: Making zenmap, ndiff, neat and nping compatible with 2to3 David Fifield (Jan 25)