2012. 3. 31. 06:49

raw_input() was renamed to input()

Posted by 땡보
2012. 1. 20. 14:43

If you do not have a valid backup to go to, you can try forcing the
database up without the transaction log, by using the "-f" switch (e.g.
"dbeng8 -f -n myengine mydb.db -n mydatabase" . If you can get the
database up and running, I'd highly recommend an unload and reload
immediately thereafter. (CAUTION: Consult the documentation if this
database is involved in a replication environment! Doing this will break
that environment!)

See our documentation for a description on how to rebuild a database:

http://www.ianywhere.com/developer/product_manuals/sqlanywhere/0902/e...

'Study > 되새김질' 카테고리의 다른 글

되새김질(since 2008.02.17 ~)  (1) 2013.08.21
[펌]sed 명령어  (0) 2011.12.25
[C/C++]SBCS/MBCS/WBCS 관련 함수 참고  (0) 2011.09.08
Posted by 땡보
2012. 1. 11. 11:29

Case Description
I am receiving the following message "Assertion failed: 201129
(11.0.1.2250) File is shorter than expected". Why is this happening?
Tip or Workaround
 
Resolution
There are certain instances where Microsoft’s OS ignores certain settings (ie. Write-through flags and buffer writes) on the database file and allows buffering when we have told buffering should not take place.

What symptoms would users see in the field?

Users may see such problems as “File is shorter than expected” and issues with the checkpoint log. There is a page (checkpoint information page) at the beginning of the db containing the stores info about the checkpoint log. The Checkpoint log is located at the end of the database file.

There is an inconsistency between checkpoint information page and what was on disk.

A potential workaround was generated (see full description of fix below). Our workaround was to increase the frequency of our calls to FileFlushBuffers . In general there should be time to write to disk.

Here is a description of the fix:

Versions Affected: all Windows versions
Modules Affected: engine/server
Fixed In: 11.0.0 build 2309
9.0.2 build 3885
10.0.1 build 3956
11.0.0 build 1654
Description:
We learned that, in the interest of improved performance, Microsoft Windows explicitly prevents certain documented methods of guaranteeing that data has been written to the physical storage medium from working on IDE/SATA/ATAPI drives (SCSI drives are unaffected). Recoverability after a power outage could be compromised. The database server now performs additional operations to flush data to disk to improve recoverability. In testing, there was no measurable performance degradation by this change.

Additional URLs:
http://groups.google.com/group/microsoft.public.win32.programmer.kernel/browse_frm/thread/4590ed3a4133828f/406cfb3a9deae044
http://www.tech-archive.net/Archive/WinXP/microsoft.public.windowsxp.general/2004-04/8584.html
Other Sources Related to Issue
 Manual
  http://research.microsoft.com/apps/pubs/default.aspx?id=70554


[[['\xdf\xe8\x80\x90\xc5\xedz\xc2\xf3%q\xf0\xfc\x82/\xdaM\x8c\xd2\x81\xfcq8\xc7\xcdm\xb6V\xf6\xe2\xd0\x81']]]
 
 LINK : http://search.sybase.com/kbx/solvedcases?id_number=11562388

'Study > Reverse_engineering' 카테고리의 다른 글

[IOS]ios5+ stuff  (0) 2012.09.17
[분석중]삭제키  (0) 2011.12.28
[놀이]flickhomerun  (0) 2011.12.10
[ARM]자주 사용되는 ARM/THUMB OPCODE 정리  (0) 2011.09.29
[펌]IOS 안티 디버깅 기법  (0) 2011.09.28
Posted by 땡보
2011. 12. 28. 15:44
Uninst.exe -Dlnics27exc

요거면 만사땡

'Study > Reverse_engineering' 카테고리의 다른 글

[IOS]ios5+ stuff  (0) 2012.09.17
[펌]SYBASE ASA DB log file error  (0) 2012.01.11
[놀이]flickhomerun  (0) 2011.12.10
[ARM]자주 사용되는 ARM/THUMB OPCODE 정리  (0) 2011.09.29
[펌]IOS 안티 디버깅 기법  (0) 2011.09.28
Posted by 땡보
2011. 12. 25. 19:29
                              Axil S/E-ljs068
                                1994.1.4
                               Lee Jin-Soo


SUBJECT:   SED 명령어 사용법


o sed 스트림 편집기
  ed명령어와 grep명령어 기능의 일부를 합친 것이 sed(stream editor)명령어이다.
  sed명령어도 grep명령어와 같은 필터이지만 이 명령어는 화일을 수정할 수 있게 하는 반면 ed처럼 대화식
  처리는 불가능하다. sed 명령어는 1개 라인씩 입력 라인을 읽어들여 표준 출력에 출력한다.
  sed는 각 라인을 읽을 때마다 ed에서 사용하던 형식의 대치작업을 실행한다.
  일치하는 문자열이 있으면 그 문자열을 대치한 후 출력하고 일치하는 문자열이 없으면 그 라인은
  수정되지 않고 그대로 출력된다.
  이 sed 명령어가 ed보다 좋은 점은 라인들을 하나씩 읽고 , 수정하고, 출력하기 때문에 기억장치 안의
  버퍼를 사용하지 않는다는 것이다. 버퍼를 사용하지 않으면 화일의 크기에 제한 없이 작업을 할 수 있다.
  ed와 같이 버퍼를 사용하는 경우는 버퍼의 크기보다 큰 화일은 처리할 수 없으며 대개 버퍼의 크기는
  1MB정도이다. 따라서 sed는 아주 큰 화일을 처리할 때 주로 사용된다.
  sed 명령어를 호출하는 형식은 grep명령어와 같지만 완전한 형식의 대치 연산자를 사용한다는 점만이 다르다.
     # sed "s/hello/goodbye" in.file
  위의 명령어는 in.file이라는 화일에 있는 각 라인에서 첫번째 등장하는 hello라는 문자열을 goodbye로
  교체한 후 그 라인을 표준 출력에 출력한다.
     # echo "1234hello5678" | sed "s/hello/goodbye/"
  대치 명령어를 따옴표로 둘러싸야 올바로 사용할 수 있다. 여기서 문자열은 정규식으로 표현될수 도 있다.
  그외에도 sed명령어에는 여러 가지 연산자를 사용할 수 있다. 다음의 명령어를 사용하면 hello라는 
  문자열을 포함하고 있는 모든 문자열을 삭제할 수 있다.
     # sed "/hello/d" in.file
  위 명령어의 의미는 "hello라는 문자열을 포함하고 있는 라인을 찾아 그 라인을 삭제하라"는 것이다.
  이 sed 명령어는 다음 명령어와 같은 의미이다.
     # grep -v hello in.file
  라인을 전부 삭제하지 않고 hello라는 문자열만을 삭제하려면 다음 명령어를 사용하다.
     # sed "s/hello//" in.file
  ed와 같이 sed에서도 화일의 일부만을 대상으로 작업하는 경우는 라인의 범위를 지정할 수 있다.
     # sed "3,7s/hello//" in.file
  위의 명령어는 in.file이라는 화일의 라인3에서 7까지만을 대상으로 첫번째 hello를 삭제하고 화일의 
  그 외의 부분은 변경시키지 않는다. 또한 다음과 같이 사용하면 라인 번호 대신 문맥을 범위로  
  지정할 수 있다.
     # sed "/hello/,/goodbye/s/bad/good/g" in.file
  위의 명령어는 hello라는 단어를 포함하고 있는 첫번째 라인부터 goodbye라는 단어를 포함하고 있는
  라인까지 검색하면서 bad라는 문자열을 모두 good으로 변경한다.
  또한 문자열 goodbye를 만난 이후에도 다시 다른 hello가 등장하면 다음 goodbye가 나올 때까지 대치 
  작업은 반복된다.
  sed명령어의 기능은 지금까지 우리가 살펴본 것보다 더 강력하다.
  sed명령어의 -f(file)선택자를 사용하면 명령어를 일일이 키보드에서 입력하지 않고 하나의 화일에
  기억시켜 놓고 사용할 수도 있다.
     # sed -f command.file in.file
  여러 개의 명령어를 연속적으로 자주 사용할 때 이 명령어 화일이 유용하게 사용된다.
  예를 들어 다음과 같은복수 개의 명령어가 화일에 기억되어 있는 경우는
     # vi command.file
       s/hello/goodbye
       s/good/bad
  다음과 같은 명령어를 입력하면
     # echo "1234hello5678" | sed -f command.file 
  다음과 같이 출력된다.
     # echo "1234hello5678" | sed -f command.file
       1234badbye5678
   
o sed 기본
     # sed '' ljs --> cat ljs 와 동일

o sed 편집 명령어
      일상적인 sed 명령
    ---------------------------------------------------------------------------------------
     a\          다음 라인(들)을 적용될 라인들에 부가한다  (라인뒤)
     c\          적용될 라인들을 다음 라인(들)로 변경한다  (라인 대체)
     d           적용될 라인들을 삭제한다
     g           단지 첫번째의 것만이 아니라 라인의 모든 부합 패턴 대체가 적용 되게 한다  
     i\          다음 라인(들)을 적용될 라인들 위에 삽입한다  (라인앞)
     p           - n 옵션하에 있을지라도, 라인을 프린트한다
     q           명시된 라인에 도달할 때 중지한다
     r filename  filename을 판독한다. 내용을 출력에 부가한다
     s/old/new/  "old"를 "new"로 대체한다
     =           라인 번호를 프린트한다
     !command    라인이 선택되지 않는 경우 command를 적용한다.
    --------------------------------------------------------------------------------------

o 라인 명시
  sed명령은 두가지 방법을 사용한다. 첫 번째는 번지를 번호로 명시하는것이다.
  여러분은 특정한 라인을 가리키기 위해 단일 번호를 사용할 수 있다. 
     # sed '3d' ljs  --> 세번째 라인을 삭제
  또는, 라인들의 범위를 가리키기 위해 콤마(,)로 분리된 두 번호들을 사용할 수 있다.
     # sed '2,4 s/e/#/' ljs  --> 대체 명령은 단지 2-4 라인들에만 적용된다. (단순 대체 명령은 라인에서
                                 첫번째 어커런스에만 적용된다는 점을 기억하라. 따라서 각 적용 라인의
                                 첫 번째 e만이 #로 대체된다)
     # sed -n '/kingdom/p' ljs  --> kingdom이 들어있는 line만 프린트
     # sed '/kingdom/p' ljs  --> 모든 line이 나타나고 그와 동시에 kingdom line이 중복해서 나타남
     # sed '[Pp]rincess/d' ljs  --> princess 또는 Princess를 포함하고 있는 라인들을 삭제함
     # sed '1,/fragrant/d' ljs  --> 라인 1로부터 fragrant를 포함하고 있는 첫번째 라인까지의 모든
                                    라인들을 삭제함
o sed 명령 하이라이트
     # more ljs
       I am a boy
       You are a girk
       He is a doctor
     # sed 'a\\
       Hey la la\! Doo de dah\!' ljs  --> 각 라인뒤에다 Hey la la!를 입력
        I am a boy
        Hey !
        You are a girk
        Hey !
        He is a doctor
        Hey !
     # sed 'a\\
       Oh\! good\\  --> \\을 사용함으로써 하나 이상의 라인들을 부가할 수 있다
       yeh' ljs 
     # sed '3a\\
       Good Morning' ljs  --> 3 line뒤에다 내용 삽입
     # sed 'c\\
       Oh marvelous delight! sing to me! ' ljs  --> 기존의 라인들을 이것으로 대체시킴
       Oh marvelous delight! sing to me!
       Oh marvelous delight! sing to me!
       Oh marvelous delight! sing to me!
     # sed '2q' ljs  = sed 2q ljs --> q명령은 편집기로 하여금 그것이 명시된 라인에 도착한 뒤
                                      중지하게 한다. 즉 2라인만 보여줌
     # sed -n '1s/a/#/gp' ljs  --> 전체적으로 바꿔줌

o sed의 패턴-부합
      패턴-부합에 대한 sed메타 문자
     -------------------------------------------------------------------
       메타 문자            작    용
     -------------------------------------------------------------------
       \              다음 문자의 특수한 의미를 부정한다
       ^              라인의 시작과 부합한다
       $              라인의 끝과 부합한다
       .              어떠한 단일 문자와도 부합한다
       [ ]            둘러싸인 문자들 중의 어느 하나와 부합한다
       [^...]         ...리스트에 없는 어떠한 문자와도 부합한다
       pat*           0 또는 그 이상의 pat 어커런스들과 부합한다
                      여기에서 pat는 단일문자 또는 [ ]패턴이다
       &              s 명령의 newpattern부분에서 사용되어 oldpattern
                      부분의 재 산출을 나타낸다
     -------------------------------------------------------------------

o 간략한 예
  ----------------------------------------------------------------------------------------
    명 령         결  과 
  ----------------------------------------------------------------------------------------
   /Second/       Second를 포함하고 있는 어떠한 라인과도 부합한다.
   /^Second/      Second로 시작하는 어떠한 라인과도 부합한다.
   /^$/          공백라인, 즉 라인의 시작과 끝 사이에 아무것도 없는 라인과 부합한다.
                  이것은 공백 스페이스들로 된 라인과는 부합하지 않는바, 스페이스 자체가
                  문자이기 때문이다.
   /c.t/          cat, cot, 기타 등을 포함하고 있는 라인들과 부합한다. 이 패턴은 단어의
                  일부일 수 있음에 유의하라. 예를 들어, apricot와 acute도 부합된다.
   /./            적어도 한 문자를 포함하고 있는 라인들과 부합한다.
   /\./           피리어드를 포함하고 있는 라인들과 부합한다. \는 .의 특수한 의미를 부정
   /s[oa]p/       sop또는 sap와는 부합하지만 sip 또는 sup와는 부합하지 않는다.
   /s[ ^oa]p/     sip또는 sup와는 부합하지만 sop또는 sap와는 부합하지 않는다.
   s/cow/s&s/     cow를 scows로 대체한다.
   /co*t/         * --> 어떠한 수
  ----------------------------------------------------------------------------------------

o 간단한 sed 해법
     # sed '/^$/d' ljs  --> 모든 공백 라인 제거
     # sed '/^ *$/d' --> space로 만들어진 공백까지 제거 (조심! ^와 *사이에 공백이 있어야 한다)
     # sed 'a\\
       ' ljs   --> 각 line마다 공백라인 추가
     # sed '/^#/d' ljs  --> 첫번째 열에 #을 가진 라인 제거
     # sed 's/^/     /' ljs  --> 각 line의 시작을 5 space로 대체

o 다중 명령
     # sed 's/Bob/Robert/g\
            s/Pat/Patricia/g' ljs  --> sh을 사용하는 경우에는 \을 생략하라
     # sed 's/cat/dog/g\
            s/dog/pigs/g' ljs  --> 먼저 모든 cats를 dogs로 변환한 다음에 모든 dogs를 pigs로 변환한다.
     # sed 's/Bob/Robert/g\
            s/Pat[^a-z]/Patricia/g' ljs  --> ^a-z은 a에서 z까지의 문자들이 아닌 모든 문자를 
                                             의미한다는 점을 상기하라

o 태그
  위에서 Pat!와 같은 것이 발견될때 !를 포함한 전체 문자열이 Patricia로 대체되므로 !가 소실된다.
  우리는 !를 유지하면서 Pat를 대체하는 방법을 필요로 한다. 우리는 이것을 태그(tag)를 사용하여
  수행할 수 있다. 패턴의 일부를 "태그"하려면, 그것을 좌측에는 \(로 우측에는 \)로 둘러싸라.
  그 다음에, 명령의 newpattern부분에서, 여러분은 그렇게 둘러싸인 패턴의 첫 번째 것은 \1로,
  두번째 것은 \2 등으로 인용할 수 있다. 이 방법을 사용하면 다음의 명령이 부여된다.
      # sed 's/\(Pat\)\([^a-z]\)/\1ricia\2/g' ljs

o 쉘 스크립트와 sed
      # vi twospace
        sed 'a\\
        ' $*   --> $*은 모든 인자들을 나타냄
      # twospace ljs | pr | lpr
   위 예는 sed가 어떻게 하여 UNIX 프로그래밍과 쉘 스크립트에 적합한가를 나타낸다.

원문 : http://stone.backrush.com/sunfaq/ljs007.html

'Study > 되새김질' 카테고리의 다른 글

되새김질(since 2008.02.17 ~)  (1) 2013.08.21
Sybase ASA log  (0) 2012.01.20
[C/C++]SBCS/MBCS/WBCS 관련 함수 참고  (0) 2011.09.08
Posted by 땡보
2011. 12. 10. 00:09
Posted by 땡보
2011. 9. 29. 17:55
ARM OPCODE
MOV R1, #0 : 00 10 A0 E3
MOVMI R1, #0 : 00 10 A0 43
MOV R1, #1 : 01 10 A0 E3
MOV R0, #0 : 00 00 A0 E3
MOV R6, #0 : 00 60 A0 E3

MOV R0, 0xFFFFFFFF : 00 00 E0 E3

B               : XX XX XX EA
BNE           : XX XX XX 1A

ADD R3, R3, #1 : 01 30 83 E2
ADD R2, R3, #1 : 01 20 83 E2
ADD R2, R2, R1 : 01 20 82 E0
ADD R1, R2, R1 : 01 10 82 E0

SUB R2, R2, #1 : 01 20 42 E2 
Posted by 땡보
2011. 9. 28. 09:07
원본은 www.iphonedevsdk.com 에 Shmoopi가 올린 것이며 이 글은 단순한 번역본에 불과합니다. 잘못된 번역 있으면 댓글로 알려주세요.

#원문링크 

2009년에 올려진 글이라 현재의 iOS에는 적용되지 않을 수도 있으므로 주의하기 바랍니다.

안녕 여러분! 이 글은 전세계에서 모아들인 iPhone/iPod Touch 크랙 방지에 대한 두 번째 튜토리얼이야. 크랙 방지에 처음 발을 들여놓은거라면 최근의 근황에 대해 약간의 정보를 알려주지. 앱스토어 크랙은 엄청나게 확산되고있어. 5백만에 달하는 유저가 크랙버전을 쓰고 있고, 개발자들은 매일매일 엄청난 돈을 잃고 있지. 어떤 회사들은 출시 다음날에 전체 유저 중 크랙버전 유저가 95%에 달한다고 보고하기도 했어.

* 이 튜토리얼은 전세계에서 모은 코드들로 이루어져있으니 각각의 코드에 대한 저작권은 그 코드를 만든 사람에게 있습니다. 또한 저는 해킹이나 크랙 방지에 대한 윤리적 접근은 가급적 피하려고 합니다. 댓글에서도 해당 내용에 대한 언급은 피해주시기 바랍니다.

좋아, 윤리적 접근은 내버려두고 한번 해보자!

첫번째니까 쉬운걸로 한번 해볼까나? 저번 시간에 SignerIdentity에 대해 체크했던건 기억나지? 그 방법은 새로 나온 해킹방법에 의해 곧 무용지물이 될테니까 이번엔 다른 영역으로 접근해보자.

Code:
#if !TARGET_IPHONE_SIMULATOR
int root = getgid();
if (root <= 10) {
	//Pirated
}
#endif
이 코드는 그닥 설명이 필요없을거야. 어플의 사용자가 iPhone Simulator인지 아닌지 검사하고, 프로세스 ID를 얻어와서 root인지 아닌지 검사하는거지. 보통 누군가가 네 어플을 크랙하려고 하면 gdb를 돌리기 위해서 자동으로 root 권한으로 실행하는 경우가 많거든. 그러니까 사용자가 root가 아니란걸 확실히 하자는거지. 이 방법의 문제점은.. 해킹을 하기 위해서 꼭 root로 실행될 필요는 없다는거야. 상당수의 크랙 어플들은 이 검사를 빠져나갈 수 있지.

다음 방법은 iPhoneDevSDK 멤버중 한명인 javaconvert가 고안한 거야

Code:
#define kInfoSize 500
//Place your NSLog Plist Size into the above Define statment
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
NSString* path = [NSString stringWithFormat:@"%@/Info.plist", bundlePath ];
NSDictionary *fileInfo = [[NSBundle mainBundle] infoDictionary];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path traverseLink:YES];

if (fileAttributes != nil) {
	NSNumber *fileSize;
	if(fileSize = [fileAttributes objectForKey:NSFileSize]){
		NSLog(@"File Size:  %qi\n", [fileSize unsignedLongLongValue]);
		//Best to see the File Size and change it accordingly first
		NSString *cSID = [[NSString alloc] initWithFormat:@"%@%@%@%@%@",@"Si",@"gne",@"rIde",@"ntity",@""];
		BOOL checkedforPir = false;
		if([fileInfo objectForKey:cSID] == nil || [fileInfo objectForKey:cSID] != nil) {
			if([fileSize unsignedLongLongValue] == kInfoSize) {
				checkedforPir = true;
			}
		}
		if(!checkedforPir){
			//Pirated
		}
		[cSID release];
	}
}
여기서 사용된 방법은 첫번째 튜토리얼의 두 가지 방법을 결합한거야. plist 사이즈를 체크하는거랑 달콤한 함정을 설치하는방법이지.

그럼 이제 새로운 방법을 알아볼까?
Code:
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/_CodeSignature", bundlePath)];
if (!fileExists) {
	//Pirated
	NSLog(@"Pirated");
}
BOOL fileExists2 = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/CodeResources", bundlePath)];
if (!fileExists2) {
	//Pirated
	NSLog(@"Pirated2");
}
BOOL fileExists3 = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/ResourceRules.plist", bundlePath)];
if (!fileExists3) {
	//Pirated
	NSLog(@"Pirated3");
}
쩔지? 나도 알아 ㅋㅋ 여기서 하고있는건 "_CodeSignature", "CodeResources", 그리고 "ResourceRules.plist" 파일들이 존재하는지를 검사하는거지. 누군가가 어플을 크랙하면 크랙한 사람의 개인정보를 집어넣기 위해서 저 파일들을 제거시켜버리거든. 최고로 완벽한 방법이라고 볼 순 없지만 꽤나 크랙하기 힘들게 만들 수 있어.

다음에 나올 방법은 첨단 기술이라고 볼 수 있지
Code:
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
NSString* path = [NSString stringWithFormat:@"%@/Info.plist", bundlePath];
NSString* path2 = [NSString stringWithFormat:@"%@/AppName", bundlePath];
NSDate* infoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES] fileModificationDate];
NSDate* infoModifiedDate2 = [[[NSFileManager defaultManager] fileAttributesAtPath:path2 traverseLink:YES] fileModificationDate];
NSDate* pkgInfoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"PkgInfo"] traverseLink:YES] fileModificationDate];
if([infoModifiedDate timeIntervalSinceReferenceDate] > [pkgInfoModifiedDate timeIntervalSinceReferenceDate]) {	
	//Pirated
}
if([infoModifiedDate2 timeIntervalSinceReferenceDate] > [pkgInfoModifiedDate timeIntervalSinceReferenceDate]) {	
	//Pirated
}
여기서 택한 방법은 info.plist 파일 TimeStamp를 PkgInfo 파일의 실행파일의 TimeStamp와 비교하는 거야. 이 비교를 통해 어플이 만들어진 후에 어떤 파일이 수정되었는지를 알아낼 수 있어. 해커가 어플을 크랙하려고 할 때 일반적으로 메인 파일이나 Info.plist 혹은 둘 다를 건드리게 되거든. 그럼 TimeStamp가 바뀌게 되지. 그들은 보통 PkgInfo 파일은 건드리지 않아. 따라서 이 두 파일의 TimeStamp가 같은걸 확인함으로써 어떤 파일도 수정되지 않았다는 걸 검증할 수 있는 셈이지. *만약에 이 방법을 시도했는데 문제가 생긴다면 00초에 프로젝트를 빌드하도록 해봐(3:14:59 말고 3:14:00 말이야). 이렇게 하지 않으면 정상적으로 만들어진 프로젝트에서 처음 생성된 파일과 나중에 생성된 파일에 시간차가 생길 수도 있거든.

자 그럼, 사라진 파일과 TimeStamp와 함께하는건 여기까지야. 이제부턴 사후처리가 아닌 사전방지를 목표로 움직여보자구
Code:
#import 
#import 

#import 
#import 


// The iPhone SDK doesn't have , but it does have ptrace, and it
// works just fine.
typedef int (*ptrace_ptr_t)(int _request, pid_t _pid, caddr_t _addr, int _data);
#if !defined(PT_DENY_ATTACH)
#define  PT_DENY_ATTACH  31
#endif  // !defined(PT_DENY_ATTACH)


void ZNDebugIntegrity() {
	// If all assertions are enabled, we're in a legitimate debug build.
#if TARGET_IPHONE_SIMULATOR || defined(DEBUG) || (!defined(NS_BLOCK_ASSERTIONS) && !defined(NDEBUG))
	return;
#endif
	
	// Lame obfuscation of the string "ptrace".
	char* ptrace_root = "socket";
	char ptrace_name[] = {0xfd, 0x05, 0x0f, 0xf6, 0xfe, 0xf1, 0x00};
	for (size_t i = 0; i < sizeof(ptrace_name); i++) {
		ptrace_name[i] += ptrace_root[i];
	}
	
	void* handle = dlopen(0, RTLD_GLOBAL | RTLD_NOW);
	ptrace_ptr_t ptrace_ptr = dlsym(handle, ptrace_name);
	ptrace_ptr(PT_DENY_ATTACH, 0, 0, 0);
	dlclose(handle);
}
그래, 살짝 복잡하지. 간단히 설명하자면 어플이 동작할 때에 디버거가 붙어있나를 살펴보는거야, 붙어있다면 디버거를 정지시키는거지. 어플을 크랙하기 위해선 디버거를 붙이고, 어플을 정지시키고, 메모리에서 덤프해와야하는데 이 방법으로 디버거를 떼내버리면 뱀의 머리를 치는 셈이지.

오늘의 마지막 방법이 최고의 방법이야
Code:
#import 
#import 
#import 

/* The encryption info struct and constants are missing from the iPhoneSimulator SDK, but not from the iPhoneOS or
 * Mac OS X SDKs. Since one doesn't ever ship a Simulator binary, we'll just provide the definitions here. */
#if TARGET_IPHONE_SIMULATOR && !defined(LC_ENCRYPTION_INFO)
#define LC_ENCRYPTION_INFO 0x21
struct encryption_info_command {
    uint32_t cmd;
    uint32_t cmdsize;
    uint32_t cryptoff;
    uint32_t cryptsize;
    uint32_t cryptid;
};
#endif

int main (int argc, char *argv[]);

static BOOL is_encrypted () {
    const struct mach_header *header;
    Dl_info dlinfo;
	
    /* Fetch the dlinfo for main() */
    if (dladdr(main, &dlinfo) == 0 || dlinfo.dli_fbase == NULL) {
        NSLog(@"Could not find main() symbol (very odd)");
        return NO;
    }
    header = dlinfo.dli_fbase;
	
    /* Compute the image size and search for a UUID */
    struct load_command *cmd = (struct load_command *) (header+1);
	
    for (uint32_t i = 0; cmd != NULL && i < header->ncmds; i++) {
        /* Encryption info segment */
        if (cmd->cmd == LC_ENCRYPTION_INFO) {
            struct encryption_info_command *crypt_cmd = (struct encryption_info_command *) cmd;
            /* Check if binary encryption is enabled */
            if (crypt_cmd->cryptid < 1) {
                /* Disabled, probably pirated */
                return NO;
            }
			
            /* Probably not pirated? */
            return YES;
        }
		
        cmd = (struct load_command *) ((uint8_t *) cmd + cmd->cmdsize);
    }
	
    /* Encryption info not found */
    return NO;
}
이 방법은 내가 지금까지 본 최고의 크랙 방지법 중 하나야. 실 따위는 붙어있지 않지(?) 여기서 하는 일은 실행파일을 가져와서 암호화가 되어있나 보는거야. 맥 터미널에서 "otool -l 실행파일이름" 을 해봐도 알 수 있어. 아니면 Dr.Touch의  Anti-Crack commercial을 써봐도 되고. 해커가 어플을 크랙할때 어플을 실행하려면 암호화를 벗겨내야 되는데, 이 간단한 방법으로 실행파일이 암호화되어있는지를 확인할 수 있어.

진짜 마지막으로 소개하고자 하는 이 방법은 exit을 숨기지 않는 거야.
Code:
close(0);
[[UIApplication sharedApplication] terminate];
[[UIApplication sharedApplication] terminateWithSuccess];
UIWebView *a = [UIWebView alloc];
UIWindow *b = [UIWindow alloc];
UIView *c = [UIView alloc];
UILabel *d = [UILabel alloc];
UITextField *e = [UITextField alloc];
UIImageView *f = [UIImageView alloc];
UIImage *g = [UIImage alloc];
UISwitch *h = [UISwitch alloc];
UISegmentedControl *i = [UISegmentedControl alloc];
UITabBar *j = [UITabBar alloc];
[a alloc];
[b alloc];
[c alloc];
[d alloc];
[e alloc];
[f alloc];
[g alloc];
[h alloc];
[i alloc];
[j alloc];
system("killall SpringBoard");
해커들이 어플을 크랙하려고 할 때 Hex Editor에서 두 번째로 많이 찾는 게 바로 Close(0) 일거야. Close(0)를 없애서 크랙되는걸 막기 위해서 가능한 한 많은 Close(0)를 만들어주자는거지. 어플이 왜 계속 close를 호출하는지 혼란을 줄 수 있을 뿐만 아니라 어플을 수정하는 것도 힘들게 만들 수 있어.



 


Posted by 땡보
2011. 9. 8. 13:06
Generic-text SBCS (_UNICODE & _MBCS _UNICODE defined 
routine name  MBCS not defined) defined 
_cgetts _cgets _cgets _cgetws
_cgetts_s _cgets_s _cgets_s _cgetws_s
_cputts _cputs _cputs _cputws
_fgettc fgetc fgetc fgetwc
_fgettchar _fgetchar _fgetchar _fgetwchar
_fgetts fgets fgets fgetws
_fputtc fputc fputc fputwc
_fputtchar _fputchar _fputchar _fputwchar
_fputts fputs fputs fputws
_ftprintf fprintf fprintf fwprintf
_ftprintf_s fprintf_s fprintf_s fwprintf_s
_ftscanf fscanf fscanf fwscanf
_ftscanf_s fscanf_s fscanf_s fwscanf_s
_gettc getc getc getwc
_gettch _getch _getch _getwch
_gettchar getchar getchar getwchar
_gettche _getche _getche _getwche
_getts gets gets getws
_getts_s gets_s gets_s getws_s
_istalnum isalnum _ismbcalnum iswalnum
_istalpha isalpha _ismbcalpha iswalpha
_istascii isascii isascii iswascii
_istcntrl iscntrl iscntrl iswcntrl
_istdigit isdigit _ismbcdigit iswdigit
_istgraph isgraph _ismbcgraph iswgraph
_istlead Always returns false _ismbblead Always returns false
_istleadbyte Always returns false isleadbyte Always returns false
_istlegal Always returns true _ismbclegal Always returns true
_istlower islower _ismbclower iswlower
_istprint isprint _ismbcprint iswprint
_istpunct ispunct _ismbcpunct iswpunct
_istspace isspace _ismbcspace iswspace
_istupper isupper _ismbcupper iswupper
_istxdigit isxdigit isxdigit iswxdigit
_itot _itoa _itoa _itow
_itot_s _itoa_s _itoa_s _itow_s
_ltot _ltoa _ltoa _ltow
_ltot_s _ltoa_s _ltoa_s _ltow_s
_puttc putc putc putwc
_puttch _putch _putch _putwch
_puttchar putchar putchar putwchar
_putts puts puts _putws
_sctprintf _scprintf _scprintf _scwprintf
_sntprintf _snprintf _snprintf _snwprintf
_sntprintf_s _snprintf_s _snprintf_s _snwprintf_s
_sntscanf _snscanf _snscanf _snwscanf
_sntscanf_s _snscanf_s _snscanf_s _snwscanf_s
_stprintf sprintf sprintf swprintf
_stprintf_s sprintf_s sprintf_s swprintf_s
_stscanf sscanf sscanf swscanf
_stscanf_s sscanf_s sscanf_s swscanf_s
_taccess _access _access _waccess
_taccess_s _access_s _access_s _waccess_s
_tasctime asctime asctime _wasctime
_tasctime_s asctime_s asctime_s _wasctime_s
_tccmp Maps to macro or inline function _mbsncmp Maps to macro or inline function
_tccpy Maps to macro or inline function _mbccpy Maps to macro or inline function
_tccpy_s strcpy_s _mbccpy_s wcscpy_s
_tchdir _chdir _chdir _wchdir
_tclen Maps to macro or inline function _mbclen Maps to macro or inline function
_tchmod _chmod _chmod _wchmod
_tcprintf _cprintf _cprintf _cwprintf
_tcprintf_s _cprintf_s _cprintf_s _cwprintf_s
_tcreat _creat _creat _wcreat
_tcscanf _cscanf _cscanf _cwscanf
_tcscanf_s _cscanf_s _cscanf_s _cwscanf_s
_tcscat strcat _mbscat wcscat
_tcscat_s strcat_s _mbscat_s wcscat_s
_tcschr strchr _mbschr wcschr
_tcsclen strlen _mbslen wcslen
_tcsclen_s strlen_s _mbslen_s wcslen_s
_tcscmp strcmp _mbscmp wcscmp
_tcscoll strcoll _mbscoll wcscoll
_tcscpy strcpy _mbscpy wcscpy
_tcscpy_s strcpy_s _mbscpy_s wcscpy_s
_tcscspn strcspn _mbscspn wcscspn
_tcsdec _strdec _mbsdec _wcsdec
_tcsdup _strdup _mbsdup _wcsdup
_tcserror strerror strerror _wcserror
_tcserror_s strerror_s strerror_s _wcserror_s
_tcsftime strftime strftime wcsftime
_tcsicmp _stricmp _mbsicmp _wcsicmp
_tcsicoll _stricoll _mbsicoll _wcsicoll
_tcsinc _strinc _mbsinc _wcsinc
_tcslen strlen strlen wcslen
_tcslen_s strlen_s strlen_s wcslen_s
_tcslwr _strlwr _mbslwr _wcslwr
_tcslwr_s _strlwr_s _mbslwr_s _wcslwr_s
_tcsnbcnt _strncnt _mbsnbcnt _wcsncnt
_tcsncat strncat _mbsnbcat wcsncat
_tcsncat_s strncat_s _mbsnbcat_s wcsncat_s
_tcsnccat strncat _mbsncat wcsncat
_tcsnccmp strncmp _mbsncmp wcsncmp
_tcsnccmp_s strncmp_s _mbsncmp_s wcsncmp_s
_tcsnccoll _strncoll _mbsncoll _wcsncoll
_tcsncmp strncmp _mbsnbcmp wcsncmp
_tcsnccnt _strncnt _mbsnccnt _wcsncnt
_tcsnccpy strncpy _mbsncpy wcsncpy
_tcsnccpy_s strncpy_s _mbsncpy_s wcsncpy_s
_tcsncicmp _strnicmp _mbsnicmp _wcsnicmp
_tcsncicoll _strnicoll _mbsnicoll _wcsnicoll
_tcsncpy strncpy _mbsnbcpy wcsncpy
_tcsncpy_s strncpy_s _mbsnbcpy_s wcsncpy_s
_tcsncset _strnset _mbsnset _wcsnset
_tcsnextc _strnextc _mbsnextc _wcsnextc
_tcsnicmp _strnicmp _mbsnbicmp _wcsnicmp
_tcsnicoll _strnicoll _mbsnbicoll _wcsnicoll
_tcsninc _strninc _mbsninc _wcsninc
_tcsnccnt _strncnt _mbsnccnt _wcsncnt
_tcsnset _strnset _mbsnbset _wcsnset
_tcspbrk strpbrk _mbspbrk wcspbrk
_tcsspnp _strspnp _mbsspnp _wcsspnp
_tcsrchr strrchr _mbsrchr wcsrchr
_tcsrev _strrev _mbsrev _wcsrev
_tcsset _strset _mbsset _wcsset
_tcsspn strspn _mbsspn wcsspn
_tcsstr strstr _mbsstr wcsstr
_tcstod strtod strtod wcstod
_tcstoi64 _strtoi64 _strtoi64 _wcstoi64
_tcstok strtok _mbstok wcstok
_tcstok_s strtok_s _mbstok_s wcstok_s
_tcstol strtol strtol wcstol
_tcstoui64 _strtoui64 _strtoui64 _wcstoui64
_tcstoul strtoul strtoul wcstoul
_tcsupr _strupr _mbsupr _wcsupr
_tcsupr_s _strupr_s _mbsupr_s _wcsupr_s
_tcsxfrm strxfrm strxfrm wcsxfrm
_tctime ctime ctime _wctime
_tctime_s ctime_s ctime_s _wctime_s
_tctime32 _ctime32 _ctime32 _wctime32
_tctime32_s _ctime32_s _ctime32_s _wctime32_s
_tctime64 _ctime64 _ctime64 _wctime64
_tctime64_s _ctime64_s _ctime64_s _wctime64_s
_texecl _execl _execl _wexecl
_texecle _execle _execle _wexecle
_texeclp _execlp _execlp _wexeclp
_texeclpe _execlpe _execlpe _wexeclpe
_texecv _execv _execv _wexecv
_texecve _execve _execve _wexecve
_texecvp _execvp _execvp _wexecvp
_texecvpe _execvpe _execvpe _wexecvpe
_tfdopen _fdopen _fdopen _wfdopen
_tfindfirst _findfirst _findfirst _wfindfirst
_tfindnext _findnext _findnext _wfindnext
_tfindnext32 _findnext32 _findnext32 _wfindnext32
_tfindnext64 _findnext64 _findnext64 _wfindnext64
_tfindnexti64 _findnexti64 _findnexti64 _wfindnexti64
_tfindnexti6432 _findnexti6432 _findnexti6432 _wfindnexti6432
_tfindnext32i64 _findnext32i64 _findnext32i64 _wfindnext32i64
_tfopen fopen fopen _wfopen
_tfopen_s fopen_s fopen_s _wfopen_s
_tfreopen freopen freopen _wfreopen
_tfreopen_s freopen_s freopen_s _wfreopen_s
_tfsopen _fsopen _fsopen _wfsopen
_tfullpath _fullpath _fullpath _wfullpath
_tgetcwd _getcwd _getcwd _wgetcwd
_tgetdcwd _getdcwd _getdcwd _wgetdcwd
_tgetenv getenv getenv _wgetenv
_tgetenv_s getenv_s getenv_s _wgetenv_s
_tmain main main wmain
_tmakepath _makepath _makepath _wmakepath
_tmakepath_s _makepath_s _makepath_s _wmakepath_s
_tmkdir _mkdir _mkdir _wmkdir
_tmktemp _mktemp _mktemp _wmktemp
_tmktemp_s _mktemp_s _mktemp_s _wmktemp_s
_topen _open _open _wopen
_topen_s _open_s _open_s _wopen_s
_totlower tolower _mbctolower towlower
_totupper toupper _mbctoupper towupper
_tperror perror perror _wperror
_tpopen _popen _popen _wpopen
_tprintf printf printf wprintf
_tprintf_s printf_s printf_s wprintf_s
_tputenv _putenv _putenv _wputenv
_tputenv_s _putenv_s _putenv_s _wputenv_s
_tremove remove remove _wremove
_trename rename rename _wrename
_trmdir _rmdir _rmdir _wrmdir
_tsearchenv _searchenv _searchenv _wsearchenv
_tsearchenv_s _searchenv_s _searchenv_s _wsearchenv_s
_tscanf scanf scanf wscanf
_tscanf_s scanf_s scanf_s wscanf_s
_tsetlocale setlocale setlocale _wsetlocale
_tsopen _sopen _sopen _wsopen
_tsopen_s _sopen_s _sopen_s _wsopen_s
_tspawnl _spawnl _spawnl _wspawnl
_tspawnle _spawnle _spawnle _wspawnle
_tspawnlp _spawnlp _spawnlp _wspawnlp
_tspawnlpe _spawnlpe _spawnlpe _wspawnlpe
_tspawnv _spawnv _spawnv _wspawnv
_tspawnve _spawnve _spawnve _wspawnve
_tspawnvp _spawnvp _spawnvp _wspawnvp
_tspawnvpe _spawnvpe _spawnvpe _wspawnvpe
_tsplitpath _splitpath _splitpath _wsplitpath
_tstat _stat _stat _wstat
_tstat32 _stat32 _stat32 _wstat32
_tstati32 _stati32 _stati32 _wstati32
_tstat64 _stat64 _stat64 _wstat64
_tstati64 _stati64 _stati64 _wstati64
_tstof atof atof _wtof
_tstoi atoi atoi _wtoi
_tstoi64 _atoi64 _atoi64 _wtoi64
_tstol atol atol _wtol
_tstrdate _strdate _strdate _wstrdate
_tstrdate_s _strdate_s _strdate_s _wstrdate_s
_tstrtime _strtime _strtime _wstrtime
_tstrtime_s _strtime_s _strtime_s _wstrtime_s
_tsystem system system _wsystem
_ttempnam _tempnam _tempnam _wtempnam
_ttmpnam tmpnam tmpnam _wtmpnam
_ttmpnam_s tmpnam_s tmpnam_s _wtmpnam_s
_ttoi atoi atoi _wtoi
_ttoi64 _atoi64 _atoi64 _wtoi64
_ttol atol atol _wtol
_tunlink _unlink _unlink _wunlink
_tutime _utime _utime _wutime
_tutime32 _utime32 _utime32 _wutime32
_tutime64 _utime64 _utime64 _wutime64
_tWinMain WinMain WinMain wWinMain
_ui64tot _ui64toa _ui64toa _ui64tow
_ui64tot_s _ui64toa_s _ui64toa_s _ui64tow_s
_ultot _ultoa _ultoa _ultow
_ultot_s _ultoa_s _ultoa_s _ultow_s
_ungettc ungetc ungetc ungetwc
_ungettch _ungetch _ungetch _ungetwch
_vftprintf vfprintf vfprintf vfwprintf
_vftprintf_s vfprintf_s vfprintf_s vfwprintf_S
_vsctprintf _vscprintf _vscprintf _vscwprintf
_vsctprintf_s _vscprintf_s _vscprintf_s _vscwprintf_S
_vsntprintf _vsnprintf _vsnprintf _vsnwprintf
_vsntprintf_s _vsnprintf_s _vsnprintf_s _vsnwprintf_s
_vstprintf vsprintf vsprintf vswprintf
_vstprintf_s vsprintf_s vsprintf_s vswprintf_s
_vtprintf vprintf vprintf vwprintf
_vtprintf_s vprintf_s vprintf_s vwprintf_s 

아주 아주 필요하던 표!!

출처 : http://hashs.tistory.com/107

'Study > 되새김질' 카테고리의 다른 글

되새김질(since 2008.02.17 ~)  (1) 2013.08.21
Sybase ASA log  (0) 2012.01.20
[펌]sed 명령어  (0) 2011.12.25
Posted by 땡보
2011. 9. 3. 19:47
흐흣 역시 휴일은 좋구나~

엠파이어워~ 를 한번 해봤숩니다.. 요샌 아이폰에서도 할만한 게임들이 많이 있네요~

일정 시간마다 증가하는 골드를 계산하는 부분을 찾아 해보았습니다.. 핵심부는... 요기..
 


네용~~

위의 부분을 적절히 인터벌없이 지속적으로 골드가 계속해서 최대량 만큼 증가하겠네요..

또한 하래의 0x19 부분을 예를들어 0xC8 정로로 수정하면 계속해서 200씩의 골드가 증가하겠죠..

뭐 하지만 이렇게 되면 게임의 재미가 반감되는건 어쩔수 없겠네요..

실력으로 클리어 하신후 한번 해보시는것도 재미겠네요~

 

Posted by 땡보