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

[!] sh: lipo: command not found #172

Closed
tghosth opened this issue May 24, 2017 · 12 comments
Closed

[!] sh: lipo: command not found #172

tghosth opened this issue May 24, 2017 · 12 comments
Labels

Comments

@tghosth
Copy link
Contributor

tghosth commented May 24, 2017

Issue

Running a module, e.g. metadata, doesn't work.
It gives an error related to lipo. Do you have any idea why that would not be on the device or where to get it from?

needle error logs

Ensure verbose and debug mode are enabled:

oot@kali:/mnt/hgfs/Work# python ./needle/needle/needle.py

             __   _ _______ _______ ______         _______
             | \  | |______ |______ |     \ |      |______
             |  \_| |______ |______ |_____/ |_____ |______
        
                   Needle v1.2.0 [mwr.to/needle]                  
  [MWR InfoSecurity (@MWRLabs) - Marco Lancini (@LanciniMarco)]   

[needle] > set IP localhost
IP => localhost
[needle] > set DEBUG True
DEBUG => True
[needle] > use binary/info/metadata
[needle][metadata] > run
[*] Checking connection with device...
[V] Connection not present, creating a new instance
[D] Setting up USB port forwarding on port 2222
[D] [LOCAL CMD] Local Subprocess Command: python /mnt/hgfs/Work/needle/needle/libs/usbmuxd/tcprelay.py -t 22:2222
[D] [AGENT] Setting up port forwarding on port 4444
[V] [AGENT] Connecting to agent (localhost:4444)...
[+] [AGENT] Successfully connected to agent (localhost:4444)...
[D] [AGENT] Executing command: os_version
[D] [AGENT] Parsing result (are you sure the agent is in the foreground?)
[V] [SSH] Connecting (localhost:2222)...
[+] [SSH] Connected (localhost:2222)
[D] Creating temp folder: /var/root/needle/
[D] [REMOTE CMD] Remote Command: if [ -d /var/root/needle/ ]; then echo "yes"; else echo "no" ; fi
[D] [AGENT] Executing command: os_version
[D] [AGENT] Parsing result (are you sure the agent is in the foreground?)
[*] Target app not selected. Launching wizard...
[D] [AGENT] Executing command: list_apps
[D] [AGENT] Parsing result (are you sure the agent is in the foreground?)
[+] Apps found:
		0 - XXXXXXXXXXXXXX
		1 - XXXXXXXXXXXXXX
		2 - com.google.ios.youtube
		3 - com.facebook.Messenger
		4 - XXXXXXXXXXXXXX
		5 - XXXXXXXXXXXXXX
		6 - com.shazam.Shazam
		7 - XXXXXXXXXXXXXX
		8 - com.google.chrome.ios
		9 - kim.cracksby.yalu102
[>][QUESTION] Please select a number: 2
[+] Target app: com.google.ios.youtube
[*] Retrieving app's metadata...
[D] Copying the plist to temp: /private/var/containers/Bundle/Application/9D250DA8-127C-4622-B208-44363A364055/YouTube.app/Info.plist -> /root/.needle/tmp/plist
[*] Pulling: /private/var/containers/Bundle/Application/9D250DA8-127C-4622-B208-44363A364055/YouTube.app/Info.plist -> /root/.needle/tmp/plist
[D] Downloading: "/private/var/containers/Bundle/Application/9D250DA8-127C-4622-B208-44363A364055/YouTube.app/Info.plist" -> /root/.needle/tmp/plist
[D] [LOCAL CMD] Local Command: sshpass -p "alpine" scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -P 2222 root@localhost:"/private/var/containers/Bundle/Application/9D250DA8-127C-4622-B208-44363A364055/YouTube.app/Info.plist" /root/.needle/tmp/plist
[D] [REMOTE CMD] Remote Command: lipo -info /private/var/containers/Bundle/Application/9D250DA8-127C-4622-B208-44363A364055/YouTube.app/YouTube
[!] sh: lipo: command not found

[V] [SSH] Disconnecting...
[V] [AGENT] Disconnecting from agent...
[D] Stopping USB port forwarding
[D] [LOCAL CMD] Stopping Local Subprocess Command [pid: 5233]
[D] [AGENT] Stopping port forwarding
[?] Resetting connection to device...
[D] Setting up USB port forwarding on port 2222
[D] [LOCAL CMD] Local Subprocess Command: python /mnt/hgfs/Work/needle/needle/libs/usbmuxd/tcprelay.py -t 22:2222
[D] [AGENT] Setting up port forwarding on port 4444
[V] [AGENT] Connecting to agent (localhost:4444)...
[+] [AGENT] Successfully connected to agent (localhost:4444)...
[D] [AGENT] Executing command: os_version
[D] [AGENT] Parsing result (are you sure the agent is in the foreground?)
[V] [SSH] Connecting (localhost:2222)...
[+] [SSH] Connected (localhost:2222)
[?] Rerunning last command...
[!] sh: lipo: command not found

[V] [SSH] Disconnecting...
[V] [AGENT] Disconnecting from agent...
[D] Stopping USB port forwarding
[D] [LOCAL CMD] Stopping Local Subprocess Command [pid: 5250]
[D] [AGENT] Stopping port forwarding
[?] Resetting connection to device...
[D] Setting up USB port forwarding on port 2222
[D] [LOCAL CMD] Local Subprocess Command: python /mnt/hgfs/Work/needle/needle/libs/usbmuxd/tcprelay.py -t 22:2222
[D] [AGENT] Setting up port forwarding on port 4444
[V] [AGENT] Connecting to agent (localhost:4444)...
[+] [AGENT] Successfully connected to agent (localhost:4444)...
[D] [AGENT] Executing command: os_version
[D] [AGENT] Parsing result (are you sure the agent is in the foreground?)
[V] [SSH] Connecting (localhost:2222)...
[+] [SSH] Connected (localhost:2222)
[?] Rerunning last command...
[!] sh: lipo: command not found

[V] [SSH] Disconnecting...
[V] [AGENT] Disconnecting from agent...
[D] Stopping USB port forwarding
[D] [LOCAL CMD] Stopping Local Subprocess Command [pid: 5261]
[D] [AGENT] Stopping port forwarding
[?] Resetting connection to device...
[D] Setting up USB port forwarding on port 2222
[D] [LOCAL CMD] Local Subprocess Command: python /mnt/hgfs/Work/needle/needle/libs/usbmuxd/tcprelay.py -t 22:2222
[D] [AGENT] Setting up port forwarding on port 4444
[V] [AGENT] Connecting to agent (localhost:4444)...
[+] [AGENT] Successfully connected to agent (localhost:4444)...
[D] [AGENT] Executing command: os_version
[D] [AGENT] Parsing result (are you sure the agent is in the foreground?)
[V] [SSH] Connecting (localhost:2222)...
[+] [SSH] Connected (localhost:2222)
[?] Rerunning last command...
------------------------------------------------------------
Traceback (most recent call last):
  File "/mnt/hgfs/Work/needle/needle/core/framework/module.py", line 111, in do_run
    pre = self.module_pre()
  File "/mnt/hgfs/Work/needle/needle/core/framework/module.py", line 147, in module_pre
    if self.app_check() is None: return None
  File "/mnt/hgfs/Work/needle/needle/core/framework/framework.py", line 690, in app_check
    self.APP_METADATA = Framework.APP_METADATA = self.device.app.get_metadata(app)
  File "/mnt/hgfs/Work/needle/needle/core/device/app.py", line 19, in get_metadata
    return self._retrieve_metadata()
  File "/mnt/hgfs/Work/needle/needle/core/device/app.py", line 37, in _retrieve_metadata
    architectures = self.__detect_architectures(binary_path)
  File "/mnt/hgfs/Work/needle/needle/core/device/app.py", line 115, in __detect_architectures
    out = self._device.remote_op.command_blocking(cmd, internal=True)
  File "/mnt/hgfs/Work/needle/needle/core/device/remote_operations.py", line 94, in command_blocking
    out, err = self._device._exec_command_ssh(cmd, internal)
  File "/mnt/hgfs/Work/needle/needle/core/utils/utils.py", line 204, in wrapper
    raise Exception("An error occurred and it was not possible to restore it ({} attempts failed)".format(self.tries))
Exception: An error occurred and it was not possible to restore it (3 attempts failed)
------------------------------------------------------------
[!] Exception: An error occurred and it was not possible to restore it (3 attempts failed)
[needle][metadata] > 

Environment

Needle Version

  • Framework (on your machine): 1.2.0
  • Agent (on your device): 1.0.4

Device iOS Version

10.2

@tghosth
Copy link
Contributor Author

tghosth commented May 24, 2017

Nevermind, looks like you need to add Darwin CC Tools to the dependencies list...

@tghosth
Copy link
Contributor Author

tghosth commented May 24, 2017

oh wow, ok I didn't know device/dependency_installer existed. Currently investigating!

@floyd-fuh
Copy link
Contributor

Please updated the wiki documentation and tell people that:
a) they will need to run the module device/dependency_installer
Also update the error messages of that module, as it currently says:

[D] [REMOTE CMD] Remote Command: which apt-get
[!] Prerequisite Not Found: apt-get 
------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/needle/needle/core/framework/module.py", line 117, in do_run
    self.module_run()
  File "/opt/needle/needle/modules/device/dependency_installer.py", line 161, in module_run
    self._check_prerequisites()
  File "/opt/needle/needle/modules/device/dependency_installer.py", line 119, in _check_prerequisites
    raise Exception('Please install the requirements listed in the README file')
Exception: Please install the requirements listed in the README file
------------------------------------------------------------
[!] Exception: Please install the requirements listed in the README file

But there is no such thing as a dependencies mentioned in the README

@floyd-fuh
Copy link
Contributor

Same for Core Utilities:

[D] [REMOTE CMD] Remote Command: dpkg --get-selections | grep -v "deinstall" | cut -f1
------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/needle/needle/core/framework/module.py", line 117, in do_run
    self.module_run()
  File "/opt/needle/needle/modules/device/dependency_installer.py", line 168, in module_run
    self._refresh_package_list()
  File "/opt/needle/needle/modules/device/dependency_installer.py", line 125, in _refresh_package_list
    out = self.device.remote_op.command_blocking(cmd, internal=True)
  File "/opt/needle/needle/core/device/remote_operations.py", line 94, in command_blocking
    out, err = self._device._exec_command_ssh(cmd, internal)
  File "/opt/needle/needle/core/utils/utils.py", line 196, in wrapper
    return func(obj, *args, **kwargs)
  File "/opt/needle/needle/core/device/device.py", line 128, in _exec_command_ssh
    raise Exception(err_str)
Exception: sh: cut: command not found

------------------------------------------------------------
[!] Exception: sh: cut: command not found

@floyd-fuh
Copy link
Contributor

And even after running the dependency installer, it said it will install [] and then everything is still missing.

So I had to install lipo and other tools from Cydia directly. I needed the following packages:

  • Darwin CC Tools
  • IPA Installer
  • Clutch 2.0
  • Open

The module binary/reversing/strings seems to be using awk, which didn't install with Core Utils strangely... and also ps is missing etc. But now at least most modules run fine.

Then I also got a "[!] IOError: [Errno 2] No such file or directory: '~/.needle/tmp/plist'", so I had to "mkdir ~/.needle/tmp"

@ThePirateWhoSmellsOfSunflowers

Hi!
Don't know if it helps but you can find awk with Cydia by installing Gawk.

🌻

@humanUnit
Copy link

@floyd-fuh hi, have you install lipo from Cydia? I believe there is way to install it on iPhone 5, but it is a arm32 device. Because I don't see lipo in Cydia.

@floyd-fuh
Copy link
Contributor

@humanUnit sorry, this was too long ago and that device is long gone, I simply can't remember :-/

@ThePirateWhoSmellsOfSunflowers

@humanUnit on my iPad 4 (32 bit) jailbroken with h3lix, I manage to install lipo by installing the package "Darwin CC Tools" from coolstar repo in Cydia.

@humanUnit
Copy link

@ThePirateWhoSmellsOfSunflowers thanks!

@303sec
Copy link

303sec commented Nov 6, 2018

I was having similar issues to @floyd-fuh with:

it said it will install [] and then everything is still missing.

But it turns out I just needed to set ALL (or any specific dependency I needed) to true. Not sure if it is the same problem, but thought it worth mentioning!

@flamecopper
Copy link

[!] Prerequisite Not Found: apt-get
[!] Exception: Please install the requirements listed in the project WIKI

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

No branches or pull requests

7 participants