home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / CRACK / JOHN14.ZIP / DOC.ZIP / john.doc next >
Encoding:
Text File  |  1997-02-27  |  44.8 KB  |  1,064 lines

  1.  
  2.     John the Ripper v1.4
  3.    ----------------------
  4.  
  5. ==========================
  6.  What is John the Ripper?
  7. ==========================
  8.  
  9. John the Ripper is a UNIX password cracker, currently available for UNIX
  10. (tested with Linux x86, FreeBSD x86, Solaris 2.x SPARC, OSF/1 Alpha), DOS,
  11. WinNT/Win95.
  12.  
  13. I assume that you have already used some UNIX password crackers, so I'll
  14. only describe the things specific to John.
  15.  
  16. ==============================
  17.  What's new since version 1.3
  18. ==============================
  19.  
  20. - MD5 based password files support;
  21. - SPARC V8 assembly version;
  22. - a lot of bugfixes.
  23.  
  24. ==========
  25.  Overview
  26. ==========
  27.  
  28. John the Ripper is designed to be both powerful and fast. It combines
  29. several cracking modes in one program, and is fully configurable for your
  30. particular needs (you can even code a custom cracking mode using the built
  31. in C compiler). Also, John is available for several different platforms,
  32. which enables you to use the same cracker everywhere (for example even
  33. continue a cracking session that you started on another platform).
  34.  
  35. John's crypt() routine is highly optimized for faster operation, which
  36. makes John run much faster than other crackers. This applies to both the
  37. assembly versions, and the portable pure C one.
  38.  
  39. John the Ripper supports the following cracking modes:
  40. - wordlist with or without rules;
  41. - "single crack", makes use of the login/GECOS information;
  42. - incremental, tries all character combinations;
  43. - external, allows you to define your own cracking mode.
  44.  
  45. ================
  46.  How to install
  47. ================
  48.  
  49. With binary distributions, just copy all the files to a separate directory.
  50. Then extract the common files there (supplied in a separate archive). You
  51. might also need a 'chmod +x john' depending on the archive type used.
  52.  
  53. To compile the sources, just enter the directory you extracted them to, and
  54. type 'make'. You'll get a list of systems supported. Select one of those,
  55. or try 'make generic' if your system is not listed. Be sure to use GCC and
  56. GNU make (you might have to type the full path to 'make', since '/bin/make'
  57. is often also present and is not what you need).
  58.  
  59. ============
  60.  How to use
  61. ============
  62.  
  63. I intentionally made John's command line interface be a lot like Cracker
  64. Jack's so that it's easier to start using John for those who have used
  65. Cracker Jack before. Anyway, here's a short description of John's features
  66. including those that are the same as Cracker Jack's.
  67.  
  68. To use John the Ripper, you need to supply it some password files, and a
  69. cracking mode. Cracked passwords will be printed on the screen and saved
  70. in file called ~/john.pot (in this text '~' means John's "home directory",
  71. i.e. the directory you put John's binary in). This file is also used not
  72. to load the accounts you already cracked if you run John again on the same
  73. password file. To retrieve the cracked passwords from ~/john.pot, use the
  74. '-show' option.
  75.  
  76. While cracking, you can press the Enter key for status, or Ctrl+C to abort
  77. the session, saving point information to a file (~/restore by default).
  78. By the way, if you press Ctrl+C twice John will abort immediately without
  79. saving. The point information is also saved every 10 minutes in case of a
  80. crash.
  81.  
  82.  Command line options
  83. ----------------------
  84.  
  85. You can specify some of the following options on John's command line (all
  86. of them are case sensitive, and can be abbreviated):
  87.  
  88.        -pwfile:<file>[,..]     specify passwd file(s) (wildcards allowed)
  89.  
  90. This option is used to specify the password files to be cracked (actually,
  91. anything on the command line that is not starting with a dash will be used
  92. as a password file name).
  93.  
  94.        -wordfile:<file> -stdin wordlist mode, read words from <file> or stdin
  95.  
  96. These are used to enable the wordlist mode.
  97.  
  98.        -rules                  enable rules for wordlist mode
  99.  
  100. Enables rules (like in Crack by Alec Muffett). The rules are stored in
  101. ~/john.ini, in section [List.Rules:Wordlist].
  102.  
  103.        -incremental[:<mode>]   incremental mode [using john.ini entry <mode>]
  104.  
  105. Enables the incremental mode, using the specified ~/john.ini definition
  106. (section [Incremental:<mode>], where <mode> is what you specify on the
  107. command line, [Incremental:All] by default).
  108.  
  109.        -single                 single crack mode
  110.  
  111. Enables the "single crack" mode, using rules from [List.Rules:Single].
  112.  
  113.        -external:<mode>        external mode, using john.ini entry <mode>
  114.  
  115. Enables an external mode, using external functions defined in ~/john.ini's
  116. [List.External:<mode>].
  117.  
  118.        -restore[:<file>]       restore session [from <file>]
  119.  
  120. Continues an interrupted cracking session, reading point information from
  121. the specified file (~/restore by default).
  122.  
  123.        -makechars:<file>       make a charset, <file> will be overwritten
  124.  
  125. Generates a charset file, based on character frequencies from ~/john.pot,
  126. for use with the incremental mode. The entire ~/john.pot will be used for
  127. the charset file unless you specify some password files. You can also use
  128. an external filter() routine with this option.
  129.  
  130.        -show                   show cracked passwords
  131.  
  132. Shows the cracked passwords in a convenient form. You should also specify
  133. the password files.
  134.  
  135.        -test                   perform a benchmark
  136.  
  137. Benchmarks the performance critical routines and prints a table of estimated
  138. cracking speed values for different number of accounts and salts.
  139.  
  140. For those unfamiliar with password crackers internals: xform1() and xform2()
  141. are the actual encryption routines, called for each key/salt pair, while
  142. setkey() is called for each word only, meaning that xform1() or xform2()
  143. (depending on the cracking mode used) are the only routines that will affect
  144. cracking speed if there're enough salts loaded. By the way, setkey() is
  145. benchmarked assuming that words differ by 1 character in length, and 1 more
  146. character replaced -- when using with xform2(), and that passwords are 8
  147. characters long and are totally different (no matching characters) -- when
  148. using with xform1(). When cracking MD5 based password files, md5crypt() is
  149. used instead of all the other routines.
  150.  
  151.        -users:<login|uid>[,..] crack this (these) user(s) only
  152.  
  153. Allows you to filter a few accounts for cracking, or for '-show'.
  154.  
  155.        -shells:[!]<shell>[,..] crack users with this (these) shell(s) only
  156.  
  157. This option is useful to crack/show accounts with the required shell only,
  158. or not to crack/show accounts with a bad shell ('!' before a shell name
  159. means 'not'). You can omit the path before a shell name, so '-shells:csh'
  160. will match both '/bin/csh' and '/usr/bin/csh', while '-shells:/bin/csh' will
  161. only match '/bin/csh'.
  162.  
  163.        -salts:[!]<count>       crack salts with at least <count> accounts only
  164.  
  165. This feature sometimes allows to achieve better performance. For example
  166. you can crack only some salts using '-salts:2' faster, and then crack the
  167. rest using '-salts:!2'. Total cracking time will be about the same, but
  168. you will get some accounts cracked earlier, and may not need the rest.
  169.  
  170.        -lamesalts              assume cleartext passwords were used as salts
  171.  
  172. Don't use this option unless you know what you're doing.
  173.  
  174.        -timeout:<time>         abort session after a period of <time> minutes
  175.  
  176. This will cause John to terminate after the specified time has elapsed.
  177.  
  178.        -list                   list each word
  179.  
  180. Prints each word being checked on the standard output. This is useful for
  181. checking if your custom cracking mode works correctly.
  182.  
  183.        -beep -quiet            beep or don't beep when a password is found
  184.  
  185. The default can be altered in ~/john.ini.
  186.  
  187.        -noname -nohash         don't use memory for login names or hash tables
  188.  
  189. You might need these if you don't have enough RAM. Note that '-noname' will
  190. not work with the "single crack" mode, since login names are used while
  191. cracking.
  192.  
  193.        -des -md5               force DES or MD5 mode
  194.  
  195. These two options allow you to override the encryption method detection. Note
  196. that John can't crack password files with different encryption methods at the
  197. same time.
  198.  
  199.  Additional utilities
  200. ----------------------
  201.  
  202. There're some symlinks to John's binary that might also be useful:
  203.  
  204.        xtract [source] [> <target>]
  205.  
  206. Extracts words from a text file (or stdin), to be used as a wordlist. Dupes
  207. are not removed, you'll also need to do a 'sort -u' on the output (in UNIX).
  208.  
  209.        unshadow <passwd> <shadow> [> <target>]
  210.  
  211. Combines the passwd and shadow files (when you already have access to both)
  212. for use with John. You might need this since if you only used shadow file,
  213. the GECOS information wouldn't be used by the "single crack" mode, and also
  214. you wouldn't be able to use the '-shells' option.
  215.  
  216. ================
  217.  Cracking modes
  218. ================
  219.  
  220. The mode descriptions here are short, and only cover the basic things.
  221. You should check the "Customizing" section below for more information.
  222.  
  223.  Wordlist mode
  224. ---------------
  225.  
  226. This is the simplest cracking mode supported by John. All you need is
  227. specify a wordlist (text file containing one word per line), and some
  228. password files. You can enable rules (which are used to modify words) if
  229. desired, they will then be applied to every word in the list.
  230.  
  231. The wordlist should not contain dupes. John doesn't sort the words not
  232. to use too much RAM, since that would require at least loading the entire
  233. wordlist to memory, while now it's read from disk while cracking. Also,
  234. leaving the words order as it is allows you to put frequent words first.
  235. However, if you don't place words in a reasonable order, it is better if
  236. you sort the wordlist alphabetically (John runs a bit faster if each word
  237. it tries only differs from the previous one by a few characters, this is
  238. especially noticable when cracking only a few accounts at a time).
  239.  
  240. However, you shouldn't bother about words longer than 8 characters being
  241. effectively the same password if their first 8 characters match. John can
  242. handle this situation (and only try the password once) if such words are
  243. going one immediately after the other (i.e. when the wordlist is sorted).
  244. You'd better not truncate words to 8 characters in your wordlist, since
  245. the rest may be needed when you use the rules.
  246.  
  247.  "Single crack" mode
  248. ---------------------
  249.  
  250. This is the mode you should start cracking with. It will try using the
  251. login/GECOS information as passwords. Since the information is only used
  252. on the account it was taken from (and on accounts with the same salt,
  253. which takes almost no extra time), "single crack" mode is much faster
  254. than the wordlist mode, which allows using a lot of rules (they are
  255. always enabled for this mode) in a reasonable time. Of course, this will
  256. only get those passwords that are based on the information used.
  257.  
  258. Note that running this mode on many password files at the same time may
  259. sometimes get more accounts cracked than you would get if you ran it on
  260. the files separately.
  261.  
  262. It might be a good idea not to run through all the rules, but specify a
  263. timeout, and then go to other modes. The rules should be sorted by the
  264. number for successful cracks for this case.
  265.  
  266. Cracker Jack users must also note that John's "single crack" mode is
  267. totally different (better) from Jack's. It doesn't require a special
  268. wordlist since the rules support is built into John.
  269.  
  270.  Incremental mode
  271. ------------------
  272.  
  273. This is the most powerful cracking mode, it can try all possible character
  274. combinations as passwords. However, it is assumed that cracking with this
  275. mode will never terminate due to the number of combinations being too large
  276. (actually, it will terminate if you set a low password length limit, or let
  277. it use a small charset), and you'll have to interrupt it earlier.
  278.  
  279. That's why this mode deals with character frequency tables -- to get as many
  280. passwords as possible within a limited time.
  281.  
  282. To use the mode you need a specific definition for the mode's parameters
  283. (including password length limits and the charsets). These parameters are
  284. defined in ~/john.ini's sections called [Incremental:<mode>], where <mode>
  285. is any identifier that you assign to the mode (it's the one you'll have to
  286. specify on John's command line). You can use a pre-defined incremental mode
  287. definition, or define a custom one.
  288.  
  289. Once you have the definition, all you need is specify the incremental mode
  290. option, the mode's identifier and some password files on the command line.
  291.  
  292.  External mode
  293. ---------------
  294.  
  295. You can define an external cracking mode for use with John. This is done
  296. with ~/john.ini's sections called [List.External:<mode>], where <mode> is
  297. any identifier that you assign to the mode. The section should contain some
  298. functions that John will use to generate the words it tries. These functions
  299. are coded in a subset of the C language, and are compiled by John at startup
  300. (if you enable the mode on John's command line).
  301.  
  302. =============
  303.  Customizing
  304. =============
  305.  
  306. John the Ripper's behavior can be customized by editing its configuration
  307. file, ~/john.ini. You can specify defaults for command line options, some
  308. other John's options that are not accessible from its command line, define
  309. parameters for incremental modes, define rules for wordlist and "single
  310. crack" modes, or even define a new cracking mode.
  311.  
  312. The configuration file consists of several sections. Each section starts
  313. with a line containing its name, in brackets. Sections consist of either
  314. value assignments to some variables (in form 'variable = value'), or some
  315. other text specific to particular section's type (names of such sections
  316. start with a 'list.'). Section and variable names are not case sensitive.
  317. Lines starting with '#' or ';' and empty lines are ignored, you can use
  318. them for comments, or to comment out lines that you don't want to delete
  319. completely.
  320.  
  321.  General options
  322. -----------------
  323.  
  324. Defaults for some command line options can be defined in the [Defaults]
  325. section. You can define the following variables:
  326.  
  327. Wordfile   Set to your wordlist file name. This will assume the wordlist
  328.            mode by default - no need to use the '-wordfile' command line
  329.            option unless you want to override this default value.
  330.  
  331. Timeout    Set to the value in minutes. This will enable the timeout for
  332.            all modes by default.
  333.  
  334. Beep       Set to something starting with 'Y' or 'N' (I hope the meaning
  335.            is clear) to specify whether to beep when a password is found or
  336.            not. This default can be overridden with the '-beep' and '-quiet'
  337.            command line options. If you omit this variable definition, the
  338.            default will be not to beep.
  339.  
  340. Some other options can be defined in the [Options] section:
  341.  
  342. Realtime   Set to 'Y' to show elapsed time as D:HH:MM:SS instead of just
  343.            seconds (as Jack does).
  344.  
  345. Percent    Set to 'Y' to show the progress indicator.
  346.  
  347.  Incremental mode parameters
  348. -----------------------------
  349.  
  350. To define the incremental mode parameters you need to create a section
  351. called [Incremental:<mode>], where <mode> is any identifier that you assign
  352. to the mode. There're some pre-defined incremental modes in the default
  353. configuration file supplied with John, you can use them as templates. The
  354. following parameters are supported:
  355.  
  356. CharCount  Allows you to limit the number of different characters used, to
  357.            make John start trying longer passwords earlier. This can also
  358.            expand the charsets to the specified size when using an external
  359.            charset file which only defines less than CharCount characters.
  360.            By default (when this parameter is not defined) all the defined
  361.            characters will be used.
  362.  
  363. MinLen     Minimum password length, in characters (1 by default).
  364.  
  365. MaxLen     Maximum password length, in characters (8 by default).
  366.  
  367. Wordlike   Set to 'Y' to enable a simple built in word filter (words with
  368.            more than one vowel in a row, or more than two non-vowels in a
  369.            row, will get filtered out).
  370.  
  371. File       External charset file name (the file is loaded from ~ unless full
  372.            path is specified). Setting this parameter disables the charsets
  373.            defined inside the configuration file.
  374.  
  375. CharsetNM  (where N and M are digits, 1 <= N <= 8, 1 <= M <= N) Defines a
  376.            charset for password length N, character position M. The order
  377.            of characters is important, more frequent characters should be
  378.            placed first. The charsets don't have to be the same size.
  379.  
  380.  Wordlist rules
  381. ----------------
  382.  
  383. The rules for wordlist and "single crack" modes are defined in separate
  384. sections called [List.Rules:Wordlist] and [List.Rules:Single] respectively.
  385. I used an extended Crack (by Alec Muffett) syntax, since many of you might
  386. be already familiar with it. I added some more rules, and (most important)
  387. a preprocessor, which generates multiple rules from a single source line.
  388. When defining rules, simply place one rule (which may include preprocessor
  389. commands) per line. Each rule consists of one or more simple commands. The
  390. following commands are supported (most of the descriptions are copied from
  391. Crack's dicts.rules, however the code is my own, and is faster than that
  392. from Crack):
  393.  
  394. Ordinary commands:
  395. :       no-op - do nothing to the input word
  396. <n      reject word unless it is < n characters long, where n = 0-9
  397. >n      reject word unless it is > n characters long, where n = 0-9
  398. ^x      prepend character 'x' to word
  399. $y      append character 'y' to word
  400. l       force word to be lowercase
  401. u       force word to be uppercase
  402. c       force word to be capitalized
  403. r       reverse word: "Fred" -> "derF"
  404. d       duplicate word: "Fred" -> "FredFred"
  405. f       reflect word: "Fred" -> "FredderF"
  406. p       make best attempt to pluralize a lowercase word
  407. onx     overstrike character in position n (start at 0) with character 'x'
  408. inx     insert character 'x' in position n (start at 0) and shift the rest
  409.         of the input string right
  410.         nb: if n > strlen(input), character 'x' will be appended
  411. xnm     extract substring from position n (start at 0) for up to m characters
  412.  
  413. Commands which may use character classes:
  414. sxy     replace (swap) all characters 'x' in the word with 'y'
  415. s?cy    replace all characters of class 'c' in the word with 'y'
  416. @x      purge all characters 'x' from the word
  417. @?c     purge all characters of class 'c' from the word
  418. !y      reject word if it contains character 'y'
  419. !?c     reject word if it contains a character in class 'c'
  420. /x      reject word unless it contains character 'x'
  421. /?c     reject word unless it contains a character in class 'c'
  422. =nx     reject word unless character at position n is equal to 'x'
  423. =n?c    reject word unless character at position n is in class 'c'
  424.         nb: the word always starts at position 0
  425.  
  426. Character classes for use in the above commands:
  427. ??      matches '?'
  428. ?v      matches vowels: "aeiouAEIOU"
  429. ?c      matches consonants: "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
  430. ?w      matches whitespace: " \t"
  431. ?p      matches punctuation: ".,:;'\"?!`"
  432. ?s      matches symbols "$%^&*()-_+=|\\<>[]{}#@/~"
  433. ?l      matches lowercase letters ('a' to 'z')
  434. ?u      matches uppercase letters ('A' to 'Z')
  435. ?d      matches digits ('0' to '9')
  436. ?a      matches letters ('a' to 'z' and 'A' to 'Z')
  437. ?x      matches letters and digits ('a' to 'z', 'A' to 'Z' and '0' to '9')
  438. The complement of a class may be matched by the uppercase of its letter,
  439. i.e.: where ?d == DIGITS, ?D == NON-DIGITS, and so on.
  440.  
  441. All the commands described above are the same as in Crack v4.1, while the
  442. following ones are added in John (not very useful, I admit, most of the
  443. required stuff was already implemented in Crack v4.1):
  444.  
  445. {       shift word left: "jsmith" -> "smithj", etc
  446. }       shift word right: "smithj" -> "jsmith", etc
  447. Dn      delete character in position n (start at 0) and shift the rest of
  448.         the input string left
  449. P       "crack" -> "cracked", etc (lowercase only)
  450. G       "crack" -> "cracking", etc (lowercase only)
  451. ~i      invert case, by keyboard: "Crack96" -> "cRACK(^", etc
  452. ~I      invert case: "Crack96" -> "cRACK96", etc
  453. ~v      lowercase vowels: "Crack96" -> "CRaCK96", etc
  454. ~>      shift each character right, by keyboard: "Crack96" -> "Vtsvl07", etc
  455. ~<      shift each character left, by keyboard: "Crack96" -> "Xeaxj85", etc
  456.  
  457. Extra "single crack" mode commands for word pairs support, to control if
  458. other commands are applied to the first, second, or both words:
  459.  
  460. 1       first word only
  461. 2       second word only
  462. +       the concatenation of both (should only be used after a '1' or '2')
  463.  
  464. If you use some of the above commands in a rule, it will only process word
  465. pairs (full names, from the GECOS information), and reject single words.
  466. A '+' is assumed at the end of any rule that uses some of these commands,
  467. unless you specify it manually. For example, '1l2u' will convert the first
  468. word to lowercase, the second one to uppercase, and use the concatenation
  469. of both. The use for a '+' might be to apply some more commands: '1l2u+r'
  470. will reverse the concatenation of both words, after applying some commands
  471. to them separately.
  472.  
  473. [ Crack v5.0 wasn't out by the time I was coding rule support for John, so
  474. I extended the syntax my own way. Actually, the new Crack v5.0's rules seem
  475. redundant, or match with what I already added to John ([ == D0, ] == rD0r,
  476. C == c~I, t == ~I, (x == =0x, )x == r=0xr, 'n == x0n). The only rule left
  477. is %nx, or %n?c (rejects the word unless it contains at least n instances
  478. of character 'x', or of members of class 'c'). Anyway, I added all these to
  479. John, for compatibility reasons. Be sure to prefix '[' and ']' with a '\'
  480. if you use them, since they're control characters for the preprocessor. ]
  481.  
  482. If a rule (line of commands) doesn't change a word, that word is rejected,
  483. unless the entire rule was a plain ':'. This assumes you have a plain ':'
  484. somewhere in your rules list.
  485.  
  486. The preprocessor is used to combine similar rules into one source line. For
  487. example, if you need to make John try lowercased words with digits appended,
  488. you could write a rule for each digit, 10 rules total. Now imagine appending
  489. two-digit numbers -- the configuration file would get large and ugly.
  490.  
  491. With the preprocessor you can do these things easier. Simply write one
  492. source line containing the common part of these rules, and the list of
  493. characters you would have put into separate rules, in brackets (the way
  494. you would do in a regular expression). The preprocessor will then generate
  495. the rules for you (at John's startup). For the examples above, the source
  496. lines will be 'l$[0-9]' (lowercase and append a digit) and 'l$[0-9]$[0-9]'
  497. (lowercase and append two digits). These source lines will be expanded to
  498. 10 and 100 rules respectively. By the way, the preprocessor's commands are
  499. processed right-to-left, and the characters are processed left-to-right,
  500. which gets a normal order of numbers in such cases as in the example with
  501. appending two-digit numbers. Note that I only used character ranges in these
  502. examples, however you can combine them with character lists, like '[aeiou]'
  503. will use vowels, and '[aeiou0-9]' will use vowels and digits.
  504.  
  505. There're some control characters in rules ('[' starts a preprocessor's
  506. character list, '-' marks a range inside the list, etc). You should prefix
  507. them with a '\' if you want to put them inside a rule without using their
  508. special meaning. Of course, the same applies to '\' itself. Also, if you
  509. need to start a preprocessor's character list at the very beginning of a
  510. line, you'll have to prefix it with a ':', or it would be treated as a new
  511. section start.
  512.  
  513.  Defining an external mode
  514. ---------------------------
  515.  
  516. To define an external cracking mode you need to create a section called
  517. [List.External:<mode>], where <mode> is any identifier that you assign to
  518. the mode. The section should contain some functions that are coded in a
  519. subset of the C language. John will compile and use them if you enable the
  520. mode on its command line. The compiler produces virtual machine code which
  521. is then either interpreted or converted into machine executable code (this
  522. is currently done for x86 hardware only).
  523.  
  524. The following functions are currently used by John:
  525.  
  526. init()     called at startup, should initialize global variables
  527. filter()   called for each word to be tried, can filter some words out
  528. generate() called to generate words, when no other cracking modes used
  529. restore()  called when restoring an interrupted session
  530.  
  531. All of them are of type 'void', with no arguments, and should use global
  532. variable 'word' (which is pre-defined as 'int word[16]'), except for init()
  533. which is called before 'word' is initialized. The 'word' variable contains
  534. current word to be tried, in ASCIIZ. filter() can modify it, or zero out
  535. 'word[0]' to skip it. generate() shouldn't assume any particular value of
  536. 'word' when it gets called, but should put there the next word to be tried,
  537. or zero out 'word[0]' when cracking is complete (this will cause John to
  538. terminate). restore() should set global variables to continue from the
  539. supplied 'word'.
  540.  
  541. You can either use an external mode separately, or with some other cracking
  542. mode, in which case only init() and filter() will be used (and only filter()
  543. will be required). Using an external filter is compatible with all the other
  544. cracking modes and '-makechars' command line option.
  545.  
  546. It is recommended that you don't use filter(), or at least don't filter too
  547. many words out when using an external mode with your own generate(). Better
  548. modify generate() not to generate words that would get filtered out.
  549.  
  550. As I already mentioned above, the compiler supports a subset of C. John is
  551. a cracker, not a compiler, so I don't think it needs anything else. Here's
  552. a list of C features that are missing in John's compiler:
  553.  
  554. - only standard functions supported, you can't define your own ones;
  555. - only 'while' loops are supported;
  556. - only 'int' and 'void' data types supported;
  557. - only single dimensional arrays supported;
  558. - structs/unions are not supported;
  559. - pointers are not supported (right, more about arrays below);
  560. - probably something else...
  561.  
  562. Some of the supported features differ from those of C:
  563.  
  564. - array name alone refers to its first element (the one with zero index),
  565.   not the array's address;
  566. - '++' and '--' operations are performed while the expression is being
  567.   calculated, not pre/post-calculated; this will give the same result as in
  568.   C in most cases (like 'i = j++;' is equal to 'i = j; j = j + 1;' in both
  569.   C and John's compiler), but if the variable these operations are applied
  570.   to is used more than once in one expression, the result will differ from
  571.   that of C (like 'i = j++ - j++;' is equal to 'i = j - (j + 1); j = j + 2;'
  572.   in John's compiler, but 'i = j - j; j = j + 2;' in C);
  573. - I hope nothing else differs...
  574.  
  575. However, the powerful C expression syntax (all the integer operations),
  576. 'if'/'else' and 'while' are still available for use. It should be enough
  577. for coding almost anything. You can use the external mode example in the
  578. configuration file supplied with John as a template.
  579.  
  580. ================
  581.  Usage examples
  582. ================
  583.  
  584. These examples are to give you some tips on what John's features can be
  585. used for. Some of them may not be obvious, I'm sorry if others are, but
  586. anyway, I just got tired of answering questions.
  587.  
  588.  Command line
  589. --------------
  590.  
  591. 1. Assume you just got a password file, 'passwd.1', and want to crack it.
  592. It is wise to start with the "single crack" mode:
  593.  
  594.    john -single passwd.1
  595.  
  596. or, since options can be abbreviated (however, I'll be using full names for
  597. most options in these examples):
  598.  
  599.    john -si passwd.1
  600.  
  601. If you have more files to crack, better to load them at the same time:
  602.  
  603.    john -single passwd.1 passwd.2
  604.  
  605. or even:
  606.  
  607.    john -single passwd.*
  608.  
  609. 2. Now, you got some passwords cracked, they are saved in ~/john.pot. You
  610. want to retrieve them:
  611.  
  612.    john -show passwd.1
  613.  
  614. If the account list gets large and doesn't fit on the screen, you can of
  615. course use output redirection, like:
  616.  
  617.    john -show passwd.1 | more
  618.  
  619. Now, you may notice that many accounts have a disabled shell, you can make
  620. John ignore these (assume that shell is called '/etc/expired'):
  621.  
  622.    john -show -shells:!/etc/expired passwd.1
  623.  
  624. or, shorter, but will also match '/any/path/expired':
  625.  
  626.    john -show -shells:!expired passwd.1
  627.  
  628. or, if you also want to ignore some other shell, say '/etc/newuser':
  629.  
  630.    john -show -shells:!expired,!newuser passwd.1
  631.  
  632. To check if any root (uid 0) accounts cracked:
  633.  
  634.    john -show -users:0 passwd.1
  635.  
  636. or, to check for cracked root (uid 0) accounts in all the files:
  637.  
  638.    john -show -users:0 passwd.*
  639.  
  640. To display the root (login 'root') account only:
  641.  
  642.    john -show -users:root passwd.1
  643.  
  644. 3. When the "single crack" mode doesn't give enough accounts, you can use
  645. more powerful cracking modes, like the wordlist one. Assume your wordlist
  646. file is called 'words.lst':
  647.  
  648.    john -w:words.lst passwd.1
  649.  
  650. or, with rules enabled (slower, but more powerful):
  651.  
  652.    john -w:words.lst -rules passwd.1
  653.  
  654. To only crack accounts with a good shell (in general, both the '-shells'
  655. and '-users' filters described above work for all the cracking modes also):
  656.  
  657.    john -w:words.lst -rules -shells:sh,csh,tcsh,bash passwd.1
  658.  
  659. Like with all the other cracking modes, faster to crack all the files you
  660. need cracked simultaneously:
  661.  
  662.    john -w:words.lst -rules passwd.*
  663.  
  664. You can crack some accounts only. This will try cracking all root (uid 0)
  665. accounts in all the password files:
  666.  
  667.    john -w:words.lst -rules -users:0 passwd.*
  668.  
  669. However, I don't recommend cracking root passwords only, since it usually
  670. takes longer to crack the password (often impossible within a reasonable
  671. time) than to hack root using security holes. If you are cracking your own
  672. password file to ensure the passwords are uncrackable, better select a good
  673. root password, and only crack the rest.
  674.  
  675. Sometimes it is useful to split your password files into two parts which
  676. you crack separately, like:
  677.  
  678.    john -w:words.lst -rules -salts:2 passwd.*
  679.    john -w:words.lst -rules -salts:!2 passwd.*
  680.  
  681. This will make John try salts with two or more accounts faster, and then
  682. try the rest. Total cracking time will be about the same, but you will get
  683. some accounts cracked earlier, and may not need the rest. Also, you might
  684. want to try all the accounts with a small wordlist, and only those that you
  685. can try faster (with '-salts:2') with a larger one. Often it is better to
  686. use a larger value than 2 for '-salts' (sometimes even as high as 1000 will
  687. do), adjust it for your particular case.
  688.  
  689. Note that the default wordlist rules include ':' (which means 'try words
  690. as they are in the list') as the first line. If you already ran through a
  691. wordlist without using rules, and then decided to try the same wordlist
  692. with rules also, you'd better comment this line out.
  693.  
  694. 4. The most powerful cracking mode in John is incremental. You can simply
  695. run:
  696.  
  697.    john -i passwd.1
  698.  
  699. This will use the default incremental mode parameters, which are defined in
  700. ~/john.ini's [Incremental:All] section. In the configuration file supplied
  701. with John these parameters are to use the full 95 character charset, and to
  702. try all possible password lengths, from 1 to 8 characters. Don't expect this
  703. to terminate in a reasonable time (unless all the passwords were weak and
  704. got cracked).
  705.  
  706. In many cases it is faster to use some other pre-defined incremental mode
  707. parameters and only crack simpler passwords, from a limited charset. The
  708. following command will try 26 different characters only, passwords from
  709. 'a' to 'zzzzzzzz':
  710.  
  711.    john -i:alpha passwd.1
  712.  
  713. Again, you can crack root accounts only and use some other John's features
  714. with the incremental mode. This command will try cracking all root (uid 0)
  715. accounts in all the password files, and only those of them that produce
  716. matching salts, so you get at least twice the performance -- if you have a
  717. lot of password files (like 1000 of them, named '*.pwd'), otherwise there
  718. will be no roots with matching salts:
  719.  
  720.    john -i -users:0 -salts:2 *.pwd
  721.  
  722. 5. If you got a password file and already have a lot of accounts cracked
  723. and/or sniffed (but need some more), and the passwords are unusual, then
  724. you might want to generate a new charset file, based on characters from
  725. that password file only:
  726.  
  727.    john -makechars:custom.chr passwd.1
  728.  
  729. Then use that new file for the incremental mode.
  730.  
  731. If you got several password files from the same country, it might be useful
  732. to use all of them for the charset file that you then use to crack more
  733. accounts in these files or some other password files from that country:
  734.  
  735.    john -makechars:custom.chr passwd.1 passwd.2
  736.    <add your custom incremental mode definition to ~/john.ini>
  737.    john -i:custom passwd.3
  738.  
  739. In the example above, I assume that 'passwd.1' and 'passwd.2' are password
  740. files from the same country that you already have a lot of accounts for,
  741. and 'passwd.3' is the password file you need cracked.
  742.  
  743. You can use some pre-defined or custom word filters when generating the
  744. charset file, to make it only try some simpler words:
  745.  
  746.    john -makechars:my_alpha.chr -external:filter_alpha passwd.1
  747.  
  748. If your ~/john.pot file got large enough (or if you don't have any charset
  749. files at all), you might want to use it for the new charset files:
  750.  
  751.    john -makechars:all.chr
  752.    john -makechars:alpha.chr -external:filter_alpha
  753.    john -makechars:digits.chr -external:filter_digits
  754.  
  755. In the example above, John will overwrite the charset files (if they already
  756. exist) with the ones based on your entire ~/john.pot (John uses the entire
  757. file if you don't specify any password files). Note that the word filters
  758. used are pre-defined in ~/john.ini supplied with John for your convenience.
  759.  
  760.  Configuration file
  761. --------------------
  762.  
  763. 1. Assume you notice that in some password file a lot of users have their
  764. passwords set to login names with '?!' appended. Then you just make a new
  765. "single crack" mode rule, and place it somewhere in the beginning:
  766.  
  767.    [List.Rules:Single]
  768.    $?$!
  769.  
  770. Hint: if you want to temporary comment out all the default rules, you can
  771. simply rename the section to something John doesn't use, and define a new
  772. one with its old name, but be sure to leave the 'list.' part of the name,
  773. so you don't get a parse error.
  774.  
  775. All the same applies to the wordlist rules also.
  776.  
  777. 2. If you generate a custom charset file (described above) you will also
  778. need to define a ~/john.ini section with the incremental mode parameters.
  779. In the simplest case it will be like this (where 'Custom' can be replaced
  780. with any name you like):
  781.  
  782.    [Incremental:Custom]
  783.    File = custom.chr
  784.  
  785. This will make John use characters that were in passwords used to generate
  786. the charset file only. If you want to use all the 95 characters, you will
  787. also need to add:
  788.  
  789.    CharCount = 95
  790.  
  791. Adding this line will tell John to expand the charsets if some of the 95
  792. characters (ASCII codes 32 to 126) didn't occur while generating the file.
  793. The characters are added in that order: a-z, A-Z, 1-9, 0, the rest.
  794.  
  795. You can also use CharCount to limit the number of different characters that
  796. John tries:
  797.  
  798.    CharCount = 25
  799.  
  800. If you didn't use any filters when generating the charset file, setting
  801. CharCount that low will most likely disable some rare characters, and make
  802. John try complicated long passwords earlier.
  803.  
  804. To make John try passwords of some lengths only, use the following lines:
  805.  
  806.    MinLen = 6
  807.    MaxLen = 8
  808.  
  809. Setting 'MinLen' high, as in the example above, is reasonable if shorter
  810. passwords weren't allowed to set on the machine you got the password file
  811. from (however, note that root can usually set any password for any user).
  812.  
  813. On the contrary, you might want to set 'MaxLen' low if you think there are
  814. enough short passwords.
  815.  
  816. When using alphabetical characters only, it may be useful to enable the
  817. simple built in word filter, if many passwords are simple enough:
  818.  
  819.    [Incremental:Wordlike]
  820.    CharCount = 26
  821.    MinLen = 3
  822.    Wordlike = Yeah
  823.    File = alpha.chr
  824.  
  825. 3. When using John on machines with only 4Mb (or less) of RAM installed, you
  826. may need to use smaller charsets, since the ones generated with '-makechars'
  827. require a lot of memory when expanded (for faster operation). You might also
  828. need this if you load a lot of password files, and don't have enough memory
  829. left, or to make John run a little faster when cracking only a few (or one)
  830. salts. This happens because John can take the advantage of each word it tries
  831. being like the previous one, with only some characters changed. When it uses
  832. large external charset files, the words are tried in a different order than
  833. when using smaller charsets inside of ~/john.ini, and are too different from
  834. each other. Also, large charsets require some extra time for their expansion.
  835. However, note that a little increase of comparisons/second does not always
  836. mean you get your passwords cracked faster, the better order of tries when
  837. using larger external charsets is also important. So it is wise to only use
  838. the smaller charsets if there's no other choice, or if you will be trying all
  839. the character combinations anyway.
  840.  
  841. I intentionally left the smaller charsets inside of ~/john.ini supplied with
  842. John so you can just comment out the 'File =' lines, and the smaller charsets
  843. will be used.
  844.  
  845. 4. Another use of the smaller charsets may be to define them manually for
  846. some special cases. For example, if you know a place where users often
  847. suffix their passwords with '1':
  848.  
  849.    [Incremental:Suffix1]
  850.    MinLen = 6
  851.    MaxLen = 6
  852.    Charset61 = abcdefghijklmnopqrstuvwxyz
  853.    Charset62 = abcdefghijklmnopqrstuvwxyz
  854.    Charset63 = abcdefghijklmnopqrstuvwxyz
  855.    Charset64 = abcdefghijklmnopqrstuvwxyz
  856.    Charset65 = abcdefghijklmnopqrstuvwxyz
  857.    Charset66 = 1
  858.  
  859. Of course, you can do the same for other lengths. It is also wise to sort
  860. the characters by their frequencies. If you're too lazy to actually do that,
  861. you can simply take the charsets from a pre-defined incremental mode. For
  862. example, if you take Charset61 to 65 in the example above from the default
  863. [Incremental:Alpha] definition's Charset51 to 55, you will get almost what
  864. you would get if calculating the frequencies for 6 character long passwords
  865. with first 5 characters being alphabetical, and '1' at the end.
  866.  
  867. 5. You can do the same thing as in the example above by coding an external
  868. word filter:
  869.  
  870.    [List.External:Filter1]
  871.    void filter() {
  872.      int i;
  873.  
  874.      i = 0;
  875.      while (word[i] && word[i] >= 'a' && word[i] <= 'z') i++;
  876.      if (word[i] != '1' || word[i + 1]) word = 0;
  877.    }
  878.  
  879. This filter will only leave words with some alphabetical characters and '1'
  880. at the end. You can now use it with some other cracking modes, but this will
  881. most likely be slow, since most words will get filtered out. Better to use
  882. it for generating the charsets, and use them (if you have enough passwords
  883. cracked that will pass the filter).
  884.  
  885. If you can't use the frequency tables for some reason, you can do the same
  886. by coding a totally new external mode:
  887.  
  888.    [List.External:Suffix1]
  889.    int len, current[9];
  890.  
  891.    void init() {
  892.      int i;
  893.  
  894.      current[len = 6] = 0; current[i = len - 1] = '1';
  895.      while (i--) current[i] = 'a';
  896.    }
  897.  
  898.    void generate() {
  899.      int i;
  900.  
  901.      i = len + 1;
  902.      while (i--) word[i] = current[i];
  903.  
  904.      i = len - 2;
  905.      while (++current[i] > 'z')
  906.      if (i) current[i--] = 'a'; else current = -1;
  907.    }
  908.  
  909.    void restore() {
  910.      int i;
  911.  
  912.      i = len + 1;
  913.      while (i--) current[i] = word[i];
  914.    }
  915.  
  916. ========
  917.  F.A.Q.
  918. ========
  919.  
  920. Q: Why "John"?
  921. A: Why not?
  922.  
  923. Q: Why "the Ripper"?
  924. A: That was Lost Soul's idea. Ask him.
  925.  
  926. Q: Is John the Ripper better than Cracker Jack?
  927. A: I think so. John supports all the features of Cracker Jack, and has a lot
  928. of new ones. Also, John runs much faster than Jack on Pentiums and somewhat
  929. faster on 486s.
  930.  
  931. Q: Is John the Ripper better than Crack?
  932. A: Decide yourself. John is faster, and has some extra features. But Crack is
  933. certainly good also.
  934.  
  935. Q: Why doesn't John run fast on my old 386?
  936. A: John is optimized for 486+ machines. Coding a separate version for 386s
  937. would probably be a waste of time. You'd better run John on a faster machine
  938. somewhere on the Internet if you only have a 386.
  939.  
  940. Q: Will there be a Pentium optimized version of John?
  941. A: John is already optimized for Pentiums.
  942.  
  943. Q: How can I test John's crypt() routine for proper encryption?
  944. A: John always tests itself when you run it and reports if an error occurs.
  945.  
  946. Q: How do I use John's "single crack" mode? It doesn't seem to use a wordlist.
  947. A: Right, it differs from Cracker Jack's "single crack" mode a lot. RTFM.
  948.  
  949. Q: Why don't you improve the "single crack" mode, by ripping the (better) one
  950. out of Jack?
  951. A: Jack's "single crack" mode is NOT better, it is worse. I wonder what makes
  952. people ask this... maybe Jack's mode looks more complicated or something.
  953.  
  954. Q: Will there be a replacement for Jack's JPP.EXE, running in Windows 95?
  955. A: You don't need it. But you probably DO need to read the "Customizing"
  956. section of this document once again, that stuff about the wordlist rules.
  957. Also, I would certainly recommend not to use Windows 95 for any purpose.
  958.  
  959. Q: How do I see the cracked passwords? There was JACKPOT.EXE in Cracker
  960. Jack's package.
  961. A: Use the '-show' option on John's command line instead.
  962.  
  963. Q: Why doesn't John load my password file? It only says 'Loaded 0 passwords'.
  964. A: Your password file is probably shadowed. You need to get both passwd and
  965. shadow files, and combine them into one for use with John. Also, you'll get
  966. the same message if your password file format is not supported by John.
  967.  
  968. Q: How do I unshadow?
  969. A: You probably mean getting the shadow file without having root access. Well,
  970. there're a few tricks, but in general you need root anyway. Sorry, but I'm not
  971. going to mention any of the tricks, or tell you how to "hack" root. This isn't
  972. the purpose of this FAQ.
  973.  
  974. Q: Why doesn't John display a progress indicator for the incremental mode?
  975. A: Do you really want to see a 0% all the time? You probably need to read
  976. this document once again (the incremental mode description) if you ask this.
  977.  
  978. Q: Why does John display meaningless c/s values that do not show real crypt()s
  979. per second rate?
  980. A: The values displayed by John mean combinations (of login and password) per
  981. second, not crypt()s per second. If you want to only benchmark the encryption
  982. routines, use the '-test' option. Note that the c/s values displayed while
  983. cracking are not meaningless -- they represent the actual cracking speed you
  984. get on particular password files, and may be useful to adjust the value you
  985. use with the '-salts' option.
  986.  
  987. Q: I just noticed that the c/s values shown while using incremental mode are
  988. a lot less than they're in other cracking modes. They're even less than they
  989. were in John v1.0. What has happened?
  990. A: You're probably running John for a few minutes only. The new incremental
  991. mode implementation uses large character sets which need to be expanded each
  992. time John switches to a different password length. These length switches are
  993. taking some time, making John try less combinations per second. Fortunately,
  994. this is only noticable when John has just started, since it rarely switches
  995. to a new password length when cracking for some hours already. I think this
  996. isn't a high price for the better order of password tries. Anyway, you can
  997. disable the large charsets (comment out the 'File =' lines in ~/john.ini) if
  998. you don't like this new implementation.
  999.  
  1000. Q: Does John support parallel processing?
  1001. A: I have a separate incremental-only cracker with network management for
  1002. that purpose (coming soon). There's no real parallel processing support in
  1003. John, but you can however customize the charsets so that the first machine
  1004. only tries passwords starting with an 'a', etc. You can also use an external
  1005. word filter to achieve this effect for modes other than the incremental one
  1006. (do something like filtering out every other word, if you have two machines;
  1007. you can achieve this by using a global word counter).
  1008.  
  1009. Q: What are the default character sets supplied with John (in ~/john.ini and
  1010. *.chr files) based on?
  1011. A: I used a list of over 65,000 real passwords, from different machines all
  1012. over the world. I'd like to thank the users for setting their passwords.
  1013.  
  1014. Q: Where do I get the wordlists?
  1015. A: You can find some at ftp://sable.ox.ac.uk/pub/wordlists.
  1016.  
  1017. Q: How can I contact you?
  1018. A: You'll find this at the end of this document.
  1019.  
  1020. =========
  1021.  Credits
  1022. =========
  1023.  
  1024. While developing John, I used some ideas from other password crackers:
  1025.  
  1026. - Crack by Alec Muffett --
  1027.     wordlist rules syntax;
  1028. - Cracker Jack by Jackal --
  1029.     user interface;
  1030. - Star Cracker by The SOrCErEr --
  1031.     thanks for proving the large charset files are worth implementing.
  1032.  
  1033. The crypt() routine is based on the old one by Alec Muffett, that came
  1034. with Crack v4.1. Only some initialization routines (which are not time
  1035. critical) remained almost unchanged now, the rest is re-coded using my
  1036. own ideas and some from other crypt() implementations (actually, there
  1037. are now several different algorithms supported with #ifdef's to better
  1038. match your architecture).
  1039.  
  1040. I'd like to thank Roman Rusakov for the x86 assembly version of crypt()
  1041. that my implementation is based on. His optimization hints are great.
  1042.  
  1043. The DOS version is compiled with DJGPP v2 by DJ Delorie with GCC 2.7.2
  1044. (http://www.delorie.com), the DPMI server is by Charles W Sandmann
  1045. (sandmann@clio.rice.edu; 1206 Braelinn, Sugar Land, TX 77479), its source
  1046. code is at ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/csdpmi3s.zip.
  1047.  
  1048. Cygnus Developer's Kit (http://www.cygnus.com/gnu-win32) was used to compile
  1049. the Win32 version.
  1050.  
  1051. ========================
  1052.  How can I contact you?
  1053. ========================
  1054.  
  1055. Send your mail to solar@ideal.ru or 2:5020/398.9, or catch me on EFnet IRC,
  1056. my nick is Solar_Diz.
  1057.  
  1058. Please, don't ask me questions until you read this entire file (and some
  1059. FAQs on password cracking in general, if you're unfamiliar with it). Also,
  1060. do not send me password files, I'm not a cracking service.
  1061.  
  1062. Signed,
  1063. Solar Designer
  1064.