Advertisement
Rapper_skull

Untitled

Nov 2nd, 2011
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 67.64 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # PoedCrackMod v25L beta9 (october 2011)
  4. #
  5. # Rapid Advanced Secure Thorough Intelligent Gaulish Nuclear Acclaimed Cracker
  6. # Rapide Avance Securise Tout-terrain Intelligent Gaulois Nucleaire Approfondi Craqueur
  7. #
  8. # For all devices, for all iOS versions.
  9. # Pour toutes les iMachines, quelque soit la version de l'iOS.
  10. #
  11. # For every kind of people, to make the world go round.
  12. # Un bon script et une bonne biere belge bien fraiche: que demande le peuple ?
  13. #
  14. # Now includes full working fat binary support and many many features.
  15. # Il sait tout faire, et bien plus encore.
  16. #
  17. #
  18. # The truth is I never left you. I kept my promise.
  19. #
  20. #
  21. # Based upon poedGirl's ancient poedCrack (December 2009).
  22. # poedGirl's version available at: http://www.roapd.com/uploads/poedCrack.gz
  23. # poedCrack is heavily based on DeCrypt by FloydianSlip
  24. # Many thanks to:
  25. # puy0, SaladFork, Flox, Flawless, FloydianSlip, MadHouse, TDDebug
  26. # and every helping people !
  27.  
  28.  
  29.  
  30. # ======
  31. # Please, customize the script first !
  32. # Choices are:
  33.  
  34. # - Default language (US:english, FR:french, ES:spanish, DE:german).
  35. PCMlang="US"
  36. #PCMlang="FR1"
  37. #PCMlang="FR2"
  38. #PCMlang="ES1"
  39. #PCMlang="ES2"
  40. #PCMlang="DE1"
  41. #PCMlang="DE2"
  42.  
  43. # - Default CrackerName (or "Anonymous").
  44. PCMcracker="Anonymous"
  45.  
  46. # - Should "extra details" appear in Ipa name (ie: "iPad / 3GS / InApp / etc") ? (You can hate them)
  47. PCMextras="YES"
  48.  
  49. # - Display graphical progress bars ? (based on number and/or size of apps) ("by size" is slower)
  50. PCMbarNum="YES"
  51. PCMbarSize="YES"
  52.  
  53. # - Should display be verbose ? (verbose is slower and messier)
  54. PCMverbose="NO"
  55.  
  56. # - Should script talk to you ? (it only speaks english, only with iOS4+, only with "speak" tool from Cydia)
  57. PCMspeak="YES"
  58.  
  59. # - Should artist's name be used in filename ?
  60. PCMartistfrommeta="YES"
  61.  
  62. # - Default compression level is blank (aka "-6"), and is the best speed/size ratio.
  63. # - Recommended. Upload/download/storage will be good.
  64. PCMcompression="-0"
  65. # - Maximum compression ("-9") (also "-8" or "-7") is very very slow, but size is the best.
  66. # - If your iDevice is fast, if you're not in a hurry, if size matters. Best upload/download/storage.
  67. #PCMcompression="-9"
  68. # - Minimum compression ("-2") (also "-3" to "-5") is way faster, but size is way worse.
  69. # - Upload/download/storage will be worse. (CrackTM and Clutch and newest Crackulous use "-2").
  70. # - With "-2", PCM will be as fast as the others.
  71. #PCMcompression="-2"
  72. # - Don't use "-1" (sloppy) or "-0" (store), as size will be horrible, and all will suffer. Avoid.
  73.  
  74. # - Should I generate fake MetaData or not ?
  75. # (Some people hate them, some love them, some protections check them, you should really keep them)
  76. PCMmetadata="YES"
  77.  
  78. # - Should I try LamestPatchest on the executable ?
  79. # (It won't work 100%, but sometimes it really helps) (and now it's very very fast) (you should keep it)
  80. PCMlamestpatchest="YES"
  81.  
  82. # - What menu dots do you prefer ?
  83. #PCMdots="$( echo -e -n "\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267\0267" )"
  84. PCMdots=".............................."
  85. #PCMdots=" "
  86. #PCMdots="------------------------------"
  87. #PCMdots="______________________________"
  88. # NOT PCMdots="$( echo -e -n "\0302\0267\0302\0267" )"
  89.  
  90. # Progress bar display
  91. PCMxxx="====="
  92. PCMsss="-----"
  93.  
  94. # DEBUG ONLY: - Should I try to crack arm6+arm7 on arm6 devices ? (It won't work at all)
  95. PCMarm7onarm6="NEVER"
  96. # DEBUG ONLY: - Force the "this script is running inside a GUI" check ?
  97. PCMinaGUI="NEVER"
  98. # DEBUG ONLY: - Check only (all tested but Ipa not created)
  99. PCMcheck="NEVER"
  100.  
  101. # Thanks you for testing.
  102. # ======
  103.  
  104.  
  105. # ======
  106. function SelectLanguage
  107. {
  108. # Language US
  109. if [ $PCMlang = "US" ]; then
  110. MsgAltMeth="Using alternative dumping method"
  111. MsgAnaAppl="Analyzing application"
  112. MsgAppLoca="Locating"
  113. MsgBadChoi="Bad choice"
  114. MsgBldMenu="Building menu..."
  115. MsgBrzMode="Berzerk mode: cracking ALL"
  116. MsgCntFind="Cannot find"
  117. MsgCopExec="and copying executable"
  118. MsgCreDire="Creating directories"
  119. MsgDmpUncr="Dumping unencrypted data from application"
  120. MsgIpaInco="Incomplete .ipa"
  121. MsgDskFull="Disk full"
  122. MsgEraMemo="Erasing memory file"
  123. MsgInsCydi="Install from Cydia"
  124. MsgIpaDone="Done as"
  125. MsgMnuEmpt="empty"
  126. MsgMrkDone="Marking all apps done"
  127. MsgPatCryp="Locating and patching CryptID"
  128. MsgRemTemp="Removing temporary files"
  129. MsgRepData="and replacing encrypted data"
  130. MsgSizUnit="B"
  131. MsgUnaLoca="Unable to locate"
  132. MsgVrfDump="Verifying dump"
  133. MsgWrgChoi="Wrong choice"
  134. MsgWrnMeta="Warning: iTunesMetadata format changed"
  135. MsgYouChoi="Your choices"
  136. MsgZipStep="Compressing the .ipa (step"
  137. MsgComBoth="Combining both parts into a fat binary"
  138. MsgSgnAppl="Signing the application"
  139. MsgCopArtw="Copying Artwork"
  140. MsgFakMeta="and faking MetaData"
  141. MsgNotMeta="and no MetaData"
  142. MsgFoundIt="Found"
  143. MsgWasAskd="Asked"
  144. MsgErrrors="Errors"
  145. MsgBrzNoth="nothing"
  146. MsgMrkDone="Mark all done "
  147. MskZroDone="Reset done list "
  148. fi
  149.  
  150. # Language FR1 (ascii)
  151. if [ $PCMlang = "FR1" ]; then
  152. MsgAltMeth="$( echo -e -n "M\0351thode alternative de dumping" )"
  153. MsgAnaAppl="Analyse d'application"
  154. MsgAppLoca="Recherche"
  155. MsgBadChoi="$( echo -e -n "Choix erron\0351" )"
  156. MsgBldMenu="Construction du menu..."
  157. MsgBrzMode="Mode Berzerk: on craque TOUT"
  158. MsgCntFind="Introuvable:"
  159. MsgCopExec="$( echo -e -n "& copie de l'ex\0351cutable" )"
  160. MsgCreDire="$( echo -e -n "Cr\0351ation r\0351pertoires" )"
  161. MsgDmpUncr="$( echo -e -n "Extraction des donn\0351es d\0351crypt\0351es de l'appli" )"
  162. MsgIpaInco="$( echo -e -n "Ipa incompl\0350te" )"
  163. MsgDskFull="Disque plein"
  164. MsgEraMemo="$( echo -e -n "Effacement fichier m\0351moire" )"
  165. MsgInsCydi="Installer avec Cydia"
  166. MsgIpaDone="$( echo -e -n "R\0351sultat:" )"
  167. MsgMnuEmpt="vide"
  168. MsgMrkDone="$( echo -e -n "Toutes les apps sont marqu\0351es comme trait\0351es" )"
  169. MsgPatCryp="$( echo -e -n "Localisation et \0351crasement du CryptID" )"
  170. MsgRemTemp="Effacement fichiers temporaires"
  171. MsgRepData="$( echo -e -n "et remplacement par d\0351crypt\0351es" )"
  172. MsgSizUnit="o"
  173. MsgUnaLoca="Impossible de trouver"
  174. MsgVrfDump="$( echo -e -n "V\0351rif donn\0351es" )"
  175. MsgWrgChoi="Mauvais choix"
  176. MsgWrnMeta="Attention: nouveau format d'iTunesMetadata"
  177. MsgYouChoi="Votre choix"
  178. MsgZipStep="$( echo -e -n "Compression de l'ipa (\0351tape" )"
  179. MsgComBoth="Consolidation des deux sections binaires"
  180. MsgSgnAppl="Signature de l'application"
  181. MsgCopArtw="Copie de l'Artwork"
  182. MsgFakMeta="et fausses MetaData"
  183. MsgNotMeta="et pas de MetaData"
  184. MsgFoundIt="$( echo -e -n "Trouv\0351" )"
  185. MsgWasAskd="Voulu"
  186. MsgErrrors="Erreurs"
  187. MsgBrzNoth="rien"
  188. MsgMrkDone="Tout marquer fait "
  189. MskZroDone="Effacer liste fait "
  190. fi
  191.  
  192. # Language FR2 (utf8)
  193. if [ $PCMlang = "FR2" ]; then
  194. MsgAltMeth="$( echo -e -n "M\0303\0251thode alternative de dumping" )"
  195. MsgAnaAppl="Analyse d'application"
  196. MsgAppLoca="Recherche"
  197. MsgBadChoi="$( echo -e -n "Choix erron\0303\0251" )"
  198. MsgBldMenu="Construction du menu..."
  199. MsgBrzMode="Mode Berzerk: on craque TOUT"
  200. MsgCntFind="Introuvable:"
  201. MsgCopExec="$( echo -e -n "& copie de l'ex\0303\0251cutable" )"
  202. MsgCreDire="$( echo -e -n "Cr\0303\0251ation r\0303\0251pertoires" )"
  203. MsgDmpUncr="$( echo -e -n "Extraction des donn\0303\0251es d\0303\0251crypt\0303\0251es de l'appli" )"
  204. MsgIpaInco="$( echo -e -n "Ipa incompl\0303\0250te" )"
  205. MsgDskFull="Disque plein"
  206. MsgEraMemo="$( echo -e -n "Effacement fichier m\0303\0251moire" )"
  207. MsgInsCydi="Installer avec Cydia"
  208. MsgIpaDone="$( echo -e -n "R\0303\0251sultat:" )"
  209. MsgMnuEmpt="vide"
  210. MsgMrkDone="$( echo -e -n "Toutes les apps sont marqu\0303\0251es comme trait\0303\0251es" )"
  211. MsgPatCryp="$( echo -e -n "Localisation et \0303\0251crasement du CryptID" )"
  212. MsgRemTemp="Effacement fichiers temporaires"
  213. MsgRepData="$( echo -e -n "et remplacement par d\0303\0251crypt\0303\0251es" )"
  214. MsgSizUnit="o"
  215. MsgUnaLoca="Impossible de trouver"
  216. MsgVrfDump="$( echo -e -n "V\0303\0251rif donn\0303\0251es" )"
  217. MsgWrgChoi="Mauvais choix"
  218. MsgWrnMeta="Attention: nouveau format d'iTunesMetadata"
  219. MsgYouChoi="Votre choix"
  220. MsgZipStep="$( echo -e -n "Compression de l'ipa (\0303\0251tape" )"
  221. MsgComBoth="Consolidation des deux sections binaires"
  222. MsgSgnAppl="Signature de l'application"
  223. MsgCopArtw="Copie de l'Artwork"
  224. MsgFakMeta="et fausses MetaData"
  225. MsgNotMeta="et pas de MetaData"
  226. MsgFoundIt="$( echo -e -n "Trouv\0303\0251" )"
  227. MsgWasAskd="Voulu"
  228. MsgErrrors="Erreurs"
  229. MsgBrzNoth="rien"
  230. MsgMrkDone="Tout marquer fait "
  231. MskZroDone="Effacer liste fait "
  232. fi
  233.  
  234. # Language ES1 (ascii)
  235. if [ $PCMlang = "ES1" ]; then
  236. MsgAltMeth="$( echo -e -n "Usando m\0351todo alternativo de dumping" )"
  237. MsgAnaAppl="$( echo -e -n "Analizando aplicaci\0363n" )"
  238. MsgAppLoca="$( echo -e -n "Ubicaci\0363n" )"
  239. MsgBadChoi="$( echo -e -n "Mala elecci\0363n" )"
  240. MsgBldMenu="$( echo -e -n "Construyendo men\0372..." )"
  241. MsgBrzMode="Modo Berzerk: crackando TODO"
  242. MsgCntFind="No encontro"
  243. MsgCopExec="y copiando ejecutable"
  244. MsgCreDire="Creando directorios"
  245. MsgDmpUncr="$( echo -e -n "Dumping decifrados datos de la aplicaci\0363n" )"
  246. MsgIpaInco="$( echo -e -n "\0241 Incompleta .ipa" )"
  247. MsgDskFull="$( echo -e -n "\0277 Disco lleno" )"
  248. MsgEraMemo="Borrado memoria archivo"
  249. MsgInsCydi="Instalarlo desde Cydia"
  250. MsgIpaDone="Done as"
  251. MsgMnuEmpt="$( echo -e -n "vac\0355o" )"
  252. MsgMrkDone="Marcando todas aplicaciones como 'hecho'"
  253. MsgPatCryp="Locating y patching CryptID"
  254. MsgRemTemp="Borrando archivos temporales"
  255. MsgRepData="y reemplazando datos cifrados"
  256. MsgSizUnit="B"
  257. MsgUnaLoca="Incapaz de ubicar"
  258. MsgVrfDump="$( echo -e -n "Verificaci\0363n" )"
  259. MsgWrgChoi="$( echo -e -n "Opci\0363n incorrecta" )"
  260. MsgWrnMeta="Warning: iTunesMetadata formato cambiado"
  261. MsgYouChoi="$( echo -e -n "\0277 Su elecci\0363" )"
  262. MsgZipStep="$( echo -e -n "Compresi\0363n de .ipa (paso" )"
  263. MsgComBoth="$( echo -e -n "Combinaci\0363n dos partes en fat binary" )"
  264. MsgSgnAppl="$( echo -e -n "Firma de la aplicaci\0363n" )"
  265. MsgCopArtw="Copiando Artwork"
  266. MsgFakMeta="y fingiendo MetaData"
  267. MsgNotMeta="y no MetaData"
  268. MsgFoundIt="Found"
  269. MsgWasAskd="Asked"
  270. MsgErrrors="Errores"
  271. MsgBrzNoth="nada"
  272. MsgMrkDone="Marcar todas hechas "
  273. MskZroDone="Vaciar lista hechas "
  274. fi
  275.  
  276. # Language ES2 (utf8)
  277. if [ $PCMlang = "ES2" ]; then
  278. MsgAltMeth="$( echo -e -n "Usando m\0303\0251todo alternativo de dumping" )"
  279. MsgAnaAppl="$( echo -e -n "Analizando aplicaci\0303\0263n" )"
  280. MsgAppLoca="$( echo -e -n "Ubicaci\0303\0263n" )"
  281. MsgBadChoi="$( echo -e -n "Mala elecci\0303\0263n" )"
  282. MsgBldMenu="$( echo -e -n "Construyendo men\0303\0272..." )"
  283. MsgBrzMode="Modo Berzerk: crackando TODO"
  284. MsgCntFind="No encontro"
  285. MsgCopExec="y copiando ejecutable"
  286. MsgCreDire="Creando directorios"
  287. MsgDmpUncr="$( echo -e -n "Dumping decifrados datos de la aplicaci\0303\0263n" )"
  288. MsgIpaInco="$( echo -e -n "\0302\0241 Incompleta .ipa" )"
  289. MsgDskFull="$( echo -e -n "\0302\0277 Disco lleno" )"
  290. MsgEraMemo="Borrado memoria archivo"
  291. MsgInsCydi="Instalarlo desde Cydia"
  292. MsgIpaDone="Done as"
  293. MsgMnuEmpt="$( echo -e -n "vac\0303\0255o" )"
  294. MsgMrkDone="Marcando todas aplicaciones como 'hecho'"
  295. MsgPatCryp="Locating y patching CryptID"
  296. MsgRemTemp="Borrando archivos temporales"
  297. MsgRepData="y reemplazando datos cifrados"
  298. MsgSizUnit="B"
  299. MsgUnaLoca="Incapaz de ubicar"
  300. MsgVrfDump="$( echo -e -n "Verificaci\0303\0263n" )"
  301. MsgWrgChoi="$( echo -e -n "Opci\0303\0263n incorrecta" )"
  302. MsgWrnMeta="Warning: iTunesMetadata formato cambiado"
  303. MsgYouChoi="$( echo -e -n "\0302\0277 Su elecci\0303\0263" )"
  304. MsgZipStep="$( echo -e -n "Compresi\0303\0263n de .ipa (paso" )"
  305. MsgComBoth="$( echo -e -n "Combinaci\0303\0263n dos partes en fat binary" )"
  306. MsgSgnAppl="$( echo -e -n "Firma de la aplicaci\0303\0263n" )"
  307. MsgCopArtw="Copiando Artwork"
  308. MsgFakMeta="y fingiendo MetaData"
  309. MsgNotMeta="y no MetaData"
  310. MsgFoundIt="Found"
  311. MsgWasAskd="Asked"
  312. MsgErrrors="Errores"
  313. MsgBrzNoth="nada"
  314. MsgMrkDone="Marcar todas hechas "
  315. MskZroDone="Vaciar lista hechas "
  316. fi
  317.  
  318. # Language DE1 (ascii). Translation by Ushnak.
  319. if [ $PCMlang = "DE1" ]; then
  320. MsgAltMeth="Alternative Methode zum Dumpen"
  321. MsgAnaAppl="Analyse der App"
  322. MsgAppLoca="Suche"
  323. MsgBadChoi="$( echo -e -n "Ung\0374ltige Wahl" )"
  324. MsgBldMenu="$( echo -e -n "Aufbau des Men\0374s..." )"
  325. MsgBrzMode="Berzerker Modus: ALLES wird gecrackt"
  326. MsgcntFind="Nicht aufzufinden:"
  327. MsgCopExec="Kopieren der Executable"
  328. MsgCreDire="Erstellen der Ordner"
  329. MsgDmpUncr="$( echo -e -n "Dumping von unverschl\0374sselten Daten der App" )"
  330. MsgIpaInco="$( echo -e -n "Unvollst\0344ndige .ipa" )"
  331. MsgDskFull="Kein Speicher mehr"
  332. MsgEraMemo="$( echo -e -n "L\0366schen des Zwischenspeichers" )"
  333. MsgInsCydi="Installieren mit Cydia"
  334. MsgIpaDone="Fertig"
  335. MsgMnuEmpt="leer"
  336. MsgMrkDone="Alle Apps als gecrackt markieren"
  337. MsgPatCryp="Aufinden und patchen der CryptID"
  338. MsgRemTemp="$( echo -e -n "L\0366schen des Speichers" )"
  339. MsgRepData="$( echo -e -n "und Austausch der verschl\0374sselten Daten" )"
  340. MsgSizUnit="B"
  341. MsgUnaLoca="$( echo -e -n "Unm\0366glich zu Finden" )"
  342. MsgVrfDump="$( echo -e -n "\0334perpr\0374fen des Dumps" )"
  343. MsgWrgChoi="Schlechte Wahl"
  344. MsgWrnMeta="$( echo -e -n "Warnung: Das Format der iTunesMetaData wurde ge\0344ndert" )"
  345. MsgYouChoi="Ihre Wahl"
  346. MsgZipStep="Kompression der .ipa (Schritt"
  347. MsgComBoth="$( echo -e -n "Zusammensetzung der zwei Bin\0344rdateien" )"
  348. MsgSgnAppl="Signieren der App"
  349. MsgCopArtw="Kopieren des Artworks"
  350. MsgFakMeta="und der falschen MetaData"
  351. MsgNotMeta="und keine MetaData"
  352. MsgFoundIt="Gefunden"
  353. MsgWasAskd="Angefragt"
  354. MsgErrrors="Fehler"
  355. MsgBrzNoth="Nichts"
  356. MsgMrkDone="$( echo -e -n "Alles als angew\0344hlt " )"
  357. MskZroDone="$( echo -e -n "Liste der angew\0344hlten l\0366schen " )"
  358. fi
  359.  
  360. # Language DE2 (utf8). Translation by Ushnak.
  361. if [ $PCMlang = "DE2" ]; then
  362. MsgAltMeth="Alternative Methode zum Dumpen"
  363. MsgAnaAppl="Analyse der App"
  364. MsgAppLoca="Suche"
  365. MsgBadChoi="$( echo -e -n "Ung\0303\0274ltige Wahl" )"
  366. MsgBldMenu="$( echo -e -n "Aufbau des Men\0303\0274s..." )"
  367. MsgBrzMode="Berzerker Modus: ALLES wird gecrackt"
  368. MsgcntFind="Nicht aufzufinden:"
  369. MsgCopExec="Kopieren der Executable"
  370. MsgCreDire="Erstellen der Ordner"
  371. MsgDmpUncr="$( echo -e -n "Dumping von unverschl\0303\0274sselten Daten der App" )"
  372. MsgIpaInco="$( echo -e -n "Unvollst\0303\0244ndige .ipa" )"
  373. MsgDskFull="Kein Speicher mehr"
  374. MsgEraMemo="$( echo -e -n "L\0303\0266schen des Zwischenspeichers" )"
  375. MsgInsCydi="Installieren mit Cydia"
  376. MsgIpaDone="Fertig"
  377. MsgMnuEmpt="leer"
  378. MsgMrkDone="Alle Apps als gecrackt markieren"
  379. MsgPatCryp="Aufinden und patchen der CryptID"
  380. MsgRemTemp="$( echo -e -n "L\0303\0266schen des Speichers" )"
  381. MsgRepData="$( echo -e -n "und Austausch der verschl\0303\0274sselten Daten" )"
  382. MsgSizUnit="B"
  383. MsgUnaLoca="$( echo -e -n "Unm\0303\0266glich zu Finden" )"
  384. MsgVrfDump="$( echo -e -n "\0303\0234perpr\0303\0274fen des Dumps" )"
  385. MsgWrgChoi="Schlechte Wahl"
  386. MsgWrnMeta="$( echo -e -n "Warnung: Das Format der iTunesMetaData wurde ge\0303\0244ndert" )"
  387. MsgYouChoi="Ihre Wahl"
  388. MsgZipStep="Kompression der .ipa (Schritt"
  389. MsgComBoth="$( echo -e -n "Zusammensetzung der zwei Bin\0303\0244rdateien" )"
  390. MsgSgnAppl="Signieren der App"
  391. MsgCopArtw="Kopieren des Artworks"
  392. MsgFakMeta="und der falschen MetaData"
  393. MsgNotMeta="und keine MetaData"
  394. MsgFoundIt="Gefunden"
  395. MsgWasAskd="Angefragt"
  396. MsgErrrors="Fehler"
  397. MsgBrzNoth="Nichts"
  398. MsgMrkDone="$( echo -e -n "Alles als angew\0303\0244hlt " )"
  399. MskZroDone="$( echo -e -n "Liste der angew\0303\0244hlten l\0303\0266schen " )"
  400. fi
  401. }
  402.  
  403.  
  404. # ======
  405. function UnicodeToHuman
  406. {
  407. # Convert from unicode to human, and remove unwanted chars
  408. human=$(echo -n "$unicode" | sed -e "s: :_:g" | od -c -A n -v --width=999 | sed \
  409. -e 's:+:Plus:g' \
  410. -e 's:302.240:_:g' \
  411. -e 's:302.251:_:g' \
  412. -e 's:302.256:_:g' \
  413. -e 's:302.260:Degree:g' \
  414. -e "s:302.264:':g" \
  415. -e 's:303.201:A:g' \
  416. -e 's:303.207:C:g' \
  417. -e 's:303.211:E:g' \
  418. -e 's:303.216:I:g' \
  419. -e 's:303.224:O:g' \
  420. -e 's:303.234:U:g' \
  421. -e 's:303.240:a:g' \
  422. -e 's:303.241:a:g' \
  423. -e 's:303.242:a:g' \
  424. -e 's:303.245:a:g' \
  425. -e 's:303.247:c:g' \
  426. -e 's:303.250:e:g' \
  427. -e 's:303.251:e:g' \
  428. -e 's:303.252:e:g' \
  429. -e 's:303.253:e:g' \
  430. -e 's:303.255:i:g' \
  431. -e 's:303.256:i:g' \
  432. -e 's:303.257:i:g' \
  433. -e 's:303.263:o:g' \
  434. -e 's:303.264:o:g' \
  435. -e 's:303.266:o:g' \
  436. -e 's:303.270:o:g' \
  437. -e 's:303.271:u:g' \
  438. -e 's:303.273:u:g' \
  439. -e 's:303.274:u:g' \
  440. -e 's:304.237:g:g' \
  441. -e 's:304.261:i:g' \
  442. -e 's:305.223:oe:g' \
  443. -e 's:312.236:k:g' \
  444. -e 's:316.251:Omega:g' \
  445. -e 's:342.200.223:-:g' \
  446. -e 's:342.200.224:-:g' \
  447. -e "s:342.200.230:':g" \
  448. -e "s:342.200.231:':g" \
  449. -e 's:342.200.242:-:g' \
  450. -e 's:342.202.254:EUR:g' \
  451. -e 's:342.204.242:_:g' \
  452. -e 's:342.213.205:.:g' \
  453. -e 's:342.226.272:_:g' \
  454. -e 's:342.227.217:-:g' \
  455. -e 's:342.230.205:_:g' \
  456. -e 's:342.231.253:_:g' \
  457. -e 's:342.235.222:_:g' \
  458. -e 's:347.246.205:_:g' \
  459. | tr -cd "[:alnum:][_'.][-]" | sed -e "s:_: :g" | sed -e "s: : :g" )
  460. # Todo: future enhancements
  461. # Help wanted for unknown or other unicodes
  462. }
  463.  
  464.  
  465. # ======
  466. function DisplayBars
  467. {
  468. ProgressPct=""
  469. if [ $PCMbarNum = "YES" ]; then
  470. ProgressXXX=$(( $BarCols * $ProgressDone / $ProgressTarget ))
  471. ProgressSSS=$(( $BarCols - $ProgressXXX ))
  472. ProgressPct=$(( 100 * $ProgressDone / $ProgressTarget ))
  473. echo "[${escGreen}${PCMxxx:0:$ProgressXXX}${escBlue}${PCMsss:0:$ProgressSSS}${escReset}] $ProgressPct%"
  474. fi
  475. if [ $PCMbarSize = "YES" ]; then
  476. ProgressXXX=$(( $BarCols * $ProgressDoneSize / $ProgressTargetSize ))
  477. ProgressSSS=$(( $BarCols - $ProgressXXX ))
  478. ProgressPct=$(( 100 * $ProgressDoneSize / $ProgressTargetSize ))
  479. echo "[${escCyan}${PCMxxx:0:$ProgressXXX}${escBlue}${PCMsss:0:$ProgressSSS}${escReset}] $ProgressPct%"
  480. fi
  481.  
  482. if [ ! -z "$ProgressPct" -a $PCMspeak = "YES" ]; then
  483. speak "$ProgressPct %" &
  484. fi
  485. }
  486.  
  487.  
  488. # ======
  489. # Begin Core Function
  490.  
  491. function CoreFunction
  492. {
  493. AppInput=$1
  494. CrackerName=$2
  495. CreditFile=$3
  496.  
  497. if [ ! "$CrackerName" ]; then
  498. CrackerName="$PCMcracker"
  499. fi
  500.  
  501. if [ ! "$CreditFile" ]; then
  502. CreditFile="$CrackerName"
  503. fi
  504.  
  505. # Script has app's full directory path as input (ie: called from GUI)
  506. if [ -d "$AppInput" ]; then
  507. tempLoc=$AppInput
  508. else
  509. # Script has app's name as input
  510. echo "$MsgAppLoca '$AppInput'"
  511. # Escape the "*" as ".*"
  512. AppGrep=$(echo "/$AppInput\.app" | sed "s:\*:\.\*:g")
  513. if [ -e /tmp/lsd.tmp ]; then
  514. tempLoc=$(grep -i "$AppGrep" /tmp/lsd.tmp)
  515. else
  516. tempLoc=""
  517. fi
  518. if [ -z "$tempLoc" ]; then
  519. echo "$MsgUnaLoca '$AppInput'"
  520. rm -f /tmp/lsd.tmp
  521. return 1
  522. fi
  523. AppCount=$(echo "$tempLoc" | wc -l)
  524. if [ $AppCount -gt 1 ]; then
  525. echo "$MsgFoundIt $AppCount installation directories:"
  526. echo "$tempLoc"
  527. rm -f /tmp/lsd.tmp
  528. return 1
  529. fi
  530. fi
  531.  
  532. # The app has been found
  533. MenuFound=$(($MenuFound + 1))
  534. AppPath=$(dirname "$tempLoc")
  535. AppName=$(basename "$tempLoc")
  536. echo -n "${Meter4}${escCyan}$MsgFoundIt ${escReset}'$(echo $AppName | sed "s:\\.app::")': "
  537.  
  538. if [ ! -d "$AppPath" ]; then
  539. echo "$MsgUnaLoca original installation directory"
  540. return 1
  541. fi
  542. if [ ! -d "$AppPath/$AppName" ]; then
  543. echo "$MsgUnaLoca .app directory"
  544. return 1
  545. fi
  546. AppExec=$(plutil -key CFBundleExecutable "$tempLoc/Info.plist" 2> /dev/null)
  547. if [ ! -e "$AppPath/$AppName/$AppExec" ]; then
  548. echo "$MsgUnaLoca executable"
  549. return 1
  550. fi
  551. # Get the name from MetaData
  552. AppDisplayName=$(plutil -key itemName "$AppPath/iTunesMetadata.plist" 2> /dev/null)
  553. # No alphanum characters at all ?
  554. AppDisplayNameAlpha=$(echo -n "$AppDisplayName" | tr -cd "[:alnum:]")
  555. if [ "$AppDisplayNameAlpha" = "" ]; then
  556. #echo "${Meter5}Warning: non-alpha name !"
  557. AppDisplayName=""
  558. fi
  559. # Get the name from InfoPlist or from executable name
  560. if [ "$AppDisplayName" = "" ]; then
  561. AppDisplayName=$(plutil -key CFBundleDisplayName "$tempLoc/Info.plist" 2> /dev/null)
  562. AppDisplayNameAlpha=$(echo -n "$AppDisplayName" | tr -cd "[:alnum:]")
  563. if [ "$AppDisplayNameAlpha" = "" ]; then
  564. AppDisplayName=$(plutil -key CFBundleName "$tempLoc/Info.plist" 2> /dev/null)
  565. AppDisplayNameAlpha=$(echo -n "$AppDisplayName" | tr -cd "[:alnum:]")
  566. if [ "$AppDisplayNameAlpha" = "" ]; then
  567. AppDisplayName=$AppExec
  568. #AppDisplayNameAlpha=$(echo -n "$AppDisplayName" | tr -cd "[:alnum:]")
  569. #if [ "$AppDisplayNameAlpha" = "" ]; then
  570. # echo "${Meter6}Warning: too exotic name !"
  571. #fi
  572. fi
  573. fi
  574. fi
  575.  
  576. # Convert AppName from unicode to human
  577. unicode=$AppDisplayName
  578. UnicodeToHuman
  579. AppDisplayName=$human
  580.  
  581. # Get the artist name from MetaData
  582. if [ $PCMartistfrommeta = "YES" ]; then
  583. artistName=$(plutil -key artistName "$AppPath/iTunesMetadata.plist" 2> /dev/null)
  584. artistNameAlpha=$(echo -n "$artistName" | tr -cd "[:alnum:]")
  585. # At least some alphanum inside ?
  586. if [ "$artistNameAlpha" != "" ]; then
  587. # Convert from unicode to human
  588. unicode=$artistName
  589. UnicodeToHuman
  590. AppDisplayName="$AppDisplayName [$human]"
  591. fi
  592. fi
  593.  
  594. # Show the real human name of the app
  595. echo "${Meter5}$AppDisplayName"
  596.  
  597. # Dealing with version numbers
  598. AppVer=$(plutil -key CFBundleVersion "$tempLoc/Info.plist" 2> /dev/null | tr -d "\n\r")
  599. AppShortVer=$(plutil -key CFBundleShortVersionString "$tempLoc/Info.plist" 2> /dev/null | tr -d "\n\r")
  600. if [ ! "$AppShortVer" = "" ]; then
  601. if [ ! "$AppShortVer" = "$AppVer" ]; then
  602. AppVer="$AppShortVer v$AppVer"
  603. fi
  604. fi
  605. MinOS=$(plutil -key MinimumOSVersion "$tempLoc/Info.plist" 2> /dev/null | tr -d ".")
  606. if [ "$MinOS" = "" ]; then
  607. echo "${Meter7}${escYellow}Warning${escReset}: unable to get MinOS"
  608. MinOS="000"
  609. fi
  610.  
  611. Patched=""
  612. Extras=""
  613. ExtrasMatos=""
  614. ExtrasInApp=""
  615. ExtrasAlsr=""
  616.  
  617. # Does it need at least an iPhone3GS ?
  618. Required=$(plutil -key 'UIRequiredDeviceCapabilities' "$tempLoc/Info.plist" 2> /dev/null)
  619. if [ ! -z "$(echo "$Required" | grep -e "armv7" -e "opengles-2")" ]; then
  620. ExtrasMatos=" 3GS"
  621. fi
  622.  
  623. # Is it iPad compatible only ?
  624. iPad=$(plutil -key 'UIDeviceFamily' "$tempLoc/Info.plist" 2> /dev/null)
  625. if [ ! -z "$iPad" ]; then
  626. if [ -z "$(echo "$iPad" | grep -e "1")" ]; then
  627. ExtrasMatos=" iPad"
  628. fi
  629. fi
  630.  
  631. # Creating temporary directory
  632. if [ $PCMverbose = "YES" ]; then
  633. echo -n "${Meter10}$MsgCreDire "
  634. fi
  635. WorkDir="/tmp/PCM-$(date +%Y%m%d-%H%M%S)"
  636. NewAppDir="$HOME/Documents/Cracked"
  637. if [ -e "$WorkDir" ]; then
  638. rm -rf "$WorkDir"
  639. fi
  640. mkdir -p "$WorkDir"
  641. if [ ! -e "$NewAppDir" ]; then
  642. mkdir -p "$NewAppDir"
  643. fi
  644. mkdir -p "$WorkDir/$AppName"
  645. if [ ! -d "$WorkDir" -o ! -d "$NewAppDir" -o ! -d "$WorkDir/$AppName" ]; then
  646. echo "failed ! Directories not created"
  647. return 1
  648. fi
  649.  
  650. # Copying executable to temporary space
  651. if [ $PCMverbose = "YES" ]; then
  652. echo "${Meter15}$MsgCopExec"
  653. fi
  654.  
  655. foo=$( cp -a "$AppPath/$AppName/$AppExec" "$WorkDir/$AppName/" 2>&1> /dev/null )
  656. if [ ! -e "$WorkDir/$AppName/$AppExec" ]; then
  657. echo "Unable to copy application files"
  658. rm -fr "$WorkDir"
  659. return 1
  660. else
  661. # Disk full ?
  662. if [ $(stat -c%s "$WorkDir/$AppName/$AppExec") != $(stat -c%s "$AppPath/$AppName/$AppExec") ]; then
  663. echo "${escRed}$MsgDskFull ?${escReset}"
  664. rm -fr "$WorkDir"
  665. return 1
  666. fi
  667. fi
  668.  
  669. if [ $PCMverbose = "YES" ]; then
  670. echo -n "${Meter20}$MsgAnaAppl: "
  671. fi
  672.  
  673. # Can I haz kittenz ?
  674. PawsPawsAttack="NO"
  675.  
  676. # Looking for fat's magic numbers (CafeBabe)
  677. CafeBabeIsFat=$(dd bs=4 count=1 skip=0 if="$WorkDir/$AppName/$AppExec" 2> /dev/null | od -A n -t x1 -v | grep "ca fe ba be")
  678. if [ ! "$CafeBabeIsFat" ]; then
  679. if [ $PCMverbose = "YES" ]; then
  680. echo "${Meter25}Thin Binary found"
  681. fi
  682. Iterations=1
  683.  
  684. # Does it have the ASLR bit flag ?
  685. AslrBits=$(dd bs=1 count=1 skip=26 if="$WorkDir/$AppName/$AppExec" 2> /dev/null | od -A n -t u -v )
  686. AslrBit=$(( $AslrBits & 32 ))
  687. if [ $AslrBit -ne 0 ]; then
  688. NotAslrBits=$(( $AslrBits & 223 ))
  689. echo "${Meter26}${escYellow}Warning:${escReset} ASLR bit detected. Trying"
  690. PawsPawsAttack="YES"
  691. fi
  692.  
  693. else
  694. if [ $PCMverbose = "YES" ]; then
  695. echo "${Meter25}Fat Binary found"
  696. echo "${Meter26}Dumping armv6 section"
  697. fi
  698.  
  699. # We don't use lipo anymore
  700. #foo=$(lipo -thin armv6 "$WorkDir/$AppName/$AppExec" -output "$WorkDir/$AppName/IWantYourSix" 2>&1> /dev/null)
  701.  
  702. # Get the fat's full headers, then extract the infos
  703. foo=$(dd bs=4096 count=1 skip=0 if="$WorkDir/$AppName/$AppExec" of="$WorkDir/$AppName/CafeBabe.is.Fat" 2>&1> /dev/null)
  704. FullCafeBabe=$(cat "$WorkDir/$AppName/CafeBabe.is.Fat" | od -A n -t x1 -v | tr -d ' ','\n')
  705. SixOrNine=${FullCafeBabe:30:2}
  706. NineOrSix=${FullCafeBabe:70:2}
  707. if [ "$SixOrNine" = "06" ]; then
  708. SixSix=${FullCafeBabe:32:16}
  709. fi
  710. if [ "$SixOrNine" = "09" ]; then
  711. NineNine=${FullCafeBabe:32:16}
  712. fi
  713. if [ "$NineOrSix" = "06" ]; then
  714. SixSix=${FullCafeBabe:72:16}
  715. fi
  716. if [ "$NineOrSix" = "09" ]; then
  717. NineNine=${FullCafeBabe:72:16}
  718. fi
  719. SixOff=$(echo "0x${SixSix:0:8}" | awk --non-decimal-data '{print ($1)+1 }')
  720. SixSize=$(echo "0x${SixSix:8:8}" | awk --non-decimal-data '{print ($1)+0 }')
  721. NineOff=$(echo "0x${NineNine:0:8}" | awk --non-decimal-data '{print ($1)+1 }')
  722. NineSize=$(echo "0x${NineNine:8:8}" | awk --non-decimal-data '{print ($1)+0 }')
  723. # Cut the arm6 part from the fat binary
  724. foo=$( cat "$WorkDir/$AppName/$AppExec" | tail --bytes=+$SixOff | head --bytes=$SixSize > "$WorkDir/$AppName/IWantYourSix" 2> /dev/null )
  725.  
  726. # Disk full ?
  727. if [ ! -e "$WorkDir/$AppName/IWantYourSix" ]; then
  728. echo "${escRed}$MsgDskFull ?${escReset}"
  729. rm -fr "$WorkDir"
  730. return 1
  731. else
  732. if [ $(stat -c%s "$WorkDir/$AppName/IWantYourSix") != $SixSize ]; then
  733. echo "${escRed}$MsgDskFull ?${escReset}"
  734. rm -fr "$WorkDir"
  735. return 1
  736. fi
  737. fi
  738.  
  739. chmod 777 "$WorkDir/$AppName/IWantYourSix"
  740.  
  741. # Does it have the ASLR bit flag ?
  742. AslrBits=$(dd bs=1 count=1 skip=26 if="$WorkDir/$AppName/IWantYourSix" 2> /dev/null | od -A n -t u -v )
  743. AslrBit=$(( $AslrBits & 32 ))
  744. if [ $AslrBit -ne 0 ]; then
  745. echo "${Meter26}${escRed}Warning:${escReset} ASLR bit detected. FAIL"
  746. rm -fr "$WorkDir"
  747. return 1
  748. fi
  749.  
  750. # Force armv7 processing on armv6 devices. (It won't work at all; for debug only !)
  751. if [ $PCMarm7onarm6 = "YES" ]; then
  752. echo "${Meter27}${escYellow}Warning:${escReset} forcing armv7 is stupid !"
  753. CPUType=""
  754. else
  755. CPUType=$(sysctl hw.cpusubtype | grep 6 | awk '{print $2}')
  756. fi
  757.  
  758. # The iDevice has an arm7 cpu
  759. if [ ! $CPUType ]; then
  760. if [ $PCMverbose = "YES" ]; then
  761. echo "${Meter28}Dumping armv7 section"
  762. fi
  763. Iterations=2
  764. # Swapping armv6 and armv7 headers
  765. SixOrNine=$(dd bs=1 count=1 skip=15 if="$WorkDir/$AppName/$AppExec" 2> /dev/null)
  766. NineOrSix=$(dd bs=1 count=1 skip=35 if="$WorkDir/$AppName/$AppExec" 2> /dev/null)
  767. foo=$(echo -n "$NineOrSix" | dd bs=1 seek=15 conv=notrunc status=noxfer of="$WorkDir/$AppName/$AppExec" 2>&1> /dev/null)
  768. foo=$(echo -n "$SixOrNine" | dd bs=1 seek=35 conv=notrunc status=noxfer of="$WorkDir/$AppName/$AppExec" 2>&1> /dev/null)
  769.  
  770. # We don't use lipo anymore
  771. #foo=$(lipo -thin armv6 "$WorkDir/$AppName/$AppExec" -output "$WorkDir/$AppName/SevenTrumpets" 2>&1> /dev/null)
  772.  
  773. # Dumping swapped armv7 part
  774. foo=$( cat "$WorkDir/$AppName/$AppExec" | tail --bytes=+$NineOff | head --bytes=$NineSize > "$WorkDir/$AppName/SevenTrumpets" 2> /dev/null )
  775.  
  776. # Disk full ?
  777. if [ ! -e "$WorkDir/$AppName/SevenTrumpets" ]; then
  778. echo "${escRed}$MsgDskFull ?${escReset}"
  779. rm -fr "$WorkDir"
  780. return 1
  781. else
  782. if [ $(stat -c%s "$WorkDir/$AppName/SevenTrumpets") != $NineSize ]; then
  783. echo "${escRed}$MsgDskFull ?${escReset}"
  784. rm -fr "$WorkDir"
  785. return 1
  786. fi
  787. fi
  788.  
  789. chmod 777 "$WorkDir/$AppName/SevenTrumpets"
  790.  
  791. # Does it have the ASLR bit flag ?
  792. AslrBits=$(dd bs=1 count=1 skip=26 if="$WorkDir/$AppName/SevenTrumpets" 2> /dev/null | od -A n -t u -v )
  793. AslrBit=$(( $AslrBits & 32 ))
  794. if [ $AslrBit -ne 0 ]; then
  795. echo "${Meter28}${escYellow}Warning:${escReset} ASLR bit detected. Trying."
  796. NotAslrBits=$(( $AslrBits & 223 ))
  797. PawsPawsAttack="YES"
  798. fi
  799.  
  800. else
  801. if [ $PCMverbose = "YES" ]; then
  802. echo "${Meter28}Non armv7 compatible CPU: not dumping armv7"
  803. fi
  804. # Forcing fat to thin
  805. Iterations=1
  806. fi
  807. # (Deleting the fat binary: later)
  808. fi
  809.  
  810. # Doing one or two parts
  811. for (( i=1;i<=$Iterations;i++)); do
  812. if [ ! "$CafeBabeIsFat" ]; then
  813. AppExecCur=$AppExec
  814. else
  815. if [ $i -eq 1 ]; then
  816. if [ $PCMverbose = "YES" ]; then
  817. echo "${Meter30}--- Cracking armv6 section ---"
  818. fi
  819. AppExecCur="IWantYourSix"
  820. else
  821. if [ $PCMverbose = "YES" ]; then
  822. echo "${Meter30}--- Cracking armv7 section ---"
  823. fi
  824. AppExecCur="SevenTrumpets"
  825. fi
  826. fi
  827.  
  828. # Getting executable's details
  829. Peter=$(otool -l "$WorkDir/$AppName/$AppExecCur")
  830.  
  831. # Check executable's dump address. Rare apps shift it on purpose.
  832. Pesky=$(echo "$Peter" | tr '\n' '\\' | sed -e 's:Load command:\nLoad command:g' | grep "cmd LC_SEGMENT" | grep "segname __TEXT" | tr '\\' '\n' | grep "vmaddr" | awk --non-decimal-data '{print ($2)+0 }')
  833. if [ $Pesky != 4096 ]; then
  834. echo "${Meter31}${escRed}Warning:${escReset} address shifting ($Pesky)"
  835. fi
  836.  
  837. # Finding location of the "cstring" data block to be LamedPatched
  838. LPoff=$(echo "$Peter" | grep cstring -A4 | grep offset | awk '{print $2}')
  839. if [ ! "$LPoff" ]; then
  840. echo "${Meter31}${escYellow}Warning:${escReset} unable to find LPoff"
  841. LPoff=0
  842. LPsize=0
  843. else
  844. LPsize=$(echo "$Peter" | grep cstring -A4 | grep size | awk --non-decimal-data '{print ($2)+0 }')
  845. if [ ! "$LPsize" ]; then
  846. echo "${Meter31}${escYellow}Warning:${escReset} unable to find LPsize"
  847. LPoff=0
  848. LPsize=0
  849. fi
  850. fi
  851.  
  852. # Finding all Crypt details
  853. CryptID=$(echo "$Peter" | grep cryptid | awk '{print $2}')
  854. if [ "$CryptID" != "1" ]; then
  855. echo "${escRed}Application is not encrypted${escReset}"
  856. rm -fr "$WorkDir"
  857. return 1
  858. fi
  859. CryptSize=$(echo "$Peter" | grep cryptsize | awk '{print $2}')
  860. if [ ! "$CryptSize" ]; then
  861. echo "${escRed}Unable to find CryptSize${escReset}"
  862. rm -fr "$WorkDir"
  863. return 1
  864. fi
  865. CryptOff=$(echo "$Peter" | grep cryptoff | awk '{print $2}')
  866. if [ ! "$CryptOff" ]; then
  867. echo "${escRed}Unable to find CryptOff${escReset}"
  868. rm -fr "$WorkDir"
  869. return 1
  870. fi
  871.  
  872. # This app has in-app purchases (aka DLC) ?
  873. if [ ! -z "$( dd bs=$CryptOff count=1 if="$WorkDir/$AppName/$AppExecCur" 2> /dev/null | grep "StoreKit.framework" )" ]; then
  874. ExtrasInApp=" InApp"
  875. fi
  876.  
  877. # - Take first 4KB of the file (ie: headers), convert to hex on 1 long line
  878. # - Find the CryptID command block
  879. # - Compute the offset to patch
  880. # - Patch 01 --> 00
  881. if [ $PCMverbose = "YES" ]; then
  882. echo "${Meter32}$MsgPatCryp"
  883. fi
  884. dd bs=4096 count=1 if="$WorkDir/$AppName/$AppExecCur" 2> /dev/null | \
  885. od -A n -t x1 -v | \
  886. tr -d ' ','\n' | \
  887. sed "s/0000002100000014......................01.*/ThisIsItThisIsItThisIsItMichaelJackson/g" > "$WorkDir/hex.tmp"
  888. foo=$(echo -ne "\x00" | dd bs=1 seek=$(expr $(($(stat -c%s "$WorkDir/hex.tmp"))) / 2) conv=notrunc status=noxfer of="$WorkDir/$AppName/$AppExecCur" 2>&1> /dev/null)
  889. rm -f "$WorkDir/hex.tmp"
  890. cid=$(otool -l "$WorkDir/$AppName/$AppExecCur" | grep cryptid | awk '{print $2}')
  891.  
  892. if [ "$cid" != "0" ]; then
  893. echo "${escRed}Unable to patch CryptID${escReset}"
  894. rm -fr "$WorkDir"
  895. return 1
  896. fi
  897.  
  898. # Creating GDB script
  899. if [ $AltDump != "YES" ]; then
  900. echo -e "set sharedlibrary load-rules \".*\" \".*\" none\r\n\
  901. set inferior-auto-start-dyld off\r\n\
  902. set sharedlibrary preload-libraries off\r\n\
  903. set sharedlibrary load-dyld-symbols off\r\n\
  904. handle all nostop\r\n\
  905. rb doModInitFunctions\r\n
  906. command 1\r\n\
  907. dump memory $WorkDir/dump.bin $(($CryptOff + $Pesky)) $(($CryptSize + $CryptOff + $Pesky))\r\n\
  908. dump memory $WorkDir/LP.bin $(($LPoff + $Pesky)) $(($LPsize + $LPoff + $Pesky))\r\n\
  909. kill\r\n\
  910. quit\r\n\
  911. end\r\n\
  912. start" > $WorkDir/batch.gdb
  913. else
  914. echo -e "set sharedlibrary load-rules \".*\" \".*\" none\r\n\
  915. set inferior-auto-start-dyld off\r\n\
  916. set sharedlibrary preload-libraries off\r\n\
  917. set sharedlibrary load-dyld-symbols off\r\n\
  918. dump memory $WorkDir/dump.bin $(($CryptOff + $Pesky)) $(($CryptSize + $CryptOff + $Pesky))\r\n\
  919. dump memory $WorkDir/LP.bin $(($LPoff + $Pesky)) $(($LPsize + $LPoff + $Pesky))\r\n\
  920. quit\r\n" > $WorkDir/batch.gdb
  921. fi
  922.  
  923. # If first part (arm6) of a fat binary and running an arm7 iDevice, swap trick !
  924. # (The arm7 iDevice always load the arm7 part, but it's swapped with the arm6 part: tricked).
  925. SwapSwapAttack="NO"
  926. if [ $i -eq 1 ]; then
  927. if [ "$CafeBabeIsFat" ]; then
  928. if [ ! $CPUType ]; then
  929. SwapSwapAttack="YES"
  930. fi
  931. fi
  932. fi
  933.  
  934. if [ $PCMverbose = "YES" ]; then
  935. echo "${Meter40}$MsgDmpUncr"
  936. fi
  937.  
  938. if [ $SwapSwapAttack = "YES" ]; then
  939. # Cracking the previously swapped fat binary in WorkDir
  940. if [ $PCMverbose = "YES" ]; then
  941. echo "${Meter41}Swap Swap Attack !"
  942. fi
  943. # Copying some files
  944. mkdir "$WorkDir/$AppName/SC_Info"
  945. chmod 777 "$WorkDir/$AppName/SC_Info"
  946. cp "$AppPath/$AppName/SC_Info/$AppExec.sinf" "$WorkDir/$AppName/SC_Info/$AppExec.sinf"
  947. chmod 777 "$WorkDir/$AppName/SC_Info/$AppExec.sinf"
  948. cp "$AppPath/$AppName/SC_Info/$AppExec.supp" "$WorkDir/$AppName/SC_Info/$AppExec.supp"
  949. chmod 777 "$WorkDir/$AppName/SC_Info/$AppExec.supp"
  950.  
  951. # Cracking the previously swapped fat binary in WorkDir
  952. if [ $AltDump != "YES" ]; then
  953. DumpLog=$(gdb -q -e "$WorkDir/$AppName/$AppExec" -x $WorkDir/batch.gdb -batch 2>&1)
  954. else
  955. echo "${Meter41}Using alt dumping"
  956. echo "${Meter42}Running app in background"
  957. # Running executable in background with low priority.
  958. (nice "$WorkDir/$AppName/$AppExec" & echo $! > /tmp/pid.txt ) > /dev/null 2>&1> /dev/null
  959. # Get PID of this background process
  960. backback=$(cat /tmp/pid.txt)
  961. rm /tmp/pid.txt
  962. echo "${Meter43}Loading app in background"
  963. sleep 10
  964. if [ ! "$(ps -e | grep "$backback " | grep "$WorkDir/$AppName/$AppExec" | wc -l)" -eq 1 ]; then
  965. echo "Buah, buah, buah"
  966. rm -fr "$WorkDir"
  967. return 1
  968. fi
  969. echo "${Meter44}Attaching process $backback"
  970. DumpLog=$(gdb -q -x $WorkDir/batch.gdb -batch --pid=$backback >&1 2>&1)
  971. sleep 1
  972. # Kill and wait...
  973. echo "${Meter45}Killing process $backback"
  974. kill $backback > /dev/null 2>&1
  975. sleep 1
  976. echo "${Meter46}Waiting for end of process $backback"
  977. wait $backback > /dev/null 2>&1
  978. fi
  979.  
  980. # Removing temp files
  981. rm "$WorkDir/$AppName/$AppExec"
  982. rm "$WorkDir/$AppName/SC_Info/$AppExec.sinf"
  983. rm "$WorkDir/$AppName/SC_Info/$AppExec.supp"
  984. rmdir "$WorkDir/$AppName/SC_Info"
  985. else
  986. # Cracking genuine executable in AppPath
  987. if [ $AltDump != "YES" ]; then
  988.  
  989. if [ $PawsPawsAttack = "YES" ]; then
  990. # Cracking the kittenz clawzed fat binary in WorkDir
  991. if [ $PCMverbose = "YES" ]; then
  992. echo "${Meter41}Paws Paws Attack ! Kittenz clawz !"
  993. fi
  994.  
  995. # Copying some files
  996. mkdir "$WorkDir/ASLR"
  997. chmod 777 "$WorkDir/ASLR"
  998. mkdir "$WorkDir/ASLR/SC_Info"
  999. chmod 777 "$WorkDir/ASLR/SC_Info"
  1000. cp "$AppPath/$AppName/SC_Info/$AppExec.sinf" "$WorkDir/ASLR/SC_Info/$AppExec.sinf"
  1001. chmod 777 "$WorkDir/ASLR/SC_Info/$AppExec.sinf"
  1002. cp "$AppPath/$AppName/SC_Info/$AppExec.supp" "$WorkDir/ASLR/SC_Info/$AppExec.supp"
  1003. chmod 777 "$WorkDir/ASLR/SC_Info/$AppExec.supp"
  1004.  
  1005. # Copying genuine executable then patching its ASLR bit
  1006. cp "$AppPath/$AppName/$AppExec" "$WorkDir/ASLR/$AppExec"
  1007. chmod 777 "$WorkDir/ASLR/$AppExec"
  1008.  
  1009. # Computing where to patch
  1010. if [ ! "$CafeBabeIsFat" ]; then
  1011. BouncingTigger=26
  1012. else
  1013. BouncingTigger=$(($NineOff + 25))
  1014. fi
  1015.  
  1016. foo=$(echo $NotAslrBits | awk '{ printf("%c",$0); }' | \
  1017. dd bs=1 seek=$BouncingTigger conv=notrunc status=noxfer of="$WorkDir/ASLR/$AppExec" 2>&1> /dev/null)
  1018.  
  1019. # Gdbing it
  1020. DumpLog=$(gdb -q -e "$WorkDir/ASLR/$AppExec" -x $WorkDir/batch.gdb -batch 2>&1)
  1021.  
  1022. # Removing temp files
  1023. rm "$WorkDir/ASLR/$AppExec"
  1024. rm "$WorkDir/ASLR/SC_Info/$AppExec.sinf"
  1025. rm "$WorkDir/ASLR/SC_Info/$AppExec.supp"
  1026. rmdir "$WorkDir/ASLR/SC_Info"
  1027. rmdir "$WorkDir/ASLR"
  1028.  
  1029. ExtrasAlsr=" ASLR"
  1030.  
  1031. else
  1032. # Cracking genuine executable in AppPath
  1033. DumpLog=$(gdb -q -e "$AppPath/$AppName/$AppExec" -x $WorkDir/batch.gdb -batch 2>&1)
  1034. fi
  1035. else
  1036. # Alt-cracking genuine executable in AppPath
  1037. echo "${Meter41}Using alt dumping"
  1038. echo "${Meter42}Running app in background"
  1039. # Running executable in background with low priority.
  1040. (nice "$AppPath/$AppName/$AppExec" & echo $! > /tmp/pid.txt ) > /dev/null 2>&1> /dev/null
  1041. # Get PID of this background process
  1042. backback=$(cat /tmp/pid.txt)
  1043. rm /tmp/pid.txt
  1044. echo "${Meter43}Loading app in background"
  1045. sleep 10
  1046. if [ ! "$(ps -e | grep "$backback " | grep "$AppPath/$AppName/$AppExec" | wc -l)" -eq 1 ]; then
  1047. echo "Buah, buah, buah"
  1048. rm -fr "$WorkDir"
  1049. return 1
  1050. fi
  1051. echo "${Meter44}Attaching process $backback"
  1052. DumpLog=$(gdb -q -x $WorkDir/batch.gdb -batch --pid=$backback >&1 2>&1)
  1053. sleep 1
  1054. # Kill and wait...
  1055. echo "${Meter45}Killing process $backback"
  1056. kill $backback > /dev/null 2>&1
  1057. sleep 1
  1058. echo "${Meter46}Waiting for end of process $backback"
  1059. wait $backback > /dev/null 2>&1
  1060. fi
  1061. fi
  1062.  
  1063. # Not needed anymore
  1064. rm $WorkDir/batch.gdb
  1065.  
  1066. # Verifying dump
  1067. if [ $PCMverbose = "YES" ]; then
  1068. echo -n "${Meter50}$MsgVrfDump "
  1069. fi
  1070. if [ ! -e "$WorkDir/dump.bin" ]; then
  1071. echo "${escRed}failed ! Can't dump ?${escReset}"
  1072. if [ -e /usr/bin/logger ]; then
  1073. echo "$DumpLog" | logger -t PCMdump
  1074. fi
  1075. rm -fr "$WorkDir"
  1076. return 1
  1077. fi
  1078. DumpSize=$(stat -c%s "$WorkDir/dump.bin")
  1079. if [ "$DumpSize" != "$CryptSize" ]; then
  1080. echo "${escRed}failed ! Wrong dump size ?${escReset}"
  1081. if [ -e /usr/bin/logger ]; then
  1082. echo "$DumpLog" | logger -t PCMdump
  1083. fi
  1084. rm -fr "$WorkDir"
  1085. return 1
  1086. fi
  1087.  
  1088. # Replacing executable's crypted data with dumped clear data
  1089. if [ $PCMverbose = "YES" ]; then
  1090. echo "${Meter54}$MsgRepData"
  1091. fi
  1092. foo=$(dd seek=1 count=1 obs=$CryptOff ibs=$DumpSize conv=notrunc if="$WorkDir/dump.bin" of="$WorkDir/$AppName/$AppExecCur" 2>&1> /dev/null)
  1093. rm "$WorkDir/dump.bin"
  1094.  
  1095. # Trying LamestPatchest to remove some ads and some security checks
  1096. if [ $PCMlamestpatchest = "YES" ]; then
  1097. if [ $LPoff = 0 -o $LPsize = 0 ]; then
  1098. patchme="$WorkDir/$AppName/$AppExecCur"
  1099. if [ $PCMverbose = "YES" ]; then
  1100. echo -n "${Meter58}${escYellow}Trying old LamerPatcher...${escReset} "
  1101. fi
  1102. else
  1103. patchme="$WorkDir/LP.bin"
  1104. if [ $PCMverbose = "YES" ]; then
  1105. echo -n "${Meter58}Trying LamestPatchest... "
  1106. fi
  1107. # Disk full ?
  1108. if [ $(stat -c%s "$WorkDir/LP.bin") != $LPsize ]; then
  1109. echo "${escRed}$MsgDskFull ?${escReset}"
  1110. rm -fr "$WorkDir"
  1111. return 1
  1112. fi
  1113. fi
  1114. # LamingPatching !
  1115. sed --in-place=.BCK \
  1116. -e 's=/Cydia\.app=/Czdjb\.bpp=g' \
  1117. -e 's=ppa\.aidyC=ppb\.bjdzC=g' \
  1118. -e 's=/private/var/lib/apt=/prjvbtf/vbr/ljb/bpt=g' \
  1119. -e 's=/bin/mkdir=/bjn/mkdjr=g' \
  1120. -e 's=/usr/bin/ssh=/vsr/bjn/ssh=g' \
  1121. -e 's=/Applicat\d0\d0\d0ions/dele\d0\d0\d0teme\.txt=/Bppljcbt\d0\d0\d0jpns/dflf\d0\d0\d0tfmf\.txt=g' \
  1122. -e 's=/Appl\d0\d0\d0ications/C\d0\d0ydi\d0a\.app=/Bppl\d0\d0\d0jcbtjpns/C\d0\d0zdj\d0b\.bpp=g' \
  1123. -e 's=ations/Cy\d0\d0\d0/Applic\d0pp\d0\d0dia.a=btjpns/Cz\d0\d0\d0/Bppljc\d0pp\d0\d0djb.b=g' \
  1124. -e 's=ate/va\d0\d0/priv\d0\d0\d0pt/\d0b/a\d0r/li=btf/vb\d0\d0/prjv\d0\d0\d0pt/\d0b/b\d0r/lj=g' \
  1125. -e 's=pinchmedia\.com=pjnchmfdjb\.cpm=g' \
  1126. -e 's=admob\.com=bdmpb\.cpm=g' \
  1127. -e 's=doubleclick\.net=dpvblfcljck\.nft=g' \
  1128. -e 's=googlesyndication\.com=gppglfszndjcbtjpn\.cpm=g' \
  1129. -e 's=flurry\.com=flvrrz\.cpm=g' \
  1130. -e 's=qwapi\.com=qwbpj\.cpm=g' \
  1131. -e 's=mobclix\.com=mpbcljx\.cpm=g' \
  1132. -e 's=http://ad\.=http://bd/=g' \
  1133. -e 's=http://ads\.=http://bds/=g' \
  1134. -e 's=http://ads2\.=http://bds2/=g' \
  1135. -e 's=adwhirl\.com=bdwhjrl\.cpm=g' \
  1136. -e 's=vdopia\.com=vdppjb\.cpm=g' \
  1137. -e 's=tapjoyads\.com=tbpjpzbds\.cpm=g' \
  1138. -e 's=/Library/MobileSubstrate=/Ljbrbrz/MpbjlfSvbstrbtf=g' \
  1139. "$patchme"
  1140.  
  1141. # "/Applications/mAdvLock.app"
  1142. # "/Applications/Icy\.app"
  1143. # "/Applications/SBSettings\.app"
  1144.  
  1145. # Disk full ?
  1146. if [ ! -e "$patchme.BCK" ]; then
  1147. echo "${escRed}$MsgDskFull ?${escReset}"
  1148. rm -fr "$WorkDir"
  1149. return 1
  1150. else
  1151. if [ $(stat -c%s "$patchme.BCK") != $(stat -c%s "$patchme") ]; then
  1152. echo "${escRed}$MsgDskFull ?${escReset}"
  1153. rm -fr "$WorkDir"
  1154. return 1
  1155. fi
  1156. fi
  1157.  
  1158. # Something patched or not ?
  1159. cmp --silent "$patchme.BCK" "$patchme"
  1160. if [ "$?" != "0" ]; then
  1161. if [ $PCMverbose = "YES" ]; then
  1162. echo "${Meter59}patched things"
  1163. fi
  1164. Patched=" LP"
  1165. if [ -e "$WorkDir/LP.bin" ]; then
  1166. foo=$(dd seek=1 count=1 obs=$LPoff ibs=$LPsize conv=notrunc if="$WorkDir/LP.bin" of="$WorkDir/$AppName/$AppExecCur" 2>&1> /dev/null)
  1167. fi
  1168. else
  1169. if [ $PCMverbose = "YES" ]; then
  1170. echo "${Meter59}found nothing"
  1171. fi
  1172. fi
  1173. rm "$patchme.BCK"
  1174. fi
  1175. if [ -e "$WorkDir/LP.bin" ]; then
  1176. rm "$WorkDir/LP.bin"
  1177. fi
  1178. done
  1179. # End of loop. All parts are now done.
  1180.  
  1181. # Unsplitting fat binary
  1182. if [ "$CafeBabeIsFat" ]; then
  1183. rm -f "$WorkDir/$AppName/$AppExec"
  1184. if [ $PCMverbose = "YES" ]; then
  1185. echo "${Meter61}---"
  1186. fi
  1187. if [ -e "$WorkDir/$AppName/SevenTrumpets" ]; then
  1188. if [ $PCMverbose = "YES" ]; then
  1189. echo "${Meter62}$MsgComBoth"
  1190. fi
  1191.  
  1192. # We don't use lipo anymore
  1193. #foo=$(lipo -create "$WorkDir/$AppName/IWantYourSix" "$WorkDir/$AppName/SevenTrumpets" -output "$WorkDir/$AppName/$AppExec" 2>&1> /dev/null)
  1194.  
  1195. if [ $NineOff -gt $SixOff ]; then
  1196. foo=$( cat "$WorkDir/$AppName/CafeBabe.is.Fat" "$WorkDir/$AppName/IWantYourSix" /dev/zero | head --bytes=$(($NineOff - 1)) > "$WorkDir/$AppName/TaSoeurEstGrosse" 2> /dev/null )
  1197. foo=$( cat "$WorkDir/$AppName/TaSoeurEstGrosse" "$WorkDir/$AppName/SevenTrumpets" > "$WorkDir/$AppName/$AppExec" 2> /dev/null )
  1198. rm -f "$WorkDir/$AppName/TaSoeurEstGrosse"
  1199. else
  1200. echo "${Meter64}Warning: Six ($SixOff) is bigger ($NineOff)"
  1201. foo=$( cat "$WorkDir/$AppName/CafeBabe.is.Fat" "$WorkDir/$AppName/SevenTrumpets" /dev/zero | head --bytes=$(($SixOff - 1)) > "$WorkDir/$AppName/TaSoeurEstGrosse" 2> /dev/null )
  1202. foo=$( cat "$WorkDir/$AppName/TaSoeurEstGrosse" "$WorkDir/$AppName/IWantYourSix" > "$WorkDir/$AppName/$AppExec" 2> /dev/null )
  1203. rm -f "$WorkDir/$AppName/TaSoeurEstGrosse"
  1204. fi
  1205. rm "$WorkDir/$AppName/IWantYourSix"
  1206. rm "$WorkDir/$AppName/SevenTrumpets"
  1207. # Disk full ?
  1208. if [ $(stat -c%s "$WorkDir/$AppName/$AppExec") != $(stat -c%s "$AppPath/$AppName/$AppExec") ]; then
  1209. echo "${escRed}$MsgDskFull ?${escReset}"
  1210. rm -fr "$WorkDir"
  1211. return 1
  1212. fi
  1213. else
  1214. mv "$WorkDir/$AppName/IWantYourSix" "$WorkDir/$AppName/$AppExec"
  1215. fi
  1216.  
  1217. # Disk full ?
  1218. if [ ! -e "$WorkDir/$AppName/$AppExec" ]; then
  1219. echo "${escRed}$MsgDskFull ?${escReset}"
  1220. rm -fr "$WorkDir"
  1221. return 1
  1222. fi
  1223.  
  1224. chmod 777 "$WorkDir/$AppName/$AppExec"
  1225.  
  1226. # Dropping my girlfriend
  1227. if [ -e "$WorkDir/$AppName/CafeBabe.is.Fat" ]; then
  1228. rm -f "$WorkDir/$AppName/CafeBabe.is.Fat"
  1229. fi
  1230. fi
  1231.  
  1232. # Signing the application with 'ldone' (better than 'ldid').
  1233. if [ $PCMverbose = "YES" ]; then
  1234. echo "${Meter64}$MsgSgnAppl"
  1235. fi
  1236. foo=$(ldone "$WorkDir/$AppName/$AppExec" -s 2>&1> /dev/null)
  1237.  
  1238. # Timestamp-back executable to defeat checks
  1239. touch -r "$AppPath/$AppName/$AppExec" "$WorkDir/$AppName/$AppExec"
  1240.  
  1241. # Adding date
  1242. DayToday="$( date +%Y-%m-%d )"
  1243.  
  1244. # Adding credits file
  1245. if [ ! "$CrackerName" = "Anonymous" ]; then
  1246. if [ $PCMverbose = "YES" ]; then
  1247. echo "${Meter65}Adding Credits"
  1248. fi
  1249. echo "Cracked by $CrackerName ($DayToday)" > "$WorkDir/$AppName/$CreditFile"
  1250. if [ ! -e "$AppPath/$AppName/$AppExec.crc" ]; then
  1251. echo "CheckSum=$(echo -n "$CrackerName" | od -A n -t x1 -v | tr -d ' ','\n')" > "$WorkDir/$AppName/$AppExec.crc"
  1252. touch -r "$AppPath/$AppName/$AppExec" "$WorkDir/$AppName/$AppExec.crc"
  1253. fi
  1254. fi
  1255.  
  1256. # Building .ipa (step 1)
  1257. mkdir -p "$WorkDir/Payload"
  1258. if [ ! -e "$WorkDir/Payload" ]; then
  1259. echo "Failed to create Payload directory"
  1260. rm -fr "$WorkDir"
  1261. return 1
  1262. fi
  1263. mv "$WorkDir/$AppName" "$WorkDir/Payload/"
  1264.  
  1265. if [ $PCMverbose = "YES" ]; then
  1266. echo -n "${Meter68}$MsgCopArtw "
  1267. fi
  1268. if [ -e "$AppPath/iTunesArtwork" ]; then
  1269. cp -a "$AppPath/iTunesArtwork" "$WorkDir/"
  1270. # Timestamp ArtWork to protect cracker
  1271. touch -r "$AppPath/$AppName/Info.plist" "$WorkDir/iTunesArtwork"
  1272. else
  1273. echo "${Meter68}failed !"
  1274. fi
  1275.  
  1276. # Handling of CodeResources and friends. Timestamp them to protect cracker
  1277. cp -a "$AppPath/$AppName/Info.plist" "$WorkDir/Payload/$AppName/Info.plist"
  1278. mkdir "$WorkDir/Payload/$AppName/_CodeSignature"
  1279. cp "$AppPath/$AppName/CodeResources" "$WorkDir/Payload/$AppName/_CodeSignature/CodeResources"
  1280. ln -s "_CodeSignature/CodeResources" "$WorkDir/Payload/$AppName/CodeResources"
  1281. if [ -e "$AppPath/$AppName/ResourceRules.plist" ]; then
  1282. cp "$AppPath/$AppName/ResourceRules.plist" "$WorkDir/Payload/$AppName/ResourceRules.plist"
  1283. touch -r "$AppPath/$AppName/Info.plist" "$WorkDir/Payload/$AppName/ResourceRules.plist"
  1284. fi
  1285. touch -h -r "$AppPath/$AppName/Info.plist" "$WorkDir/Payload/$AppName/CodeResources"
  1286. touch -r "$AppPath/$AppName/Info.plist" "$WorkDir/Payload/$AppName/_CodeSignature/CodeResources"
  1287. touch -r "$AppPath/$AppName/Info.plist" "$WorkDir/Payload/$AppName/_CodeSignature"
  1288.  
  1289. # Faking MetaData
  1290. if [ $PCMverbose = "YES" ]; then
  1291. if [ $PCMmetadata = "YES" ]; then
  1292. echo "${Meter69}$MsgFakMeta"
  1293. else
  1294. echo "${Meter69}$MsgNotMeta"
  1295. fi
  1296. fi
  1297. if [ "$CrackerName" = "Anonymous" ]; then
  1298. CrackedBy="Timothy.D.Cook@apple.com"
  1299. else
  1300. CrackedBy="$CrackerName@cracked.by"
  1301. fi
  1302. cp "$AppPath/iTunesMetadata.plist" "$WorkDir/iTunesMetadataSource.plist"
  1303. # Convert to pure text (if binary plist)
  1304. plutil -xml "$WorkDir/iTunesMetadataSource.plist" 2>&1> /dev/null
  1305. # Remove unwanted key and subkeys
  1306. plutil -remove -key 'com.apple.iTunesStore.downloadInfo' "$WorkDir/iTunesMetadataSource.plist" 2>&1> /dev/null
  1307. # Building lines
  1308. echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "$WorkDir/iTunesMetadata.plist"
  1309. echo "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "$WorkDir/iTunesMetadata.plist"
  1310. echo "<plist version=\"1.0\">" >> "$WorkDir/iTunesMetadata.plist"
  1311. echo "<dict>" >> "$WorkDir/iTunesMetadata.plist"
  1312. grep -A99 "<key>UIRequiredDeviceCapabilities</key>" "$WorkDir/iTunesMetadataSource.plist" | grep -m1 -B99 "</dict>" >> "$WorkDir/iTunesMetadata.plist"
  1313. echo -e "\t<key>appleId</key>" >> "$WorkDir/iTunesMetadata.plist"
  1314. echo -e "\t<string>$CrackedBy</string>" >> "$WorkDir/iTunesMetadata.plist"
  1315. echo -e "\t<key>purchaseDate</key>" >> "$WorkDir/iTunesMetadata.plist"
  1316. echo -e "\t<date>2011-10-10T10:10:10Z</date>" >> "$WorkDir/iTunesMetadata.plist"
  1317. grep -A1 "<key>artistId</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1318. grep -A1 "<key>artistName</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1319. grep -A1 "<key>bundleShortVersionString</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1320. grep -A1 "<key>bundleVersion</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1321. grep -A1 "<key>buy-only</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1322. grep -A1 "<key>buyParams</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1323. grep -A1 "<key>copyright</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1324. grep -A1 "<key>drmVersionNumber</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1325. grep -A1 "<key>fileExtension</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1326. grep -A1 "<key>gameCenterEnabled</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1327. grep -A1 "<key>gameCenterEverEnabled</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1328. grep -A1 -m1 "<key>genre</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1329. grep -A1 -m1 "<key>genreId</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1330. grep -A1 "<key>itemId</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1331. grep -A1 "<key>itemName</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1332. grep -A1 "<key>kind</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1333. grep -A1 "<key>playlistArtistName</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1334. grep -A1 "<key>playlistName</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1335. grep -A1 "<key>price</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1336. grep -A1 "<key>priceDisplay</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1337. grep -A99 "<key>rating</key>" "$WorkDir/iTunesMetadataSource.plist" | grep -m1 -B99 "</dict>" >> "$WorkDir/iTunesMetadata.plist"
  1338. grep -A1 "<key>releaseDate</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1339. grep -A1 "<key>s</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1340. grep -A1 "<key>softwareIcon57x57URL</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1341. grep -A1 "<key>softwareIconNeedsShine</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1342. grep -A99 "<key>softwareSupportedDeviceIds</key>" "$WorkDir/iTunesMetadataSource.plist" | grep -m1 -B99 "</array>" >> "$WorkDir/iTunesMetadata.plist"
  1343. grep -A1 "<key>softwareVersionBundleId</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1344. grep -A1 "<key>softwareVersionExternalIdentifier</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1345. grep -A99 "<key>softwareVersionExternalIdentifiers</key>" "$WorkDir/iTunesMetadataSource.plist" | grep -m1 -B99 "</array>" >> "$WorkDir/iTunesMetadata.plist"
  1346. grep -A99 "<key>subgenres</key>" "$WorkDir/iTunesMetadataSource.plist" | grep -m1 -B99 "</array>" >> "$WorkDir/iTunesMetadata.plist"
  1347. grep -A1 "<key>vendorId</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1348. grep -A1 "<key>versionRestrictions</key>" "$WorkDir/iTunesMetadataSource.plist" >> "$WorkDir/iTunesMetadata.plist"
  1349. echo "</dict>" >> "$WorkDir/iTunesMetadata.plist"
  1350. echo -e "</plist>\n" >> "$WorkDir/iTunesMetadata.plist"
  1351. # Timestamp Metadata to protect cracker
  1352. touch -r "$AppPath/$AppName/Info.plist" "$WorkDir/iTunesMetadata.plist"
  1353.  
  1354. # Check for possible iTunesMetadata format changes
  1355. rm -f /tmp/diff.txt
  1356. diff "$WorkDir/iTunesMetadataSource.plist" "$WorkDir/iTunesMetadata.plist" > /tmp/diff.txt
  1357. rm -f "$WorkDir/iTunesMetadataSource.plist"
  1358. NewFields=$(wc -l /tmp/diff.txt | cut -f 1 -d " ")
  1359. if [ $NewFields -ne "11" -a $NewFields -ne "7" ]; then
  1360. echo "${Meter70}${escYellow}$MsgWrnMeta ?${escReset}"
  1361. #BEGIN DEBUG
  1362. #echo "( $NewFields )"
  1363. #cat /tmp/diff.txt
  1364. #END DEBUG
  1365. fi
  1366. rm -f /tmp/diff.txt
  1367.  
  1368. # Don't want MetaData ? Keeping a backup
  1369. if [ ! $PCMmetadata = "YES" ]; then
  1370. mv "$WorkDir/iTunesMetadata.plist" "$WorkDir/iTunesMetadata.backup.plist"
  1371. fi
  1372.  
  1373. # Want Extras in filename ?
  1374. if [ $PCMextras = "YES" ]; then
  1375. Extras="$ExtrasMatos$ExtrasInApp"
  1376. fi
  1377.  
  1378. # Building IPA name, adding AppVersion and MinOsVersion, adding CrackerName
  1379. if [ "$CrackerName" = "Anonymous" ]; then
  1380. CrackedBy=""
  1381. ZipComment="25Lb9 ($DayToday)"
  1382. else
  1383. CrackedBy="-$CrackerName"
  1384. ZipComment="From $CrackerName with 25Lb9 ($DayToday)"
  1385. fi
  1386.  
  1387. IPAName="$NewAppDir/$AppDisplayName (v$AppVer$ExtrasAlsr$Extras$Patched os$MinOS)$CrackedBy.Lb9.ipa"
  1388. #IPAName="$NewAppDir/$(echo -n "$AppDisplayName" | tr " " ".")-v$AppVer$CrackedBy.ipa"
  1389.  
  1390. # If debug-check-only, don't create Ipa
  1391. if [ $PCMcheck = "YES" ]; then
  1392. touch "$IPAName.checked"
  1393. echo "${Meter100}${escGreen}Check:${escReset} $AppDisplayName (v$AppVer$ExtrasAlsr$Extras$Patched os$MinOS)."
  1394. rm -fr "$WorkDir"
  1395. echo "$tempLoc" >> /var/mobile/.cracked.log
  1396. MenuOK=$(($MenuOK + 1))
  1397. return 0
  1398. fi
  1399.  
  1400. #DEBUG
  1401. #FreeSize=$(df -m "$NewAppDir/" | grep disk | awk '{print $4}')
  1402. #echo "${Meter74}Debug: free size on device [$FreeSize M$MsgSizUnit]"
  1403. #DEBUG
  1404.  
  1405. # Size of first data to compress
  1406. FirstSize=$(du -m -s "$WorkDir" | cut -f 1)
  1407. echo "${Meter75}$MsgZipStep 1) [$FirstSize M$MsgSizUnit]"
  1408.  
  1409. # Timestamping
  1410. touch -r "$AppPath/$AppName/Info.plist" "$WorkDir/Payload/$AppName"
  1411. touch -r "$AppPath/$AppName/Info.plist" "$WorkDir/Payload"
  1412.  
  1413. cd "$WorkDir"
  1414. rm -f "$IPAName"
  1415. # Script version number in zip's comment
  1416. # Faster ipa thanks to smart files order (?)
  1417. ZipError=$( echo "$ZipComment" | zip $PCMcompression -z -y -m -r "$IPAName" "Payload/$AppName/Info.plist" iTunesMetadata.plist iTunesArtwork Payload 2>&1> /dev/null )
  1418. #DEBUG: unzip -l "$IPAName"
  1419. cd "$PwdPwd" 2>&1> /dev/null
  1420.  
  1421. if [ ! -z "$ZipError" ]; then
  1422. echo "${Meter76}${escRed}ZipError${escReset}: \"$( echo "$ZipError" | tr -d "\t\n" )\""
  1423. fi
  1424.  
  1425. if [ ! -e "$IPAName" ]; then
  1426. echo "${escRed}Failed to compress the .ipa${escReset}"
  1427. rm -fr "$WorkDir"
  1428. return 1
  1429. fi
  1430.  
  1431. # Remember size of .ipa after step 1
  1432. ZipSize=$(stat -c%s "$IPAName")
  1433.  
  1434. # Building .ipa (step 2)
  1435. # Using a SymbolicLink pointing to App Directory
  1436. ln -s "$AppPath/" "$WorkDir/Payload"
  1437.  
  1438. #DEBUG
  1439. #FreeSize=$(df -m "$NewAppDir/" | grep disk | awk '{print $4}')
  1440. #echo "${Meter74}Debug: free size on device [$FreeSize M$MsgSizUnit]"
  1441. #DEBUG
  1442.  
  1443. # Size of other data to compress
  1444. SecondSize=$(du -m -s "$AppPath" | cut -f 1)
  1445. echo "${Meter80}$MsgZipStep 2) [$(expr $SecondSize - $FirstSize) M$MsgSizUnit]"
  1446.  
  1447. cd "$WorkDir"
  1448. # Zip doesn't move/delete source, and excludes some unwanted files. Smart "-n" flag excludes already compact files.
  1449. ZipError=$( zip $PCMcompression -u -y -r -n .jpg:.JPG:.jpeg:.png:.PNG:.gif:.GIF:.Z:.gz:.zip:.zoo:.arc:.lzh:.rar:.arj:.mp3:.mp4:.m4a:.m4v:.ogg:.ogv:.avi:.flac:.aac \
  1450. "$IPAName" Payload/* -x Payload/iTunesArtwork Payload/iTunesMetadata.plist "Payload/Documents/*" "Payload/Library/*" "Payload/tmp/*" "Payload/$AppName/$AppExec" "Payload/$AppName/SC_Info/*" "Payload/$AppName/_CodeSignature/*" "Payload/$AppName/CodeResources" "Payload/$AppName/ResourceRules.plist" "Payload/$AppName/Info.plist" 2>&1> /dev/null )
  1451. ## */
  1452.  
  1453. if [ ! -z "$ZipError" ]; then
  1454. echo "${Meter81}${escRed}ZipError${escReset}: \"$( echo "$ZipError" | tr -d "\t\n" )\""
  1455. fi
  1456.  
  1457. # It failed because disk is full (zip size after part2 is still the same)
  1458. if [ $(stat -c%s "$IPAName") -eq $ZipSize ]; then
  1459. echo "${escRed}$MsgIpaInco ! $MsgDskFull ?${escReset}"
  1460. rm -f "$IPAName"
  1461. rm -fr "$WorkDir"
  1462. return 1
  1463. fi
  1464.  
  1465. # Removing SymbolicLink
  1466. rm "$WorkDir/Payload"
  1467. cd "$PwdPwd" 2>&1> /dev/null
  1468.  
  1469. # Removing temporary directory
  1470. if [ $PCMverbose = "YES" ]; then
  1471. echo "${Meter98}$MsgRemTemp"
  1472. fi
  1473. rm -rf "$WorkDir"
  1474.  
  1475. # Cracked app is added into the already-cracked apps list
  1476. echo "$tempLoc" >> /var/mobile/.cracked.log
  1477.  
  1478. # Cracked app is added into Crackulous' cracked-apps-ready-to-upload list
  1479. p="/private/var/root/Documents/IPAStore.plist"
  1480. if [ -e "$p" ]; then
  1481. #If Crackulous is running, we must close it first
  1482. Killous=$(ps -e | grep "/Applications/Crackulous" | grep -v "grep" | awk '{print $1}')
  1483. if [ "$Killous" ]; then
  1484. echo "${Meter99}Warning: killing Crackulous softly"
  1485. kill $Killous
  1486. sleep 1
  1487. fi
  1488. plutil -key "$IPAName" -type int -value "$(plutil -key 'itemId' "$AppPath/iTunesMetadata.plist" 2> /dev/null)" "$p" 2>&1> /dev/null
  1489. fi
  1490.  
  1491. # Displaying finished Ipa details
  1492. ZipSize=$(du -m -s "$IPAName" | cut -f 1)
  1493. echo "${Meter100}${escGreen}$MsgIpaDone${escReset} \"$IPAName\" [$ZipSize M$MsgSizUnit]"
  1494.  
  1495. MenuOK=$(($MenuOK + 1))
  1496. }
  1497.  
  1498. # End Core Function
  1499. # ======
  1500.  
  1501.  
  1502.  
  1503. # ======
  1504. # Begin script main part
  1505.  
  1506. # Origin's directory
  1507. PwdPwd="$PWD"
  1508.  
  1509. # Select texts' language
  1510. SelectLanguage
  1511.  
  1512. # Votez Martine !
  1513. if [ ! -e /bin/ps ]; then
  1514. echo "$MsgCntFind 'ps'. $MsgInsCydi: 'adv-cmds'"
  1515. exit 1
  1516. fi
  1517.  
  1518. # Is this script running inside a GUI ?
  1519. # (ie: parent process runs from "/Applications/xxx.app")
  1520. if [ ! "$(ps -e | grep "$PPID" | grep "/Applications/.*\.app/")" = "" ]; then
  1521. PCMinaGUI="YES"
  1522. fi
  1523.  
  1524. # Initialize progress meter labels (for GUI)
  1525. if [ $PCMinaGUI = "YES" ]; then
  1526. export TERM="xterm"
  1527. for ((i=0;i<=100;i++)); do
  1528. export Meter$i="$i% "
  1529. done
  1530. else
  1531. # Not GUI
  1532. clear
  1533. # Escape codes
  1534. esc="$( echo -e -n "\033" )"
  1535. escReset="${esc}[0m"
  1536. escUnder="${esc}[4m"
  1537. escBlue="${esc}[34m"
  1538. escGreen="${esc}[32m"
  1539. escRed="${esc}[31m"
  1540. escYellow="${esc}[33m"
  1541. escPurple="${esc}[35m"
  1542. escCyan="${esc}[36m"
  1543.  
  1544. # Terminal misconfigured
  1545. if [ -z "$TERM" ]; then
  1546. echo "${escYellow}Warning:${escReset} your \$TERM is not set"
  1547. export TERM="xterm"
  1548. fi
  1549.  
  1550. # Screen width
  1551. if [ ! -e /usr/bin/tput ]; then
  1552. echo "$MsgCntFind 'tput'"
  1553. exit 1
  1554. fi
  1555. Cols=$(tput cols)
  1556.  
  1557. # Progress bars full width
  1558. BarCols=$(( $Cols - 8 ))
  1559. while [ ${#PCMxxx} -lt $BarCols ]
  1560. do
  1561. PCMxxx="$PCMxxx$PCMxxx"
  1562. PCMsss="$PCMsss$PCMsss"
  1563. done
  1564. fi
  1565.  
  1566. echo "${Meter0} *** ${escUnder}PoedCrackMod v2.5.Lb9${escReset} ***"
  1567.  
  1568. if [ ! -e /usr/bin/plutil ]; then
  1569. echo "$MsgCntFind 'plutil'. $MsgInsCydi: 'Erica Utils'"
  1570. exit 1
  1571. fi
  1572.  
  1573. if [ ! -e /usr/bin/gdb ]; then
  1574. echo "$MsgCntFind 'gdb'. $MsgInsCydi: 'GNU Debugger'"
  1575. exit 1
  1576. fi
  1577.  
  1578. if [ ! -e /usr/bin/otool ]; then
  1579. echo "$MsgCntFind 'otool'. $MsgInsCydi: 'Darwin CC Tools'"
  1580. exit 1
  1581. fi
  1582.  
  1583. #if [ ! -e /usr/bin/ldid ]; then
  1584. # echo "$MsgCntFind 'ldid'. $MsgInsCydi: 'Link Identity Editor'"
  1585. # exit 1
  1586. #fi
  1587. if [ ! -e /usr/bin/ldone ]; then
  1588. echo "$MsgCntFind 'ldone'. $MsgInsCydi"
  1589. exit 1
  1590. fi
  1591.  
  1592. if [ ! -e /bin/touch ]; then
  1593. echo "$MsgCntFind 'touch'"
  1594. exit 1
  1595. fi
  1596.  
  1597. # We don't use lipo anymore. Lipo sucks.
  1598. #if [ ! -e /usr/bin/lipo ]; then
  1599. # echo "$MsgCntFind 'lipo'. $MsgInsCydi: 'Darwin CC Tools'"
  1600. # exit 1
  1601. #fi
  1602.  
  1603. if [ ! -e /usr/bin/zip ]; then
  1604. echo "$MsgCntFind 'zip'"
  1605. exit 1
  1606. fi
  1607.  
  1608. if [ ! -e /usr/sbin/sysctl ]; then
  1609. echo "$MsgCntFind 'sysctl'"
  1610. exit 1
  1611. fi
  1612.  
  1613. if [ ! -e /usr/bin/basename ]; then
  1614. echo "$MsgCntFind 'basename'"
  1615. exit 1
  1616. fi
  1617.  
  1618. if [ ! -e /usr/bin/cut ]; then
  1619. echo "$MsgCntFind 'cut'"
  1620. exit 1
  1621. fi
  1622.  
  1623. if [ ! -e /usr/bin/awk ]; then
  1624. echo "$MsgCntFind 'awk'. $MsgInsCydi: 'Gawk'"
  1625. exit 1
  1626. fi
  1627.  
  1628. # Cydia's "speak" tool is needed for speech support
  1629. if [ ! -e /usr/bin/speak ]; then
  1630. PCMspeak="NO"
  1631. fi
  1632.  
  1633. if [ ! -e /usr/bin/head ]; then
  1634. echo "$MsgCntFind 'head'"
  1635. exit 1
  1636. fi
  1637.  
  1638. if [ ! -e /usr/bin/tail ]; then
  1639. echo "$MsgCntFind 'tail'"
  1640. exit 1
  1641. fi
  1642.  
  1643. # Create an empty public memory file
  1644. if [ ! -e /var/mobile/.cracked.log ]; then
  1645. touch /var/mobile/.cracked.log
  1646. chmod 666 /var/mobile/.cracked.log
  1647. fi
  1648.  
  1649. AltDump="NO"
  1650.  
  1651. if [ ! $PCMinaGUI = "YES" ]; then
  1652. # Get and store the encrypted apps list
  1653. rm -f /tmp/lsd.tmp
  1654.  
  1655. # Why is that slower than next code ???
  1656. #ls -d /var/mobile/Applications/*/*.app/SC_Info 2> /dev/null | sort -f -t \/ -k 6 | while read OneApp
  1657. ## */
  1658. #do
  1659. # echo "$(dirname "$OneApp")" >> /tmp/lsd.tmp
  1660. #done
  1661.  
  1662. # Why is that faster than previous code ???
  1663. ls -d /var/mobile/Applications/*/*.app 2> /dev/null | sort -f -t \/ -k 6 | while read OneApp
  1664. ## */
  1665. do
  1666. if [ -d "$OneApp/SC_Info" ]; then
  1667. echo "$OneApp" >> /tmp/lsd.tmp
  1668. fi
  1669. done
  1670.  
  1671. # Secret "alternative dumping" flag
  1672. if [ "$1" = "-a" ]; then
  1673. shift
  1674. echo "$MsgAltMeth"
  1675. if [ ! -e /usr/bin/nice ]; then
  1676. echo "$MsgCntFind 'nice'"
  1677. rm -f /tmp/lsd.tmp
  1678. exit 1
  1679. fi
  1680. AltDump="YES"
  1681. fi
  1682.  
  1683. if [ "$1" = "-v" ]; then
  1684. shift
  1685. PCMverbose="YES"
  1686. fi
  1687.  
  1688. # Secret "check only" flag
  1689. if [ "$1" = "-chk" ]; then
  1690. shift
  1691. PCMcheck="YES"
  1692. fi
  1693.  
  1694. # No more argument: display help
  1695. if [ $# -lt 1 ]; then
  1696. # The "-a" flag is not displayed in the help, but it does exist.
  1697. scr=$(basename $0)
  1698. echo "List/Help: $scr"
  1699. echo " Menu: $scr [-v] -m [CN [CFN]]"
  1700. echo " CrackAll: $scr [-v] -all [CN [CFN]]"
  1701. echo " CrackOne: $scr [-v] AN [CN [CFN]]"
  1702. echo " MarkDone: $scr -mark"
  1703. echo "ResetDone: $scr -zero"
  1704. echo
  1705. echo "AN=AppName CN=CrackerName CFN=CreditFileName"
  1706. echo
  1707. if [ -e /tmp/lsd.tmp ]; then
  1708. cat /tmp/lsd.tmp | cut -f 6 -d '/' | sed "s:\\.app:,:" | tr "\n" " "
  1709. echo -e "\010\010."
  1710. rm -f /tmp/lsd.tmp
  1711. fi
  1712. exit 1
  1713. fi
  1714.  
  1715. # Erasing memory file
  1716. if [ "$1" = "-zero" ]; then
  1717. echo "$MsgEraMemo"
  1718. # Don't use rm
  1719. cp /dev/null /var/mobile/.cracked.log 2>&1> /dev/null
  1720. rm -f /tmp/lsd.tmp
  1721. exit 1
  1722. fi
  1723.  
  1724. # Marking all apps as done in memory file
  1725. if [ "$1" = "-mark" ]; then
  1726. echo "$MsgMrkDone"
  1727. if [ -e /tmp/lsd.tmp ]; then
  1728. cp /tmp/lsd.tmp /var/mobile/.cracked.log 2>&1> /dev/null
  1729. rm -f /tmp/lsd.tmp
  1730. else
  1731. cp /dev/null /var/mobile/.cracked.log 2>&1> /dev/null
  1732. fi
  1733. exit 1
  1734. fi
  1735.  
  1736. MenuAsked=0
  1737. MenuFound=0
  1738. MenuOK=0
  1739. MenuError=0
  1740. MenuErrorList=""
  1741.  
  1742. # Berzerk mode: cracking all apps
  1743. if [ "$1" = "-all" ]; then
  1744. echo -n "$MsgBrzMode !"
  1745. if [ -e /tmp/lsd.tmp ]; then
  1746. # ("grep -vf" is sloooow. Use "-Fvf")
  1747. # Removing already-done from full apps list
  1748. tempgrep=$(mktemp)
  1749. grep -Fvf /var/mobile/.cracked.log /tmp/lsd.tmp > $tempgrep
  1750. MenuAsked=$(cat $tempgrep | wc -l)
  1751. ProgressTarget=$MenuAsked
  1752. ProgressDone=0
  1753. echo " ($MenuAsked)"
  1754. echo
  1755.  
  1756. if [ $PCMbarSize = "YES" -a $MenuAsked != 0 ]; then
  1757. ProgressTargetSize=0
  1758. ProgressDoneSize=0
  1759. echo -n "Computing total size"
  1760. # (Don't use a pipe for the while loop)
  1761. while read OneApp
  1762. do
  1763. # Size of the app, till dawn.
  1764. AppSize=$( du -s -k "$OneApp" | cut -f 1 )
  1765. ProgressTargetSize=$(($ProgressTargetSize + $AppSize))
  1766. echo -n "."
  1767. done < $tempgrep
  1768. echo
  1769. echo
  1770. fi
  1771.  
  1772. # (Don't use a pipe for the while loop)
  1773. while read OneApp
  1774. do
  1775. ProgressDone=$(($ProgressDone + 1))
  1776. echo -n "${escPurple}($ProgressDone/$ProgressTarget)${escReset} "
  1777.  
  1778. if [ $PCMbarSize = "YES" ]; then
  1779. # Size of the app, till dawn.
  1780. AppSize=$( du -s -k "$OneApp" | cut -f 1 )
  1781. ProgressDoneSize=$(($ProgressDoneSize + $AppSize))
  1782. fi
  1783.  
  1784. CoreFunction "$OneApp" "$2" "$3"
  1785. if [ $? = 1 ]; then
  1786. if [ $PCMspeak = "YES" ]; then
  1787. speak "Error !" &
  1788. fi
  1789. MenuError=$(($MenuError + 1))
  1790. if [ -z "$MenuErrorList" ]; then
  1791. MenuErrorList="${OneApp:62:$(( ${#OneApp} - 66 ))}"
  1792. else
  1793. MenuErrorList="$MenuErrorList, ${OneApp:62:$(( ${#OneApp} - 66 ))}"
  1794. fi
  1795. fi
  1796.  
  1797. DisplayBars
  1798. echo
  1799. done < $tempgrep
  1800. rm -f $tempgrep
  1801. rm -f /tmp/lsd.tmp
  1802. else
  1803. echo " ($MsgBrzNoth)"
  1804. fi
  1805.  
  1806. echo "$MsgWasAskd:all ($MenuAsked) $MsgFoundIt:$MenuFound $MsgErrrors:$MenuError OK:$MenuOK."
  1807. if [ ! -z "$MenuErrorList" ]; then
  1808. echo "$MsgErrrors: $MenuErrorList."
  1809. fi
  1810.  
  1811. if [ $PCMspeak = "YES" ]; then
  1812. speak "Terminated." &
  1813. fi
  1814.  
  1815. exit 1
  1816. else
  1817. # Menu mode: displaying menu and processing user choices
  1818. if [ "$1" = "-m" ]; then
  1819. if [ -e /tmp/lsd.tmp ]; then
  1820. rm -f /tmp/lsdmenu.tmp
  1821. touch /tmp/lsdmenu.tmp
  1822. rm -f /tmp/lsddisp.tmp
  1823. # Array with all the letters
  1824. Letters=( $( echo {a..z} {a..z}{a..z} ) )
  1825. # Search for best columns size
  1826. BestFiller=666
  1827. BestFound=666
  1828. for (( i=18;i<=30;i++)); do
  1829. FillerFound=$(( $Cols % $i ))
  1830. if [ $FillerFound -lt $BestFiller ]; then
  1831. BestFiller=$FillerFound
  1832. BestFound=$i
  1833. if [ $FillerFound = 0 ]; then
  1834. break
  1835. fi
  1836. fi
  1837. done
  1838. LongNames=$(( $BestFound - 3 ))
  1839. ShortNames=$(( $LongNames - 1 ))
  1840.  
  1841. echo -n "$MsgBldMenu"
  1842. Letter=0
  1843. LineLength=$Cols
  1844. # ("grep -vf" is sloooow. Use "-Fvf")
  1845. # Removing already-done from full apps list
  1846. grep -Fvf /var/mobile/.cracked.log /tmp/lsd.tmp | while read OneApp
  1847. do
  1848. GoodLetter=${Letters[$Letter]}
  1849. OneOneApp="${OneApp:62:$(( ${#OneApp} - 66 ))}$PCMdots"
  1850. if [ $Letter -lt 26 ]; then
  1851. echo -n "${escPurple}$GoodLetter:${escReset}${OneOneApp:0:$LongNames} " >> /tmp/lsddisp.tmp
  1852. echo "\"$GoodLetter\"$OneApp" >> /tmp/lsdmenu.tmp
  1853. LineLength=$(( $LineLength - $LongNames - 3 ))
  1854. else
  1855. echo -n "${escPurple}$GoodLetter:${escReset}${OneOneApp:0:$ShortNames} " >> /tmp/lsddisp.tmp
  1856. echo "\"$GoodLetter\"$OneApp" >> /tmp/lsdmenu.tmp
  1857. LineLength=$(( $LineLength - $ShortNames - 4 ))
  1858. fi
  1859.  
  1860. # End of line
  1861. if [ $LineLength = $BestFiller ]; then
  1862. echo "" >> /tmp/lsddisp.tmp
  1863. LineLength=$Cols
  1864. fi
  1865.  
  1866. Letter=$(($Letter + 1))
  1867. # Too much apps (max is 27*26 = 702)
  1868. if [ $Letter = 702 ]; then
  1869. break
  1870. fi
  1871. done
  1872.  
  1873. # Other options
  1874. echo -n "${escPurple}0:${escReset}${MskZroDone:0:$LongNames} " >> /tmp/lsddisp.tmp
  1875. echo -n "${escPurple}9:${escReset}${MsgMrkDone:0:$LongNames} " >> /tmp/lsddisp.tmp
  1876.  
  1877. # Displaying menu
  1878. if [ -e /tmp/lsddisp.tmp ]; then
  1879. echo
  1880. clear
  1881. echo " *** ${escUnder}PoedCrackMod v2.5.Lb9 menu${escReset} ***"
  1882. cat /tmp/lsddisp.tmp
  1883. rm -f /tmp/lsddisp.tmp
  1884. echo
  1885. read -p "$MsgYouChoi ? " YourChoices
  1886. echo
  1887. ProgressTarget=$( echo $YourChoices | wc -w )
  1888. ProgressDone=0
  1889.  
  1890. if [ $PCMbarSize = "YES" -a $ProgressTarget != 0 ]; then
  1891. ProgressTargetSize=0
  1892. ProgressDoneSize=0
  1893. echo -n "Computing total size"
  1894.  
  1895. # Do all these choices
  1896. for OneChoice in $YourChoices
  1897. do
  1898. if [ ! "$OneChoice" = "0" ]; then
  1899. if [ ! "$OneChoice" = "9" ]; then
  1900. tempLoc=$(grep -i "\"$OneChoice\"" /tmp/lsdmenu.tmp | cut -f 3 -d "\"")
  1901. if [ ! -z "$tempLoc" ]; then
  1902. AppCount=$(echo "$tempLoc" | wc -l)
  1903. if [ $AppCount = 1 ]; then
  1904. # Size of the app, till dawn.
  1905. AppSize=$( du -s -k "$tempLoc" | cut -f 1 )
  1906. ProgressTargetSize=$(($ProgressTargetSize + $AppSize))
  1907. echo -n "."
  1908. fi
  1909. fi
  1910. fi
  1911. fi
  1912. done
  1913. echo
  1914. echo
  1915.  
  1916. # Nothing to do; no need for progress
  1917. if [ $ProgressTargetSize = 0 ]; then
  1918. PCMbarSize="ZERO"
  1919. fi
  1920. fi
  1921.  
  1922. # Do all these choices
  1923. for OneChoice in $YourChoices
  1924. do
  1925. ProgressDone=$(($ProgressDone + 1))
  1926. echo -n "${escPurple}($ProgressDone/$ProgressTarget)${escReset} "
  1927. MenuAsked=$(($MenuAsked + 1))
  1928. if [ "$OneChoice" = "0" ]; then
  1929. echo "$MsgEraMemo"
  1930. # Don't use rm
  1931. cp /dev/null /var/mobile/.cracked.log 2>&1> /dev/null
  1932. MenuAsked=$(($MenuAsked - 1))
  1933. else
  1934. if [ "$OneChoice" = "9" ]; then
  1935. echo "$MsgMrkDone"
  1936. cp /tmp/lsd.tmp /var/mobile/.cracked.log 2>&1> /dev/null
  1937. MenuAsked=$(($MenuAsked - 1))
  1938. else
  1939. tempLoc=$(grep -i "\"$OneChoice\"" /tmp/lsdmenu.tmp | cut -f 3 -d "\"")
  1940. if [ -z "$tempLoc" ]; then
  1941. echo "$MsgWrgChoi ($OneChoice)"
  1942. else
  1943. AppCount=$(echo "$tempLoc" | wc -l)
  1944. if [ $AppCount = 1 ]; then
  1945.  
  1946. if [ $PCMbarSize = "YES" ]; then
  1947. # Size of the app, till dawn.
  1948. AppSize=$( du -s -k "$tempLoc" | cut -f 1 )
  1949. ProgressDoneSize=$(($ProgressDoneSize + $AppSize))
  1950. fi
  1951.  
  1952. CoreFunction "$tempLoc" "$2" "$3"
  1953. if [ $? = 1 ]; then
  1954. if [ $PCMspeak = "YES" ]; then
  1955. speak "Error !" &
  1956. fi
  1957. MenuError=$(($MenuError + 1))
  1958. if [ -z "$MenuErrorList" ]; then
  1959. MenuErrorList="${tempLoc:62:$(( ${#tempLoc} - 66 ))}"
  1960. else
  1961. MenuErrorList="$MenuErrorList, ${tempLoc:62:$(( ${#tempLoc} - 66 ))}"
  1962. fi
  1963. fi
  1964. else
  1965. echo "$MsgBadChoi ($OneChoice = $AppCount)"
  1966. fi
  1967. fi
  1968. fi
  1969. fi
  1970.  
  1971. DisplayBars
  1972. echo
  1973.  
  1974. done
  1975. rm -f /tmp/lsdmenu.tmp
  1976.  
  1977. if [ $PCMspeak = "YES" ]; then
  1978. speak "Finished." &
  1979. fi
  1980.  
  1981. echo
  1982. echo "$MsgWasAskd:$MenuAsked $MsgFoundIt:$MenuFound $MsgErrrors:$MenuError OK:$MenuOK."
  1983. if [ ! -z "$MenuErrorList" ]; then
  1984. echo "${escRed}$MsgErrrors:${escReset} $MenuErrorList."
  1985. fi
  1986. else
  1987. echo " $MsgMnuEmpt !"
  1988. fi
  1989. rm -f /tmp/lsd.tmp
  1990. fi
  1991. exit 1
  1992. fi
  1993. fi
  1994. fi
  1995.  
  1996.  
  1997. # Just one app to do
  1998. CoreFunction "$1" "$2" "$3"
  1999. #if [ $? = 1 ]; then
  2000. # echo "Error: problem encountered."
  2001. # exit 1
  2002. #fi
  2003.  
  2004. # Not needed anymore
  2005. rm -f /tmp/lsd.tmp
  2006.  
  2007.  
  2008. #
  2009. # The truth is I never left you. I kept my promise.
  2010. #
  2011. # Never gonna give you up, never gonna let you down, never gonna run around and desert you.
  2012. # Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you.
  2013. #
  2014.  
  2015.  
  2016. #
  2017. # Thanks.
  2018. # Merci.
  2019. # Hontoni arigato.
  2020. #
  2021.  
  2022.  
  2023.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement