之前僅僅介紹了工具的使用,本文將實(shí)踐一下如何利用 cycript 結(jié)合 class-dump 結(jié)果 hack,還要犧牲一下支付寶 App 。
首先,老套路,取到手勢解鎖界面的 View Controller:

然后,對照 class-dump-z 結(jié)果,來分析 GestureUnlockViewController 有什么利用價值 :
@interface GestureUnlockViewController : DTViewController{? @private? ? ? GestureHeadImageView* _headImageView;? ? ? GestureTipLabel* _tipLabel;? ? ? GestureInputView* _inputView;? ? ? DTButton* _forgetButton;? ? ? DTButton* _changeAccountButton;? ? ? int _retryCount;? ? ? UIView* _guideView;? ? ? id_delegate;? }? @property(assign, nonatomic) __weak iddelegate;
-(void).cxx_destruct;
-(BOOL)shouldAutorotateToInterfaceOrientation:(int)interfaceOrientation;
-(void)headClicked;
-(void)gestureInputView:(id)view didFinishWithPassword:(id)password;
-(void)gestureInputViewFirstEffectiveTouch:(id)touch;
-(void)alertView:(id)view clickedButtonAtIndex:(int)index;
-(void)actionChangeAccountToLogin;
-(void)actionResetPswBtnClick;
-(void)resetCurrentUser;
-(void)resetPsw;
-(void)viewWillDisappear:(BOOL)view;
-(void)notifyFaceToFacePayReceivedData:(id)facePayReceivedData;
-(void)viewWillAppear:(BOOL)view;
-(void)breakFirstRun;
-(BOOL)isFirstRun;
-(void)guideViewClicked:(id)clicked;
-(void)viewDidLoad;
-(void)viewWillLayoutSubviews;
@end
目測 _tipLabel 是寫賬戶名和提示操作的 label ,上篇文章我提到過:@private 限制不了 keyPath ,現(xiàn)在我們來修改一下支付寶登錄頁的用戶名信息:
cy# [visible setValue:@"Test By yiyaaixuexi" forKeyPath:@"_tipLabel.text"]

支付寶手勢密碼解鎖有嘗試次數(shù)限制,連續(xù)錯 5 次就要重新登錄。 我想解除重試解鎖次數(shù)的限制,發(fā)現(xiàn)了記錄解鎖次數(shù)的類型是 int ,int _retryCount ,這一點(diǎn)讓我很不開心,因為我無法通過 KVC 來修改其值了。
但是沒有關(guān)系,我可以通過指針訪問:
cy# visible->_retryCount = 0
0
這樣我就能無限制的用程序暴力破解手勢密碼了,來計算一下有多少種可能呢?
hack-practice2
這個數(shù)字對我來說有點(diǎn)大,可是對 iPhone5 的 CPU 來說就是小菜一碟了~
等一下,密碼格式是什么呢?
-(void)gestureInputView:(id)view
didFinishWithPassword:(id)password;
id 類型的密碼,很嚴(yán)謹(jǐn),又給 hack 帶來不少麻煩呀~ 不過沒關(guān)系,我們可以利用 Method Swizzling 來打出 password 到底是什么,不過呢,貌似可以再寫一篇新文章去介紹了……