Nmap Development mailing list archives
Re: Making zenmap, ndiff, neat and nping compatible with 2to3
From: Varunram Ganesh <vrg2009 () ymail com>
Date: Thu, 26 Jan 2017 05:24:10 +0000 (UTC)
I basically wrote a script which looked through all the subdirectories and ran futurize -wn <script-name>.py on them. And yeah, old_div is not required on the last example, don't know how that went wrong. I got the mistake regarding raw_input() though. Seems I ran the script twice on that particular file. Another problem I'm facing is regarding the Makefile. I keep getting "make[3]: Nothing to be done for `all'". Any suggestions regarding that? On Thursday, 26 January 2017 2:06 AM, David Fifield <david () bamsoftware com> wrote: 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)