{"id":1351,"date":"2014-08-14T00:33:47","date_gmt":"2014-08-14T05:33:47","guid":{"rendered":"http:\/\/areciv.com\/blog\/?p=1351"},"modified":"2021-09-22T17:57:55","modified_gmt":"2021-09-22T22:57:55","slug":"f-script-injection-in-mavericks","status":"publish","type":"post","link":"https:\/\/areciv.com\/blog\/2014\/08\/f-script-injection-in-mavericks\/","title":{"rendered":"F-Script Injection in Mavericks"},"content":{"rendered":"\n<p>I continue to use <a href=\"http:\/\/www.fscript.org\">F-Script<\/a> occasionally to investigate how programs work internally. The framework itself <a href=\"https:\/\/github.com\/Kentzo\/F-Script\/releases\/tag\/v2.2.1\">has been updated<\/a> to handle the changes in OS X Mavericks. However, the developer tools included with Xcode 5 swap out the <a href=\"http:\/\/www.gnu.org\/software\/gdb\/\">gdb<\/a> debugger for <a href=\"http:\/\/lldb.llvm.org\">lldb<\/a>, breaking <a title=\"F-Script Injection in Lion\" href=\"http:\/\/areciv.com\/blog\/2012\/05\/f-script-injection-in-lion\/\">the injection script I fixed for Lion<\/a> again. After playing around with the automator action some more, here's what I came up with that works on Mavericks.<\/p>\n\n\n\n<p>I switched back to using a temporary file to hold the lldb commands, because lldb is less tolerant of non-interactive shells. To use this: start automator, create a new \"Service\" file, add a \"Run Applescript\" block with the contents below, and save it as \"Inject F-Script into application\".<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: applescript; title: ; notranslate\" title=\"\">\ntell application &quot;System Events&quot;\nset pid to unix id of the first process whose frontmost is true\nend tell\n\ndo shell script &quot;\nsrc=`mktemp -t fscript`\n\ncat &lt;&lt; EOF &gt; $src\nattach &quot; &amp; pid &amp; &quot;\np (char)&#x5B;&#x5B;NSBundle bundleWithPath:@\\&quot;\/Library\/Frameworks\/FScript.framework\\&quot;] load]\np (void)&#x5B;FScriptMenuItem insertInMainMenu]\ndetach\nquit\nEOF\n\nlldb -s $src\nrm $src&quot; with administrator privileges\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>I continue to use F-Script occasionally to investigate how programs work internally.  The framework itself has been updated to handle the changes in OS X Mavericks.  However, the developer tools included with Xcode 5 swap out the gdb debugger for lldb, breaking the injection script again.  After playing around with the automator action some more, here's what I came up with that works on Mavericks.<\/p>\n","protected":false},"author":1,"featured_media":1355,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[88],"tags":[41,39,42],"class_list":["post-1351","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-f-script","tag-hack","tag-osx"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/areciv.com\/blog\/wp-content\/uploads\/2014\/08\/automator-icon.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/posts\/1351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/comments?post=1351"}],"version-history":[{"count":5,"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/posts\/1351\/revisions"}],"predecessor-version":[{"id":4397,"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/posts\/1351\/revisions\/4397"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/media\/1355"}],"wp:attachment":[{"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/media?parent=1351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/categories?post=1351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/areciv.com\/blog\/wp-json\/wp\/v2\/tags?post=1351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}