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 땡보
2012. 1. 7. 16:38

'주옥같은사이트주저리' 카테고리의 다른 글

[펌]THUMB Instruction Set  (0) 2012.02.07
[프로그래밍]python 강좌들  (0) 2012.01.28
[펌]Wiki Crack prevention  (0) 2011.12.25
[Link]Anti-unpacking tricks  (0) 2011.12.16
[LINK]유용한 강좌 사이트  (0) 2011.12.13
Posted by 땡보
2012. 1. 7. 16:36






We’ve gone hands-on with Siri Proxy, and the things you can do with this handy tool are amazing.

But as you know, at iDB we don’t like to keep all the good stuff to ourselves. For that reason, we’ve created this comprehensive video tutorial and guide that shows you how to run Siri Proxy on your iPhone 4S.

We show you step-by-step what’s needed to try out Siri Proxy yourself…

Before we get too deep into the tutorial, we want to let you know about a few prerequisites.

1: You don’t have to use Ubuntu, but in order to follow these steps verbosely, you must have an Ubuntu machine, which is free. This install can be done on a Mac, Windows, or Linux machine. In my opinion it is much easier to do this on an Ubuntu installation than anything else, that’s why I selected it to install Siri Proxy. Your Ubuntu installation can be the real thing, or it can be a virtual machine like I have. In order to show you the full start to finish tutorial, I show you how to install Ubuntu using Parallels for Mac as a part of this tutorial. Parallels is a paid app for the Mac, but the good news is that you can download a free 14-day trial, and start using this today.

2: This only works with the iPhone 4S. We haven’t tested it on any other devices, because frankly, it probably wouldn’t work anyway, and it’s not exactly legal.

3: This will only work while connected to your local WiFi network. It’s true that you could get this working remotely with some VPN skills, but I tried to keep this as simple and straightforward as possible.

4: This tutorial only covers the initial install. Later, I’ll show you how to add various plugins to get more out of the experience, as seen here.

5: Anyone can do this. Yes, even you. So don’t be scared, give it a shot.

6: Lastly, we want to thank Pete “Plamoni” Lamonica for creating Siri Proxy, and providing the basis for this tutorial.

How to Install Siri Proxy

Preliminary Steps

Step 1: If you have Ubuntu already installed, great! If not, that’s okay, too. If you’re on a Windows box, you can install Ubuntu outright as if it was just another program. If you’re on a Mac, you can install Ubuntu as a virtual machine using software like Parallels 7 or VMWare Fusion. In this tutorial, I use Parallels.

Step 2: Install the latest Ubuntu updates if applicable. Please see 1:00 on the video tutorial.

Step 3: If you’re using Parallels, or any other virtual machine, you will need to set the Internet connection to bridged mode so that devices on your network can interface directly with the virtual machine. Please see 4:00 on the video tutorial for more info.

Step 4: Setup Dropbox. This is an optional step, but I found it easier than anything else. You must have some way to transfer the certificate that you generate to your iPhone. You can use email if you prefer, but I decided to use DropBox.

Command Line Steps

Each of these steps can be referenced in the video, and each has an accompanying timestamp for ease of reference. Simply copy and paste each of these commands in the Terminal app, and follow any additional instructions if so indicated. Each step has a timestamp that you can reference in the video tutorial to help gather your bearings.

Command 01: Time 5:44
sudo apt-get install dnsmasq ruby build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
Select ‘y’ to continue.

Command 02: Time 6:13
sudo nano /etc/dnsmasq.conf
Find the following line on approximately line 62: #address=/double-click.net/127.0.0.1
Directly beneath that line type: address=/guzzoni.apple.com/(your_machine's_ip_address)
Replace (your_machine’s_ip_address) with the IP address of your machine as shown in the video.
Press control+o, and then return to save. Press control+x to exit back to main terminal prompt.

Command 03: Time 7:42
sudo /etc/init.d/dnsmasq restart
Command 04: Time 7:55
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Command 05: Time 8:20
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Command 06: Time 8:33
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
Command 07: Time 8:47
rvm install 1.9.3
This command takes some time to execute. Be patient, especially on the compiling portion.

Command 08: Time 9:22
rvm use 1.9.3 --default
Command 09: Time 9:32
git clone git://github.com/plamoni/SiriProxy.git
Command 10: Time 9:49
cd SiriProxy
Select 'y' to continue.

Command 11: Time 10:06
rake install
Command 12: Time 10:21
mkdir ~/.siriproxy
Command 13: Time 10:31
cp ./config.example.yml ~/.siriproxy/config.yml
Command 14: Time 10:43
siriproxy gencerts
Command 15: Time 11:04
siriproxy bundle
Command 16: Time 11:23
rvmsudo siriproxy server
This command starts your Siri Proxy Server. It should say "Starting SiriProxy on port 443.."

Setting up the iPhone 4S

Step 1: First you need to grab the certificate we generated in Command 14 above, and install it on your iPhone 4S. You can use Dropbox or Email to transfer this to your iPhone 4S. See the video at 11:40 for more details on this.

The certificate is located at ~/.siriproxy/ca.pem so you will have to view hidden files in order to see this file. Once the certificate is on your iPhone, select install as shown at 12:44 in the video tutorial.

Step 2: In your iPhone 4S's WiFi Settings, select the blue arrow icon next to your active WiFi connection. Remember, you must be connected to the same local network as the Siri Proxy running on your computer. Tap on the DNS section, and edit the DNS entry to point to the IP address of your Siri Proxy server. See the video at 12:59 for more details.

Step 3: Test Siri! Invoke Siri (hold home button on your iPhone 4S) and say "Test Siri Proxy". Siri should respond with: "Siri Proxy is up and running!" You'll also see the terminal window display all of your SpeechPackets from your conversation with Siri.

And that's a wrap folks. I know that seems like a lot of steps, but you can honestly have it running in less than an hour. This is just the beginning though. We now need to get Siri Proxy plugins installed so we can start to reap the benefits of this powerful tool. Stay tuned, we'll be back with tutorials on how to install Siri Proxy Plugins in the near future.

Were you able to get your Siri Proxy running? Let us know in the comments below.


Link : http://www.idownloadblog.com/2011/12/09/how-to-install-siri-proxy-tutorial-video/
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. 25. 08:51

Crack prevention

From iPhone Development Wiki

Jump to: navigation, search

How cracking works

Redistribution

The first step of crackers is to get the redistributable files. Crackulous and AppCrack are the notorious examples of cracking the DRMs and get the redistributable IPAs for installation on unauthorized devices.

AppStore

AppStore apps are all encrypted when downloaded, to prevent reverse engineering, and ensure every account can only run their own copy. The CPU, however, is unable to run encrypted instructions. Everything must be decrypted by the time it is loaded into the RAM. Crackers exploit this fact, and uses GDB to dump the decrypted data, so that these apps can be run anywhere.

In detail, every protected app has an LC_ENCRYPTION_INFO load command. This load command looks like:

#define LC_ENCRYPTION_INFO 0x21
struct encryption_info_command {
  uint32_t cmd;
  uint32_t cmdsize;
  uint32_t cryptoff;   // file offset of first encrypted byte
  uint32_t cryptsize;  // file size of encrypted data
  uint32_t cryptid;    // method of encryption
};

when the binary is encrypted, this load command must exist, and all the 3 crypt*** fields are nonzero. For deCrypt, xCrack and alike, the GDB command to get the dump is like this:

set sharedlibrary load-rules ".*" ".*" none # Don't load any symbols and libraries automatically
set inferior-auto-start-dyld off
set sharedlibrary preload-libraries off
set sharedlibrary load-dyld-symbols off
handle all nostop                           # Ignore all terminating signals.
rb doModInitFunctions                       # Breaks when dyld starts.
command 1                                   # When the breakpoint is reached, dump the encrypted content and quit.
  dump memory output.bin 0x2000 (cryptsize + 0x2000)
  kill
  quit
end
start

This script will execute before the app's user code comes into play, and therefore you have no chance to deploy a working prevention against it (PT_DENY_ATTACH won't work).

CydiaStore and RockApp

CydiaStore and RockApp, in a nutshell, are just repositories with a secure, authenticated connection on top of the usual APT/DPKG system. Unlike AppStore there isn't additional encryption/DRM. Therefore all the crackers need is to obtain the download .deb file.

Crack prevention

General techniques

All anti-piracy checking won't 100% prevent crackers because they have total access to your code. But they can delay the cracks from appearing early and hurt legitimate sales.

Multi-pass check

To make crackers a hard day a simple method is to have multitudes of checks at different locations. A convenient method is to define an always inline function, e.g.

__attribute__((always_inline)) void check_crack(symbol, length, result) {
  if (checksum(symbol, length) != result)
    exit(0);
}
...
check_crack(my_inline_uuid_check, 0x200, 0x12345678);
register int res = my_inline_uuid_check();
...
check_crack(my_inline_serial_number_check, 0x200, 0x87654321);
...

The key point here is always_inline. Without inlining, the cracker could simply patch the check_crack() function to do nothing and your anti-crack will fail immediately.

Do not make the check computationally too expensive, otherwise legitimate users will be affected too.

Anti-redistribution

These are methods which can delay the time the first redistributable copy appear.


Anti-analysis

Avoids your binary being analyzed.

Malformed Mach-O Binaries

Many reverse engineering tools, including otool, gdb, class-dump, etc. will blindly trust the Mach-O file to be well-formed. If a Mach-O file is malformed these tools will fail to work. On the other hand, the kernel is more resistant to these corruptions, making it viable to be run.

One proved method is to set a wrong value to the number of sections in a segment command. Unfortunately, both ldid and dyld cannot recover from this kind of error, making such binaries not runnable nor linkable. But you can do the following to get your dylib/executable working: ldid -S the binary, modify nsects and then recreate the SHA with ldid -s. After that the binary is fully usable on the iDevice.

Crackers can simply fix the count to perform their analysis.

PT_DENY_ATTACH

PT_DENY_ATTACH[1] is an Apple-specific constant that can prevent debuggers (gdb, DTrace, etc.) from debugging your binary in kernel-level. Calling

ptrace(PT_DENY_ATTACH, 0, 0, 0);

will send a SEGFAULT to its tracing parent. Nevertheless, since ptrace has a well-defined address, a simple GDB macro is enough to break this[2]:

break ptrace
commands 1
   return
   continue
end

Nevertheless, since the ptrace is built inside the kernel, which the userspace interface only performs syscall 26[3], as long as your assembly code resembles

mov r0, #31
mov r1, #0
mov r2, #0
mov r3, #0
mov ip, #26
svc #0x80

the PT_DENY_ATTACH will be installed and there is no way GDB can workaround it. The cracker can still use patching techniques to nop out the svn #0x80 instructions, but checksumming would help in these cases. Also make sure you don't compile your binary in thumb, cause the compiler will fail due to limited availability of registers in thumb mode.

Obfuscation

Strip symbols

Stripping symbols makes it hard to guess the purpose of a routine.

Minimize use of Objective-C

To support the runtime features, Objective-C-based binaries need to retain a lot of class information, which is enough to rebuild the class interface. These information cannot be stripped away. Therefore, all essential stuff should be done using C or C++.

Generate strings dynamically

Even if you have stripped the binary, there is must still be a constant string pool. If you use some visual technique to inform the user they're using a cracked version, the crackers can quickly track down where the view is generated with strings and disable your check.

Legitimacy check

Check if encryption is intact

This is only meaningful for AppStore apps. If the binary is not yet decrypted, the LC_ENCRYPTION_INFO load command should still exist and all its fields are nonzero. There is a sample code in http://landonf.bikemonkey.org/2009/02/index.html showing how to check this.


Deprecated or not working methods

Kali Anti-Piracy

Kali Anti-Piracy, developed by RiP-Dev, was the first generic AppStore crack prevention mechanism announced. Since RiP-Dev has been closed down, Kali's status is doubtful enough to be considered obsoleted.

Kali has 3 levels of protection[4]:

  • Anti-debugging
  • Anti-dumping
  • Integrity check and dynamic code generation.


References

  1. http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man2/ptrace.2.html
  2. http://steike.com/code/debugging-itunes-with-gdb/
  3. http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/kern/syscalls.master
  4. http://www.iclarified.com/entry/index.php?enid=3058 


원문 : http://iphonedevwiki.net/index.php/Crack_prevention

Posted by 땡보
2011. 12. 16. 08:35
Link : http://pferrie.tripod.com/papers/unpackers.pdf
Posted by 땡보
2011. 12. 13. 16:25
Posted by 땡보
2011. 12. 10. 00:09
Posted by 땡보