topangadetect.m 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. //
  2. // topangadetect.c
  3. // electra
  4. //
  5. // Created by CoolStar on 2/12/18.
  6. // Copyright © 2018 Electra Team. All rights reserved.
  7. //
  8. #include "topangadetect.h"
  9. #include "file_utils.h"
  10. #import <Foundation/Foundation.h>
  11. //THIS DETECTION IS NOT COMPREHENSIVE
  12. //DO NOT TRY MANUALLY REMOVING FILES TO PASS THIS CHECK
  13. //IF NOT ALL OF TOPANGA'S FILES ARE REMOVED, ELECTRA WILL FAIL TO EXTRACT THE BOOTSTRAP
  14. //YOU HAVE BEEN WARNED
  15. bool topangaInstalled(){
  16. NSMutableArray *bootstrap_files_list = [[NSMutableArray alloc] initWithObjects:
  17. @"/bin/bash",
  18. @"/bin/dd",
  19. @"/bin/ln",
  20. @"/bin/sed",
  21. @"/bin/vdir",
  22. @"/bin/bunzip2",
  23. @"/bin/dir",
  24. @"/bin/ls",
  25. @"/bin/sh",
  26. @"/bin/zcat",
  27. @"/bin/bzcat",
  28. @"/bin/echo",
  29. @"/bin/mkdir",
  30. @"/bin/sleep",
  31. @"/bin/zcmp",
  32. @"/bin/bzip2",
  33. @"/bin/egrep",
  34. @"/bin/mknod",
  35. @"/bin/stty",
  36. @"/bin/zdiff",
  37. @"/bin/bzip2recover",
  38. @"/bin/false",
  39. @"/bin/mktemp",
  40. @"/bin/su",
  41. @"/bin/zegrep",
  42. @"/bin/cat",
  43. @"/bin/fgrep",
  44. @"/bin/mv",
  45. @"/bin/sync",
  46. @"/bin/zfgrep",
  47. @"/bin/chgrp",
  48. @"/bin/grep",
  49. @"/bin/pwd",
  50. @"/bin/tar",
  51. @"/bin/zforce",
  52. @"/bin/chmod",
  53. @"/bin/gunzip",
  54. @"/bin/readlink",
  55. @"/bin/touch",
  56. @"/bin/zgrep",
  57. @"/bin/chown",
  58. @"/bin/gzexe",
  59. @"/bin/rm",
  60. @"/bin/true",
  61. @"/bin/zless",
  62. @"/bin/cp",
  63. @"/bin/gzip",
  64. @"/bin/rmdir",
  65. @"/bin/uname",
  66. @"/bin/zmore",
  67. @"/bin/date",
  68. @"/bin/kill",
  69. @"/bin/run-parts",
  70. @"/bin/uncompress",
  71. @"/bin/znew",
  72. @"/private/var/run/utmp",
  73. @"/sbin/reboot",
  74. @"/sbin/halt",
  75. @"/sbin/dmesg",
  76. @"/sbin/dynamic_pager",
  77. @"/sbin/nologin",
  78. @"/usr/bin/lzmainfo",
  79. @"/usr/bin/iomfsetgamma",
  80. @"/usr/bin/chsh",
  81. @"/usr/bin/gpgv",
  82. @"/usr/bin/toe",
  83. @"/usr/bin/cmp",
  84. @"/usr/bin/locate",
  85. @"/usr/bin/cfversion",
  86. @"/usr/bin/gpg-zip",
  87. @"/usr/bin/dselect",
  88. @"/usr/bin/infotocap",
  89. @"/usr/bin/ncursesw5-config",
  90. @"/usr/bin/dpkg-deb",
  91. @"/usr/bin/diff3",
  92. @"/usr/bin/sw_vers",
  93. @"/usr/bin/gpg",
  94. @"/usr/bin/df",
  95. @"/usr/bin/renice",
  96. @"/usr/bin/captoinfo",
  97. @"/usr/bin/dpkg-name",
  98. @"/usr/bin/bashbug",
  99. @"/usr/bin/dpkg-split",
  100. @"/usr/bin/chfn",
  101. @"/usr/bin/tset",
  102. @"/usr/bin/unlzma",
  103. @"/usr/bin/uicache",
  104. @"/usr/bin/reset",
  105. @"/usr/bin/pagesize",
  106. @"/usr/bin/gpgsplit",
  107. @"/usr/bin/diff",
  108. @"/usr/bin/uiopen",
  109. @"/usr/bin/dpkg-trigger",
  110. @"/usr/bin/updatedb",
  111. @"/usr/bin/ncurses5-config",
  112. @"/usr/bin/script",
  113. @"/usr/bin/ldrestart",
  114. @"/usr/bin/time",
  115. @"/usr/bin/sbdidlaunch",
  116. @"/usr/bin/clear",
  117. @"/usr/bin/tic",
  118. @"/usr/bin/getconf",
  119. @"/usr/bin/lzless",
  120. @"/usr/bin/dpkg-query",
  121. @"/usr/bin/infocmp",
  122. @"/usr/bin/lzcmp",
  123. @"/usr/bin/arch",
  124. @"/usr/bin/xargs",
  125. @"/usr/bin/getty",
  126. @"/usr/bin/lzcat",
  127. @"/usr/bin/ldid",
  128. @"/usr/bin/uiduid",
  129. @"/usr/bin/dirname",
  130. @"/usr/bin/lzdiff",
  131. @"/usr/bin/find",
  132. @"/usr/bin/lzmadec",
  133. @"/usr/bin/lzgrep",
  134. @"/usr/bin/sdiff",
  135. @"/usr/bin/lzmore",
  136. @"/usr/bin/tput",
  137. @"/usr/bin/lzfgrep",
  138. @"/usr/bin/hostinfo",
  139. @"/usr/bin/tar",
  140. @"/usr/bin/lzma",
  141. @"/usr/bin/sbreload",
  142. @"/usr/bin/login",
  143. @"/usr/bin/which",
  144. @"/usr/bin/gssc",
  145. @"/usr/bin/apt-key",
  146. @"/usr/bin/lzegrep",
  147. @"/usr/bin/passwd",
  148. @"/usr/bin/dpkg",
  149. @"/usr/lib/libhistory.5.dylib",
  150. @"/usr/lib/libapt-pkg.dylib.4.6",
  151. @"/usr/lib/libpam.dylib",
  152. @"/usr/lib/libpamc.1.dylib",
  153. @"/usr/lib/libapt-pkg.dylib.4.6.0",
  154. @"/usr/lib/libpanelw.5.dylib",
  155. @"/usr/lib/libhistory.5.2.dylib",
  156. @"/usr/lib/libreadline.6.dylib",
  157. @"/usr/lib/libpanel.dylib",
  158. @"/usr/lib/libapt-inst.dylib.1.1",
  159. @"/usr/lib/libcurses.dylib",
  160. @"/usr/lib/liblzmadec.0.dylib",
  161. @"/usr/lib/libhistory.6.dylib",
  162. @"/usr/lib/libformw.dylib",
  163. @"/usr/lib/libncursesw.dylib",
  164. @"/usr/lib/libapt-inst.dylib",
  165. @"/usr/lib/libncurses.5.dylib",
  166. @"/usr/lib/libapt-pkg.dylib",
  167. @"/usr/lib/libreadline.5.dylib",
  168. @"/usr/lib/libhistory.6.0.dylib",
  169. @"/usr/lib/libform.5.dylib",
  170. @"/usr/lib/libpanelw.dylib",
  171. @"/usr/lib/libmenuw.dylib",
  172. @"/usr/lib/libform.dylib",
  173. @"/usr/lib/terminfo",
  174. @"/usr/lib/libpam.1.0.dylib",
  175. @"/usr/lib/libmenu.5.dylib",
  176. @"/usr/lib/libpatcyh.dylib",
  177. @"/usr/lib/libreadline.6.0.dylib",
  178. @"/usr/lib/liblzmadec.dylib",
  179. @"/usr/lib/libncurses.dylib",
  180. @"/usr/lib/libhistory.dylib",
  181. @"/usr/lib/libpamc.dylib",
  182. @"/usr/lib/libformw.5.dylib",
  183. @"/usr/lib/libapt-inst.dylib.1.1.0",
  184. @"/usr/lib/libpanel.5.dylib",
  185. @"/usr/lib/liblzmadec.0.0.0.dylib",
  186. @"/usr/lib/_ncurses",
  187. @"/usr/lib/libpam_misc.1.dylib",
  188. @"/usr/lib/libreadline.5.2.dylib",
  189. @"/usr/lib/libpam_misc.dylib",
  190. @"/usr/lib/libreadline.dylib",
  191. @"/usr/lib/libmenuw.5.dylib",
  192. @"/usr/lib/libpam.1.dylib",
  193. @"/usr/lib/libmenu.dylib",
  194. @"/usr/lib/liblzmadec.la",
  195. @"/usr/lib/libncursesw.5.dylib",
  196. @"/usr/libexec/frcode",
  197. @"/usr/libexec/bigram",
  198. @"/usr/libexec/code",
  199. @"/usr/libexec/reload",
  200. @"/usr/libexec/rmt",
  201. @"/usr/sbin/accton",
  202. @"/usr/sbin/vifs",
  203. @"/usr/sbin/ac",
  204. @"/usr/sbin/update",
  205. @"/usr/sbin/pwd_mkdb",
  206. @"/usr/sbin/sysctl",
  207. @"/usr/sbin/zdump",
  208. @"/usr/sbin/startupfiletool",
  209. @"/usr/sbin/iostat",
  210. @"/usr/sbin/mkfile",
  211. @"/usr/sbin/zic",
  212. @"/usr/sbin/vipw",
  213. @"/usr/share/dict",
  214. @"/usr/bin/gtar",
  215. @"/usr/bin/dselect",
  216. @"/usr/bin/cycc",
  217. @"/usr/bin/dpkg-statoverride",
  218. @"/usr/bin/dpkg-deb",
  219. @"/usr/bin/dpkg-divert",
  220. @"/usr/bin/cynject",
  221. @"/usr/bin/update-alternatives",
  222. @"/usr/bin/dpkg-split",
  223. @"/usr/bin/uicache",
  224. @"/usr/bin/dpkg-trigger",
  225. @"/usr/bin/dpkg-maintscript-helper",
  226. @"/usr/bin/env",
  227. @"/usr/bin/gnutar",
  228. @"/usr/bin/cycript",
  229. @"/usr/bin/dpkg-query",
  230. @"/usr/bin/apt",
  231. @"/usr/bin/apt-get",
  232. @"/usr/bin/dpkg",
  233. @"/usr/libexec/MSUnrestrictProcess",
  234. @"/usr/libexec/substrate",
  235. @"/usr/sbin/start-stop-daemon",
  236. @"/usr/lib/libcycript.dylib",
  237. @"/usr/lib/libcycript.jar",
  238. @"/usr/lib/libapt-inst.dylib",
  239. @"/usr/lib/libapt-pkg.dylib",
  240. @"/usr/lib/libdpkg.a",
  241. @"/usr/lib/libcrypto.1.0.0.dylib",
  242. @"/usr/lib/libssl.1.0.0.dylib",
  243. @"/usr/lib/libcycript.db",
  244. @"/usr/lib/libcurl.4.dylib",
  245. @"/usr/lib/libcycript.0.dylib",
  246. @"/usr/lib/libcycript.cy",
  247. @"/usr/lib/libdpkg.la",
  248. @"/usr/lib/libsubstrate.0.dylib",
  249. @"/bin/cat",
  250. @"/bin/pwd",
  251. @"/bin/sed",
  252. @"/bin/sleep",
  253. @"/bin/stty",
  254. @"/bin/date",
  255. @"/bin/bzip2_64",
  256. @"/bin/kill",
  257. @"/bin/sh",
  258. @"/bin/dd",
  259. @"/bin/mkdir",
  260. @"/bin/hostname",
  261. @"/bin/rmdir",
  262. @"/bin/mv",
  263. @"/bin/ln",
  264. @"/bin/ls",
  265. @"/bin/cp",
  266. @"/bin/chown",
  267. @"/bin/chmod",
  268. @"/bin/rm",
  269. @"/bin/bzip2",
  270. @"/Library/test_inject_springboard.cy",
  271. @"/usr/local/lib/libluajit.a",
  272. nil];
  273. NSFileManager *fileManager = [NSFileManager defaultManager];
  274. for (NSString *fileName in bootstrap_files_list){
  275. if ([fileManager fileExistsAtPath:fileName]){
  276. NSLog(@"Found uncleanable file %@", fileName);
  277. return true;
  278. }
  279. }
  280. return false;
  281. }