home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / pc / crack / crak1.doc < prev    next >
Encoding:
Text File  |  2003-06-11  |  10.0 KB  |  268 lines

  1.   Chapter I                                        How to Crack
  2.  
  3.  
  4.      -------------------------------------------------------------
  5.      Let's start with a simple introduction to patching a  program
  6.      using the DOS DEBUG program.  The following article will  in-
  7.      troduce you to the basic ideas and concepts of looking for  a
  8.      certain area of a program and making a patch to it.
  9.      -------------------------------------------------------------
  10.  
  11.  
  12.      By:            Charles Petzold / Specular Vision
  13.      Title:         Case Study: A Colorful CLS
  14.  
  15.        This article originally appeared in the Oct.  14,1986 Issue
  16.      of PC Magazine (Vol 15. Num 17.). Written by Charles Petzold.
  17.  
  18.        The hardest part of patching existing programs is determin-
  19.      ing  where the patch should go.  You really have to  make  an
  20.      intelligent guess about the functioning of the program.
  21.  
  22.        As an example,  let's attempt to modify COMMAND.COM so that
  23.      is colors the screen on a CLS command.   As with any type  of
  24.      patch try it out on a copy and NOT the original.
  25.  
  26.        First, think about what we should look for.  CLS is differ-
  27.      ent from all the other DOS internal Commands,  It is the only
  28.      internal command that does something to the screen other than
  29.      just write to it with simple teletype output.  CLS blanks the
  30.      screen and homes the cursor.   Since it can't do this through
  31.      DOS Calls (unless ANSI.SYS is loaded), it is probably calling
  32.      the BIOS Directly.   The BIOS Interrupt 10h call controls the
  33.      video,  and so the CLS command probably uses several INT  10h
  34.      instructions.  The machine code for INT 10h is CD 10.
  35.  
  36.        (While  this  same method will work under  any  version  of
  37.      PC-DOS,  Version 2.0 and later, the addresses I'll  be  using
  38.      are from PC-DOS 3.1. Other versions of PC-DOS(or MS-DOS) will
  39.      have  different addresses;  you should be absolutely  certain
  40.      that you're using the correct addresses.)
  41.  
  42.        Load COMMAND.COM into DEBUG:
  43.  
  44.                     DEBUG COMMAND.COM
  45.  
  46.      and do an R (Registers) command.  The size of COMMAND.COM  is
  47.      in  register CX.   For DOS 3.1's COMMAND.COM,  this value  is
  48.      5AAA.
  49.  
  50.        Now do Search command to look for the CD 10 bytes:
  51.  
  52.                     S 100 L 5AAA CD 10
  53.  
  54.      You'll get a list of six addresses, all clustered close to-
  55.  
  56.                                    4
  57.      gether.  The first one is 261D. You can now pick an address a
  58.      little before that (to see what the first call is doing)  and
  59.      start disassembling:
  60.  
  61.                     U 261B
  62.  
  63.       The  first INT 10 has AH set to 0F which is a Current  Video
  64.      State  call.   The code checks if the returned  value  of  AL
  65.      (Which  is  the  video mode) is less than 3 or  equal  to  7.
  66.      These are the text modes.   If so,  it branches to 262C.   If
  67.      not, it just resets the video mode with another INT 10 at ad-
  68.      dress 2629.
  69.  
  70.        At 262C,  the code first sets the border black (the INT  10
  71.      at  2630),  then does another Current Video  State  call  (at
  72.      2634) to get the screen width in register AH.  It uses infor-
  73.      mation from this call to set DX equal to the bottom right row
  74.      and column.   It then clears the screen by scrolling the  en-
  75.      tire screen up with another INT 10 (at 2645),  and then  sets
  76.      the cursor to the zeroth row and zeroth column with the final
  77.      INT 10 (at 264D).
  78.  
  79.        When it scrolls the whole screen, the zero value in AL  ac-
  80.      tually  means blank the screen,  the value of BH is  the  at-
  81.      tribute  to be used on the blanked area.   In  an  unmodified
  82.      COMMAND.COM,  BH is set to 7 (Which is white on black) by the
  83.      following statement at address 2640:
  84.  
  85.                     MOV  BX,0700
  86.  
  87.        If  you  prefer a yellow-on-blue attribute  (1E),  you  can
  88.      change this line by going into Assemble mode by entering:
  89.  
  90.                     A
  91.  
  92.      then entering
  93.  
  94.                     MOV  BX,1E00
  95.  
  96.      and exiting Assemble mode by entering a blank line.
  97.  
  98.        Now you can save the modified file:
  99.  
  100.                     W
  101.  
  102.      and quit DEBUG:
  103.  
  104.                     Q
  105.  
  106.        When  you load the new version of COMMAND.COM (and you  can
  107.      do so without rebooting by just entering:
  108.  
  109.                     COMMAND
  110.  
  111.  
  112.                                    5
  113.      on  the DOS command level),  a CLS will turn the screen  blue
  114.      and display characters as yellow.
  115.  
  116.        If it doesn't or if anything you type shows up as white  on
  117.      black,  that probably means you have ANSI.SYS loaded.  If you
  118.      use ANSI.SYS,  you don't have to make this patch but can  in-
  119.      stead use the prompt command for coloring the screen.
  120.  
  121.      END.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.                                    6
  169.      -------------------------------------------------------------
  170.      That was just one section of a very large article that helped
  171.      me  to get started.   Next we'll look at two other  articles,
  172.      both written by Buckaroo Banzi.   These two articles  CRACK-1
  173.      and  CRACK-2 give you an introduction to the  different  copy
  174.      protection schemes used on IBM PC's, and how to find and  by-
  175.      pass them.
  176.      -------------------------------------------------------------
  177.  
  178.  
  179.  
  180.      By:            Buckaroo Banzai
  181.      Title:         Cracking On the IBM PC Part I
  182.  
  183.  
  184.      Introduction
  185.      ------------
  186.        For  years,  I have seen cracking tutorials for  the  APPLE
  187.      computers,  but never have I seen one for the PC.  I have de-
  188.      cided to try to write this series to help that pirate move up
  189.      a level to a crackest.
  190.  
  191.        In this part, I will cover what happens with INT 13 and how
  192.      most copy protection schemes will use it.  I strongly suggest
  193.      a  knowledge of Assembler (M/L) and how to use  DEBUG.  These
  194.      will be an important figure in cracking anything.
  195.  
  196.  
  197.      INT-13 - An overview
  198.      --------------------
  199.  
  200.        Many  copy  protection  schemes  use  the  disk   interrupt
  201.      (INT-13).  INT-13 is often use to either try to read in a il-
  202.      legally   formatted   track/sector  or  to   write/format   a
  203.      track/sector that has been damaged in some way.
  204.  
  205.        INT-13 is called like any normal interrupt with the  assem-
  206.      bler  command INT 13 (CD 13).  [AH] is used to  select  which
  207.      command to be used, with most of the other registers used for
  208.      data.
  209.  
  210.      INT-13 Cracking College
  211.      -----------------------
  212.        Although,  INT-13 is used in almost all protection schemes,
  213.      the easiest to crack is the DOS file.  Now the protected pro-
  214.      gram  might use INT-13 to load some other data from a  normal
  215.      track/sector on a disk, so it is important to determine which
  216.      tracks/sectors  are  important to the protection  scheme.   I
  217.      have  found  the best way to do this is to  use  LOCKSMITH/pc
  218.      (what, you don't have LS. Contact your local pirate for it.)
  219.  
  220.        Use LS to analyze the diskette. Write down any track/sector
  221.      that seems abnormal.  These track are must likely are part of
  222.      the protection routine.   Now, we must enter debug. Load in
  223.  
  224.                                    7
  225.      the  file  execute a search for CD 13.   Record  any  address
  226.      show.
  227.  
  228.        If no address are picked up,  this mean 1 or 2 things,  the
  229.      program is not copy protected (right...) or that the check is
  230.      in an other part of the program not yet loaded.   The  latter
  231.      being  a real hassle to find,  so I'll cover it in  part  II.
  232.      There is another choice.   The CD 13 might be hidden in  self
  233.      changing  code.   Here is what a sector of hidden code  might
  234.      look like
  235.  
  236.      -U CS:0000
  237.      1B00:0000 31DB     XOR    BX,BX
  238.      1B00:0002 8EDB     MOV    DS,BX
  239.      1B00:0004 BB0D00   MOV    BX,000D
  240.      1B00:0007 8A07     MOV    AL,[BX]
  241.      1B00:0009 3412     XOR    AL,12
  242.      1B00:000B 8807     MOV    [BX],AL
  243.      hip, The - WWIV............................................314-644-5777
  244. First Capitol Computer............................................314-928-9228
  245. Fishing Pond, The - WWIV..........................................314-846-4031
  246. Flash BBS, The (B)................................................314-275-2040
  247. Flo Valley LongShips - WWIV.......................................314-595-4489
  248. Forgotten Realm, The - WWIV.......................................314-838-5116
  249. Freedom Station - TAG.............................................314-677-8284
  250. Frog, The.........................................................314-776-0321
  251. Future BBS, The...................................................314-921-6867
  252. Games Depot (*)...................................................314-576-7686
  253. Gateway Area Mac Users' Group.....................................314-997-6912
  254. Gateway City......................................................314-647-3290
  255. Ghost Wheel.......................................................314-427-4119
  256. Glass Menagerie (?)...............................................314-423-5787
  257. Harris-Stowe State College - WWIV.................................314-533-3158
  258. Heath Users' Group................................................314-291-8653
  259. Hoops BBS, The - WWIV.............................................314-428-5209
  260. IBM PC Users' Group - Maximus.....................................314-928-9993
  261. Information Exchange, The ($) - WWIV..............................314-845-2780
  262. Java Shoppe.......................................................314-772-5073
  263. Junk Drawer - MTAB................................................314-434-4034
  264. Just Crumbs.......................................................314-595-2002
  265. KAYPRO Users' Group...............................................314-821-0638
  266. Ken's Survivalist - TBBS..........................................314-821-2815
  267. Kingdom of Darkness, The - WWIV...................................314-225-1721
  268. Kirkwood Community BBS.................................