dmayer / idb

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

Crash on "Rsync + Git" via Application Filesystem #9

Closed sanitybit closed 10 years ago

sanitybit commented 10 years ago

Built from commit 49094b1eb2b84749b4a5fb48ea6249f133c74c1d.

Select application, go to Filesystem tab, click on Rsync + Git. Do I need to do something to initialize the repo?

[INFO] 2014-01-21 20:52:14 :: gidb ::  git reset "--hard"  2>&1
[DEBUG] 2014-01-21 20:52:14 :: gidb ::  fatal: Failed to resolve 'HEAD' as a valid ref.
/usr/local/rvm/gems/ruby-1.9.3-p429/gems/git-1.2.6/lib/git/lib.rb:718:in `command': git reset "--hard"  2>&1:fatal: Failed to resolve 'HEAD' as a valid ref. (Git::GitExecuteError)
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/git-1.2.6/lib/git/lib.rb:424:in `reset'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/git-1.2.6/lib/git/base.rb:280:in `reset_hard'
    from /home/sanitybit/.sources/idb/lib/rsync_git_manager.rb:18:in `sync_new_revision'
    from /home/sanitybit/.sources/idb/gui/fs_viewer_tab_widget.rb:18:in `block in initialize'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:2427:in `call'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:2427:in `invoke'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:469:in `qt_metacall'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:469:in `method_missing'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:469:in `exec'
    from gidb.rb:244:in `<main>'
sanitybit commented 10 years ago

The contents of {app_temp_dir}/idb_mirror.git/.git/HEAD:

ref: refs/heads/master

idb_mirror.git/.git/refs/heads/ has nothing in it.

dmayer commented 10 years ago

Does this happen the very first time you click the button? The first time when the repo does not exist, it is created. Since you have a .git folder in the idb_mirror.git that clearly worked. So I wonder if it failed right away or just the second time you call it.

Also, I just realized that the status page does not include rsync on the device yet. I believe you will need to install that from cydia / via apt-get. I will add it to the tool as well.

dmayer commented 10 years ago

@sanitybit Could you please delete your entire tmp folder under idb's root and try the git+rsync function again with the newest version? Thanks.

sanitybit commented 10 years ago

rm -rf'd tmp/ pulled 28091bbae78859ce4795f6944a42a803add1d377 ran rsync+git

results:

[INFO] 2014-01-29 14:39:18 :: gidb ::  Starting Git
[INFO] 2014-01-29 14:39:36 :: gidb ::  Hard resetting work dir tmp/075D88FF-2108-4244-AF3B-F3612DD19D63//idb_mirror.git...
[INFO] 2014-01-29 14:39:36 :: gidb ::  git reset "--hard"  2>&1
[DEBUG] 2014-01-29 14:39:36 :: gidb ::  fatal: Failed to resolve 'HEAD' as a valid ref.
/usr/local/rvm/gems/ruby-1.9.3-p429/gems/git-1.2.6/lib/git/lib.rb:718:in `command': git reset "--hard"  2>&1:fatal: Failed to resolve 'HEAD' as a valid ref. (Git::GitExecuteError)
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/git-1.2.6/lib/git/lib.rb:424:in `reset'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/git-1.2.6/lib/git/base.rb:280:in `reset_hard'
    from /home/sanitybit/.sources/idb/lib/rsync_git_manager.rb:20:in `sync_new_revision'
    from /home/sanitybit/.sources/idb/gui/fs_viewer_tab_widget.rb:18:in `block in initialize'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:2427:in `call'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:2427:in `invoke'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:469:in `qt_metacall'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:469:in `method_missing'
    from /usr/local/rvm/gems/ruby-1.9.3-p429/gems/qtbindings-4.8.3.0/lib/Qt/qtruby4.rb:469:in `exec'
    from gidb.rb:251:in `<main>'
dmayer commented 10 years ago

Interesting. Which git version is this? I will try to replicate. Also, are you running it against an app on the app store I can install and try myself?

Thanks for helping to debug this.

sanitybit commented 10 years ago

Host: git version 1.8.1.2 : rsync version 3.0.9 protocol version 30 iPad: git version 1.5.6.rc0 : rsync version 3.0.5 protocol version 30

Happens on all the apps I've tried it on (Bank of America for iPad, Tweetbot for iPad, Hotspot for iPhone[1]).

[1] https://itunes.apple.com/us/app/hotspot-meet-up-with-friends/id737629048?ls=1&mt=8

dmayer commented 10 years ago

I think I have tracked it down. Resetting the repo when there are no commits should throw the error you are getting. I am actually wondering why I don't get as well ;-)

Working on initializing the repo with an initial commit. Will updated once it works properly.

dmayer commented 10 years ago

The latest version should not have the problem anymore. You might want to delete the tmp dir just in case. I had to use a PTY no since it will also enter your SSH password automatically if you don't use public key auth.