Giter Site home page Giter Site logo

xia0lldb's Introduction

xia0LLDB 😈


           https://github.com/4ch12dy/xia0LLDB
          Welcome to xia0LLDB - Python3 Edition
          ,--.          ,--.  ,--.   ,--.   ,------.  ,-----.   
,--.  ,--.`--' ,--,--. /    \ |  |   |  |   |  .-.  \ |  |) /_  
 \  `'  / ,--.' ,-.  ||  ()  ||  |   |  |   |  |  \  :|  .-.  \ 
 /  /.  \ |  |\ '-'  | \    / |  '--.|  '--.|  '--'  /|  '--' /  
'--'  '--'`--' `--`--'  `--'  `-----'`-----'`-------' `------'   

[xia0LLDB] * Version: v3.1
[xia0LLDB] + Loading all scripts from ~/xia0/iOSRE/LLDB/xia0LLDB
[xia0LLDB] * Finished

Notice(^_<)

There is a problem that lldb import xia0LLDB in last macOS Catalina, because the last macOS's lldb default use python3. Here is a way to change it to python2

defaults write com.apple.dt.lldb DefaultPythonVersion 2

Welcome to xia0LLDB - Python3 Edition

Thanks @Lakr so much for porting it to Python3 !

Install

Just open Terminal and run below command

git clone https://github.com/4ch12dy/xia0LLDB.git && cd xia0LLDB && ./install.sh

It highly recommend you to install issh/Tap2debug

Happy debugging ✔️

Commands

alias

Below is cmds just use alias in cmd.txt

  • mload [dylib_in_the_iphone_device_path]

    Load a dylib into current process

  • rr

    Fast show some important regiters

  • pwindow

    Print current key windown

  • xi [code_address]

    just show address disassmble +/- 8

  • dfuc [addr_of_func]

    show function all disassemble by given address

  • pclass [oc_object]

    print oc object class name

  • pbcopy

    get string from iOS device pasteboard

  • pbpaste [string]

    paste string to iOS device pasteboard

  • data [object_of_NSData]

    print NSData object

  • pcc

    It is just alias of process connect connect://127.0.0.1:1234

  • wpc

    write pc register to control exe process

croc

👉👉👉 go to the env that can run oc script. This cmd is always used when backboard debug luanch app, debuger just attch on.The point is between app code not execute and can run lldb commands.So try use it when backboard debug luanch app.

ivars

print all ivars of OC object (iOS Only) and macOS version will come soon!

(lldb) ivars 0x2835c4d00
<CContactMgr: 0x2835c4d00>:
in CContactMgr:
	m_oLock (NSRecursiveLock*): <NSRecursiveLock: 0x2830aaca0>
	m_uiLoadedType (unsigned int): 0
	m_oContactDB (CContactDB*): <CContactDB: 0x2819b07e0>
	m_oNewContactDB (NewContactDB*): <NewContactDB: 0x28156b7e0>
	m_oContactOPLog (CContactOPLog*): <CContactOPLog: 0x2819b07f0>
	m_openImContactMgr (OpenImContactMgr*): <OpenImContactMgr: 0x281bc07a0>
	m_dicRemark (NSMutableDictionary*): <__NSDictionaryM: 0x281bc0a00>
	m_dicLastAccessTime (NSMutableDictionary*): <__NSDictionaryM: 0x281bc0a60>
	m_dicContacts (NSMutableDictionary*): <__NSDictionaryM: 0x281bc09e0>
...

methods

print all methods of OC object (iOS Only) and macOS version will come soon!

if the objc class name contains space like " m" or other odd characters. you can use "methods -n the_odd_class_name."

(lldb) methods CContactMgr
<CContactMgr: 0x1071caa28>:
in CContactMgr:
	Properties:
		@property (readonly) unsigned long hash;
		@property (readonly) Class superclass;
		@property (readonly, copy) NSString* description;
		@property (readonly, copy) NSString* debugDescription;
	Instance Methods:
		- (void) MessageReturn:(id)arg1 Event:(unsigned int)arg2; (0x1005cb338)
		- (id) getContactByName:(id)arg1; (0x1000f4e74)
		- (void) OnGetNewXmlMsg:(id)arg1 Type:(id)arg2 MsgWrap:(id)arg3; (0x1001de380)
		- (void) onServiceReloadData; (0x102d10934)
...

(lldb) methods -n " m"
[*] will get methods for class:" m"
< m: 0x10d6f86f0>:
in  m:
	Properties:
		@property (retain, nonatomic)  N*  kManager;  (@synthesize  kManager = _configManager;)
		@property (retain, nonatomic)  h* payloadStore;  (@synthesize payloadStore = _payloadStore;)
		@property (retain, nonatomic)  5* sensorAgent;  (@synthesize sensorAgent = _sensorAgent;)
		@property (retain, nonatomic) NSObject<OS_dispatch_queue>* scriptMsgQueue;  (@synthesize scriptMsgQueue = _scriptMsgQueue;)
  ...
	Instance Methods:
		- (void) setConfigManager:(id)arg1; (0x10d65b68c)
		- (void) setSensorAgent:(id)arg1; (0x10d5c86d0)
		- (void)  lb; (0x10d60aa04)
		- (void) setKernelCode:(id)arg1; (0x10d6d9330)
		- (void) setIsBaseKernel:(BOOL)arg1; (0x10d606168)
  ...

freshxlldb

Re import xia0LLDB from lldbinit

sbt [2018/08/04]

the replacement of bt , it can restore frame OC symbol on stackframe. if you want to restore block symbol, you can use the ida python script provided to get block symbol json file. then input sbt -f block_json_file_path in lldb. Beside it can show more infomation: mem address, file address

// also you can spcail -f block_json_file to restore block symbol
(lldb) sbt
==========================================xia0LLDB=========================================
  BlockSymbolFile    Not Set The Block Symbol Json File, Try 'sbt -f'
===========================================================================================
  frame #0: [file:0x100009740 mem:0x100fb1740] WeChat`-[MMServiceCenter getService:] + 0
  frame #1: [file:0x100017cd4 mem:0x100fbfcd4] WeChat`+[SettingUtil getMainSetting] + 88
  frame #2: [file:0x10004eef0 mem:0x100ff6ef0] WeChat`-[CDownloadVoiceMgr TimerCheckDownloadQueue] + 44
  frame #3: [file:0x1800a3604 mem:0x1ccb33604] libobjc.A.dylib`-[NSObject performSelector:withObject:] + 68 
  frame #4: [file:0x10002e92c mem:0x100fd692c] WeChat`-[MMNoRetainTimerTarget onNoRetainTimer:] + 84
  frame #5: [file:0x1819750bc mem:0x1ce4050bc] Foundation`__NSFireTimer + 88 
  frame #6: [file:0x180e3d0a4 mem:0x1cd8cd0a4] CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32 
  frame #7: [file:0x180e3cdd0 mem:0x1cd8ccdd0] CoreFoundation`__CFRunLoopDoTimer + 884 
  frame #8: [file:0x180e3c5c4 mem:0x1cd8cc5c4] CoreFoundation`__CFRunLoopDoTimers + 252 
  frame #9: [file:0x180e37284 mem:0x1cd8c7284] CoreFoundation`__CFRunLoopRun + 1832 
  frame #10: [file:0x180e36844 mem:0x1cd8c6844] CoreFoundation`CFRunLoopRunSpecific + 452 
  frame #11: [file:0x1830e5be8 mem:0x1cfb75be8] GraphicsServices`GSEventRunModal + 104 
  frame #12: [file:0x1ae78431c mem:0x1fb21431c] UIKitCore`UIApplicationMain + 216 
  frame #13: [file:0x10022ee88 mem:0x1011d6e88] WeChat`main + 556
  frame #14: [file:0x1808ec020 mem:0x1cd37c020] libdyld.dylib`start + 4 

choose [2019/07/21]

get instance object of given class name, a lldb version of cycript's choose command

(lldb) choose CContactMgr
====>xia0LLDB NSArray Address: 0x2815a8540	size: 0x1
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 
V  V  V  V  V  V  V  V  V  V  V  V  V  V  V  V  V  V  V  V 
======>xia0LLDB Object Address: 0x2835c4d00
<CContactMgr: 0x2835c4d00>

xbr [2019/08/11]

xia0 super set breakpoint command:set breakpoint at OC class method although strip symbol and so on

// set breakpoint at oc methold even symbol stripped
(lldb) xbr "-[MMServiceCenter getService:]"
[*] className:MMServiceCenter methodName:getService:
[+] found class address:0x10803d208
[+] found selector address:0x106425b4c
[+] found method address:0x100fb1740
Breakpoint 1: where = WeChat`___lldb_unnamed_symbol50$$WeChat, address = 0x0000000100fb1740

// set breakpoint at address of ida, auto add slide
(lldb) xbr 0x100009740
[*] you not specail the module, default is main module
[*] ida's address:0x100009740 main module slide:0xfa8000 target breakpoint address:0x100fb1740
Breakpoint 3: where = WeChat`___lldb_unnamed_symbol50$$WeChat, address = 0x0000000100fb1740

// set breakpoint at memory address
(lldb) xbr -a 0x100fb1740
[*] breakpoint at address:0x100fb1740
Breakpoint 4: where = WeChat`___lldb_unnamed_symbol50$$WeChat, address = 0x0000000100fb1740

// set breakpoint at main function
(lldb) xbr -E main
[*] breakpoint at main function:0x1011d6c5c
Breakpoint 5: where = WeChat`___lldb_unnamed_symbol7390$$WeChat, address = 0x00000001011d6c5c

// set breakpoint at first mod_init function
(lldb) xbr -E init
[*] breakpoint at mod int first function:0x1044553dc
Breakpoint 6: where = WeChat`___lldb_unnamed_symbol143513$$WeChat, address = 0x00000001044553dc

//  set breakpoint at adresses of all methods of given class name
(lldb) xbr UPLivePlayerVC
Breakpoint 1: where = TestPaly`-[UPLivePlayerVC progressSliderSeekTime:] at UPLivePlayerVC.m:205, address = 0x0000000102dc134c
Breakpoint 2: where = TestPaly`-[UPLivePlayerVC progressSliderTouchDown:] at UPLivePlayerVC.m:197, address = 0x0000000102dc1184
Breakpoint 3: where = TestPaly`-[UPLivePlayerVC progressSliderValueChanged:] at UPLivePlayerVC.m:201, address = 0x0000000102dc11ec
...
Breakpoint 45: where = TestPaly`-[UPLivePlayerVC setUrl:] at UPLivePlayerVC.h:13, address = 0x0000000102dc2990
Breakpoint 46: where = TestPaly`-[UPLivePlayerVC play] at UPLivePlayerVC.m:124, address = 0x0000000102dbfd84
Breakpoint 47: where = TestPaly`-[UPLivePlayerVC pause] at UPLivePlayerVC.m:132, address = 0x0000000102dbfe1c
Set 47 breakpoints of UPLivePlayerVC

// set breakpoint at all +[* load] methods
(lldb) xbr -E load
[*] will set breakpoint at all +[* load] methold, count:2
Breakpoint 2: where = TestAPP`+[OCTest load] at OCTest.m:19, address = 0x00000001042df674
[+] set br at:0x1042df674
Breakpoint 3: where = TestAPP`+[OCClassDemo load] at OCClassDemo.m:19, address = 0x000000010430272c
[+] set br at:0x10430272c

debugme [2019/08/13]

bypass anti-debug: can hook ptrace and inlinehook svc to kill anti debug. it is so strong ever!!!

[*] start patch ptrace funtion to bypass antiDebug
[+] success ptrace funtion to bypass antiDebug
[*] start patch svc ins to bypass antiDebug
[+] get text segment start address:0x100017430 and end address:0x10001a398
[+] found svc address:0x100017528
[*] start hook svc at address:0x100017528
[+] success hook svc at address:0x100017528
[+] found svc address:0x100017540
[*] start hook svc at address:0x100017540
[+] success hook svc at address:0x100017540
[*] all patch done
[x] happy debugging~ kill antiDebug by xia0@2019

info [2019/08/20]

very useful command to get info of address/function/module and so on

// get info of image
(lldb) info -m WeChat
=======
Module Path : /var/containers/Bundle/Application/747A9704-6252-45A9-AE55-59690DAD60BB/WeChat.app/WeChat
Module Silde: 0x7d4000
Module base : 0x1007d4000
=======

// get info of address of function
(lldb) info -a 0x00000001cd4ca3b8
Module Path: /usr/lib/system/libsystem_kernel.dylib
Module base: 0x1cd4a8000
Symbol name: __getpid
Symbol addr: 0x1cd4ca3b8

// get info of function
(lldb) info -f getpid
Func   name: getpid
Func   addr: 0x1cd4ca3b8
Module Path: /usr/lib/system/libsystem_kernel.dylib
Module base: 0x1cd4a8000
Symbol name: __getpid
Symbol addr: 0x1cd4ca3b8

dumpdecrypted [2019/09/22]

dump macho image in lldb, default dump all macho image.

👇👇👇 very important!!!

Notice: if app crash at launch like detect jailbreak, you should use -x backboard launch app, and just input dumpdecrypted -X see more: http://4ch12dy.site/2020/02/26/lldb-how-to-dump-gracefully/lldb-how-to-dump-gracefully/

(lldb) dumpdecrypted
[*] start dump image:/var/containers/Bundle/Application/701B4574-1606-41F3-B0DB-92D34F92E886/com_kwai_gif.app/com_kwai_gif

[+] Dumping com_kwai_gif
[+] detected 64bit ARM binary in memory.
[+] offset to cryptid found: @0x100014980(from 0x100014000) = 980
[+] Found encrypted data at address 00004000 of length 16384 bytes - type 1.
[+] Opening /private/var/containers/Bundle/Application/701B4574-1606-41F3-B0DB-92D34F92E886/com_kwai_gif.app/com_kwai_gif for reading.
[+] Reading header
[+] Detecting header type
[+] Executable is a plain MACH-O image
[+] Opening /var/mobile/Containers/Data/Application/23C75F90-C42D-4F43-83D9-5DCCA36FE2D5/Documents/com_kwai_gif.decrypted for writing.
[+] Copying the not encrypted start of the file
[+] Dumping the decrypted data into the file
[+] Copying the not encrypted remainder of the file
[+] Setting the LC_ENCRYPTION_INFO->cryptid to 0 at offset 980
[+] Closing original file
[+] Closing dump file
[*] This mach-o file decrypted done.
[+] dump macho file at:/var/mobile/Containers/Data/Application/23C75F90-C42D-4F43-83D9-5DCCA36FE2D5/Documents/com_kwai_gif.decrypted


[*] start dump image:/private/var/containers/Bundle/Application/701B4574-1606-41F3-B0DB-92D34F92E886/com_kwai_gif.app/Frameworks/gifIMFramework.framework/gifIMFramework

[+] Dumping gifIMFramework
[+] detected 64bit ARM binary in memory.
[+] offset to cryptid found: @0x100064bd0(from 0x100064000) = bd0
[+] Found encrypted data at address 00004000 of length 2752512 bytes - type 1.
[+] Opening /private/var/containers/Bundle/Application/701B4574-1606-41F3-B0DB-92D34F92E886/com_kwai_gif.app/Frameworks/gifIMFramework.framework/gifIMFramework for reading.
[+] Reading header
[+] Detecting header type
[+] Executable is a plain MACH-O image
[+] Opening /var/mobile/Containers/Data/Application/23C75F90-C42D-4F43-83D9-5DCCA36FE2D5/Documents/gifIMFramework.decrypted for writing.
[+] Copying the not encrypted start of the file
[+] Dumping the decrypted data into the file
[+] Copying the not encrypted remainder of the file
[+] Setting the LC_ENCRYPTION_INFO->cryptid to 0 at offset bd0
[+] Closing original file
[+] Closing dump file
[*] This mach-o file decrypted done.
[+] dump macho file at:/var/mobile/Containers/Data/Application/23C75F90-C42D-4F43-83D9-5DCCA36FE2D5/Documents/gifIMFramework.decrypted

...
[*] Developed By xia0@2019

patcher [2019/10/17]

runtime patch instrument in lldb

// -a patch_address -i patch_instrument{nop/ret/mov0/mov1} -s instrument_count
(lldb) patcher -a 0x0000000100233a18 -i nop -s 8
[*] start patch text at address:0x100233a18 size:8 to ins:"nop" and data:0x1f, 0x20, 0x03, 0xd5 
[*] make ins data:
{0x1f, 0x20, 0x03, 0xd5 ,0x1f, 0x20, 0x03, 0xd5 ,0x1f, 0x20, 0x03, 0xd5 ,0x1f, 0x20, 0x03, 0xd5 ,0x1f, 0x20, 0x03, 0xd5 ,0x1f, 0x20, 0x03, 0xd5 ,0x1f, 0x20, 0x03, 0xd5 ,0x1f, 0x20, 0x03, 0xd5 }
[+] patch done
[x] power by xia0@2019
(lldb) x/12i 0x0000000100233a18
    0x100233a18: 0xd503201f   nop    
    0x100233a1c: 0xd503201f   nop    
    0x100233a20: 0xd503201f   nop    
    0x100233a24: 0xd503201f   nop    
    0x100233a28: 0xd503201f   nop    
    0x100233a2c: 0xd503201f   nop    
    0x100233a30: 0xd503201f   nop    
    0x100233a34: 0xd503201f   nop    
    0x100233a38: 0xf941ac14   ldr    x20, [x0, #0x358]
    0x100233a3c: 0xf9419c15   ldr    x21, [x0, #0x338]
    0x100233a40: 0xf941a400   ldr    x0, [x0, #0x348]
    0x100233a44: 0xf9400008   ldr    x8, [x0]
    
// 2019-10-27 update: -i option can receive raw instrument data like: "{0x20, 0x00, 0x80, 0xd2}"
(lldb) patcher -a 0x183a40fd8 -i "{0x20, 0x00, 0x80, 0xd2}"
[*] detect you manual set ins data:{0x20, 0x00, 0x80, 0xd2}
[*] start patch text at address:0x183a40fd8 size:1 to ins data:{0x20, 0x00, 0x80, 0xd2}
[x] power by xia0@2019
(lldb) x/12i $pc
->  0x183a40fd8: 0xd2800020   mov    x0, #0x1
    0x183a40fdc: 0x928003f0   mov    x16, #-0x20
    0x183a40fe0: 0xd4001001   svc    #0x80
    0x183a40fe4: 0xd65f03c0   ret    
    0x183a40fe8: 0x92800410   mov    x16, #-0x21
    0x183a40fec: 0xd4001001   svc    #0x80
    0x183a40ff0: 0xd65f03c0   ret    
    0x183a40ff4: 0x92800430   mov    x16, #-0x22
    0x183a40ff8: 0xd4001001   svc    #0x80
    0x183a40ffc: 0xd65f03c0   ret    
    0x183a41000: 0x92800450   mov    x16, #-0x23
    0x183a41004: 0xd4001001   svc    #0x80

TODO

  • Anti-anti-debug:bypass anti debug in lldb (done at 2019/09/11)
  • OCHOOK:hook ObjectC function in lldb
  • NetworkLog:minitor network info
  • UI Debug:some useful command for UI debug
  • xbr: set breakpoint at address of methods of class(done at 2019/08/11)
  • traceOC: trace ObjectC call by inlinehook msg_send stub code
  • ...

Update

  • [2019/07/04] Update for sbt -x / xutil : xutil cmd and sbt -x to disable color output in Xcode

  • [2019/07/21] Update for choose : lldb's choose command version of cycript's choose command

  • [2019/08/07] Fix critical bugs in choose : Fix critical bugs

  • [2019/08/11] Update for xbr : xbr className can set breakpoint at adresses of all methods of class

  • [2019/08/13] New debugme: kill anti debug in lldb

  • [2019/08/20] New info: get info of address/function/module and so on

  • [2019/09/11] debugme update: hook ptrace and inlinehook svc ins done.

  • [2019/09/22] new dumpdecrypted: dump macho image in lldb

  • [2019/09/27] dumpdecrypted update: can dump all image in app dir

  • [2019/10/17] new patcher :runtime patch instrument in lldb

  • [2022/04/18] add xivars/xmethods/xprotocol to enable dump class when ivars/methods not support like in macOS or iOS system process.

Document

Credits

xia0lldb's People

Contributors

4ch12dy avatar mustangym avatar xia0z avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xia0lldb's Issues

xbr -E main failed

(lldb) xbr -E main
Traceback (most recent call last):
File "/Users/mymac/Documents/GitHub/frida-ios-dump/xia0LLDB/src/xbr.py", line 527, in xbr
entryAddr_int = int(entryAddrStr.strip()[1:-1], 16)
ValueError: invalid literal for int() with base 16: 'rror: Execution was interrupted, reason: EXC_BAD_ACCESS (code=259, address=0x16f3db9c8).\nThe process has been returned to the state before expression evaluation'

砸壳失败

6s,12.0系统
砸壳报错

error: Couldn't lookup symbols:
__Z7strrchrUa9enable_ifIXLb1EEEPci
__Z6strchrUa9enable_ifIXLb1EEEPci

error: Couldn't lookup symbols:
__Z7strrchrUa9enable_ifIXLb1EEEPci
__Z6strchrUa9enable_ifIXLb1EEEPci

error: Couldn't lookup symbols:
__Z7strrchrUa9enable_ifIXLb1EEEPci
__Z6strchrUa9enable_ifIXLb1EEEPci

error: Couldn't lookup symbols:
__Z7strrchrUa9enable_ifIXLb1EEEPci
__Z6strchrUa9enable_ifIXLb1EEEPci

[*] Developed By xia0@2019

debugme执行失败

在万国觉醒上使用debugme时,在执行exp -lobjc -O --语句时失败。

Aweme 17.2 sbt无法显示符号,加了block symbol 也不行

不知道是不是Aweme做了手脚导致看不到符号,还是xia0LLDB的问题?

(lldb) sbt -f "~/Downloads/block_symbol.json"
  ==========================================xia0LLDB===========================================
  BlockSymbolFile    "~/Downloads/block_symbol.json"
  =============================================================================================
  frame #0: [file:0x106348c54 mem:0x108fccc54] Aweme`___lldb_unnamed_symbol490826$$Aweme + 0 
  frame #1: [file:0x10457586c mem:0x1071f986c] Aweme`___lldb_unnamed_symbol163835$$Aweme + 1128 
  frame #2: [file:0x10a388a04 mem:0x10d00ca04] Aweme`___lldb_unnamed_symbol1098374$$Aweme + 532 
  frame #3: [file:0x10a387cd0 mem:0x10d00bcd0] Aweme`___lldb_unnamed_symbol1098363$$Aweme + 1252 
  frame #4: [file:0x10a2b7274 mem:0x10cf3b274] Aweme`___lldb_unnamed_symbol1089223$$Aweme + 108 
  frame #5: [file:0x10a387d74 mem:0x10d00bd74] Aweme`___lldb_unnamed_symbol1098366$$Aweme + 64 
  frame #6: [file:0x10a2b71e0 mem:0x10cf3b1e0] Aweme`___lldb_unnamed_symbol1089222$$Aweme + 168 
  frame #7: [file:0x10a2b7edc mem:0x10cf3bedc] Aweme`___lldb_unnamed_symbol1089234$$Aweme + 368 
  frame #8: [file:0x10a2b710c mem:0x10cf3b10c] Aweme`___lldb_unnamed_symbol1089221$$Aweme + 188 
  frame #9: [file:0x10a202724 mem:0x10ce86724] Aweme`___lldb_unnamed_symbol1081988$$Aweme + 772 
  frame #10: [file:0x10a34e374 mem:0x10cfd2374] Aweme`___lldb_unnamed_symbol1095859$$Aweme + 256 
  frame #11: [file:0x10a34e260 mem:0x10cfd2260] Aweme`___lldb_unnamed_symbol1095858$$Aweme + 96 
  frame #12: [file:0x10a2023f8 mem:0x10ce863f8] Aweme`___lldb_unnamed_symbol1081987$$Aweme + 260 
  frame #13: [file:0x10a2039f0 mem:0x10ce879f0] Aweme`___lldb_unnamed_symbol1082000$$Aweme + 152 
  frame #14: [file:0x10a202244 mem:0x10ce86244] Aweme`___lldb_unnamed_symbol1081986$$Aweme + 352 
  frame #15: [file:0x10a002234 mem:0x10cc86234] Aweme`___lldb_unnamed_symbol1060580$$Aweme + 908 
  frame #16: [file:0x10a0037b8 mem:0x10cc877b8] Aweme`___lldb_unnamed_symbol1060599$$Aweme + 264 
  frame #17: [file:0x1091fd3ac mem:0x10be813ac] Aweme`___lldb_unnamed_symbol909747$$Aweme + 212 
  frame #18: [file:0x184f39c44 mem:0x1a1d45c44] UIKitCore`-[UITextView keyboardInput:shouldInsertText:isMarkedText:] + 144 
  frame #19: [file:0x1849d9a88 mem:0x1a17e5a88] UIKitCore`-[UIKeyboardImpl callShouldInsertText:] + 72 
  frame #20: [file:0x1849ee188 mem:0x1a17fa188] UIKitCore`-[UIKeyboardImpl

输出颜色怎么显示出来

首先给个大大的赞。
Xcode终端输出的时候,颜色没有生效,效果是这样的:
frame #5: [file:[36m0x1814b1a00[0m mem:[2m0x196e65a00[0m] [33mCFNetwork[0m`__75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 32
请问怎么才能显示出来色彩?

debugme error


 @import Foundation;NSString* appDir = @"/var/containers/Bundle/Application/31CEF822-DB1D-4585-ABDE-F3DD229D7EC3/Butler.app";
    NSMutableString* retStr = [NSMutableString string];

    uint32_t count = (uint32_t)_dyld_image_count();
    for(uint32_t i = 0; i < count; i++){
        char* curModuleName_cstr = (char*)_dyld_get_image_name(i);
        long slide = (long)_dyld_get_image_vmaddr_slide(i);
        uintptr_t baseAddr = (uintptr_t)_dyld_get_image_header(i);
        NSString* curModuleName = @(curModuleName_cstr);

        if([curModuleName containsString:appDir]) {
            [retStr appendString:(id)[@(i) stringValue]];
            [retStr appendString:@","];
            [retStr appendString:@(curModuleName_cstr)];
            [retStr appendString:@"#"];
        }
    }
    retStr

choose 命令失败

(lldb) choose WBStatus
error: expected ';' at end of declaration
error: extraneous ')' before ';'
error: expected ';' at end of declaration
error: definition of class NSNumber must be available to use Objective-C numeric literals
forward declaration of class here
error: illegal type 'uint64_t' (aka 'unsigned long long') used in a boxed expression
error: definition of class NSNumber must be available to use Objective-C numeric literals
forward declaration of class here
error: illegal type 'unsigned int' used in a boxed expression
error: definition of class NSNumber must be available to use Objective-C numeric literals
forward declaration of class here
error: illegal type 'uint64_t' (aka 'unsigned long long') used in a boxed expression
error: definition of class NSNumber must be available to use Objective-C numeric literals
forward declaration of class here
error: illegal type 'uint64_t' (aka 'unsigned long long') used in a boxed expression

Mac 10.14.6
xia0lldb 2.9
Xcode 11.3.1

xcode lldb does not support image to im

ret = utils.exe_cmd(debugger, "im li -o -f")

(lldb) im li -o -f
"malloc_info", "ptr_refs", "cstr_refs", "find_variable", and "objc_refs" commands have been installed, use the "--help" options on these commands for detailed help.

so, consider not using abbreviations

exeucte debugme will make Tiiktok crash

Hi there,

我在抖音启动到UIApplicationMain时加了断点,然后执行了debugme

提示似乎都正常也patch了,但是继续调试就会直接crash在

TikTok`___lldb_unnamed_symbol400947$$TikTok:
->  0x1071925a0 <+0>:  udf    #0x1
    0x1071925a4 <+4>:  ldr    x16, #0x8                 ; <+12>
    0x1071925a8 <+8>:  br     x16
    0x1071925ac <+12>: .long  0x0f024000                ; unknown opcode

crash 在 udf #0x1这里

(lldb) bt
* thread #24, queue = 'com.apple.root.background-qos', stop reason = EXC_BAD_INSTRUCTION (code=1, subcode=0x1)
  * frame #0: 0x00000001071925a0 TikTok`___lldb_unnamed_symbol400947$$TikTok
    frame #1: 0x0000000107193224 TikTok`___lldb_unnamed_symbol400952$$TikTok + 508
    frame #2: 0x0000000107193edc TikTok`___lldb_unnamed_symbol400954$$TikTok + 884
    frame #3: 0x0000000107199fe8 TikTok`___lldb_unnamed_symbol400972$$TikTok + 284
    frame #4: 0x0000000107199304 TikTok`___lldb_unnamed_symbol400969$$TikTok + 196

indexError: list index out of range

raceback (most recent call last):
File "/Users/aaabbb/xia0LLDB/src/debugme.py", line 43, in handle_command
debugme(debugger)
File "/Users/aaabbb/xia0LLDB/src/debugme.py", line 718, in debugme
images = utils.get_all_image_of_app()
File "/Users/aaabbb/xia0LLDB/src/utils.py", line 102, in get_all_image_of_app
image_name = image_str.split(",")[1]
IndexError: list index out of range
[x] happy debugging~ kill antiDebug by xia0@2019

图片

图片

执行dumpdecrypted -X报错

手机:iPhone8 plus
系统:iOS14.2
越狱方式:unc0ver7.0.0

执行dumpdecrypted -X后报错,如下:
(lldb) dumpdecrypted -X
[] set breakpoint at CFBundleGetMainBundle
[
] will continue process and dump
[] start execute dumpdecrypted
[
] delete all breakpoints
[+] use "target list" to get main module:/private/var/containers/Bundle/Application/C1082122-4000-4896-8B91-E6BD52F37FA9/.app/
[+] use "target list" to get main module:/private/var/containers/Bundle/Application/C1082122-4000-4896-8B91-E6BD52F37FA9/.app/
[] app dir:/var/containers/Bundle/Application/C1082122-4000-4896-8B91-E6BD52F37FA9/***.app
[-] failed to get app images from:error: while importing modules:
While building module 'Foundation' imported from LLDBModulesMemoryBuffer:1:
While building module 'Security' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
In file included from :2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework/Headers/SecImportExport.h:41:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework/Headers/SecKeychain.h:287:48: error: 'SecKeychainRef' is unavailable: not available on iOS
OSStatus SecKeychainOpen(const char *pathName, SecKeychainRef * __nonnull CF_RETURNS_RETAINED keychain);
^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:135:51: note: 'SecKeychainRef' has been explicitly marked unavailable here
typedef struct CF_BRIDGED_TYPE(id) __SecKeychain *SecKeychainRef

dumpdecrypted -X failed

iPhone6
iOS12.3.1
Python3.6.8
MacOS

执行的指令和报错
(lldb) dumpdecrypted -X
[] set breakpoint at CFBundleGetMainBundle
[
] will continue process and dump
[] start execute dumpdecrypted
[
] delete all breakpoints
[-] failed to auto get main module, use -m option
[-] failed to auto get main module, use -m option
Traceback (most recent call last):
File "/Users/shiro/Downloads/xia0LLDB/src/dumpdecrypted.py", line 51, in handle_command
ret = dumpdecrypted(debugger)
File "/Users/shiro/Downloads/xia0LLDB/src/dumpdecrypted.py", line 545, in dumpdecrypted
images = utils.get_all_image_of_app()
File "/Users/shiro/Downloads/xia0LLDB/src/utils.py", line 91, in get_all_image_of_app
if app_path.startswith("/private"):
AttributeError: 'NoneType' object has no attribute 'startswith'

有点迷茫,想请教一下为什么会是执行python出问题,我对Python不是很熟

debugme issues

(lldb) debugme
[] start patch ptrace funtion to bypass antiDebug
[+] success ptrace funtion to bypass antiDebug
[
] start patch svc ins to bypass antiDebug
[-] failed to get text segment:["rror: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long')\nwarning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long')\nwarning: ISO C++11 does not allow conversion from string literal to 'char *'\nerror: Couldn't lookup symbols:\n _sprint"]
[x] happy debugging~ kill antiDebug by xia0@2019

输入sbt命令,报错,求大佬指点

===[E]===:error: <user expression 48>:10:29: definition of class NSNumber must be available to use Objective-C numeric literals NSString *c_size_str = [@(c_size) stringValue]; ^note: forward declaration of class hereerror: <user expression 48>:10:29: illegal type 'unsigned int' used in a boxed expression NSString *c_size_str = [@(c_size) stringValue]; ^~~~~~~~~error: <user expression 48>:37:73: extraneous ')' before ';' theDistance = frame_addr - (uintptr_t)implementation); ^error: <user expression 48>:57:73: extraneous ')' before ';' theDistance = frame_addr - (uintptr_t)implementation); ^error: <user expression 48>:81:31: definition of class NSNumber must be available to use Objective-C numeric literals [retStr appendString:(id)[@((uintptr_t)theDistance) stringValue]]; ^note: forward declaration of class hereerror: <user expression 48>:81:31: illegal type 'uintptr_t' (aka 'unsigned long') used in a boxed expression [retStr appendString:(id)[@((uintptr_t)theDistance) stringValue]];

当dumpdecrypted -X时报错 AttributeError: 'NoneType' object has no attribute 'startswith'

(lldb) dumpdecrypted -X
[] set breakpoint at CFBundleGetMainBundle
[
] will continue process and dump
[] start execute dumpdecrypted
[
] delete all breakpoints
[-] failed to auto get main module, use -m option
[-] failed to auto get main module, use -m option
Traceback (most recent call last):
File "/Users/XX/xia0LLDB/src/dumpdecrypted.py", line 51, in handle_command
ret = dumpdecrypted(debugger)
File "/Users/XX/xia0LLDB/src/dumpdecrypted.py", line 546, in dumpdecrypted
images = utils.get_all_image_of_app()
File "/Users/XX/xia0LLDB/src/utils.py", line 121, in get_all_image_of_app
if app_path.startswith("/private"):
AttributeError: 'NoneType' object has no attribute 'startswith'

命令无法加载

[xia0LLDB] + Loading all scripts from /path/to/xia0LLDB/src
error: cannot add command: user command exists and force replace not set
error: cannot add command: can't replace builtin command
error: cannot add command: can't replace builtin command
error: cannot add command: user command exists and force replace not set
error: cannot add command: user command exists and force replace not set
[xia0LLDB] * Finished

你好,.framework好像砸壳不成功

你好,可执行文件能砸壳成功,但是.framework砸壳不成功,请问这个有好的解决方案吗?

设备:iPhone6 用的checkra.in越狱的,系统12.4.5, 砸壳APP是喜马拉雅6.6.66版本

dumpdecrypted failed

iphone6s
ios12.1.4
error msg:

error: <user expression 3>:178:44: no matching function for call to 'NSSearchPathForDirectoriesInDomains'
NSString docPath = ((NSArray)NSSearchPathForDirectoriesInDomains(9, 1, YES))[0];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSPathUtilities.h:96:40: candidate function not viable: no known conversion from 'int' to 'NSSearchPathDirectory' for 1st argument
FOUNDATION_EXPORT NSArray<NSString *> *NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, BOOL expandTilde);
^

error: <user expression 3>:180:36: property 'UTF8String' not found on object of type 'NSString *'
strlcpy(npath, docPath.UTF8String, sizeof(npath));
^

[] now is image: 21,/private/var/containers/Bundle/Application/FB625427-A2F0-43C4-85BF-7AE57499EB42/Ingeek Premium.app/Frameworks/Ares.framework/Ares
[
] start dump [21] image:/private/var/containers/Bundle/Application/FB625427-A2F0-43C4-85BF-7AE57499EB42/Ingeek Premium.app/Frameworks/Ares.framework/Ares
error: <user expression 4>:178:44: no matching function for call to 'NSSearchPathForDirectoriesInDomains'
NSString docPath = ((NSArray)NSSearchPathForDirectoriesInDomains(9, 1, YES))[0];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSPathUtilities.h:96:40: candidate function not viable: no known conversion from 'int' to 'NSSearchPathDirectory' for 1st argument
FOUNDATION_EXPORT NSArray<NSString *> *NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, BOOL expandTilde);
^

error: <user expression 4>:180:36: property 'UTF8String' not found on object of type 'NSString *'
strlcpy(npath, docPath.UTF8String, sizeof(npath));
^

[-] image info is null, skip image #

[*] Developed By xia0@201

v3.0 error: module importing failed: invalid pathname

你好,
更新到3.0以后,每次都会出现error: module importing failed: invalid pathname

error: module importing failed: invalid pathname

           https://github.com/4ch12dy/xia0LLDB
          Welcome to xia0LLDB - Python3 Edition
          ,--.          ,--.  ,--.   ,--.   ,------.  ,-----.   
,--.  ,--.`--' ,--,--. /    \ |  |   |  |   |  .-.  \ |  |) /_  
 \  `'  / ,--.' ,-.  ||  ()  ||  |   |  |   |  |  \  :|  .-.  \ 
 /  /.  \ |  |\ '-'  | \    / |  '--.|  '--.|  '--'  /|  '--' /  
'--'  '--'`--' `--`--'  `--'  `-----'`-----'`-------' `------'   

[xia0LLDB] * Version: 3.0 
[xia0LLDB] * Disabling color in output due to Xcode detected
[xia0LLDB] + Loading all scripts from /Development/GitHub/xia0LLDB/src
[xia0LLDB] * Finished 

请问是bug么?

与QT Creator程序冲突

在mac版本上使用后,会导致QT Creator无法正常调试,有办法兼容这个问题么?

Add More Detailed Documentation

Hi,
I would really appreciate if you could add more detailed documentation on how to use/run with possibly real examples of what the tool can do. I have been going over the readme/code attempting to understand how to fully utilize the tool but been failing to do so. I think a stronger "how to use" doc would significantly increase UX.

Segmentation fault

Thank you for your scripts. They look so promising.

Unfortunately, running the debugme script on any app, results in a segmentation fault:

(lldb) debugme
[] start patch ptrace funtion to bypass anti debug
[+] ptrace funtion patach done
[
] start patch svc ins to bypass anti debug
[+] use "target list" to get main module:/private/var/containers/Bundle/Application/62665631-5B78-4128-93DF-4F6DE5576C8D/test.app/test
[*] app dir:/var/containers/Bundle/Application/62665631-5B78-4128-93DF-4F6DE5576C8D/test.app
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/usr/bin/lldb
Segmentation fault: 11

Any advice?

MacOS: Catalina
iPhone 6
iOS 12.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.