Xchat2 Plugin CrackMe 0.3 Beta (devel)


SUBMITTED BY: Guest

DATE: Sept. 18, 2012, 5:21 p.m.

FORMAT: Python

SIZE: 67.3 kB

HITS: 2022

  1. #-*- coding: utf-8 -*-
  2. __module_name__ = "CrackMe"
  3. __module_version__ = "0.3 beta"
  4. __module_description__ = "X-Chat2 plugin Hashes look up."
  5. __module_author__ = "Sorcier_FXK <sorcierfxk@kalkulators.org>"
  6. ##CrackMe XChat2 plugin
  7. ## Latest version here : http://project.kalkulators.org/download/xchat2_crackme_0.3.tar.gz
  8. ## Stand alone version here : http://project.kalkulators.org/<url> // not released at the moment
  9. ## Last update : 29 August 2011
  10. ## All depencies are included in archive
  11. ##
  12. ## dependencies : python mhash, python phpass, pycrypto
  13. ##
  14. ## https://github.com/exavolt/python-phpass
  15. ##
  16. ## How to update 0.2.1b to 0.3 ?
  17. ## Download archive, open archive and extract xchat2_crackme.py in your /home/user/.xchat2/
  18. ## Create those folders:
  19. ## /home/user/.xchat2/crackme/
  20. ## /home/user/.xchat2/crackme/db/
  21. ## /home/user/.xchat2/crackme/download/
  22. ## /home/user/.xchat2/crackme/output/
  23. ##
  24. ## How to install ?
  25. ## Be carefull : Automatic installation mode is only for linux package. (not released)
  26. ## Only manual installation at the moment. This plugin has tested only
  27. ## under linux (Ubuntu). Feedbacks are welcomes :)
  28. ##
  29. ## Automatic:
  30. ## Run "install.sh" with root privileges, load "xchat_crackme.py" in XChat2,
  31. ## ready.
  32. ## Manual:
  33. ## Install dependencies (phpass folder & crypto.py are in archive), copy
  34. ## "crypto.py" file and 'phpass' folder in your /usr/lib/python2.6/ directory
  35. ## (for Ubuntu) , install python-mhash & py-crypto via apt-get/aptitude
  36. ## load "xchat2_crackme.py" in XChat2, ready. Type in Xchat2 /crackme config init
  37. ## Done, you are ok.
  38. ##
  39. ## Thanks to :
  40. ##
  41. ## Yiannis, owner of md5this.com, for add his db in crackme plugin and
  42. ## maker wordlist from websites (mode /harverster grab) :)
  43. ##
  44. ##
  45. ##TODO for validate 0.4 version
  46. ##
  47. ## recode /hash with 'dynamic motor'
  48. ## add filter module
  49. ## -add filter {MD5}b64 -> hex MD5
  50. ## -add filter {SHA}b64 -> hex sha1(pass.salt) (for soloris & linux ldap)
  51. ##
  52. ##TODO for validate 0.3 version.
  53. ##
  54. ## add password generator --> ok
  55. ## use sqlite3 for captured plaintexts & not found hashes --> in progress
  56. ## add hashlists manager --> in progress
  57. ## add MySQL module
  58. ## add new hash types for /whatis
  59. ## import to pastebin.com API --> ok
  60. ## export to pastebin.com API --> ok
  61. ## add salt support in /hash function --> ok
  62. ## add b64 encoder/decoder --> ok
  63. ## add ROT13 encoder/decoder --> ok
  64. ## add harvester to collect plaintext from any sources --> in progress
  65. ## add new charsets in /password function --> ok
  66. ## Remove old look up function, add newest at cracker.kalkulators.org API --> ok
  67. ## add lm look up support via /pwdump switch --> ok
  68. ##
  69. ##TODO for validate 0.2 version.
  70. ##
  71. ## add hash calculator --> ok
  72. ## /whatis => identification hashes module --> ok
  73. ## /len <string> => string length --> ok
  74. ## Remplace all "syntax error" messages by "man page" --> ok
  75. ##
  76. ##TODO list for dev in 0.3 version.
  77. ##
  78. ## Bug in harvest mode with google dork
  79. ##
  80. ##
  81. ##BUG Tracker
  82. ##
  83. ## Ver Comment
  84. ## 0.2.1 bug in function /len with espace char --> Fixed
  85. ## 0.2.1 DB down crash thread --> Fixed
  86. ## 0.2.1 MD5This.com db added, see "Thanks to:" section.
  87. ## 0.2 TMTO's API's modified, don't works, --> Fixed
  88. ## 0.1 command without parameter (ie: '/ntlm') -> crash plug in --> Fixed
  89. import warnings
  90. def fxn():
  91. warnings.warn("deprecated", DeprecationWarning)
  92. import sets
  93. with warnings.catch_warnings():
  94. warnings.simplefilter("ignore")
  95. fxn()
  96. import xchat, urllib, urllib2, crypt, random, phpass, hashlib
  97. import base64, sqlite3, time, re, simplejson, ast
  98. from threading import Thread
  99. from crypto import HashMaker
  100. class Pastebin(object):
  101. prefix_url = 'http://pastebin.com/'
  102. subdomain_url = 'http://%s.pastebin.com/' # % paste_subdomain
  103. api_url = 'http://pastebin.com/api_public.php'
  104. paste_expire_date = ('N', '10M', '1H', '1D', '1M')
  105. paste_format = (
  106. 'abap', 'actionscript', 'actionscript3', 'ada', 'apache',
  107. 'applescript', 'apt_sources', 'asm', 'asp', 'autoit', 'avisynth',
  108. 'bash', 'basic4gl', 'bibtex', 'blitzbasic', 'bnf', 'boo', 'bf', 'c',
  109. 'c_mac', 'cill', 'csharp', 'cpp', 'caddcl', 'cadlisp', 'cfdg',
  110. 'klonec', 'klonecpp', 'cmake', 'cobol', 'cfm', 'css', 'd', 'dcs',
  111. 'delphi', 'dff', 'div', 'dos', 'dot', 'eiffel', 'email', 'erlang',
  112. 'fo', 'fortran', 'freebasic', 'gml', 'genero', 'gettext', 'groovy',
  113. 'haskell', 'hq9plus', 'html4strict', 'idl', 'ini', 'inno', 'intercal',
  114. 'io', 'java', 'java5', 'javascript', 'kixtart', 'latex', 'lsl2',
  115. 'lisp', 'locobasic', 'lolcode', 'lotusformulas', 'lotusscript',
  116. 'lscript', 'lua', 'm68k', 'make', 'matlab', 'matlab', 'mirc',
  117. 'modula3', 'mpasm', 'mxml', 'mysql', 'text', 'nsis', 'oberon2', 'objc',
  118. 'ocaml-brief', 'ocaml', 'glsl', 'oobas', 'oracle11', 'oracle8',
  119. 'pascal', 'pawn', 'per', 'perl', 'php', 'php-brief', 'pic16',
  120. 'pixelbender', 'plsql', 'povray', 'powershell', 'progress', 'prolog',
  121. 'properties', 'providex', 'python', 'qbasic', 'rails', 'rebol', 'reg',
  122. 'robots', 'ruby', 'gnuplot', 'sas', 'scala', 'scheme', 'scilab',
  123. 'sdlbasic', 'smalltalk', 'smarty', 'sql', 'tsql', 'tcl', 'tcl',
  124. 'teraterm', 'thinbasic', 'typoscript', 'unreal', 'vbnet', 'verilog',
  125. 'vhdl', 'vim', 'visualprolog', 'vb', 'visualfoxpro', 'whitespace',
  126. 'whois', 'winbatch', 'xml', 'xorg_conf', 'xpp', 'z80'
  127. )
  128. # Submit a code snippet to Pastebin
  129. @classmethod
  130. def submit(cls, paste_code,
  131. paste_name = None, paste_subdomain = None,
  132. paste_private = None, paste_expire_date = None,
  133. paste_format = None):
  134. # Code snippet to submit
  135. argv = { 'paste_code' : str(paste_code) }
  136. # Name of the poster
  137. if paste_name is not None:
  138. argv['paste_name'] = str(paste_name)
  139. # Custom subdomain
  140. if paste_subdomain is not None:
  141. paste_subdomain = str(paste_subdomain).strip().lower()
  142. argv['paste_subdomain'] = paste_subdomain
  143. # Is the snippet private?
  144. if paste_private is not None:
  145. argv['paste_private'] = int(bool(int(paste_private)))
  146. # Expiration for the snippet
  147. if paste_expire_date is not None:
  148. paste_expire_date = str(paste_expire_date).strip().upper()
  149. if not paste_expire_date in cls.paste_expire_date:
  150. raise ValueError, "Bad expire date: %s" % paste_expire_date
  151. # Syntax highlighting
  152. if paste_format is not None:
  153. paste_format = str(paste_format).strip().lower()
  154. if not paste_format in cls.paste_format:
  155. raise ValueError, "Bad format: %s" % paste_format
  156. argv['paste_format'] = paste_format
  157. # Make the request to the Pastebin API
  158. fd = urllib.urlopen(cls.api_url, urllib.urlencode(argv))
  159. try:
  160. response = fd.read()
  161. finally:
  162. fd.close()
  163. del fd
  164. # Return the new snippet URL on success, raise exception on error
  165. if argv.has_key('paste_subdomain'):
  166. prefix = cls.subdomain_url % paste_subdomain
  167. else:
  168. prefix = cls.prefix_url
  169. if not response.startswith(prefix):
  170. raise RuntimeError, response
  171. return response
  172. def db_sqlite(param, data):
  173. if param[0] == 'init.config':
  174. try:
  175. start_point = ".xchat2/crackme/db/config.db"
  176. link = start_point
  177. con = sqlite3.connect(link)
  178. con.isolation_level = None
  179. cur = con.cursor()
  180. cur.execute('''create table config(output_dir text, input_dir text)''')
  181. cur.execute('''create table mod(mod_name text, mod_ver text, mod_ip text, mod_port text)''')
  182. cur.execute('''create table hashlist(h_id int,h_name text, h_type text, h_date text, h_lastup text, h_qty int, h_qty_lastup int, h_list text)''')
  183. cur.execute("""insert into config values ('.xchat2/crackme/output/', '.xchat2/crackme/download/')""")
  184. return True
  185. except:
  186. return False
  187. cur.close()
  188. if param[0] == 'init':
  189. print "[>]" + 60 * "-"
  190. print "[>] Initialization of config.db."
  191. param[0] = 'init.config'
  192. statut = db_sqlite(param, data)
  193. if statut == True:
  194. print "[>] Success ! config.db is now initialized."
  195. else:
  196. print "[>] Error ! Check your paths & rights."
  197. if param[0] == 'read.config':
  198. try:
  199. start_point = ".xchat2/crackme/db/config.db"
  200. link = start_point
  201. con = sqlite3.connect(link)
  202. con.isolation_level = None
  203. cur = con.cursor()
  204. cur.execute('''select * from config''')
  205. r_query = []
  206. for raw in cur:
  207. for x in raw:
  208. r_query.append(x)
  209. cur.close()
  210. return r_query
  211. except:
  212. return False
  213. if param[0] == 'read.config.input_path':
  214. try:
  215. start_point = ".xchat2/crackme/db/config.db"
  216. link = start_point
  217. con = sqlite3.connect(link)
  218. con.isolation_level = None
  219. cur = con.cursor()
  220. cur.execute('''select input_dir from config''')
  221. r_query = []
  222. for raw in cur:
  223. for x in raw:
  224. r_query.append(x)
  225. cur.close()
  226. return r_query
  227. except:
  228. return False
  229. if param[0] == 'read.hashlist.info':
  230. try:
  231. start_point = ".xchat2/crackme/db/config.db"
  232. link = start_point
  233. con = sqlite3.connect(link)
  234. con.isolation_level = None
  235. cur = con.cursor()
  236. cur.execute('''select h_name, h_type, h_date, h_lastup, h_qty, h_qty_lastup from hashlist''')
  237. r_query = []
  238. for raw in cur:
  239. r_query.append(raw)
  240. cur.close()
  241. return r_query
  242. except:
  243. return False
  244. if param[0] == 'read.hashlist.search':
  245. try:
  246. start_point = ".xchat2/crackme/db/config.db"
  247. link = start_point
  248. con = sqlite3.connect(link)
  249. con.isolation_level = None
  250. cur = con.cursor()
  251. cur.execute('''select h_name, h_type, h_date, h_lastup, h_qty, h_qty_lastup from hashlist where h_name like "%s"''' % ('%' + data[0] + '%'))
  252. r_query = []
  253. for raw in cur:
  254. r_query.append(raw)
  255. cur.close()
  256. return r_query
  257. except:
  258. return False
  259. if param[0] == 'write.config.output_path':
  260. try:
  261. start_point = ".xchat2/crackme/db/config.db"
  262. link = start_point
  263. con = sqlite3.connect(link)
  264. con.isolation_level = None
  265. cur = con.cursor()
  266. cur.execute('''update config set output_dir="%s"''' % data[0])
  267. cur.close()
  268. return True
  269. except:
  270. return False
  271. if param[0] == 'write.config.input_path':
  272. try:
  273. start_point = ".xchat2/crackme/db/config.db"
  274. link = start_point
  275. con = sqlite3.connect(link)
  276. con.isolation_level = None
  277. cur = con.cursor()
  278. cur.execute('''update config set input_dir="%s"''' % data[0])
  279. cur.close()
  280. return True
  281. except:
  282. return False
  283. if param[0] == 'write.hashlist':
  284. #try:
  285. start_point = ".xchat2/crackme/db/config.db"
  286. link = start_point
  287. con = sqlite3.connect(link)
  288. con.isolation_level = None
  289. cur = con.cursor()
  290. cur.execute('''insert into hashlist values ("%s", "%s", "%s", "%s", "%s", %s, %s, "%s")''' % (data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]))
  291. cur.close()
  292. # return True
  293. #except:
  294. # return False
  295. if param[0] == 'read':
  296. if len(param) == 2 and param[1] == 'config':
  297. param = ['read.config']
  298. statut = db_sqlite(param, data)
  299. return statut
  300. if len(param) == 3 and param[1] == 'config' and param[2] == 'input_path':
  301. param = ['read.config.input_path']
  302. statut = db_sqlite(param, data)
  303. return statut
  304. if len(param) == 3 and param[1] == 'hashlist' and param[2] == 'info':
  305. param = ['read.hashlist.info']
  306. statut = db_sqlite(param, data)
  307. return statut
  308. if len(param) == 3 and param[1] == 'hashlist' and param[2] == 'search':
  309. param = ['read.hashlist.search']
  310. statut = db_sqlite(param, data)
  311. return statut
  312. else:
  313. print "[>] Error DB, check your paths & your rights."
  314. return False
  315. if param[0] == 'write':
  316. if len(param) == 2 and param[1] == 'hashlist':
  317. param == ['write.hashlist']
  318. statut = db_sqlite(param, data)
  319. return statut
  320. if len(param) == 3 and param[1] == 'config' and param[2] == 'output_path':
  321. param = ['write.config.output_path']
  322. statut = db_sqlite(param, data)
  323. return statut
  324. if len(param) == 3 and param[1] == 'config' and param[2] == 'input_path':
  325. param = ['write.config.input_path']
  326. statut = db_sqlite(param, data)
  327. return statut
  328. else:
  329. print "[>] Error DB, check your paths & your rights."
  330. return False
  331. def run_md5(hashes):
  332. print "[>]\0034 Looking for MD5 %s...\0034" % hashes
  333. log = open('.xchat2/crackme/crackme_wl.txt', 'a+')
  334. Thread(None, md5_lookup, None, (hashes, log), {}).start()
  335. def run_ntlm(hashes):
  336. log = open('.xchat2/crackme/crackme_wl.txt', 'a+')
  337. print "[>]\0034 Looking for NTLM %s... \0034" % hashes
  338. Thread(None, ntlm_lookup, None, (hashes, log,), {}).start()
  339. def run_lm(hashes):
  340. log = open('.xchat2/crackme/crackme_wl.txt', 'a+')
  341. print "[>]\0034 Looking for LM %s... \0034" % hashes
  342. Thread(None, lm_lookup, None, (hashes, log,), {}).start()
  343. def run_sha1(hashes):
  344. log = open('.xchat2/crackme/crackme_wl.txt', 'a+')
  345. print "[>]\0034 Looking for SHA-1 %s...\0034" % hashes
  346. Thread(None, sha1_lookup, None, (hashes, log,), {}).start()
  347. def md5_lookup(hashes, log):
  348. try:
  349. f = urllib2.urlopen('http://cracker.kalkulators.org/API/md5/json/%s/' % hashes)
  350. data = ast.literal_eval(f.read())
  351. if data['status'] == 'found':
  352. if data['website'] == 'tmto (base64 encoded string)':
  353. result = base64.b64decode(data['value'])
  354. data['website'] = 'TMTO'
  355. else:
  356. result = data['value']
  357. print "[>] \0033[MD5] %s\0033 : %s:%s" % (data['website'],hashes, result)
  358. else:
  359. result = 'Not found'
  360. print "[>] \0033[MD5] %s\0033 : %s" % (hashes, result)
  361. if result != 'Not found':
  362. log.write(result+"\n")
  363. log.close()
  364. except:
  365. print "[>] cracker.kalkulators.org API appear down for the moment..."
  366. def sha1_lookup(hashes, log):
  367. try:
  368. f = urllib2.urlopen('http://cracker.kalkulators.org/API/sha1/json/%s/' % hashes)
  369. data = ast.literal_eval(f.read())
  370. if data['status'] == 'found':
  371. result = data['value']
  372. print "[>] \0033[SHA1] %s\0033 : %s:%s" % (data['website'],hashes, result)
  373. else:
  374. result = 'Not found'
  375. print "[>] \0033[SHA1] %s\0033 : %s" % (hashes, result)
  376. if result != 'Not found':
  377. log.write(result+"\n")
  378. log.close()
  379. except:
  380. print "[>] cracker.kalkulators.org API appear down for the moment..."
  381. def ntlm_lookup(hashes, log):
  382. try:
  383. f = urllib2.urlopen('http://cracker.kalkulators.org/API/ntlm/json/%s/' % hashes)
  384. data = ast.literal_eval(f.read())
  385. if data['status'] == 'found':
  386. result = data['value']
  387. print "[>] \0033[NTLM] %s\0033 : %s:%s" % (data['website'],hashes, result)
  388. else:
  389. result = 'Not found'
  390. print "[>] \0033[NTLM] %s\0033 : %s" % (hashes, result)
  391. if result != 'Not found':
  392. log.write(result+"\n")
  393. log.close()
  394. except:
  395. print "[>] cracker.kalkulators.org API appear down for the moment..."
  396. def lm_lookup(hashes, log):
  397. try:
  398. f = urllib2.urlopen('http://cracker.kalkulators.org/API/lm/json/%s/' % hashes)
  399. data = ast.literal_eval(f.read())
  400. if data['status'] == 'found':
  401. result = data['value']
  402. print "[>] \0033[LM] %s\0033 : %s:%s" % (data['website'],hashes, result)
  403. else:
  404. result = 'Not found'
  405. print "[>] \0033[LM] %s\0033: %s" % (hashes, result)
  406. if result != 'Not found':
  407. log.write(result+"\n")
  408. log.close()
  409. except:
  410. print "[>] cracker.kalkulators.org API appear down for the moment..."
  411. def crackme(word, word_eol, userdata):
  412. if len(word) == 1:
  413. print "[>]" + 60 * "-"
  414. print "[>] CrackMe Xchat2 plugin by Sorcier_FXK"
  415. print "[>] sorcierfxk@kalkulators.org"
  416. print "[>] Version : %s" % __module_version__
  417. print "[>] Latest version here : http://project.kalkulators.org/download/xchat2_crackme_0.3.tar.gz"
  418. print "[>] Project Kalkulator's Knights"
  419. print "[>] http://project.kalkulators.org"
  420. print "[>]"
  421. print "[>] Reverse lookup"
  422. print "[>] /md5 <hash> Looking for MD5 hash on public DB's"
  423. print "[>] /ntlm <hash> Looking for NTLM hash on public DB's"
  424. print "[>] /sha1 <hash> Looking for SHA-1 hash on public DB's"
  425. print "[>] /pwdump <lm_hash:ntlm_hash> Looking for LM/NTLM hashes on public DB's"
  426. print "[>] /pwdump <lm_hash> Looking for LM hashes on public DB's"
  427. print "[>] /lm <lm_hash> Looking for LM hashes on public DB's"
  428. print "[>]"
  429. print "[>] Tools"
  430. print "[>] /whatis <hash> Identify hash type"
  431. print "[>] /len <string> Chain length"
  432. print "[>] /hash <type> <string> <n°ite> Hash calculator"
  433. print "[>] /password <charset> <len> Generate random password"
  434. print "[>] /import <site> <url> <file> Import hashlist from pastebin"
  435. print "[>] /export <string> Export string or text file to pastebin.com"
  436. print "[>] /harvester <param1> <param2> Harvest plaintext (from file, URL...)"
  437. print "[>] /hashlist <param1> <param2> Manage your hashlists"
  438. print "[>] /b64 <param> <string> To encode/decode Base64 string"
  439. print "[>] /rot13 <param> <string> To encode/decode ROT13 string"
  440. print "[>]"
  441. print "[>] Options"
  442. print "[>] /crackme This page"
  443. print "[>] /crackme config View configuration's page"
  444. print "[>]"
  445. print "[>] MAN PAGES :"
  446. print "[>] To Man page's access, type command (ie: /hash, /ntlm...) without parameter"
  447. elif len(word) == 2 and word[1] == 'config':
  448. statut = db_sqlite(['read', 'config'], [' '])
  449. statut = list(statut)
  450. print "[>]" + 60 * "-"
  451. print "[>] Actual configuration of CrackMe :"
  452. print "[>] Output path : %s" % statut[0]
  453. print "[>] Input path : %s" % statut[1]
  454. print "[>]"
  455. print "[>] To change your Output path type : /crackme config output_path /your/new/path/"
  456. print "[>] To change your Input path type : /crackme config input_path /your/new/path/"
  457. elif len(word) == 3 and word[1] == 'config' and word[2] == 'init':
  458. param = ['init',' ']
  459. data = []
  460. db_sqlite(param, data)
  461. elif len(word) == 4 and word[1] == 'config' and word[2] == 'output_path':
  462. param = ['write', 'config', 'output_path']
  463. dat = word[3]
  464. data = []
  465. if dat[len(dat)-1] != '/':
  466. data.append(dat + '/')
  467. else:
  468. data.append(dat)
  469. statut = db_sqlite(param, data)
  470. if statut == True:
  471. print "[>] Configuration updated."
  472. else:
  473. print "[>] Error with DB."
  474. elif len(word) == 4 and word[1] == 'config' and word[2] == 'input_path':
  475. param = ['write', 'config', 'input_path']
  476. dat = word[3]
  477. data = []
  478. if dat[len(dat)-1] != '/':
  479. data.append(dat + '/')
  480. else:
  481. data.append(dat)
  482. statut = db_sqlite(param, data)
  483. if statut == True:
  484. print "[>] Configuration updated."
  485. else:
  486. print "[>] Error with DB."
  487. else:
  488. print "[>] Error incorrect parameter : %s" % word[1]
  489. print "[>] Type /crackme for more informations."
  490. return xchat.EAT_XCHAT
  491. def md5(word, word_eol, userdata):
  492. if len(word) > 1:
  493. hashes = word[1]
  494. Thread(None, run_md5, None, (hashes,), {}).start()
  495. else:
  496. print "[>]" + 60 * "-"
  497. print "[>] Man page : /md5"
  498. print "[>] Syntax informations : /md5 <hash>"
  499. print "[>] Looking for md5 on public db's"
  500. print "[>] <hash> Remplace by your md5 hash"
  501. print "[>]"
  502. print "[>] Kalkulator's Knight Web Cracker"
  503. print "[>] http://cracker.kalkulators.org"
  504. return xchat.EAT_XCHAT
  505. def ntlm(word, word_eol, userdata):
  506. if len(word) > 1:
  507. hashes = word[1]
  508. Thread(None, run_ntlm, None, (hashes,), {}).start()
  509. else:
  510. print "[>]" + 60 * "-"
  511. print "[>] Man page : /ntlm"
  512. print "[>] Syntax informations : /ntlm <hash>"
  513. print "[>] Looking for ntlm hash on public db's"
  514. print "[>] <hash> Remplace by your ntlm hash"
  515. print "[>]"
  516. print "[>] Kalkulator's Knight Web Cracker"
  517. print "[>] http://cracker.kalkulators.org"
  518. return xchat.EAT_XCHAT
  519. def pwdump(word, word_eol, userdata):
  520. if len(word) > 1:
  521. hashes = word[1]
  522. hashes = hashes.split(':')
  523. if len(hashes) == 2:
  524. Thread(None, run_lm, None, (hashes[0],), {}).start()
  525. Thread(None, run_ntlm, None, (hashes[1],), {}).start()
  526. else:
  527. Thread(None, run_lm, None, (hashes[0].lower(),), {}).start()
  528. else:
  529. print "[>]" + 60 * "-"
  530. print "[>] Man page : /pwdump"
  531. print "[>] Man page : /lm"
  532. print "[>] Syntax informations : /pwdump <LM:NTLM>"
  533. print "[>] : /pwdump <LM>"
  534. print "[>] : /lm <LM>"
  535. print "[>] Looking for pwdump hash format on public db's"
  536. print "[>] <LM:NTLM> Replace by your hashes (LM & NTLM)"
  537. print "[>] <LM> Replace by your LM hash"
  538. print "[>]"
  539. print "[>] Kalkulator's Knight Web Cracker"
  540. print "[>] http://cracker.kalkulators.org"
  541. return xchat.EAT_XCHAT
  542. def sha1(word, word_eol, userdata):
  543. if len(word) > 1:
  544. hashes = word[1]
  545. Thread(None, run_sha1, None, (hashes,), {}).start()
  546. else:
  547. print "[>]" + 60 * "-"
  548. print "[>] Man page : /sha1"
  549. print "[>] Syntax informations : /sha1 <hash>"
  550. print "[>] Looking for sha1 hash on public db's"
  551. print "[>] <hash> Remplace by your sha1 hash"
  552. print "[>]"
  553. print "[>] Kalkulator's Knight Web Cracker"
  554. print "[>] http://cracker.kalkulators.org"
  555. return xchat.EAT_XCHAT
  556. def length(word, word_eol, userdata):
  557. if len(word) > 1:
  558. hashes = word_eol[1]
  559. print "[>]" + 60 * "-"
  560. print "[>] String : %s" % hashes
  561. print "[>] length : %s" % len(hashes)
  562. else:
  563. print "[>]" + 60 * "-"
  564. print "[>] Man page : /len"
  565. print "[>] Syntax informations : /len <string>"
  566. print "[>] To calculate length"
  567. print "[>] <string> Your chain here"
  568. return xchat.EAT_XCHAT
  569. def edbase64(word, word_eol, userdata):
  570. if len(word) > 2:
  571. if word[1] == 'encode':
  572. print "[>]" + 60 * "-"
  573. print "[>] Base64 encoder"
  574. print "[>] String : %s" % word[2]
  575. print "[>] Encoded : %s" % base64.b64encode(word[2])
  576. elif word[1] == 'decode':
  577. try:
  578. data = base64.b64decode(word[2])
  579. print "[>]" + 60 * "-"
  580. print "[>] Base64 decoder"
  581. print "[>] String : %s" % word[2]
  582. print "[>] Decoded : %s" % data
  583. except:
  584. print "[>] Error, your string is not Base64 encoded"
  585. else:
  586. print "[>] Error, parameters : 'encode' or 'decode'"
  587. else:
  588. print "[>]" + 60 * "-"
  589. print "[>] Man page : /b64"
  590. print "[>] Syntax informations : /b64 <param> <string>"
  591. print "[>] To encode or decode string to Base64"
  592. print "[>] <param> 'encode' or 'decode'"
  593. print "[>] <string> Your chain here"
  594. return xchat.EAT_XCHAT
  595. def rot13(word, word_eol, userdata):
  596. if len(word) > 2:
  597. if word[1] == 'encode':
  598. print "[>]" + 60 * "-"
  599. print "[>] ROT13 encoder"
  600. print "[>] String : %s" % word_eol[2]
  601. print "[>] Encoded : %s" % word_eol[2].encode('rot13')
  602. elif word[1] == 'decode':
  603. try:
  604. data = word_eol[2].decode('rot13')
  605. print "[>]" + 60 * "-"
  606. print "[>] ROT13 decoder"
  607. print "[>] String : %s" % word_eol[2]
  608. print "[>] Decoded : %s" % data
  609. except:
  610. print "[>] Error, your string is not Base64 encoded"
  611. else:
  612. print "[>] Error, parameters : 'encode' or 'decode'"
  613. else:
  614. print "[>]" + 60 * "-"
  615. print "[>] Man page : /rot13"
  616. print "[>] Syntax informations : /rot13 <param> <string>"
  617. print "[>] To encode or decode string to ROT13"
  618. print "[>] <param> 'encode' or 'decode'"
  619. print "[>] <string> Your chain here"
  620. return xchat.EAT_XCHAT
  621. def export_data(word, word_eol, userdata):
  622. Thread(None, export_data_run, None, (word, word_eol, userdata), {}).start()
  623. return xchat.EAT_XCHAT
  624. def export_data_run(word, word_eol, userdata):
  625. if len(word) == 3:
  626. if word[1] == 'file':
  627. print "[>]" + 60 * "-"
  628. print "[>] Export to pastebin.com"
  629. try:
  630. file_in = open(word[2], 'r')
  631. data = file_in.read()
  632. try:
  633. url = Pastebin.submit(paste_code = data, paste_name = "CrackMe")
  634. print "[>] Link : %s" % url
  635. except:
  636. print "[>] Error pastebin.com down ?"
  637. except:
  638. print "[>] Error with your path/file, check your rights."
  639. else:
  640. print "[>] Error Incorect parameter."
  641. print "[>] Parameters : file"
  642. elif len(word) == 2:
  643. print "[>]" + 60 * "-"
  644. print "[>] Export to pastebin.com"
  645. try:
  646. url = Pastebin.submit(paste_code = word_eol[1], paste_name = "CrackMe")
  647. print "[>] Link : %s" % url
  648. except:
  649. print "[>] Error pastebin.com down ?"
  650. else:
  651. print "[>]" + 60 * "-"
  652. print "[>] Man page : /export"
  653. print "[>] Syntax informations : /export <string>"
  654. print "[>] : /export <param> <path/file>"
  655. print "[>] To export string/text file to pastebin.com"
  656. print "[>] WARNING : Max size is 10Mb"
  657. print "[>] <string> Your text"
  658. print "[>] <param> *Optionnal* See table below"
  659. print "[>] <path/file> *Optionnal* File path (ie : /media/usb1/myfile.txt)"
  660. print "[>]"
  661. print "[>] Compatible pastebin table :"
  662. print "[>] Pastebin Parameter ie"
  663. print "[>] pastebin.com - /export file /home/user/test.txt"
  664. print "[>]"
  665. print "[>] Parameters list :"
  666. print "[>] Parameter info ie"
  667. print "[>] file to specificy output path/file /export file /path/file.txt"
  668. return xchat.EAT_XCHAT
  669. def import_data(word, word_eol, userdata):
  670. Thread(None, import_data_run, None, (word, word_eol, userdata), {}).start()
  671. return xchat.EAT_XCHAT
  672. def import_data_run(word, word_eol, userdata):
  673. error_lvl = 0
  674. ## Import from pastebin.com to .txt file (user define file name & path)
  675. if len(word) == 4:
  676. if word[1] == "pb":
  677. link = word[2].split('/')
  678. link = link[3]
  679. output_path = word[3]
  680. print "[>]" + 60 * "-"
  681. print "[>] Import from pastebin.com %s" % word[2]
  682. try:
  683. f = urllib2.urlopen('http://pastebin.com/download.php?i=%s' % link)
  684. data = f.read()
  685. if 'jkUAIOE8owUXu8UXIhRLB9oHJsWBfOgJbZzncqHoF4A' in data:
  686. error_lvl = 1
  687. if error_lvl < 1:
  688. try:
  689. out = open(output_path, 'w')
  690. out.write(data+'\n')
  691. print "[>] Output : %s" % output_path
  692. print "[>] Import : Success"
  693. except:
  694. print "[>] Error with your path/file, check your rights."
  695. print "[>] Import : Echec !"
  696. except:
  697. print "[>] Error with your URL, maybe site down."
  698. print "[>] Import : Echec !"
  699. ## Import to pastebin.com to .txt file (with random file name)
  700. elif len(word) == 3:
  701. if word[1] == "pb":
  702. link = word[2].split('/')
  703. link = link[3]
  704. print "[>]" + 60 * "-"
  705. print "[>] Import from pastebin.com %s" % word[2]
  706. try:
  707. f = urllib2.urlopen('http://pastebin.com/download.php?i=%s' % link)
  708. data = f.read()
  709. if 'jkUAIOE8owUXu8UXIhRLB9oHJsWBfOgJbZzncqHoF4A' in data:
  710. error_lvl = 1
  711. if error_lvl < 1:
  712. try:
  713. output_path = db_sqlite(['read', 'config', 'input_path'], [' '])
  714. file_name = "%spb-%s.txt" % (output_path[0], link)
  715. out = open(file_name, 'w')
  716. out.write(data+'\n')
  717. print "[>] Output in your default folder : %s" % file_name
  718. print "[>] Import : Success"
  719. except:
  720. print "[>] Error with your path/file, check your rights."
  721. print "[>] Import : Echec !"
  722. except:
  723. print "[>] Error with your URL, maybe site down."
  724. print "[>] Import : Echec !"
  725. else:
  726. print "[>]" + 60 * "-"
  727. print "[>] Man page : /import"
  728. print "[>] Syntax informations : /import <site> <url> <output>"
  729. print "[>] To import hashlist from pastebin of your choice."
  730. print "[>] <site> See table below"
  731. print "[>] <url> URL of your post"
  732. print "[>] <output> *Optionnal* Output path (ie : /media/usb1/mypast.txt)"
  733. print "[>]"
  734. print "[>] Compatible pastebin table :"
  735. print "[>] Pastebin Parameter ie"
  736. print "[>] pastebin.com pb /importe pb"
  737. if error_lvl == 1:
  738. print "[>] Error unknow pastebin ID."
  739. return xchat.EAT_XCHAT
  740. def password(word, word_eol, userdata):
  741. charset_dico = {1:'abcdefghijklmnopqrstuvwxyz',
  742. 2:'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
  743. 3:'0123456789',
  744. 4:'abcdefghijklmnopqrstuvwxyz0123456789',
  745. 5:'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
  746. 6:'abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ',
  747. 7:'abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
  748. 8:'abcdefghijklmnopqrstuvwxyz0123456789!:/;.,?@=+-}])[({%&*$',
  749. 9:'abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!:/;.,?@=+-}])[({%&*$',
  750. 10:'0123456789abcdef'}
  751. if len(word) > 2:
  752. try:
  753. charset = int(word[1])
  754. length = int(word[2])
  755. try:
  756. multi = int(word[3])
  757. except:
  758. multi = 1
  759. if charset < 9 or charset > 0:
  760. charset = charset_dico[charset]
  761. print "[>]" + 60 * "-"
  762. print "[>] Charset :", charset
  763. print "[>] Length :", length
  764. result = ''
  765. for y in xrange(multi):
  766. for x in xrange(length):
  767. a = random.randint(1, len(charset)-1)
  768. result = result + charset[a]
  769. print "[>] Random password :", result
  770. result = ''
  771. except:
  772. print "[>] Parameters error, check your syntax or type /password for man page"
  773. else:
  774. print "[>]" + 60 * "-"
  775. print "[>] Man page : /password"
  776. print "[>] Syntax informations : /password <charset> <length> <number_pwd>"
  777. print "[>] To generate one or many random passwords."
  778. print "[>] <charset> Number of charset, see table below"
  779. print "[>] <length> Password length"
  780. print "[>] <number_pwd> Number of generated password, default is '1'"
  781. print "[>]"
  782. print "[>] Charsets :"
  783. print "[>] [1] Lower a -> z"
  784. print "[>] [2] Upper A -> Z"
  785. print "[>] [3] Decimal 0 -> 9"
  786. print "[>] [4] Lower + decimal a -> 9"
  787. print "[>] [5] Upper + decimal A -> 9"
  788. print "[>] [6] Lower + upper a -> Z"
  789. print "[>] [7] Lower + upper + decimal a -> A -> 9"
  790. print "[>] [8] abcdefghijklmnopqrstuvwxyz0123456789!:/;.,?@=+-}])[({%&*$"
  791. print "[>] [9] abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!:/;.,?@=+-}])[({%&*$"
  792. print "[>] [10] Hexadecimal 0 -> f"
  793. return xchat.EAT_XCHAT
  794. def hashlist(word, word_eol, userdata):
  795. if len(word) == 2:
  796. if word[1] == "info":
  797. param = ['read', 'hashlist', 'info']
  798. data = []
  799. statut = db_sqlite(param, data)
  800. if statut == [] or statut == False:
  801. print "[>] Error, you don't have hashlist for the moment."
  802. else:
  803. print "[>]" + 60 * "-"
  804. print "[>] List of your hashlists :"
  805. print "[>] Name Type N# full N# left Success rate"
  806. count = 0
  807. stat = []
  808. for x in statut:
  809. x = list(x)
  810. count = count + 1
  811. if int(x[4]) == int(x[5]):
  812. percent = 0
  813. stat.append(percent)
  814. else:
  815. percent = (100 / int(x[4])) * int(x[5])
  816. stat.append(percent)
  817. print "[>] %0016s %14s %09d %09d %11.2f" % (x[0], x[1], x[4], x[5], percent)
  818. global_stat = 0
  819. for x in stat:
  820. global_stat = global_stat + x
  821. global_stat = global_stat / count
  822. print "[>] Total hashlist : %s" % count
  823. print "[>] Total reversed : %.2f" % global_stat, "%"
  824. elif len(word) == 2 and word[1] == 'search':
  825. print "[>]" + 60 * "-"
  826. print "[>] Search hashlist :"
  827. print "[>] /hashlist search <string>"
  828. print "[>] <string> Remplace by you request (max 16 char)"
  829. elif len(word) == 3 and word[1] == 'search':
  830. print "[>]" + 60 * "-"
  831. print "[>] Hashlist :"
  832. print "[>] Search : %s" % word[2]
  833. if len(word[2]) > 16:
  834. print "[>] Error, 16 char maximum please."
  835. else:
  836. param = ['read', 'hashlist', 'search']
  837. data = []
  838. data.append(word[2])
  839. statut = db_sqlite(param, data)
  840. if statut != []:
  841. print "[>] List of your hashlists :"
  842. print "[>] Name Type N# full N# left Success rate"
  843. count = 0
  844. stat = []
  845. for x in statut:
  846. x = list(x)
  847. count = count + 1
  848. if int(x[4]) == int(x[5]):
  849. percent = 0
  850. stat.append(percent)
  851. else:
  852. percent = (100 / int(x[4])) * int(x[5])
  853. stat.append(percent)
  854. print "[>] %0016s %14s %09d %09d %11.2f" % (x[0], x[1], x[4], x[5], percent)
  855. global_stat = 0
  856. for x in stat:
  857. global_stat = global_stat + x
  858. global_stat = global_stat / count
  859. print "[>] Total hashlist : %s" % count
  860. print "[>] Total reversed : %.2f" % global_stat, "%"
  861. else:
  862. print "[>] No result found."
  863. elif len(word) == 5 and word[1] == 'add':
  864. error_lvl = 0
  865. link = word[4].split('/')
  866. link = link[3]
  867. print "[>]" + 60 * "-"
  868. print "[>] Import from pastebin.com %s" % word[3]
  869. #try:
  870. f = urllib2.urlopen('http://pastebin.com/download.php?i=%s' % link)
  871. datas = f.read()
  872. if 'jkUAIOE8owUXu8UXIhRLB9oHJsWBfOgJbZzncqHoF4A' in datas:
  873. error_lvl = 1
  874. if error_lvl < 1:
  875. # try:
  876. data2 = datas.split('\n')
  877. param = ['write.hashlist']
  878. ran_int = random.randint(100000, 9999999)
  879. timing = time.asctime( time.localtime(time.time()))
  880. data = [str(link)+str(ran_int), word[2], word[3], timing, timing, len(data2), len(data2), datas]
  881. statut = db_sqlite(param, data)
  882. print statut
  883. #output_path = db_sqlite(['read', 'config', 'input_path'], [' '])
  884. #file_name = "%spb-%s.txt" % (output_path[0], link)
  885. #out = open(file_name, 'w')
  886. #out.write(data+'\n')
  887. #print "[>] Output in your default folder : %s" % file_name
  888. #print "[>] Import : Success"
  889. # except:
  890. # print "[>] Error with your path/file, check your rights."
  891. # print "[>] Import : Echec !"
  892. #except:
  893. # print "[>] Error with your URL, maybe site down."
  894. # print "[>] Import : Echec !"
  895. else:
  896. print "[>]" + 60 * "-"
  897. print "[>] Man page : /hashlist"
  898. print "[>] Syntax informations : /hashlist <param>"
  899. print "[>] To manage your hashlists."
  900. print "[>] <param> See table below"
  901. print "[>]"
  902. print "[>] List of parameters :"
  903. print "[>] Parameter info ie"
  904. print "[>] info Show general infos of your /hashlist info"
  905. print "[>] hashlists"
  906. print "[>] search For search hashlist /hashlist search for more info"
  907. print "[>] add_pb For add hashlist from /hashlist add_pb <name> <type> <url>"
  908. print "[>] Pastebin.com"
  909. print "[>] add_file For add hashlist from /hashlist add_file <name> <type> <path/file>"
  910. print "[>] a file"
  911. print "[>] delete Delete hashlist /hashlist delete <hashlist_ID>"
  912. return xchat.EAT_XCHAT
  913. def harvester(word, word_eol, userdata):
  914. ## Thanks to Toxic (md5this.com) for grab mode
  915. ## Original source code here : http://md5this.com/wordextract.py
  916. def StripTags(text):
  917. finished = 0
  918. while not finished:
  919. finished =1
  920. start = text.find("<")
  921. if start >= 0:
  922. stop = text[start:].find(">")
  923. if stop >= 0:
  924. text = text[:start] + text[start+stop+1:]
  925. finished = 0
  926. return text
  927. def grabber(min_len, max_len, target, output_file):
  928. print "[>] Retrieving Source:", target
  929. source = StripTags(urllib2.urlopen(target).read())
  930. words = re.findall("\w+", source)
  931. words = list(sets.Set(words))
  932. l = len(words)
  933. print "[>] Found:", l, "words"
  934. print "[>] Trimming words to length"
  935. for word in words:
  936. if not min_len <= len(word) <= max_len:
  937. words.remove(word)
  938. print "[>] Removed:", l-len(words), "words"
  939. print "[>] Writing:", len(words), "words to", output_file
  940. file = open(output_file,"a")
  941. for word in words:
  942. file.writelines(word+"\n")
  943. file.close()
  944. print "[>] Task complete"
  945. def google_api(start, query):
  946. query = urllib.urlencode({'q' : query})
  947. url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=8&start=%s&%s' % (start, query)
  948. search_results = urllib.urlopen(url)
  949. json = simplejson.loads(search_results.read())
  950. return json
  951. def catch_urls(json):
  952. results = json['responseData']['results']
  953. catched_urls = []
  954. for i in results:
  955. if i not in catched_urls:
  956. catched_urls.append(i['url'])
  957. return catched_urls
  958. def dorky(gdork):
  959. sorted_urls = []
  960. num_cycle = 0
  961. count = 0
  962. while count < 1:
  963. num_cycle = num_cycle + 1
  964. start = 0
  965. #dork = 'back filetype:sql'
  966. json = google_api(start, gdork)
  967. #for x in json['responseData']['cursor']['pages']:
  968. # print x
  969. print "-" * 50
  970. print "Cycle numbers : %s" % num_cycle
  971. print "Dork : %s" % gdork
  972. currentPageIndex = json['responseData']['cursor']['currentPageIndex']
  973. print "Current page index : %s" % currentPageIndex
  974. estimatedResultCount = json['responseData']['cursor']['estimatedResultCount']
  975. print "Result numbers : %s" % estimatedResultCount
  976. pages = json['responseData']['cursor']['pages']
  977. num_pages = len(json['responseData']['cursor']['pages'])
  978. print "Page numbers : %s" % num_pages
  979. if num_pages > 1:
  980. catched_urls = catch_urls(json)
  981. index_num = num_pages * 7
  982. for start in xrange(0, index_num, 8):
  983. json = google_api(start, gdork)
  984. catched_urls_tmp = catch_urls(json)
  985. catched_urls = catched_urls + catched_urls_tmp
  986. for x in catched_urls:
  987. if x not in sorted_urls:
  988. sorted_urls.append(x)
  989. print "Num catched URLs : %s" % len(sorted_urls)
  990. #for x in sorted_urls:
  991. # print x
  992. time.sleep(120)
  993. count = count + 1
  994. if len(word) >= 5 and word[1] == 'grab':
  995. min_len = int(word[2])
  996. max_len = int(word[3])
  997. target = word[4]
  998. if target[:7] != 'http://':
  999. target = 'http://' + target
  1000. if len(word) == 5:
  1001. file_name = random.randint(100000,999999)
  1002. output_file = ".xchat2/crackme/output/wl-" + str(file_name) + ".txt"
  1003. else:
  1004. output_file = word[5]
  1005. Thread(None, grabber, None, (min_len, max_len, target, output_file,), {}).start()
  1006. if len(word) == 3 and word[1] == 'dork':
  1007. Thread(None, dorky, None, (word[2],), {}).start()
  1008. else:
  1009. print "[>]" + 60 * "-"
  1010. print "[>] Man page : /harvester"
  1011. print "[>] Syntax informations : /harvester <mode> <source> <output>"
  1012. print "[>] To harvest plaintext from many sources."
  1013. print "[>]"
  1014. print "[>] Mode grab : To harvest plaintexts from web sites"
  1015. print "[>] ie : /harvester grab <min_len> <max_len> <target> <output>"
  1016. print "[>] <min_len> Minumum length word"
  1017. print "[>] <max_len> Maximum length word"
  1018. print "[>] <target> Your web site target"
  1019. print "[>] <output> Output path & file name, if missing plugin put file in :"
  1020. print "[>] /home/user/.xchat2/crackme/output/ folder"
  1021. print "[>]"
  1022. print "[>] Mode dork : To use Google Dork"
  1023. print "[>] ie : /harvester dork <dork>"
  1024. print "[>] <dork> Type your dork here (ie : filetype:sql)"
  1025. return xchat.EAT_XCHAT
  1026. def whatis(word, word_eol, userdata):
  1027. if len(word) > 1:
  1028. stat = {'md5':0, 'md4':0, 'md2':0, 'sha1':0, 'sha224':0, 'sha256':0,
  1029. 'sha384':0, 'sha512':0, 'mysql3':0, 'mysql5':0, 'ntlm':0,
  1030. 'md5unix':0, 'sha256unix':0, 'sha512unix':0, 'lm':0, 'md5wp':0,
  1031. 'md5phpbb3':0, 'desunix':0, 'pwdump':0}
  1032. hashes = word[1]
  1033. def is_hexa(hashes):
  1034. ishexa = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  1035. 'a', 'b', 'c', 'd', 'e', 'f']
  1036. for x in xrange(len(hashes)):
  1037. if hashes[x] not in ishexa:
  1038. return False
  1039. break
  1040. return True
  1041. def is_md(hashes):
  1042. hashes_l = len(hashes)
  1043. hexa = is_hexa(hashes)
  1044. if hashes_l == 32 and hexa == True:
  1045. stat['md5'] = stat['md5'] + 1
  1046. stat['md4'] = stat['md4'] + 1
  1047. stat['md2'] = stat['md2'] + 1
  1048. stat['ntlm'] = stat['ntlm'] + 1
  1049. stat['lm'] = stat['lm'] + 1
  1050. return True
  1051. else:
  1052. return False
  1053. def is_sha(hashes):
  1054. hashes_l = len(hashes)
  1055. hexa = is_hexa(hashes)
  1056. if hashes_l == 40 and hexa == True:
  1057. stat['sha1'] = stat['sha1'] + 1
  1058. stat['mysql5'] = stat['mysql5'] + 1
  1059. return True
  1060. if hashes_l == 56 and hexa == True:
  1061. stat['sha224'] = stat['sha224'] + 1
  1062. return True
  1063. if hashes_l == 64 and hexa == True:
  1064. stat['sha256'] = stat['sha256'] + 1
  1065. return True
  1066. if hashes_l == 96 and hexa == True:
  1067. stat['sha384'] = stat['sha384'] + 1
  1068. return True
  1069. if hashes_l == 128 and hexa == True:
  1070. stat['sha512'] = stat['sha512'] + 1
  1071. return True
  1072. else:
  1073. return False
  1074. def is_unix(hashes):
  1075. if hashes[:3] == '$1$' and len(hashes) == 34 and len(hashes[3:11]) == 8:
  1076. stat['md5unix'] = stat['md5unix'] + 1
  1077. return True
  1078. if hashes[:3] == '$5$':
  1079. stat['sha256unix'] = stat['sha256unix'] + 1
  1080. return True
  1081. if hashes[:3] == '$6$':
  1082. stat['sha512unix'] = stat['sha512unix'] + 1
  1083. return True
  1084. else:
  1085. return False
  1086. def is_salted(hashes):
  1087. hashes_l = len(hashes)
  1088. hexa = is_hexa(hashes)
  1089. if hashes_l == 13:
  1090. if hexa == False:
  1091. stat['desunix'] = stat['desunix'] + 1
  1092. return True
  1093. if hashes_l == 34:
  1094. if hashes[:3] == '$P$':
  1095. stat['md5wp'] = stat['md5wp'] + 1
  1096. return True
  1097. if hashes[:3] == '$H$':
  1098. stat['md5phpbb3'] = stat['md5phpbb3'] + 1
  1099. return True
  1100. else:
  1101. return False
  1102. else:
  1103. return False
  1104. def is_classic(hashes):
  1105. hashes_l = len(hashes)
  1106. hexa = is_hexa(hashes)
  1107. if hexa == True:
  1108. if len(hashes) == 16:
  1109. stat['lm'] = stat['lm'] + 1
  1110. stat['mysql3'] = stat['mysql3'] + 1
  1111. return True
  1112. else:
  1113. return False
  1114. elif hexa == False:
  1115. try:
  1116. check = str(hashes[:32]) + str(hashes[33:])
  1117. except:
  1118. return False
  1119. if len(check) == 64:
  1120. stat['pwdump'] = stat['pwdump'] + 1
  1121. return True
  1122. else:
  1123. return False
  1124. else:
  1125. return False
  1126. def type_md(hashes):
  1127. print "[>]" + 60 * "-"
  1128. print "[>] Hash : %s" % hashes
  1129. print "[>] Length : 32"
  1130. print "[>] Probable hash type : MD2, MD4, MD5, LM, NTLM"
  1131. print "[>] Recommended tool(s) : Oclhashcat, Hashcat, Jtr, PasswordsPro, BarsWF, Cain."
  1132. print "[>] You can use : /md5 %s" % hashes
  1133. print "[>] You can use : /ntlm %s" % hashes
  1134. def type_sha(hashes):
  1135. print "[>]" + 60 * "-"
  1136. print "[>] Hash : %s" % hashes
  1137. print "[>] Length : %s" % len(hashes)
  1138. if len(hashes) == 40:
  1139. print "[>] Probable hash type : SHA1, MySQL5"
  1140. print "[>] Recommanded tool(s) : Oclhashcat, Hashcat, Jtr, PasswordsPro, Cain."
  1141. print "[>] You can use : /sha1 %s" % hashes
  1142. if len(hashes) == 56:
  1143. print "[>] Probable hash type : SHA-224"
  1144. print "[>] Recommanded tool(s) : ?"
  1145. if len(hashes) == 64:
  1146. print "[>] Probable hash type : SHA-256"
  1147. print "[>] Recommanded tool(s) : Jtr, PasswordsPro, Hashcat"
  1148. if len(hashes) == 96:
  1149. print "[>] Probable hash type : SHA-384"
  1150. print "[>] Recommanded tool(s) : Jtr"
  1151. if len(hashes) == 128:
  1152. print "[>] Probable hash type : SHA-512, Whirlpool"
  1153. print "[>] Recommanded tool(s) : Jtr"
  1154. def type_unk(hashes):
  1155. print "[>]" + 60 * "-"
  1156. print "[>] Hash : %s" % hashes
  1157. print "[>] Length : %s" % len(hashes)
  1158. print "[>] Hexa : %s" % is_hexa(hashes)
  1159. print "[>] Probable hash type : ?"
  1160. print "[>] Recommanded tool(s) : ?"
  1161. def type_unix(hashes):
  1162. print "[>]" + 60 * "-"
  1163. print "[>] Hash : %s" % hashes
  1164. print "[>] Length : %s" % len(hashes)
  1165. print "[>] Salt : %s" % hashes[3:11]
  1166. print "[>] Salt length : %s" % len(hashes[3:11])
  1167. if hashes[:3] == '$1$':
  1168. print "[>] Probable hash type : md5(unix)"
  1169. print "[>] Recommanded tool(s) : Oclhashcat+, Hashcat, Jtr, PasswordsPro"
  1170. if hashes[:3] == '$5$':
  1171. print "[>] Probable hash type : sha256(unix)"
  1172. print "[>] Recommanded tool(s) : Jtr"
  1173. if hashes[:3] == '$6$':
  1174. print "[>] Probable hash type : sha512(unix)"
  1175. print "[>] Recommanded tool(s) : Jtr"
  1176. def type_salted(hashes):
  1177. print "[>]" + 60 * "-"
  1178. print "[>] Hash : %s" % hashes
  1179. print "[>] Length : %s" % len(hashes)
  1180. if len(hashes) == 13 and is_hexa(hashes) == False:
  1181. print "[>] Probable hash type : des(unix)"
  1182. print "[>] Recommanded tool(s) : PasswordsPro"
  1183. if len(hashes) == 34:
  1184. if hashes[:3] == '$P$':
  1185. print "[>] Probable hash type : PHPass, md5(wordpress)"
  1186. print "[>] Recommanded tool(s) : Hashcat, Jtr, PasswordsPro"
  1187. if hashes[:3] == '$H$':
  1188. print "[>] Probable hash type : md5(phpbb3)"
  1189. print "[>] Recommanded tool(s) : Hashcat, Jtr, PasswordsPro"
  1190. def type_classic(hashes):
  1191. print "[>]" + 60 * "-"
  1192. print "[>] Hash : %s" % hashes
  1193. print "[>] Length : %s" % len(hashes)
  1194. if len(hashes) == 16:
  1195. if is_hexa(hashes) == True:
  1196. print "[>] Probable hash type : Mysql3 (old_password), LM"
  1197. print "[>] Recommanded tool(s) : Oclhashcat, Hashcat, Jtr, PasswordsPro"
  1198. if len(hashes) == 65:
  1199. if hashes[32] == ':':
  1200. lmntlm = hashes.split(':')
  1201. print "[>] LM hash : %s" % lmntlm[0]
  1202. print "[>] NTLM hash : %s" % lmntlm[1]
  1203. print "[>] Probable hash type : Pwdump format, LM:NTLM"
  1204. print "[>] Recommanded tool(s) : Oclhashcat, Hashcat, Jtr, PasswordsPro"
  1205. ismd = is_md(hashes)
  1206. issha = is_sha(hashes)
  1207. isunix = is_unix(hashes)
  1208. issalted = is_salted(hashes)
  1209. isclassic = is_classic(hashes)
  1210. #print ismd, issha, isunix, issalted, isclassic ##Only for debug
  1211. #print stat ##Only for debug
  1212. if ismd == True and issha == False and isunix == False and issalted == False and isclassic == False:
  1213. type_md(hashes)
  1214. if ismd == False and issha == True and isunix == False and issalted == False and isclassic == False:
  1215. type_sha(hashes)
  1216. if ismd == False and issha == False and isunix == True and issalted == False and isclassic == False:
  1217. type_unix(hashes)
  1218. if ismd == False and issha == False and isunix == False and issalted == True and isclassic == False:
  1219. type_salted(hashes)
  1220. if ismd == False and issha == False and isunix == False and issalted == False and isclassic == True:
  1221. type_classic(hashes)
  1222. if ismd == False and issha == False and isunix == False and issalted == False and isclassic == False:
  1223. type_unk(hashes)
  1224. else:
  1225. print "[>]" + 60 * "-"
  1226. print "[>] Man page : /whatis"
  1227. print "[>] Syntax informations : /whatis <hash>"
  1228. print "[>] Hash types identification"
  1229. print "[>] <hash> Remplace by your unknow hash"
  1230. return xchat.EAT_XCHAT
  1231. def calculator(word, word_eol, userdata):
  1232. Thread(None, calculator_run, None, (word, word_eol, userdata), {}).start()
  1233. return xchat.EAT_XCHAT
  1234. def calculator_run(word, word_eol, userdata):
  1235. list_type = ['md5', 'md2', 'md4', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'ntlm', 'md5(unix)',
  1236. 'sha256(unix)', 'sha512(unix)', 'crc32', 'crc32b', 'lm', 'mysql3', 'mysql5', 'haval256',
  1237. 'haval224', 'haval192', 'haval160', 'haval128', 'tiger160', 'tiger128', 'tiger',
  1238. 'ripemd320', 'ripemd256', 'ripemd160', 'ripemd128', 'whirlpool', 'ghost', 'snefru256',
  1239. 'snefru128', 'md5(wordpress)', 'md5(pass.salt)', 'md5(salt.pass)', 'md2(pass.salt)', 'md2(salt.past)',
  1240. 'md4(pass.salt)', 'md4(salt.pass)', 'sha1(pass.salt)', 'sha1(salt.pass)', 'sha224(pass.salt)',
  1241. 'sha224(salt.pass)', 'sha256(pass.salt)', 'sha256(salt.pass)', 'sha384(pass.salt)', 'sha384(salt.pass)',
  1242. 'sha512(pass.salt)', 'sha512(salt.pass)',]
  1243. salt_list = ['md5(pass.salt)', 'md5(salt.pass)', 'md2(pass.salt)', 'md2(salt.pass)', 'md4(pass.salt)', 'md4(salt.pass)',
  1244. 'sha1(pass.salt)', 'sha1(salt.pass)', 'sha224(pass.salt)', 'sha224(salt.pass)', 'sha256(pass.salt)',
  1245. 'sha256(salt.pass)', 'sha384(pass.salt)', 'sha384(salt.pass)', 'sha512(pass.salt)', 'sha512(salt.pass)',
  1246. ]
  1247. if len(word) > 2:
  1248. password = word[2]
  1249. type_h = word[1]
  1250. if len(word) >= 4:
  1251. if type_h in salt_list:
  1252. if len(word) == 4:
  1253. salt = word[3]
  1254. ite = 1
  1255. isint = True
  1256. elif len(word) == 5:
  1257. salt = word[3]
  1258. ite = word[4]
  1259. else:
  1260. try: ite = word[3]
  1261. except:
  1262. ite = 1
  1263. isint = True
  1264. if len(word) == 3:
  1265. try:
  1266. ite = word[3]
  1267. except:
  1268. ite = 1
  1269. isint = True
  1270. if ite != 1:
  1271. try:
  1272. ite = int(ite)
  1273. isint = True
  1274. except:
  1275. isint = False
  1276. if type_h in list_type and isint == True:
  1277. if type_h == 'lm':
  1278. data = password
  1279. for x in xrange(ite):
  1280. data = HashMaker.lm(data)
  1281. if type_h == 'mysql5':
  1282. data = password
  1283. for x in xrange(ite):
  1284. data = HashMaker.mysql5(data)
  1285. if type_h == 'mysql3':
  1286. data = password
  1287. for x in xrange(ite):
  1288. data = HashMaker.mysql3(data)
  1289. if type_h == 'whirlpool':
  1290. data = password
  1291. for x in xrange(ite):
  1292. data = HashMaker.whirlpool(data)
  1293. if type_h == 'ghost':
  1294. data = password
  1295. for x in xrange(ite):
  1296. data = HashMaker.ghost(data)
  1297. if type_h == 'snefru256':
  1298. data = password
  1299. for x in xrange(ite):
  1300. data = HashMaker.snefru256(data)
  1301. if type_h == 'snefru128':
  1302. data = password
  1303. for x in xrange(ite):
  1304. data = HashMaker.snefru128(data)
  1305. if type_h == 'crc32b':
  1306. data = password
  1307. for x in xrange(ite):
  1308. data = HashMaker.crc32b(data)
  1309. if type_h == 'crc32':
  1310. data = password
  1311. for x in xrange(ite):
  1312. data = HashMaker.crc32(data)
  1313. if type_h == 'haval256':
  1314. data = password
  1315. for x in xrange(ite):
  1316. data = HashMaker.haval256(data)
  1317. if type_h == 'haval224':
  1318. data = password
  1319. for x in xrange(ite):
  1320. data = HashMaker.haval224(data)
  1321. if type_h == 'haval192':
  1322. data = password
  1323. for x in xrange(ite):
  1324. data = HashMaker.haval192(data)
  1325. if type_h == 'haval160':
  1326. data = password
  1327. for x in xrange(ite):
  1328. data = HashMaker.haval160(data)
  1329. if type_h == 'haval128':
  1330. data = password
  1331. for x in xrange(ite):
  1332. data = HashMaker.haval128(data)
  1333. if type_h == 'tiger160':
  1334. data = password
  1335. for x in xrange(ite):
  1336. data = HashMaker.tiger160(data)
  1337. if type_h == 'tiger128':
  1338. data = password
  1339. for x in xrange(ite):
  1340. data = HashMaker.tiger128(data)
  1341. if type_h == 'tiger':
  1342. data = password
  1343. for x in xrange(ite):
  1344. data = HashMaker.tiger(data)
  1345. if type_h == 'ripemd320':
  1346. data = password
  1347. for x in xrange(ite):
  1348. data = HashMaker.ripemd320(data)
  1349. if type_h == 'ripemd256':
  1350. data = password
  1351. for x in xrange(ite):
  1352. data = HashMaker.ripemd256(data)
  1353. if type_h == 'ripemd160':
  1354. data = password
  1355. for x in xrange(ite):
  1356. data = HashMaker.ripemd160(data)
  1357. if type_h == 'ripemd128':
  1358. data = password
  1359. for x in xrange(ite):
  1360. data = HashMaker.ripemd128(data)
  1361. if type_h == 'md4':
  1362. data = password
  1363. for x in xrange(ite):
  1364. data = HashMaker.md4(data)
  1365. if type_h == 'md2':
  1366. data = password
  1367. for x in xrange(ite):
  1368. data = HashMaker.md2(data)
  1369. if type_h == 'sha512':
  1370. data = password
  1371. for x in xrange(ite):
  1372. data = HashMaker.sha512(data)
  1373. if type_h == 'sha384':
  1374. data = password
  1375. for x in xrange(ite):
  1376. data = HashMaker.sha384(data)
  1377. if type_h == 'sha256':
  1378. data = password
  1379. for x in xrange(ite):
  1380. data = HashMaker.sha256(data)
  1381. if type_h == 'sha224':
  1382. data = password
  1383. for x in xrange(ite):
  1384. data = HashMaker.sha224(data)
  1385. if type_h == 'sha1':
  1386. data = password
  1387. for x in xrange(ite):
  1388. data = HashMaker.sha1(data)
  1389. if type_h == 'md5':
  1390. data = password
  1391. for x in xrange(ite):
  1392. data = HashMaker.md5(data)
  1393. if type_h == 'md5(unix)':
  1394. data = password
  1395. for x in xrange(ite):
  1396. salt = '$1$'
  1397. chain = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
  1398. for x in xrange(8):
  1399. a = random.randint(1,62)
  1400. salt = salt + chain[a-1]
  1401. salt = salt + '$'
  1402. data = crypt.crypt(data, salt)
  1403. if type_h == 'sha256(unix)':
  1404. data = password
  1405. for x in xrange(ite):
  1406. salt = '$5$'
  1407. chain = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
  1408. for x in xrange(8):
  1409. a = random.randint(1,62)
  1410. salt = salt + chain[a-1]
  1411. salt = salt + '$'
  1412. data = crypt.crypt(data, salt)
  1413. if type_h == 'sha512(unix)':
  1414. data = password
  1415. for x in xrange(ite):
  1416. salt = '$6$'
  1417. chain = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
  1418. for x in xrange(8):
  1419. a = random.randint(1,62)
  1420. salt = salt + chain[a-1]
  1421. salt = salt + '$'
  1422. data = crypt.crypt(data, salt)
  1423. if type_h == 'md5(wordpress)':
  1424. t_hasher = phpass.PasswordHash(8, False)
  1425. data = password
  1426. for x in xrange(ite):
  1427. data = t_hasher.hash_password(data)
  1428. if type_h == 'md5(pass.salt)':
  1429. data = password
  1430. data = data + salt
  1431. for x in xrange(ite):
  1432. data = HashMaker.md5(data)
  1433. print data
  1434. if type_h == 'md5(salt.pass)':
  1435. data = password
  1436. date = salt+data
  1437. for x in xrange(ite):
  1438. data = HashMaker.md5(data)
  1439. if type_h == 'md2(pass.salt)':
  1440. data = password
  1441. data = data + salt
  1442. for x in xrange(ite):
  1443. data = HashMaker.md2(data)
  1444. if type_h == 'md2(salt.pass)':
  1445. data = password
  1446. date = salt+data
  1447. for x in xrange(ite):
  1448. data = HashMaker.md2(data)
  1449. if type_h == 'md4(pass.salt)':
  1450. data = password
  1451. data = data + salt
  1452. for x in xrange(ite):
  1453. data = HashMaker.md4(data)
  1454. if type_h == 'md4(salt.pass)':
  1455. data = password
  1456. date = salt+data
  1457. for x in xrange(ite):
  1458. data = HashMaker.md4(data)
  1459. if type_h == 'sha1(pass.salt)':
  1460. data = password
  1461. data = data + salt
  1462. for x in xrange(ite):
  1463. data = HashMaker.sha1(data)
  1464. if type_h == 'sha1(salt.pass)':
  1465. data = password
  1466. date = salt+data
  1467. for x in xrange(ite):
  1468. data = HashMaker.sha1(data)
  1469. if type_h == 'sha224(pass.salt)':
  1470. data = password
  1471. data = data + salt
  1472. for x in xrange(ite):
  1473. data = HashMaker.sha224(data)
  1474. if type_h == 'sha224(salt.pass)':
  1475. data = password
  1476. date = salt+data
  1477. for x in xrange(ite):
  1478. data = HashMaker.sha224(data)
  1479. if type_h == 'sha256(pass.salt)':
  1480. data = password
  1481. data = data + salt
  1482. for x in xrange(ite):
  1483. data = HashMaker.sha256(data)
  1484. if type_h == 'sha256(salt.pass)':
  1485. data = password
  1486. date = salt+data
  1487. for x in xrange(ite):
  1488. data = HashMaker.sha256(data)
  1489. if type_h == 'sha384(pass.salt)':
  1490. data = password
  1491. data = data + salt
  1492. for x in xrange(ite):
  1493. data = HashMaker.sha384(data)
  1494. if type_h == 'sha384(salt.pass)':
  1495. data = password
  1496. date = salt+data
  1497. for x in xrange(ite):
  1498. data = HashMaker.sha384(data)
  1499. if type_h == 'sha512(pass.salt)':
  1500. data = password
  1501. data = data + salt
  1502. for x in xrange(ite):
  1503. data = HashMaker.sha512(data)
  1504. if type_h == 'sha512(salt.pass)':
  1505. data = password
  1506. date = salt+data
  1507. for x in xrange(ite):
  1508. data = HashMaker.sha512(data)
  1509. if type_h == 'ntlm':
  1510. data = password
  1511. for x in xrange(ite):
  1512. data = hashlib.new('md4', data.encode('utf-16le')).hexdigest()
  1513. print "[>]" + 60 * "-"
  1514. print "[>] String : %s" % password
  1515. if type_h in salt_list:
  1516. print "[>] Salt : %s" % salt
  1517. print "[>] Type : %s" % type_h
  1518. print "[>] Round(s) : %s" % ite
  1519. print "[>] Hash : %s" % data
  1520. elif isint == True:
  1521. print "[>]" + 60 * "-"
  1522. print "[>] \0034Syntax error, unknow hash type\0034 %s" % type_h
  1523. print "[>] Complet information here : /hash"
  1524. else:
  1525. print "[>]" + 60 * "-"
  1526. print "[>] \0034Syntax error, unknow round value\0034 %s" % ite
  1527. print "[>] Complet information here : /hash"
  1528. else:
  1529. print "[>]" + 60 * "-"
  1530. print "[>] Man page : /hash"
  1531. print "[>] Syntax informations : /hash <type> <string> <n°ite>"
  1532. print "[>] To calculate hash"
  1533. print "[>] <type> : anyone in the Type list"
  1534. print "[>] <string> : Type your chain here"
  1535. print "[>] <n°ite> : Round numbers"
  1536. print "[>] : ie: (simple md5 aka md5() ) /hash md5 my_password"
  1537. print "[>] : (triple md5 aka md5(md5(md5))) ) /hash md5 my_password 3"
  1538. print "[>] Type list :"
  1539. print "[>] crc32, crc32b, ghost, haval128, haval160, haval192, haval224,"
  1540. print "[>] haval256, lm,md2, md4, md5, md5(unix), ntlm, mysql3, mysql5,"
  1541. print "[>] ripemd128, ripemd160, ripemd256,ripemd320, sha1, sha224,"
  1542. print "[>] sha256, sha256(unix), sha384, sha512, sha512(unix), snefru128,"
  1543. print "[>] snefru256, tiger, tiger128, tiger160, whirlpool, md5(wordpress)"
  1544. print "[>] md5(pass.salt), md5(salt.pass), md4(pass.salt), md4(salt.pass),"
  1545. print "[>] md2(pass.salt), md2(salt.pass),'sha1(pass.salt)', 'sha1(salt.pass)',"
  1546. print "[>] 'sha224(pass.salt)', 'sha224(salt.pass)', 'sha256(pass.salt)',"
  1547. print "[>] 'sha256(salt.pass)', 'sha384(pass.salt)', 'sha384(salt.pass)',"
  1548. print "[>] 'sha512(pass.salt)', 'sha512(salt.pass)'"
  1549. return xchat.EAT_XCHAT
  1550. print "[>] CrackMe Plugin Version %s loaded" % __module_version__
  1551. xchat.hook_command("crackme", crackme, help="/crackme : General informations on CrackMe Xchat2 plugin")
  1552. xchat.hook_command("md5", md5, help="/md5 <hash> : Submit MD5 hash on public DBs")
  1553. xchat.hook_command("ntlm", ntlm, help="/ntlm <hash> : Submit NTLM hash on public DBs")
  1554. xchat.hook_command("lm", pwdump, help="/lm <hash> : Submit LM hash on public DBs")
  1555. xchat.hook_command("pwdump", pwdump, help="/pwdump <hash> : Submit LM & NTLM hashes on public DBs")
  1556. xchat.hook_command("sha1", sha1, help="/sha1 <hash> : Submit SHA-1 hash on public DBs")
  1557. xchat.hook_command("whatis", whatis, help="/whatis <hash> : Statistical hashes identifier")
  1558. xchat.hook_command("len", length, help="/len <string> : Chain length")
  1559. xchat.hook_command("hash", calculator, help="/hash <type> <string> : Hash calculator, type /hash for more info")
  1560. xchat.hook_command("password", password, help="/password <charset> <length> : Random password generator, type /password for more info")
  1561. xchat.hook_command("b64", edbase64, help="/b64 <param> <string> : Encoder/Decoder Base64")
  1562. xchat.hook_command("rot13", rot13, help="/rot13 <param> <string> : Encoder/Decoder ROT13")
  1563. xchat.hook_command("import", import_data, help="/import <site> <link> : Import hashlist from pastebin website, type /import for more info")
  1564. xchat.hook_command("export", export_data, help="/export <site> <link> : Export hashlist from pastebin website, type /export for more info")
  1565. xchat.hook_command("hashlist", hashlist, help="/hashlist : Hashlists manager")
  1566. xchat.hook_command("harvester", harvester, help="/harvester : Harvester mode, type /harvester for more informations")

comments powered by Disqus