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

Fixing old code - replacement for 'import IW' - 'iw.scan' #816

Closed
SecurityJon opened this issue Jun 8, 2021 · 5 comments
Closed

Fixing old code - replacement for 'import IW' - 'iw.scan' #816

SecurityJon opened this issue Jun 8, 2021 · 5 comments

Comments

@SecurityJon
Copy link

Hi there!

Hopefully a quick solution, I'm fixing up some legacy code from the https://github.com/SecurityJon/audit-radius project and this utilises pyroute2.

The code imports:

from pyroute2 import IW

And this throws:

ImportError: cannot import name 'IW' from 'pyroute2' (/usr/local/lib/python3.9/dist-packages/pyroute2/__init__.py)

It's using this for wifi scanning.

I can't easily see in the docs (I'm not a python dev) the correct way of fixing this - was this functionality removed or accessed in a different way?

@SecurityJon
Copy link
Author

Quick update - I've found iwutils which appears to import fine, and then I call this with iwutils.IW().

Unfortunately the code still won't 'do' anything so I can't test if this was correct, but does it look right?

@SecurityJon
Copy link
Author

In the same vein - another import appears to be missing now

import RawIPRoute
with RawIPRoute() as rawip:

Is there an equivalent?

@ralonsoh
Copy link
Contributor

ralonsoh commented Jun 8, 2021

Hi @SecurityJon:

Import the module, not the class or the variable. For example, in the last example:

from pyroute2 import iproute
with iproute.RawIPRoute() as rawip:
    ...

Regards.

@svinota
Copy link
Owner

svinota commented Jun 8, 2021

The plan was that it should work without any code change, so I'm to fix this. Will be fixed asap.

Still some import errors are possible (not all the modules are covered with CI), and thanks for reporting it.

svinota added a commit that referenced this issue Jun 9, 2021
@svinota
Copy link
Owner

svinota commented Jun 9, 2021

Fixed in the master branch.

@svinota svinota closed this as completed Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants