WithSecureLabs / needle

The iOS Security Testing Framework
https://mobiletools.mwrinfosecurity.com/
Other
1.33k stars 284 forks source link

No module named utils #168

Closed javixeneize closed 7 years ago

javixeneize commented 7 years ago

Issue

When running needle, i have an error in printer.py. Importerror:No module named 'utils'

I think the problem is that in your code, there is an utils.py, and there is also a python module called utils, so the tool can't open that class

Any suggestions on how to solve it? I think i need to force the app to search for utils in my directory instead of the python library folder

Thanks

Thanks

marco-lancini commented 7 years ago

In order to debug this issue, we require more information.

Ensure VERBOSE and DEBUG mode are enabled, this will provide us with more detailed needle logs:

[needle] > set VERBOSE True
VERBOSE => True
[needle] > set DEBUG True
DEBUG => True

Once you have this information, please attach the log files (starting from when you type python needle.py) to this thread and we can assist further.

f-fly2 commented 7 years ago

Thats what i have

Traceback (most recent call last): File "needle.py", line 9, in from core.framework import cli File "/Users/me/needle/needle/core/framework/cli.py", line 7, in from ..utils.printer import Colors, Printer File "/Users/me/needle/needle/core/utils/printer.py", line 4, in from utils import Utils ImportError: No module named 'utils'

I cant enable verbose/debug mode as i cant even get into needle...

marco-lancini commented 7 years ago

What version are you using? From what branch? Also, how are you launching it?

javixeneize commented 7 years ago

Hi

The latest one from master -- https://github.com/mwrlabs/needle.git

On Wed, May 17, 2017 at 12:33 PM, Marco Lancini notifications@github.com wrote:

What version are you using? From what branch?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mwrlabs/needle/issues/168#issuecomment-302063102, or mute the thread https://github.com/notifications/unsubscribe-auth/AMK55qKKbNqfejYvHERYhx4PGtNNG7-pks5r6trygaJpZM4NcuJV .

ccsplit commented 7 years ago

@javixeneize, are you using Python3? (python --version) I've seen this issue within Python3, which I believe the imports may need to be changed in order to fully support Python3. I would suggest using Python 2.7.x in the meantime.

javixeneize commented 7 years ago

Hi

Im on python 2.7

Thanks El El mié, 17 may 2017 a las 15:59, ccsplit notifications@github.com escribió:

@javixeneize https://github.com/javixeneize, are you using Python3? (python --version) I've seen this issue within Python3, which I believe the imports may need to be changed in order to fully support Python3. I would suggest using Python 2.7.x in the meantime.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/mwrlabs/needle/issues/168#issuecomment-302118004, or mute the thread https://github.com/notifications/unsubscribe-auth/AMK55qz0OIzENWBs68W9LNX0a3sBa3lYks5r6wtCgaJpZM4NcuJV .

marco-lancini commented 7 years ago

As requested earlier, how are you launching it?

javixeneize commented 7 years ago

Just python needle.py

El El jue, 18 may 2017 a las 13:44, Marco Lancini notifications@github.com escribió:

As requested earlier, how are you launching it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mwrlabs/needle/issues/168#issuecomment-302392668, or mute the thread https://github.com/notifications/unsubscribe-auth/AMK55teDGwcuclEhhW7Wx-H1dWGQB1G-ks5r7D0cgaJpZM4NcuJV .

marco-lancini commented 7 years ago

sorry can't reproduce it with the information provided

ccsplit commented 7 years ago

@javixeneize and @f-fly2,

Can you please provide the following information from a command line: python --version and pip freeze. This will help determine if there are possibly issues with libraries conflicting, etc.

For example (mine): python --version: Python 2.7.13

pip freeze:

appdirs==1.4.3
asn1crypto==0.22.0
biplist==1.0.1
cffi==1.10.0
colorama==0.3.9
cryptography==1.8.1
enum34==1.1.6
frida==10.0.3
gnureadline==6.3.3
idna==2.5
ipaddress==1.0.18
packaging==16.8
paramiko==2.1.2
prompt-toolkit==1.0.14
pyasn1==0.2.3
pycparser==2.17
Pygments==2.2.0
pyparsing==2.2.0
six==1.10.0
sshtunnel==0.1.2
wcwidth==0.1.7
javixeneize commented 7 years ago

Hi

All sorted out now. The problem was that related to the naming, as ccsplit pointed out. Thats solved now

marco-lancini commented 7 years ago

@javixeneize can you please provide details?

javixeneize commented 7 years ago

Sure. What i did was to remove the external module that had the same name

javedparmar commented 7 years ago

@javixeneize: Can you please provide just 1 more step ahead insight. I am facing the same issue. And based on above statement, i guess I am very near to what it has been mention here.

python version: 2.7.13

needle master folder needle - needle folder

I didn't get based on your last statement "remove the external module that had the same name"?

javixeneize commented 7 years ago

Hi

Not sure if i recall it correctly

The thing was that i had a library installed that had the same name as a needle module. Python was trying to find the methods in that library instead of in the needle module.

So, what i did was to remove the external library to avoid the naming issue

Hope it helps

El El jue, 17 ago 2017 a las 16:18, javedparmar notifications@github.com escribió:

@javixeneize https://github.com/javixeneize: Can you please provide just 1 more step ahead insight. I am facing the same issue. And based on above statement, i guess I am very near to what it has been mention here.

I didn't get based on your last statement "remove the external module that had the same name"?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mwrlabs/needle/issues/168#issuecomment-323093775, or mute the thread https://github.com/notifications/unsubscribe-auth/AMK55iRhVWKEJQkr2GLg4c728h1vInjyks5sZFD8gaJpZM4NcuJV .

ccsplit commented 7 years ago

Hello @javedparmar,

More than likely you have the needle package installed. Which if you want to get the path of the file being imported you can obtain it by doing: python -c "import needle; print needle.__file__". If you want to check to see if it is the other needle you can try pip freeze | grep needle and if it appears it is more than likely the other needle package. Since I don't believe this package is on PyPi. You can also do pip show needle to see the details of the package if it shows up with pip freeze | grep needle.

The other needle will have the following information:

Name: needle
Version: 0.5.0
Summary: Automated testing for your CSS.
Home-page: https://github.com/bfirsh/needle
Author: Ben Firshman
Author-email: ben@firshman.co.uk
License: UNKNOWN
Location: /Users/ccsplit/.virtualenvs/test/lib/python2.7/site-packages
Requires: selenium, pillow, nose

Hopefully that helps.