Skip to content
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

Zenmap and Ndiff are python2 only #1176

Closed
landgraf opened this issue Apr 9, 2018 · 51 comments
Closed

Zenmap and Ndiff are python2 only #1176

landgraf opened this issue Apr 9, 2018 · 51 comments

Comments

@landgraf
Copy link

landgraf commented Apr 9, 2018

Python 2.X faces official EOL in 2020 and most of the Linux distributions started to drop python2 support already. To keep zenmap and ndiff they should be ported to python3.

@dmiller-nmap dmiller-nmap marked this as a duplicate of #665 Apr 9, 2018
@dmiller-nmap dmiller-nmap marked this as not a duplicate of #665 Apr 9, 2018
@dmiller-nmap
Copy link

Sorry, thought we already had an issue for this, but I got the wrong thing (a PR instead).

@Vascom
Copy link

Vascom commented Sep 18, 2018

Any work in progress?

@dmiller-nmap
Copy link

@Vascom No, no work is in progress. We would accept a pull request if one was made that passed review. Some challenges that would have to be overcome:

  1. Zenmap makes extensive use of pygtk, and I'm not sure that the equivalent Python 3 package is compatible. Nothing definite, just a concern that would have to be investigated.
  2. We do packaging of Zenmap and Ndiff for Windows and OS X using py2exe and gtk-mac-bundler, and those processes will require adjustment for Python 3 and whatever GTK+ library is compatible.

@samueloph
Copy link

samueloph commented Oct 31, 2018

I've received the following from a bug report on Debian:

pygtk is unmaintained upstream. It has not had a release since GNOME 3
was released in 2011.

The way forward is to port your app to use GObject Introspection
bindings (and gtk3).

For more information on GObject Introspection see [1] and [2].

Please try to do this before the Buster release as we're going to
try to remove pygtk this cycle.

If you have any question don't hesitate to ask.

[1] https://wiki.gnome.org/Projects/GObjectIntrospection
[2] https://wiki.gnome.org/Projects/PyGObject

The bug report is here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=885498

I believe that means you might want to switch to GObject Introspection while also dropping the python2 dependency.

I'm not sure if I should open another issue or just use this one for both problems (maybe change title of issue?).

Thanks

@a-andre
Copy link

a-andre commented Feb 19, 2019

See #1484 for a first step to support python3.

@BryanQuigley
Copy link

Can python2 support be dropped entirely? Just jump straight to python3?

@landgraf
Copy link
Author

Can python2 support be dropped entirely? Just jump straight to python3?

It can be dropped altogether with nping and zenmap only. Porting gtk application from Python 2 to Python 3 is not simple task but patches are welcomed :)

@BryanQuigley
Copy link

I didn't even see that nping had python2 bits. Does ndiff need to keep python2 support?

@landgraf
Copy link
Author

landgraf commented Nov 1, 2019

I didn't even see that nping had python2 bits. Does ndiff need to keep python2 support?

I meant ndiff and zenmap. Sorry

BryanQuigley pushed a commit to BryanQuigley/nmap that referenced this issue Nov 5, 2019
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
@BryanQuigley
Copy link

^^ #1807 Proposed port of ndiff - did everything but setup.py.

@XVilka
Copy link

XVilka commented Nov 28, 2019

Less than 2 months left for the old snake to be alive: https://pythonclock.org/

BryanQuigley pushed a commit to BryanQuigley/nmap that referenced this issue Jan 24, 2020
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
@BryanQuigley
Copy link

Zenmap has been removed from Debian unstable - and ndiff in Debian has been kept by merging my PR #1807 ahead of upstream.

I don't have time at the moment, but I'm not planning on trying Zenmap porting until ndiff is merged.

BryanQuigley pushed a commit to BryanQuigley/nmap that referenced this issue Apr 23, 2020
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
@BryanQuigley
Copy link

@landgraf @dmiller-nmap
Can either of you push for merge of #1807 ? Thanks!

@fyodor
Copy link
Member

fyodor commented May 26, 2020

I just wanted to note that there are some useful comments in the closed duplicate issue #2022 . In particular, here is a workaround posted by @N0rbert for Ubuntu 20.04 LTS:

mkdir -p ~/Downloads/zenmap
cd ~/Downloads/zenmap

wget http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-gtk2_2.24.0-6_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/n/nmap/zenmap_7.80+dfsg1-1build1_all.deb

sudo apt install ./*.deb

We have been slow with this because the pygtk and Windows aspects make it more difficult than a traditional Python2 -> Python3 port. But it is on our radar.

@fyodor
Copy link
Member

fyodor commented Jun 10, 2020

I also wanted to note PR #1972 here. That's a patch which tries to support Python3 while still retaining Python2 compatibility.

@ghost
Copy link

ghost commented Mar 23, 2021

@BryanQuigley Thank you very much for your help.

I'm not familiar with working branches; I'm only seeing the master branch. Where should I be looking?

By "those with commit access", are you referring to people who have write access to the repository?

Most importantly, what should I do? Should I reopen the pull request, delete it, or fiddle with it somehow?

@BryanQuigley
Copy link

I don't believe more coding work is needed - it's more organizational - see the open PRs here https://github.com/nmap/nmap/pulls?q=is%3Apr+is%3Aopen+python3

@ghost
Copy link

ghost commented Mar 23, 2021

...Oh. Well, then.

Could somebody please remove the BountySource listing, perchance? :(

I should have read the thread before beginning my coding. I learned some things, anyway.

@N0rbert
Copy link

N0rbert commented Jan 16, 2022

Possible workaround is to use Flatpak version of ZenMap as follows:

sudo apt-get update
sudo apt-get install flatpak

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub org.nmap.Zenmap

Such installation needs ~330 Mb of downloads, and will use ~1 Gb on disk.

@cclauss
Copy link

cclauss commented Aug 16, 2022

@medmedin2014
Copy link

For now all Arch based distros removed python2 from their official repos, and it's nightmare to build it from AUR.

cclauss added a commit to cclauss/nmap that referenced this issue Nov 7, 2022
Prove the Python syntax errors as discussed in
* nmap#91
* nmap#342
* nmap#624
* nmap#665
* nmap#666
* nmap#1176
* nmap#1484
* nmap#1807
* nmap#1972
* nmap#2088 
* nmap#2279
* nmap#2287
* nmap#2446
* nmap#2493
* nmap#2522
And many more...
cclauss added a commit to cclauss/nmap that referenced this issue Nov 7, 2022
Prove the Python syntax errors as discussed in
* nmap#91
* nmap#342
* nmap#624
* nmap#665
* nmap#666
* nmap#1176
* nmap#1484
* nmap#1807
* nmap#1972
* nmap#2088 
* nmap#2279
* nmap#2287
* nmap#2446
* nmap#2493
* nmap#2522
And many more...
@maravento
Copy link

ubuntu 22.04

The following packages have unmet dependencies:
  python-gtk2 : Depends: python (< 2.8) but not installable
                Depends: python (>= 2.7) but it's not installable
                Depends: python:any (>= 2.6.6-7~) but it's not installable
                Depends: libgdk-pixbuf2.0-0 (>= 2.22.0) but it won't install
                Depends: python-cairo (>= 1.0.2-1.1) but it's not installable
                Depends: python-gobject-2 (>= 2.21.3) but it's not installable

Please zenmap for ubuntu 22.04. Thanks

@N0rbert
Copy link

N0rbert commented Nov 17, 2022

Use Flatpak then as described in #1176 (comment) . Or check https://aur.archlinux.org/packages/zenmap-python3-git .

@maravento
Copy link

Use Flatpak then as described in #1176 (comment) .

very heavy

@chmelarp
Copy link

Please, use Python3 version as described here
#2088 (comment)

@maravento
Copy link

The zenmap flatpack project seems abandoned. The expected results are not obtained.

@chmelarp
Copy link

Sure, use this branch:
https://github.com/kulikjak/nmap/tree/master-python3

@cclauss
Copy link

cclauss commented Nov 17, 2022

@chmelarp Based on the incomplete kulikjak#1, the master-python3 branch needs a lot of work.

I would be interested to work on https://github.com/nmap/nmap/pulls/cclauss if any maintainers of the nmap/nmap repo are willing to review PRs. It has been 1,051 days since Python 2 end of life on 1/1/2020 so it is past the time to make this upgrade.

@chmelarp
Copy link

Thank you for your effort, @cclauss !

@kulikjak 's code works OK, but it may need some polishing as he made it quite a time ago. There are plenty of deprecated warnings and the README should be updated from what I can see.

Also, Zenmap is mostly independent on the C code. IMHO it should have a separate repository so it can be packaged and maintained separately.

What is your opinion @kulikjak, @fyodor, @cldrn, @hsluoyz ?

@kulikjak
Copy link

Hi, I rebased my change pretty recently (3 months ago) and based on my limited testing, everything seemed to work - but I won't deny there might be some polishing to be done. That said, it appears that some people (maybe even distros) are already using it, and I fixed most issues they reported so far.

I didn't get rid of all deprecation warnings because that would mean even more changes, and I didn't want to rewrite it completely as that would make the review and subsequent merge even harder. The same goes for the GTK 4 migration (I asked about it in January, but got no upstream response for that and thus didn't really explore it further yet).

README and e.g. setup.py might need some changes as well, but there were other PRs that looked into that (I believe), and I focused on the Zenmap only. I can certainly look at README and setup.py update as well.

I guess that separate repository might make sense, considering that the Zenmap GUI isn't really the core of Nmap and doesn't really depend on it that much.

@darkbasic
Copy link

I'm all in for the separate repo: it makes sense from a coding point of view and it will allow to proceed faster as well.

@kulikjak
Copy link

@chmelarp Based on the incomplete kulikjak#1, the master-python3 branch needs a lot of work.

Well, I think it's complete from the Zenmap point of view (I mean, except for possible bugs I didn't catch). I didn't touch ndiff.py because there is #1807 for that, and setup.py or Makefile.in because those are not really about Zenmap specifically - but they will certainly need an update as well.

@cclauss
Copy link

cclauss commented Nov 18, 2022

@cldrn @fyodor @hsluoyz Would it be possible to create repos for:

so that we can focus on modernizing those codebases? There are currently almost 500 open issues and more than 200 open pull requests on https://github.com/nmap/nmap so perhaps all would benefit from a bit of divide and conquer.

If there are more appropriate repos to focus on these two codebases, please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests