vincentcox / StaCoAn

StaCoAn is a crossplatform tool which aids developers, bugbounty hunters and ethical hackers performing static code analysis on mobile applications.
MIT License
827 stars 129 forks source link

OSX - File not found #54

Closed MindNinja closed 6 years ago

MindNinja commented 6 years ago

On Macs, your download (V.6) is not working. Below is the error. I believe you have hard coded some paths into the app. My mac is on Python 2.7.10

[INFO] serving report server at port: 8080
[INFO] serving dragdrop server at port: 8000
0:38: execution error: File some object wasn’t found. (-43)
^CTraceback (most recent call last):
  File "/Users/travis/build/vincentcox/StaCoAn/src/stacoan.py", line 264, in <module>
  File "/Users/travis/build/vincentcox/StaCoAn/src/stacoan.py", line 151, in program
  File "/Users/travis/build/vincentcox/StaCoAn/src/stacoan.py", line 117, in server
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 1056, in join
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/travis/build/vincentcox/StaCoAn/src/stacoan.py", line 264, in <module>
KeyboardInterrupt
[9549] Failed to execute script stacoan
L-75
sa7mon commented 6 years ago

I get the same 0:38: execution error: File some object wasn’t found. (-43) error.

Running the application in both Python 2.7 and 3.6 gives the same result. Running MacOS 10.13.3

vincentcox commented 6 years ago

Thanks for reporting this guys! Are you guys running the release? Or are you running it by downloading the source and executing it via python?

vincentcox commented 6 years ago

Keep in mind that this project is only tested on python3. Make sure to invoke python3 stacoan.py -d test-apk.apk instead of python stacoan.py -d test-apk.apk.

sa7mon commented 6 years ago

The error seems to happen on both the 0.6 release, and the master branch as of writing (last commit: 49ac37aa5080a90327ab35540148baeeaf17f2bd)

Environment: OSX 10.13.3 Python: 3.6.4

Stacktrace:

(venv) (venv)sphynx:/Volumes/DATA/Projects/StaCoAn/src $ python3 ./stacoan.py
[INFO] serving report server at port: 8080
[INFO] serving dragdrop server at port: 8000
0:38: execution error: File some object wasn’t found. (-43)
69:77: execution error: Can’t get application "chrome". (-1728)
[INFO] GET / HTTP/1.1 200 -
[INFO] TrueFile '/Volumes/DATA/Projects/StaCoAn/src/com.spotify.apk' upload success!by: ('127.0.0.1', 56254)
[INFO] POST / HTTP/1.1 200 -
[INFO] serving report server at port: 8080
Process Process-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "./stacoan.py", line 151, in program
    server(args, server_enabled, DRAG_DROP_SERVER_PORT)
  File "./stacoan.py", line 92, in server
    reportserver = ServerWrapper.create_reportserver()
  File "/Volumes/DATA/Projects/StaCoAn/src/helpers/server.py", line 31, in create_reportserver
    return socketserver.TCPServer(("", ServerWrapper.REPORT_SERVER_PORT), RequestHandlerClass=ServerWrapper.reportserver)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 453, in __init__
    self.server_bind()
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 467, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 48] Address already in use

The error about Chrome is probably unrelated and due to the fact that I run Firefox.

vincentcox commented 6 years ago

I think I have an idea why this is. The program uses a frequently used port (8080) which in your case is used. Because the program cannot opens this port, the rest of the program doesn't get certain information, causing some objects to not be found by StaCoAn. I will fix this by changing the port number to something less frequent.

About the chrome thing, it's also a bug (wrong assumption of me that everybody has chrome), thanks for reporting.

Summary: To fix

sa7mon commented 6 years ago

Awesome, thanks for the prompt responses. Might I suggest that in addition to using a less-common port you add an argument or config somewhere where the user can specify the port to use?

Also, the Chrome error message is less critical than it seems. The page does open in Firefox after it gives the Chrome error, but the address is file://127.0.0.1:8080 which doesn't work until I change it to http://localhost:8080 so it's not trying to serve from the filesystem as opposed to the webserver.

vincentcox commented 6 years ago

Ah that's a good thing you mention that. I added that also on the roadmap (use file:// when server is disabled and https:// when server is enabled).

vincentcox commented 6 years ago

Can you guys try with the latest update in the development branch?

git clone -b develop https://github.com/vincentcox/stacoan

If both the chrome and the 'File some object wasn’t found'-error is fixed I will push this to master and make a new executable.

sa7mon commented 6 years ago

Running with Python 3.6.5 yields the following:

screen shot 2018-04-01 at 09 25 13

vincentcox commented 6 years ago

I could reproduce it and I have created a fix in the dev branch. The issue seems fixed for me but I want to confirm this with you guys. Happy easter by the way!

vincentcox commented 6 years ago

Feel free to re-open this issue if you still get the error with this new release.