메뉴 건너뛰기

app

[iphone] cycript 설치 및 테스트

suritam92013.09.12 22:19조회 수 5529댓글 2

  • 3
    • 글자 크기

cycript 의 소개는


http://ileeyj.tistory.com/257


위 사이트에 되어 있다. 아이폰 소스는 못 보는 것인줄 알았는데, 역시 방법은 다 있기 마련이다.


http://www.cycript.org/


위 사이트에서 설명을 보고 http://www.cycript.org/debs/ 로 가면 


cycript_0.9.461_iphoneos-arm.deb

mobilesubstrate_0.9.3069-1_iphoneos-arm.deb

libffi_1:3.0.10-5_iphoneos-arm.deb


이 있다. cydia에서 mobilesubstrate는 검색되고 설치가 되는데, libffi 는 검색이 안되어, 여기서 다운 받아 설치했다.


다운 받은 deb 파일은 /var/mobile 에서 아래와 같이 설치했다.

# dpkg -i libffi.deb

Selecting previously deselected package libffi.

(Reading database ... 5599 files and directories currently installed.)

Unpacking libffi (from libffi.deb) ...

Setting up libffi (1:3.0.10-5) ...

# dpkg -i cycript.deb

(Reading database ... 5605 files and directories currently installed.)

Preparing to replace cycript 0.9.461 (using cycript.deb) ...

Unpacking replacement cycript ...

Setting up cycript (0.9.461) ...



# ps -ef | grep Spring

  501    32     1   0   0:49.08 ??         2:35.45 /System/Library/CoreServices/SpringBoard.app/SpringBoard

# cycript -p 32


예제를 따라하기 위해 위와 같이 했다.


cy# UIApp

@"<SpringBoard: 0x1fd79aa0>"

cy# UIApp->_uiController.window

@"<SBAppWindow: 0x1fdd5390; baseClass = UIWindow; frame = (0 0; 320 480); layer = <CALayer: 0x1fdea940>>"

cy# UIApp->_uiController.window.subviews

@["<SBUIRootView: 0x1fdeabe0; frame = (0 0; 320 480); layer = <CALayer: 0x1fdeac60>>","<SBAppContextHostView: 0x2091c320; frame = (0 0; 320 480); clipsToBounds = YES; hidden = YES; layer = <CALayer: 0x2091eba0>> enabled: yes, context array: (n)","<SBAppContextHostView: 0x20b4d890; frame = (0 0; 320 480); clipsToBounds = YES; hidden = YES; layer = <CALayer: 0x20b497a0>> enabled: yes, context array: (n)"]

cy# UIApp->_uiController.window.subviews[0].subviews

@["<UIView: 0x1fdeade0; frame = (0 0; 320 480); autoresize = W+H; layer = <CALayer: 0x1fdeaeb0>>"]

cy# UIApp->_uiController.window.subviews[0].subviews[0].image.size

TypeError: Result of expression 'UIApp.$cyi._uiController.window.subviews[0].subviews[0].image' [undefined] is not an object.


안 되는 부분이 있어서, 일단 넘어가고 다른 앱을 보기로 한다. 설치파일을 첨부하였다.


cycript_0.9.461_iphoneos-arm.deb 20-Sep-2012 23:06 288K  

libffi_1:3.0.10-5_iphoneos-arm.deb 19-Mar-2012 00:30 12K  

mobilesubstrate_0.9.3069-1_iphoneos-arm.deb 03-Nov-2009 00:53 33K  



cy# var app = [UIApplication sharedApplication]

@"<UIApplication: 0x1eaf90>"

cy# app.keyWindow.recursiveDescription


위까지 진행하고 한글이 나오면 알아볼 수 없을 것이다. 이 때는 아래와 같이 python을 이용해 문자열을 변환해 확인한다.


>>> print(u'탈옥폰에서는 실행할 수 없습니다.'.encode('utf-8'))

b'xedx83x88xecx98xa5xedx8fxb0xecx97x90xecx84x9cxebx8ax94 xecx8bxa4xedx96x89xedx95xa0 xecx88x98 xecx97x86xecx8axb5xebx8bx88xebx8bxa4.'


>>> print(u'xedx83x88xecx98xa5xedx8fxb0xecx97x90xecx84x9cxebx8ax94 xecx8bxa4xedx96x89xedx95xa0 xecx88x98 xecx97x86xecx8axb5xebx8bx88xebx8bxa4.'.encode('iso8859-1').decode('utf-8'))

탈옥폰에서는 실행할 수 없습니다.



FM 대로 실습할 수 있는 자료이다.

http://www.securitylearn.net/2013/06/26/penetration-testing-of-iphone-applications-part-5/

설명이 잘 되어있다.


서뷰 뷰를 사용하고 있다면, 아래와 같이 없앨 수 있다. 서뷰 뷰는 alertview 와 imageview가 해당한다.


[UIApp.keyWindow.subviews[1] removeFromSuperview]

[UIApp.keyWindow.subviews[0] removeFromSuperview] 



또한 윈도우가 여러개 일 경우 완전히 없애지는 못해도, 숨김 옵션으로 밑의 window를 볼 수 있다.

UIApp.delegate 로 메일 메소드에는 접근할 수 있으나, 다른 윈도우에 종속된 경우 윈도우를 선택해 controller 의 메소드를 접근할 수 있다.


[UIApp.windows[2] setHidden:YES]


cy# UIApp.windows[0].rootViewController
@"<MainNavigationController: 0x1ed21fe0>"

아래 정의 함수와 file로 만들어주는 기능은 유용하다.(한글로 나온다! 파이선이 필요없는 것이다!)
function printMethods(className) {
  var count = new new Type("I");
  var methods = class_copyMethodList(objc_getClass(className), count);
  var methodsArray = [];
  for(var i = 0; i < *count; i++) {
    var method = methods[i];
    methodsArray.push({selector:method_getName(method), implementation:method_getImplementation(method)});
  }
  free(methods);
  free(count);
  return methodsArray;
}
printMethods(MainNavigationController)
[[UIApp.windows[0] recursiveDescription] writeToFile:"/var/mobile/viewdump.txt" atomically:NO encoding:4 error:NULL]
suritam9 (비회원)
  • 3
    • 글자 크기
[iphone] 리스프링 했는데, 멈춰버렸을 때, reboot (by suritam9) [XE] 아이핀 구현 (by suritam9)

댓글 달기

댓글 2
  • http://bitxflow.synology.me/wordpress/?p=208 의 예제의 messages 관련 명령은 Cydia에서 받은 cycript 에 적용되지 않는다.

    아래와 같이 prototype 이라는 속성을 사용한다.(반나절을 버렸네. T.T)

    cy# AntiPiracyViewController.prototype['isJailbroken'] = function () { return f lse; }
    function () {return!1;}
  • [UIApp.keyWindow setHidden:YES] 로 앱 사용 중에도 탈옥을 지속 체크하고 window가 별도인 방식을 우회할 수 있다.

suritam9
2013.12.02 조회 3149
lispro06
2017.06.22 조회 1607
suritam9
2019.04.05 조회 1838
lispro06
2013.12.10 조회 2728
lispro06
2014.02.08 조회 3790
이전 1 2 3 4 5 6 7 8 9 10... 14다음
첨부 (3)
libffi.deb
12.4KB / Download 43
cycript.deb
288.3KB / Download 46
mobilesubstrate.deb
32.5KB / Download 45
위로