4

I am using cycript,but I have tried some of these commands and not sure where I went wrong.

cy# UIApp.windows[0]

#"<UIWindow: 0x102d0b2d0; frame = (0 0; 320 568); gestureRecognizers = <NSArray: 0x28173ca50>; layer = <UIWindowLayer: 0x281977ca0>>"

Where I try to access the subview, there is no output:

cy# UIApp.windows[0].subviews[0]
cy# UIApp.windows[0].subviews[0].subviews[0]
throw new TypeError("undefined is not an object (evaluating 'UIApp.windows[0].subviews[0].subviews')")

By the way, is there any alternative to cycript since nowadays most of the apps are in objective -c?

A O
  • 161
  • 3

1 Answers1

-1

There are a few potential issues here:

You may not have the right window - UIApp.windows[0] just gets the first window, but the app may have multiple windows, or the first window may not contain the views you're interested in. The subviews you're accessing may not exist - if the index is out of bounds, or if the window has no subviews at that level, you'll get undefined and the error you're seeing. cycript has some quirks with dynamically typed objects - you may need to insert .toString() or .valueOf() to force evaluation in some cases.

Alternatives to cycript include:

Frida - Supports Obj-C, Swift and other languages, and has a richer API and ecosystem of scripts/tools built on top of it. objection - A mobile security framework built on Frida, with a simpler API focused on common mobile security tasks. xdb - Similar to cycript, but with a more lightweight/streamlined approach and Swift support. Various other debuggers/injection tools - There are quite a few other options out there too, depending on your exact use case.