install cycript
brew install https://gist.github.com/raw/890258/cycript.rb
wget https://gist.github.com/raw/890258/hack_propane.js
chmod +x hack_propane.js
sudo ./hack_propane.js
brew install https://gist.github.com/raw/890258/cycript.rb
wget https://gist.github.com/raw/890258/hack_propane.js
chmod +x hack_propane.js
sudo ./hack_propane.js
require 'formula' | |
class Cycript < Formula | |
head 'http://svn.saurik.com/repos/cycript/trunk/', :using => :svn | |
homepage 'http://www.cycript.org/' | |
skip_clean ['bin'] | |
def install | |
ENV['OBJCXX'] = ENV['CXX'] | |
ENV['CY_ATTACH_GROUP'] = '' | |
system "./configure", "--prefix=#{prefix}" | |
system "make" | |
system "make install" | |
end | |
def caveats; <<-EOS.undent | |
cycript requires special privileges to inject itself into running processes. | |
Either run cycript as root: | |
sudo cycript -p PID | |
Or, add it to the procmod group: | |
sudo chgrp procmod #{prefix}/bin/cycript | |
sudo chmod g+s #{prefix}/bin/cycript | |
EOS | |
end | |
end |
#!/usr/bin/arch -arch i386 cycript -p Propane | |
var NSLog = new Functor(dlsym(RTLD_DEFAULT, "NSLog"), "v@"); | |
var puts = function(obj) { NSLog(obj === undefined ? '(undefined)' : obj === null ? '(null)' : obj.toString()); }; | |
puts("hello!"); | |
var enhancerPath = [[NSBundle mainBundle] pathForResource:"enhancer" ofType:"js"]; | |
var enhancer = [NSString stringWithContentsOfFile:enhancerPath]; | |
puts("loaded enhancer.js: " + enhancer.length); | |
var patchPath = [FPEnvironment appSupport:"unsupported" file:"caveatPatchor.js"]; | |
var patch = [NSString stringWithContentsOfFile:patchPath]; | |
puts("loaded caveatPatchor.js: " + patch.length); | |
/* | |
var app = NSApplication.sharedApplication | |
var windows = app.windows | |
var controllers = [window.windowController for each (window in windows) if (window.windowController)]; | |
var transcripts = [controller for each (controller in controllers) if (controller.toString().match(/TranscriptWindow/))]; | |
puts(transcripts.length + " transcript windows"); | |
*/ | |
TranscriptWindowController.messages['_webViewProgressFinished:'] = function(){ | |
var transcript = this; | |
[transcript setIsProcessing:false]; | |
if (transcript.webView) { | |
var script = transcript.webView.windowScriptObject; | |
var url = [script evaluateWebScript:"document.location.toString()"]; | |
if (url.match(/transcript/)) { | |
if (![script evaluateWebScript:"window.loadedEnhancer"]) { | |
puts("found a transcript to patch: " + transcript); | |
ret = [script evaluateWebScript:"try{ window.propane=true } catch(e) { e.toString() }"]; | |
puts("done w/ setup"); | |
puts(ret); | |
ret = [script evaluateWebScript:"try{ " + enhancer.toString() + " } catch(e) { e.toString() }"]; | |
puts("done w/ enhancer"); | |
puts(ret); | |
ret = [script evaluateWebScript:"try{ " + patch.toString() + " } catch(e) { e.toString() }"]; | |
puts("done w/ patch"); | |
puts(ret); | |
[script evaluateWebScript:"window.loadedEnhancer = true"]; | |
puts("loaded!"); | |
} | |
} | |
} | |
return null; | |
} | |
puts("done!") | |
"done" |
Dude you're insane, this is amazing.