dmayer / idb

idb is a tool to simplify some common tasks for iOS pentesting and research
MIT License
942 stars 155 forks source link

Select App error #91

Open Daemonceltics opened 7 years ago

Daemonceltics commented 7 years ago

iOS 10.2,Get the app list an error as follows Error downloading file. /usr/local/lib/ruby/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:294:in `open': No filename specified (RuntimeError)

jimmyjammz99 commented 7 years ago

Yeah... I figured out why it is doing that... but it will be some work to fix it...

Modified the code a bit to insert some additional logging during the ssh_operations.rb. under this section:

    def download(remote_path, local_path = nil)
      begin
        if local_path.nil?
          $log.info "Starting download #{@sftp} #{remote_path}"
          @sftp.download! remote_path
        else
          $log.info "Starting download #{@sftp} #{remote_path} to #{local_path}"
          @sftp.download! remote_path, local_path
        end
      rescue
        $log.error "Error downloading file."
        return false
      end
      true
    end

It will give you output like this in the log... [INFO] 2017-06-22 15:42:09 :: idb :: Starting download # /private/var/installd/Library/MobileInstallation/LastLaunchServicesMap.plist to /home/username/.idb/tmp//%UUID%//private/var/installd/Library/MobileInstallation/LastLaunchServicesMap.plist [ERROR] 2017-06-22 15:42:09 :: idb :: Error downloading file.

the app.rb file defines this path inside this block of code:

     if $device.ios_version >= 8
        if $device.ios_version == 8
          mapping_file = "/var/mobile/Library/MobileInstallation/LastLaunchServicesMap.plist"
        else
          mapping_file = "/private/var/installd/Library/MobileInstallation/LastLaunchServicesMap.plist"
        end
        local_mapping_file = cache_file mapping_file
        @services_map = IOS8LastLaunchServicesMapWrapper.new local_mapping_file
        @data_dir = @services_map.data_path_by_bundle_id @info_plist.bundle_identifier
        @keychain_access_groups = @services_map.keychain_access_groups_by_bundle_id @info_plist.bundle_identifier

      else
        @data_dir = @app_dir
      end

The issue is iOS 10.x does not use the file LastLaunchServicesMap.plist anymore. They are using a database for the list of installed applications. /User/Library/FrontBoard/applicationState.db

So basically a sql query will need to take place to grab the appropriate information idb is requesting... Wonder if anyone has time to work through this...

Anyways... hope this points someone in the correct direction...

dmayer commented 7 years ago

thanks for getting this far. Will look into this.

dmayer commented 7 years ago

this should be fixed in the latest version. Are you still having issues?

MuchiMuchiPink commented 7 years ago

App listing works now, but idb crashes when I select an App. iOS 10.2 my os: 4.4.0-93-generic #116-Ubuntu

from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:inmethod_missing' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:in exec' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/idb.rb:278:inrun' from /var/lib/gems/2.3.0/gems/idb-2.10.1/bin/idb:4:in <top (required)>' from /usr/local/bin/idb:22:inload' from /usr/local/bin/idb:22:in <main>' recv failed: Resource temporarily unavailable

dmayer commented 7 years ago

Are you able to share which app causes this? If its a free one I would install and test it. Which ruby version are you using? Also, is there more output you could paste? That does not seem to be the entire error.

Daemonceltics commented 7 years ago

Thanks a lot @dmayer

MuchiMuchiPink commented 7 years ago

DB Navigator, but it crashes on any App I tried. ruby version is: ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux-gnu]

Edit: Still crashes

[INFO] 2017-09-15 09:16:53 :: idb :: Loading configuration from /home/*****/.idb/settings.yml QLayout: Cannot add null widget to QGridLayout/ QLayout: Cannot add null widget to QGridLayout/ [DEBUG] 2017-09-15 09:17:05 :: idb :: Connecting via USB [DEBUG] 2017-09-15 09:17:05 :: idb :: Using port 41142 for SSH forwarding [INFO] 2017-09-15 09:17:05 :: idb :: Launching SSH proxy on port 41142 [INFO] 2017-09-15 09:17:06 :: idb :: Establishing SSH Session for root@localhost:41142 [INFO] 2017-09-15 09:17:06 :: idb :: Establishing SFTP Session... [DEBUG] 2017-09-15 09:17:06 :: idb :: opening port 41142 for manual ssh connection [INFO] 2017-09-15 09:17:06 :: idb :: Launching SSH proxy on port 2222 [DEBUG] 2017-09-15 09:17:06 :: idb :: opening tool port 44894 for internal ssh connection [INFO] 2017-09-15 09:17:06 :: idb :: Launching SSH proxy on port 44894 bind(): Address already in use Error creating socket: Invalid argument [INFO] 2017-09-15 09:17:06 :: idb :: Checking iOS version [DEBUG] 2017-09-15 09:17:06 :: idb :: Executing blocking SSH command: touch /tmp/daniel [INFO] 2017-09-15 09:17:06 :: idb :: iOS Version: 10 or newer [INFO] 2017-09-15 09:17:06 :: idb :: iOS Version: 10 with apps dir: /private/var/containers/Bundle/Application and data dir: /private/var/mobile/Containers/Data/Application [INFO] 2017-09-15 09:17:06 :: idb :: Checking if aptget is installed... [DEBUG] 2017-09-15 09:17:06 :: idb :: File not found: Net::SFTP::StatusException (2, "no such file") [DEBUG] 2017-09-15 09:17:06 :: idb :: File not found: Net::SFTP::StatusException (2, "no such file") [INFO] 2017-09-15 09:17:06 :: idb :: aptget found at /usr/bin/aptitude. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if open is installed... [INFO] 2017-09-15 09:17:06 :: idb :: open found at /usr/bin/open. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if openurl is installed... [INFO] 2017-09-15 09:17:06 :: idb :: openurl found at /usr/bin/uiopen. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if dumpdecrypted_armv6 is installed... [INFO] 2017-09-15 09:17:06 :: idb :: dumpdecrypted_armv6 found at /usr/lib/dumpdecrypted_armv6.dylib. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if dumpdecrypted_armv7 is installed... [INFO] 2017-09-15 09:17:06 :: idb :: dumpdecrypted_armv7 found at /usr/lib/dumpdecrypted_armv7.dylib. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if pbwatcher is installed... [INFO] 2017-09-15 09:17:06 :: idb :: pbwatcher found at /var/root/pbwatcher. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if pcviewer is installed... [INFO] 2017-09-15 09:17:06 :: idb :: pcviewer found at /var/root/protectionclassviewer. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if keychaineditor is installed... [INFO] 2017-09-15 09:17:06 :: idb :: keychaineditor found at /var/root/keychaineditor. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if rsync is installed... [INFO] 2017-09-15 09:17:06 :: idb :: rsync found at /usr/bin/rsync. [INFO] 2017-09-15 09:17:06 :: idb :: Checking if cycript is installed... [INFO] 2017-09-15 09:17:06 :: idb :: cycript found at /usr/bin/cycript. [INFO] 2017-09-15 09:17:06 :: port_forward :: Loading configuration from /home/****/.idb/settings.yml [DEBUG] 2017-09-15 09:17:06 :: port_forward :: Connecting via USB [DEBUG] 2017-09-15 09:17:06 :: port_forward :: Using port 45706 for SSH forwarding [INFO] 2017-09-15 09:17:06 :: port_forward :: Launching SSH proxy on port 45706 [INFO] 2017-09-15 09:17:06 :: port_forward :: Establishing SSH port forwarding... [INFO] 2017-09-15 09:17:06 :: port_forward :: Setting up port forwarding... [INFO] 2017-09-15 09:17:06 :: port_forward :: - Forwarding remote:4711 -> localhost:4711 /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/service/forward.rb:179:inblock in remote': remote forwarding request failed (Net::SSH::Exception) from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/session.rb:596:in request_failure' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/session.rb:540:indispatch_incoming_packets' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/session.rb:237:in ev_preprocess' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/event_loop.rb:99:ineach' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/event_loop.rb:99:in ev_preprocess' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/event_loop.rb:27:inprocess' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/session.rb:216:in process' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/session.rb:178:inblock in loop' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/session.rb:178:in loop' from /var/lib/gems/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/connection/session.rb:178:inloop' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/lib/ssh_port_forwarder.rb:29:in start' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/helper/ssh_port_forwarder.rb:58:inrun' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/helper/ssh_port_forwarder.rb:63:in <module:Idb>' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/helper/ssh_port_forwarder.rb:7:in

' recv failed: Resource temporarily unavailable [] Retrieving list of applications... [DEBUG] 2017-09-15 09:17:08 :: idb :: App Dir: /private/var/containers/Bundle/Application/19D9CEF2-751F-4DBF-906B-D6A9D61FF387 [DEBUG] 2017-09-15 09:17:08 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/19D9CEF2-751F-4DBF-906B-D6A9D61FF387/app/Info.plist [INFO] 2017-09-15 09:17:08 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/19D9CEF2-751F-4DBF-906B-D6A9D61FF387/TestFlight.app/Info.plist [INFO] 2017-09-15 09:17:08 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:08 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:08 :: idb :: App Dir: /private/var/containers/Bundle/Application/1CB775A3-EA0C-49E4-9F95-169B8D2B212D [DEBUG] 2017-09-15 09:17:08 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/1CB775A3-EA0C-49E4-9F95-169B8D2B212D/app/Info.plist [INFO] 2017-09-15 09:17:08 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/1CB775A3-EA0C-49E4-9F95-169B8D2B212D/Game Pack.app/Info.plist [INFO] 2017-09-15 09:17:09 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:09 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:09 :: idb :: App Dir: /private/var/containers/Bundle/Application/23C80050-DB21-48EE-9CC7-7EB19F23F9E2 [DEBUG] 2017-09-15 09:17:09 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/23C80050-DB21-48EE-9CC7-7EB19F23F9E2/app/Info.plist [INFO] 2017-09-15 09:17:09 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/23C80050-DB21-48EE-9CC7-7EB19F23F9E2/SuperMarioRunStickers.app/Info.plist [INFO] 2017-09-15 09:17:09 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:09 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:09 :: idb :: App Dir: /private/var/containers/Bundle/Application/407F8323-1A6E-4456-BC4D-2112204E2E07 [DEBUG] 2017-09-15 09:17:09 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/407F8323-1A6E-4456-BC4D-2112204E2E07/app/Info.plist [INFO] 2017-09-15 09:17:10 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/407F8323-1A6E-4456-BC4D-2112204E2E07/DB Navigator.app/Info.plist [INFO] 2017-09-15 09:17:10 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:10 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:10 :: idb :: App Dir: /private/var/containers/Bundle/Application/BF155203-0B74-437C-AB8B-B24F9120C8E9 [DEBUG] 2017-09-15 09:17:10 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/BF155203-0B74-437C-AB8B-B24F9120C8E9/app/Info.plist [INFO] 2017-09-15 09:17:10 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/BF155203-0B74-437C-AB8B-B24F9120C8E9/Doctor Strange.app/Info.plist [INFO] 2017-09-15 09:17:10 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:11 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:11 :: idb :: App Dir: /private/var/containers/Bundle/Application/D9315781-2145-459C-9743-5CA13BF8370E [DEBUG] 2017-09-15 09:17:11 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/D9315781-2145-459C-9743-5CA13BF8370E/*app/Info.plist [INFO] 2017-09-15 09:17:11 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/D9315781-2145-459C-9743-5CA13BF8370E/***.app/Info.plist [INFO] 2017-09-15 09:17:11 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:11 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:11 :: idb :: App Dir: /private/var/containers/Bundle/Application/DB62CBCC-861B-46CB-8228-1612A8095A11 [DEBUG] 2017-09-15 09:17:11 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/DB62CBCC-861B-46CB-8228-1612A8095A11/app/Info.plist [INFO] 2017-09-15 09:17:11 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/DB62CBCC-861B-46CB-8228-1612A8095A11/Wordswipe.app/Info.plist [INFO] 2017-09-15 09:17:11 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:12 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:12 :: idb :: App Dir: /private/var/containers/Bundle/Application/EC513734-3493-4087-8B0F-0A21E2D665E0 [DEBUG] 2017-09-15 09:17:12 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/EC513734-3493-4087-8B0F-0A21E2D665E0/app/Info.plist [INFO] 2017-09-15 09:17:12 :: idb :: Info.plist found at /private/var/containers/Bundle/Application/EC513734-3493-4087-8B0F-0A21E2D665E0/***.app/Info.plist [INFO] 2017-09-15 09:17:12 :: idb :: Parsing plist file.. [DEBUG] 2017-09-15 09:17:12 :: idb :: Data Dir: [DEBUG] 2017-09-15 09:17:16 :: idb :: Appending extension to AppIcon60x60 [DEBUG] 2017-09-15 09:17:16 :: idb :: Now: AppIcon60x60.png [DEBUG] 2017-09-15 09:17:16 :: idb :: Executing blocking SSH command: ls /private/var/containers/Bundle/Application/407F8323-1A6E-4456-BC4D-2112204E2E07/app/AppIcon60x60.png [INFO] 2017-09-15 09:17:16 :: idb :: Icon found at /private/var/containers/Bundle/Application/407F8323-1A6E-4456-BC4D-2112204E2E07/DB Navigator.app/AppIcon60x60@2x.png [INFO] 2017-09-15 09:17:17 :: idb :: Locating application binary... [DEBUG] 2017-09-15 09:17:18 :: idb :: File not found: Net::SFTP::StatusException (2, "no such file") [DEBUG] 2017-09-15 09:17:18 :: idb :: File not found: Net::SFTP::StatusException (2, "no such file") [DEBUG] 2017-09-15 09:17:18 :: idb :: Executing blocking SSH command: /usr/bin/ldid -e /private/var/containers/Bundle/Application/407F8323-1A6E-4456-BC4D-2112204E2E07//DB Navigator.app/DB Navigator /var/lib/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:82:in from_string': Unknown plist format for string: ./minimal/mapping.h(54): _assert(false); errno=2 (RuntimeError) ./minimal/mapping.h(54): _assert(false); errno=2 ./minimal/mapping.h(54): _assert(false); errno=2 from /var/lib/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:280:inblock in parse_opts' from /var/lib/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:277:in each' from /var/lib/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:277:inparse_opts' from /var/lib/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:53:in initialize' from /var/lib/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r.rb:20:innew' from /var/lib/gems/2.3.0/gems/plist4r-1.2.2/lib/plist4r.rb:20:in new' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/lib/ios10_application_state_db_wrapper.rb:28:inentitlements_by_binary' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/lib/app.rb:300:in entitlements' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/default_protection_class_group_widget.rb:23:inupdate' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/plist_file_widget.rb:52:in setup' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/local_storage_tab_widget.rb:25:insetup' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/main_tab_widget.rb:95:in enableLocalStorage' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/main_tab_widget.rb:159:inapp_changed' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/idb.rb:122:in block in init_ui' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:ininvoke' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/global_app_details_group_box.rb:61:in qt_metacall' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/global_app_details_group_box.rb:61:inapp_changed' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/global_app_details_group_box.rb:61:in block (2 levels) in initialize' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:ininvoke' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/app_list_dialog.rb:16:in qt_metacall' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/app_list_dialog.rb:16:inmethod_missing' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/app_list_dialog.rb:16:in block in initialize' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:ininvoke' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:917:in qt_metacall' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:917:inmethod_missing' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:917:in exec' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/gui/global_app_details_group_box.rb:63:inblock in initialize' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:in invoke' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:inqt_metacall' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:in method_missing' from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:inexec' from /var/lib/gems/2.3.0/gems/idb-2.10.1/lib/idb.rb:278:in run' from /var/lib/gems/2.3.0/gems/idb-2.10.1/bin/idb:4:in<top (required)>' from /usr/local/bin/idb:22:in load' from /usr/local/bin/idb:22:in
' recv failed: Resource temporarily unavailable`

ximerus commented 7 years ago

I have same problem on app select. Thats my log

/Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/app_details_group_box.rb:69:in `app_changed': undefined method `sub' for {"identifier"=>nil, "snapshots"=>nil, "$class"=>nil}:Hash (NoMethodError)
Did you mean?  sum
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/app_tab_widget.rb:48:in `app_changed'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/main_tab_widget.rb:163:in `app_changed'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/idb.rb:122:in `block in init_ui'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `qt_metacall'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `app_changed'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `block (2 levels) in initialize'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `qt_metacall'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `method_missing'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `block in initialize'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:917:in `qt_metacall'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:917:in `method_missing'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:917:in `exec'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:63:in `block in initialize'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:479:in `qt_metacall'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:479:in `method_missing'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/qtbindings-0.0.0.0/lib/Qt/qtruby4.rb:479:in `exec'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/lib/idb.rb:278:in `run'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/gems/idb-2.10.3/bin/idb:4:in `<top (required)>'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/bin/idb:23:in `load'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/bin/idb:23:in `<main>'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/ximerus/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
recv failed: Resource temporarily unavailable
whoot commented 6 years ago

I found a workaround for the app crashing issue. It seems like there is something wrong with the iOS 10 support. Revert this and all subsequent commits and idb will work again!

You have to do the following steps:

git clone https://github.com/dmayer/idb
cd idb/
git revert 038355497091b24c53596817b8818d2b2bc18e4b
git revert 799a0e6565c17f72dce5a7e9f1a5738abbd08ae2
git revert 092929aa51b941e003f7e4d162b550171da8d66a
git revert c8dcb9f091fc7f706af60b40c5a041299c3dcf35
git revert c8d025012fa7eacaae688a53e22078ccf4cebe15

bundle install
bundle exec idb

WARNING: This will drop the support for iOS 10!

MuchiMuchiPink commented 6 years ago

Thanks for the workaround, however I need idb working on iOS 10. ;)

jtof-fap commented 6 years ago

After some researchs, I found the root cause of crash in iOS 10. I use an iPhone 5c 10.3.3 (32bit/Helix) and the application crashs when I select an application in list because IDB failed to get the correct data_dir from /User/Library/FrontBoard/applicationState.db.

The error comes from the value of kvs.key on the sql request in /lib/lib/ios10_application_state_db_wrapper.rb :

stmnt = db.prepare "SELECT kvs.value FROM application_identifier_tab left join kvs on application_identifier_tab.id = kvs.application_identifier where kvs.key = 2 and application_identifier_tab.application_identifier='#{bundle_id}'"

On my iPhone, the app_dir and data_dir are in the blob associated to the kvs.key number 1. Just replace 2 (XBApplicationSnapshotManifest) by 1 (compatibilityInfo) in this request work like a charm for me on iOS 10.3.3.

You could test the following command to find an application data_dir (ex: facebook)

# sqlite3 /tmp/applicationState.db "select quote(value) from kvs inner join application_identifier_tab on kvs.application_identifier = application_identifier_tab.id where application_identifier_tab.application_identifier like '%facebook%' and kvs.key = 1;" | cut -d "'" -f2 | xxd -r -p | strings | sed -n 's/T\(\/private\/var\/mobile\/Containers\/Data.*\)_/\1/p'
/private/var/mobile/Containers/Data/Application/B3D96422-D800-4040-9047-A8BC8E977929

The solution is to test the others kvs.key values if the data_dir is null.

I hope it will help.

mattymcfatty commented 6 years ago

oh, I think they changed the directories of where apps are stored in iOS > 10. Could this be the issue? Applications have been moved in iOS 10. They're now in /private/var/containers/Bundle/Application/

jtof-fap commented 6 years ago

No, it is not the issue.

When you select an application in the list, IDB need to get 2 directories :

As mentionned previously, before IOS 10 all these information was in LastLaunchServicesMap.plist file. Since IOS 10, these information are stored in binary format in a sqllite database : /User/Library/FrontBoard/applicationState.db.

IDB is compatible with IOS 10 and get correctly app_dirand data_dir in applicationState.db and probabely works with some IOS 10 versions.

In my case, the SQL request in the code return nothing for the data_dir and, in trying to update the IHM label Data directory with null value, the application crashs with the following error message :

.../idb-2.10.3/lib/gui/app_details_group_box.rb:69:in `app_changed': undefined method `sub' for {"identifier"=>nil, "snapshots"=>nil, "$class"=>nil}:Hash (NoMethodError)
Did you mean?  sum
....

By adapting the request, in my case (or by coding in hard the correct data_dir value), IDB don't crash and perfectly works with my phone in IOS 10.

I don't know if it is due to the architecture (32bit vs 64bit) of my phone 5C or my IOS version 10.3.3 but in my case, the data_dir value is in kvs.key 1 (compatibilityInfo) and not in kvs.key 2 (XBApplicationSnapshotManifest) in the applicationState.db database. Maybe that the kvs.key values in database vary between phones and by using name (compatibilityInfo) instead of kvs.key values it would fix the problem for everybody. I don't have other phones in order to test.

mattymcfatty commented 6 years ago

Ah. So helpful! Thanks @jtof-fap !

I grepped "data_dir" to see if I could hard-code it like you did, but I got a few diff files. Did you hard code the "data_dir" value in "app_details_group_box.rb" or a different file? It would be clutch if I got this working for my current test.

Also, I'm on a 5s with iOS version 10.1.1 and IDB is on my 64-bit Linux host. Is my rig different enough from yours to help fix the problem? I'd love to collaborate to see if we can fix this for everyone.

mattymcfatty commented 6 years ago

oh nvm. I guess I should read higher up.... I've got the filename. Let me know if my version(s) would be any help nailing this down.

jtof-fap commented 6 years ago

Had you try to set : kvs.key = 1 (instead of 2) on the SQL request in /lib/lib/ios10_application_state_db_wrapper.rb : line 44 ?

Except for testing, hardcoding data_dir isn't good solution but it works. If you want hardcode the value, the best place is in /lib/lib/app.rb but you will break the flexibility of app choice for future.

mattymcfatty commented 6 years ago

Awesome! Using your fix in /lib/lib/ios10_application_state_db_wrapper.rb I got it working (changed the 2 to a 1).

Maybe i'll dust off the GIT manual and submit a fix that checks if results are empty, if so, try switching 2 to 1. Gotta finish this iOS test first tho...

Thanks for the help!

jtof-fap commented 6 years ago

I don't submit a fix because I think kvs.key=2 (set by default) seems to be work on certain phones and setting permanently to 1 will probably break the compatibility with these phones...

Maybe that the kvs.key values in database vary between phones and by using name (compatibilityInfo) instead of kvs.key values it would fix the problem for everybody. I don't have other phones in order to test.

bensh commented 6 years ago

Changing the kvs.key to 1 didn't work for me.

ruby 2.4.2 idb 2.10.3 iPad Air - iPad4,1 ios 10.0.2

jtof-fap commented 6 years ago

Thanks for your return. Try the fork of zk-ncc : https://github.com/dmayer/idb/pull/105/commits/038413e444eccbe60455767f8e12e65acb19b040

bensh commented 6 years ago

Tried the fork with the code change, still crashing with recv failed: resource temporarily unavailable

Tried with Lloyds Bank and EdgeVis Mobile, both free apps on the store.

whoot commented 6 years ago

I'm honestly not sure if IDB will be supported for much longer, since the response time and the support in general is awful.. Meanwhile I simply switched to another tool (cough Needle cough), which works very well and provides the same features (and more).

MuchiMuchiPink commented 6 years ago

I've got Needle and Objection.

bensh commented 5 years ago

Shame this thread seems to have died with no update. idb was a very good tool for quick sanity checking with easily read output

MuchiMuchiPink commented 5 years ago

@bensh maybe look into passionfruit. https://github.com/chaitin/passionfruit