Can not get symbols using Frida JavaScript api 'DebugSymbol.fromAddress' - ios

I'm trying to develop a test tool with Frida. Recently I try the code snippet from the doc to log a backtrace:
Interceptor.attach(Module.findExportByName(null, 'open'), {
onEnter: function (args) {
var path = Memory.readUtf8String(args[0]);
console.log("open" + path + ")\n\t" + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\n") + "\n");
}
});
but we I try to run the script with my app(MyApp), I got these:
open/var/mobile/Containers/Data/Application/E459A8E1-12D5-4E20-8F99-40CA90967C0B/Library/Caches/XXXX/XXXX.plist)
0x1ce3140f Foundation!_NSReadBytesFromFileWithExtendedAttributes
0x1ce356c7 Foundation!-[NSData(NSData) initWithContentsOfFile:options:error:]
0x1cecf0c1 Foundation!+[NSKeyedUnarchiver unarchiveObjectWithFile:]
0x534293 MyApp!0x4f0293
0x5341f5 MyApp!0x4f01f5
0x53450d MyApp!0x4f050d
0x53360f MyApp!0x4ef60f
0x5346b9 MyApp!0x4f06b9
0x8b4473 MyApp!0x870473
0xb81ecb MyApp!0xb3decb
0xb82225 MyApp!0xb3e225
0xb823bf MyApp!0xb3e3bf
0xb3974d MyApp!0xaf574d
0xb00533 MyApp!0xabc533
0x48039 MyApp!0x4039
0x218595c5 UIKit!-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]
you can see that the
DebugSymbol.fromAddress
can symbolicate the address for Foundation, but for MyApp it failed.
from the video 19:33, we can see that the DebugSymbol.fromAddress can symbolicate the address of the target app.
I'm using Frida 11.0.12 and the device is iPhone 5 with iOS10.3.3 cracked with h3lix-RC5.
do anyone also meet this problem?

To reproduce your issue I will need the IPA, or at least nm -DC output on MyApp mach0 file.
Also, there is an issue with the script you pasted, path is the first element in args, it's an address which is a reference to a string, args is an array that contains (not finite) arguments.
$ frida -U Telegram
____
/ _ | Frida 11.0.11 - A world-class dynamic instrumentation toolkit
| (_| |
> _ | Commands:
/_/ |_| help -> Displays the help system
. . . . object? -> Display information about 'object'
. . . . exit/quit -> Exit
. . . .
. . . . More info at http://www.frida.re/docs/home/
[iOS Device::Telegram]-> Interceptor.attach(Module.findExportByName(null, "open"), {
onEnter: function (args) {
console.log("open " + Memory.readUtf8String(args[0]));
console.log(Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join
("\n"));
}
});
{}
[iOS Device::Telegram]-> open /private/var/mobile/Containers/Shared/AppGroup/1E33CAF6-1422-.../Documents/network-usage
0x10109a8ec Telegram!0x102a8ec
0x1822bd4bc libdispatch.dylib!_dispatch_call_block_and_release
0x1822bd47c libdispatch.dylib!_dispatch_client_callout
0x1822c94c0 libdispatch.dylib!_dispatch_queue_drain
0x1822c0f80 libdispatch.dylib!_dispatch_queue_invoke
0x1822cb390 libdispatch.dylib!_dispatch_root_queue_drain
0x1822cb0b0 libdispatch.dylib!_dispatch_worker_thread3
0x1824d5470 libsystem_pthread.dylib!_pthread_wqthread
open /private/var/mobile/Containers/Data/Application/3ED4C762-597B-.../Library/Cookies/Cookies.binarycookies
0x182777dec CoreFoundation!fileOpen
0x182767eb8 CoreFoundation!_CFStreamOpen
0x182777d14 CoreFoundation!CFReadStreamOpen
0x182e578d0 CFNetwork!DiskCookieStorage::readFileToCookies(MemoryCookies*)

Related

FFmpeg no output on stdout

The problem is simple:
When I run for example:
print(Process.runSync('ipconfig', []).stdout)
I get the expected output:
Windows IP Configuration
Unknown adapter Helyi kapcsolat:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
......
But when I try to run ffmpeg, I get no output:
print(Process.runSync('ffmpeg', []).stdout)
What I'd expect in this case is to get the help output from ffmpeg.
My guess is, ffmpeg has some kind of "different" way of interacting with stdout than most executables. What could be the problem? I'm totally lost here.
I need to read the stdout eventually to get the output of ffmpeg -list_devices true -f dshow -i dummy, which would list the available DirectShow devices.
FFmpeg outputs useful data to stderr, including the help output and the device list of my original command, ffmpeg -list_devices true -f dshow -i dummy.
Simply use stderr (as well as stdout) to get the output:
print(Process.runSync('ffmpeg', []).stderr)
Tested in python 3.7 <=
import subprocess
s_out = subprocess.run(['ffmpeg', 'command_here'], check=True, capture_output=True).stderr
print(s_out)
"subprocess.CalledProcessError" must be returned if command is invalid.

Copying all the contents of an xcode program to one document

I have a project where I have to submit all the code comprising my program.
However, I am using xcode and an MVC architecture, so my code is split into different files/folders plus the storyboard itself.
I am wondering if there is anyway for me to see all the lines of code in one document so I can copy and paste my CR easily instead of going through each page and copying its content.
Try to run these commands in the working directory using terminal
find . -name "*.swift" -type f -exec cat {} + > "combined.swift"
If you just wanted to copy all of them
find . -name "*.swift" -type f -exec cat {} + | pbcopy

For certain files in a directory carry out an action

I haven't worked with this stuff in years, so please be patient!
I'm having some really weird issues with Mac Excel greying out some .csv files but not others. From what I've read so far, this could have something to do with some of the more hidden file parameters.
Anyways, I'd like to find the files with a certain name in the directory, do a getfileinfo on them and spit out the result, i.e. something like:
for each i in (ls \*_xyz*.csv) do getfileinfo $i | echo
(or whatever more intelligent way this can be accomplished these days...)
I tried a few combinations but keep getting "-bash syntax error", so I've decided it's time to get help...
Thanks!!
Create dummy test files:
$ touch file{1..10}_xyz.csv
$ ls
file10_xyz.csv file1_xyz.csv file2_xyz.csv file3_xyz.csv file4_xyz.csv file5_xyz.csv file6_xyz.csv file7_xyz.csv file8_xyz.csv file9_xyz.csv
There are many ways to do this. My favorite is method1.
Method 1)
$ find . -name "*xyz*.csv" -exec someCommand {} \;
Method2)
$ for x in $( find . -name "*xyz*.csv") ; do someCommand $x ; done
Method3)
$find . -name "*xyz*.csv" | xargs someCommand

Yeoman generator-generator giving error when running

I am using WindowsXP and tryign to create my first yeoman angular project
I installed npm, yo, grunt-cli, generator-generator etc.
when i run
yo generator
I am getting flowing error
D:\OpenSource\html\generator-jbake>yo generator
_-----_
| |
|--(o)--| .--------------------------. `---------' | Welcome to Yeoman, |
( _'U`_ ) | ladies and gentlemen! |
/___A___\ '__________________________'
| ~ | __'.___.'__ ' ` |° ' Y `
[?] Would you mind telling me your username on GitHub? raj[?]
What's the base name of your generator? jbake
C:\Documents and Settings\hegdera\Application
Data\npm\node_modules\generator-generator\app\index.js:38
throw err;
^ 2636:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown
protocol:openssl\ssl\s23_clnt.c:766:
at Object.proto.sendError (C:\Documents and Settings\hegdera\Application
Data\npm\node_modules\generator-generator\node_modules\github\api\v3.0.0\index.js:30:19)
at C:\Documents and Settings\hegdera\Application Data\npm\node_modules\generator-generator\node_modules\github\api\v3.0.0\user.js:36:29
at ClientRequest. (C:\Documents and Settings\hegdera\Application
Data\npm\node_modules\generator-generator\node_modules\github\index.js:719:17)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1547:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at SecurePair. (tls.js:1392:15)
at SecurePair.EventEmitter.emit (events.js:95:17)
at SecurePair.error (tls.js:1012:27)
at CleartextStream.read [as _read] (tls.js:457:17)
Anyone tell me what is the problme ?
I installed generator-generator locally and ran the same command "yo generator" and it worked well.
I tested on Windows XP and Node v0.10.26 , yo v1.3.2.
The error you get has some issues related to proxy/ssl settings. Read this & this it may help resolve it.

Grails 2.2.1 is not reading plugin Config file

I have an app and a plugin built with Grails 2.1.1 that i upgraded to 2.2.1 and I am running into a weird issue. My application started blowing up all over because configuration values defined in my app Config.groovy all of a sudden resolve to groovy.Util.ConfigObject instead of their actual values. This is part 1 of the problem, part 2 is that in my app, I define in my app's Config.groovy
grails.config.defaults.locations = [
"classpath:DemoPluginConfig.groovy",
]
DemoPluginConfig.groovy contains this property
oo.memcached.timeout=400000
and the DemoPluginConfig.groovy file is in the src/java folder of my Demo plugin.
I have a memcache service where i am trying to set that timeout property once the service is ready:
def void afterPropertiesSet() {
ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder()
def config = grailsApplication.config;
def operationTimeOut = config.oo.memcached.timeout
cfb.setOpTimeout(timeOut)
}
grails run-app blows up at this point with error:
Caused by MissingMethodException: No signature of method: net.spy.memcached.ConnectionFactoryBuilder.setOpTimeout() is applicable for argument types: (groovy.util.ConfigObject) values: [[:]]
Possible solutions: setOpTimeout(long)
->> 55 | unwrap in org.codehaus.groovy.runtime.ScriptBytecodeAdapter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 46 | call in org.codehaus.groovy.runtime.callsite.PojoMetaClassSite
| 45 | defaultCall . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 108 | call in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 116 | call . . . . . . . . . . . . . in ''
| 20 | afterPropertiesSet in com.millennialmedia.ui.core.MemcachedService
| 1514 | invokeInitMethods . . . . . . . in org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
| 1452 | initializeBean in ''
| 519 | doCreateBean . . . . . . . . . in ''
| 122 | doCreateBean in org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory
| 456 | createBean . . . . . . . . . . in org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
| 271 | resolveInnerBean in org.springframework.beans.factory.support.BeanDefinitionValueResolver
| 126 | resolveValueIfNecessary . . . . in ''
| 1360 | applyPropertyValues in org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
| 1118 | populateBean . . . . . . . . . in ''
If i try to run grails run-app a couple more time it starts up successfully but the app blows up on loading a page with another groovy.Util.ConfigObject is not serializable error. Step by step debugging before the app blows up shows that by the time we get to the setOptTimeOut line, grailsApplication.config only contains config options from my app's Config.groovy, as if the values from the plugin DemoPLuginConfig.groovy were just ignored.
Reverting back to 2.1.1 brings everything back to normal. At this point I have no idea where to look.
Shouldn't you be using operationTimeOut instead of timeOut below
cfb.setOpTimeout(timeOut)
Try to put your Groovy configuration in grails-app/conf instead of src/java. Then, see if you can reproduce your error on a consistent basis.
If all fails, grails clean may prevail.
Hope it helps

Resources