Emdee five for life

use for hack the box challenge [Emdee five for life](https://app.hackthebox.eu/challenges/Emdee-five-for-life)

目前为 2021-04-23 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Emdee five for life
  3. // @namespace XenoAmess
  4. // @version 0
  5. // @description use for hack the box challenge [Emdee five for life](https://app.hackthebox.eu/challenges/Emdee-five-for-life)
  6. // @author XenoAmess
  7. // @match http://*
  8. // @run-at document-end
  9. // @grant none
  10. // @supportURL https://github.com/XenoAmess/
  11. // ==/UserScript==
  12.  
  13. var REFRESH_TIME = 10;
  14. var success = false;
  15. var submitted = false;
  16. var intervalId;
  17.  
  18. function xenoamess() {
  19. if (!success && !submitted && (typeof $ !== 'undefined')) {
  20. var p = $("p");
  21. if (p && p.text() && p.text() !== "" && p.text() !== "Too slow!") {
  22. success = true;
  23. return;
  24. }
  25. var rawText = $("h3").text();
  26. console.log(rawText);
  27. var md5 = hexMD5(rawText);
  28. console.log(md5);
  29. var input = $("input:nth-child(1)");
  30. input.val(md5);
  31. $("form").submit();
  32. submitted = true;
  33. } else if (success) {
  34. window.clearInterval(intervalId);
  35. }
  36. }
  37.  
  38. (function () {
  39. 'use strict';
  40. if (!window.jQuery) {
  41. var oScript = document.createElement('script');
  42. oScript.type = "text/javascript";
  43. oScript.src = "//s1.hdslb.com/bfs/static/jinkela/long/js/jquery/jquery1.7.2.min.js";
  44. document.head.appendChild(oScript);
  45. }
  46. window.onload = function (ev) {
  47. intervalId = window.setInterval(xenoamess, REFRESH_TIME);
  48. }
  49. })();
  50.  
  51. /*
  52. * Codes down this line is a MD5 library, from https://github.com/blueimp/JavaScript-MD5
  53. * Thanks you, Sebastian Tschan.
  54. * --------------------
  55. */
  56.  
  57. /*
  58. * JavaScript MD5
  59. * https://github.com/blueimp/JavaScript-MD5
  60. *
  61. * Copyright 2011, Sebastian Tschan
  62. * https://blueimp.net
  63. *
  64. * Licensed under the MIT license:
  65. * https://opensource.org/licenses/MIT
  66. *
  67. * Based on
  68. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  69. * Digest Algorithm, as defined in RFC 1321.
  70. * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
  71. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  72. * Distributed under the BSD License
  73. * See http://pajhome.org.uk/crypt/md5 for more info.
  74. */
  75.  
  76. /* global define */
  77.  
  78. /* eslint-disable strict */
  79.  
  80. /**
  81. * Add integers, wrapping at 2^32.
  82. * This uses 16-bit operations internally to work around bugs in interpreters.
  83. *
  84. * @param {number} x First integer
  85. * @param {number} y Second integer
  86. * @returns {number} Sum
  87. */
  88. function safeAdd(x, y) {
  89. var lsw = (x & 0xffff) + (y & 0xffff)
  90. var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
  91. return (msw << 16) | (lsw & 0xffff)
  92. }
  93.  
  94. /**
  95. * Bitwise rotate a 32-bit number to the left.
  96. *
  97. * @param {number} num 32-bit number
  98. * @param {number} cnt Rotation count
  99. * @returns {number} Rotated number
  100. */
  101. function bitRotateLeft(num, cnt) {
  102. return (num << cnt) | (num >>> (32 - cnt))
  103. }
  104.  
  105. /**
  106. * Basic operation the algorithm uses.
  107. *
  108. * @param {number} q q
  109. * @param {number} a a
  110. * @param {number} b b
  111. * @param {number} x x
  112. * @param {number} s s
  113. * @param {number} t t
  114. * @returns {number} Result
  115. */
  116. function md5cmn(q, a, b, x, s, t) {
  117. return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)
  118. }
  119.  
  120. /**
  121. * Basic operation the algorithm uses.
  122. *
  123. * @param {number} a a
  124. * @param {number} b b
  125. * @param {number} c c
  126. * @param {number} d d
  127. * @param {number} x x
  128. * @param {number} s s
  129. * @param {number} t t
  130. * @returns {number} Result
  131. */
  132. function md5ff(a, b, c, d, x, s, t) {
  133. return md5cmn((b & c) | (~b & d), a, b, x, s, t)
  134. }
  135.  
  136. /**
  137. * Basic operation the algorithm uses.
  138. *
  139. * @param {number} a a
  140. * @param {number} b b
  141. * @param {number} c c
  142. * @param {number} d d
  143. * @param {number} x x
  144. * @param {number} s s
  145. * @param {number} t t
  146. * @returns {number} Result
  147. */
  148. function md5gg(a, b, c, d, x, s, t) {
  149. return md5cmn((b & d) | (c & ~d), a, b, x, s, t)
  150. }
  151.  
  152. /**
  153. * Basic operation the algorithm uses.
  154. *
  155. * @param {number} a a
  156. * @param {number} b b
  157. * @param {number} c c
  158. * @param {number} d d
  159. * @param {number} x x
  160. * @param {number} s s
  161. * @param {number} t t
  162. * @returns {number} Result
  163. */
  164. function md5hh(a, b, c, d, x, s, t) {
  165. return md5cmn(b ^ c ^ d, a, b, x, s, t)
  166. }
  167.  
  168. /**
  169. * Basic operation the algorithm uses.
  170. *
  171. * @param {number} a a
  172. * @param {number} b b
  173. * @param {number} c c
  174. * @param {number} d d
  175. * @param {number} x x
  176. * @param {number} s s
  177. * @param {number} t t
  178. * @returns {number} Result
  179. */
  180. function md5ii(a, b, c, d, x, s, t) {
  181. return md5cmn(c ^ (b | ~d), a, b, x, s, t)
  182. }
  183.  
  184. /**
  185. * Calculate the MD5 of an array of little-endian words, and a bit length.
  186. *
  187. * @param {Array} x Array of little-endian words
  188. * @param {number} len Bit length
  189. * @returns {Array<number>} MD5 Array
  190. */
  191. function binlMD5(x, len) {
  192. /* append padding */
  193. x[len >> 5] |= 0x80 << len % 32
  194. x[(((len + 64) >>> 9) << 4) + 14] = len
  195.  
  196. var i
  197. var olda
  198. var oldb
  199. var oldc
  200. var oldd
  201. var a = 1732584193
  202. var b = -271733879
  203. var c = -1732584194
  204. var d = 271733878
  205.  
  206. for (i = 0; i < x.length; i += 16) {
  207. olda = a
  208. oldb = b
  209. oldc = c
  210. oldd = d
  211.  
  212. a = md5ff(a, b, c, d, x[i], 7, -680876936)
  213. d = md5ff(d, a, b, c, x[i + 1], 12, -389564586)
  214. c = md5ff(c, d, a, b, x[i + 2], 17, 606105819)
  215. b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330)
  216. a = md5ff(a, b, c, d, x[i + 4], 7, -176418897)
  217. d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426)
  218. c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341)
  219. b = md5ff(b, c, d, a, x[i + 7], 22, -45705983)
  220. a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416)
  221. d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417)
  222. c = md5ff(c, d, a, b, x[i + 10], 17, -42063)
  223. b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162)
  224. a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682)
  225. d = md5ff(d, a, b, c, x[i + 13], 12, -40341101)
  226. c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290)
  227. b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329)
  228.  
  229. a = md5gg(a, b, c, d, x[i + 1], 5, -165796510)
  230. d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632)
  231. c = md5gg(c, d, a, b, x[i + 11], 14, 643717713)
  232. b = md5gg(b, c, d, a, x[i], 20, -373897302)
  233. a = md5gg(a, b, c, d, x[i + 5], 5, -701558691)
  234. d = md5gg(d, a, b, c, x[i + 10], 9, 38016083)
  235. c = md5gg(c, d, a, b, x[i + 15], 14, -660478335)
  236. b = md5gg(b, c, d, a, x[i + 4], 20, -405537848)
  237. a = md5gg(a, b, c, d, x[i + 9], 5, 568446438)
  238. d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690)
  239. c = md5gg(c, d, a, b, x[i + 3], 14, -187363961)
  240. b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501)
  241. a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467)
  242. d = md5gg(d, a, b, c, x[i + 2], 9, -51403784)
  243. c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473)
  244. b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734)
  245.  
  246. a = md5hh(a, b, c, d, x[i + 5], 4, -378558)
  247. d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463)
  248. c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562)
  249. b = md5hh(b, c, d, a, x[i + 14], 23, -35309556)
  250. a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060)
  251. d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353)
  252. c = md5hh(c, d, a, b, x[i + 7], 16, -155497632)
  253. b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640)
  254. a = md5hh(a, b, c, d, x[i + 13], 4, 681279174)
  255. d = md5hh(d, a, b, c, x[i], 11, -358537222)
  256. c = md5hh(c, d, a, b, x[i + 3], 16, -722521979)
  257. b = md5hh(b, c, d, a, x[i + 6], 23, 76029189)
  258. a = md5hh(a, b, c, d, x[i + 9], 4, -640364487)
  259. d = md5hh(d, a, b, c, x[i + 12], 11, -421815835)
  260. c = md5hh(c, d, a, b, x[i + 15], 16, 530742520)
  261. b = md5hh(b, c, d, a, x[i + 2], 23, -995338651)
  262.  
  263. a = md5ii(a, b, c, d, x[i], 6, -198630844)
  264. d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415)
  265. c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905)
  266. b = md5ii(b, c, d, a, x[i + 5], 21, -57434055)
  267. a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571)
  268. d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606)
  269. c = md5ii(c, d, a, b, x[i + 10], 15, -1051523)
  270. b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799)
  271. a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359)
  272. d = md5ii(d, a, b, c, x[i + 15], 10, -30611744)
  273. c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380)
  274. b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649)
  275. a = md5ii(a, b, c, d, x[i + 4], 6, -145523070)
  276. d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379)
  277. c = md5ii(c, d, a, b, x[i + 2], 15, 718787259)
  278. b = md5ii(b, c, d, a, x[i + 9], 21, -343485551)
  279.  
  280. a = safeAdd(a, olda)
  281. b = safeAdd(b, oldb)
  282. c = safeAdd(c, oldc)
  283. d = safeAdd(d, oldd)
  284. }
  285. return [a, b, c, d]
  286. }
  287.  
  288. /**
  289. * Convert an array of little-endian words to a string
  290. *
  291. * @param {Array<number>} input MD5 Array
  292. * @returns {string} MD5 string
  293. */
  294. function binl2rstr(input) {
  295. var i
  296. var output = ''
  297. var length32 = input.length * 32
  298. for (i = 0; i < length32; i += 8) {
  299. output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff)
  300. }
  301. return output
  302. }
  303.  
  304. /**
  305. * Convert a raw string to an array of little-endian words
  306. * Characters >255 have their high-byte silently ignored.
  307. *
  308. * @param {string} input Raw input string
  309. * @returns {Array<number>} Array of little-endian words
  310. */
  311. function rstr2binl(input) {
  312. var i
  313. var output = []
  314. output[(input.length >> 2) - 1] = undefined
  315. for (i = 0; i < output.length; i += 1) {
  316. output[i] = 0
  317. }
  318. var length8 = input.length * 8
  319. for (i = 0; i < length8; i += 8) {
  320. output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32
  321. }
  322. return output
  323. }
  324.  
  325. /**
  326. * Calculate the MD5 of a raw string
  327. *
  328. * @param {string} s Input string
  329. * @returns {string} Raw MD5 string
  330. */
  331. function rstrMD5(s) {
  332. return binl2rstr(binlMD5(rstr2binl(s), s.length * 8))
  333. }
  334.  
  335. /**
  336. * Calculates the HMAC-MD5 of a key and some data (raw strings)
  337. *
  338. * @param {string} key HMAC key
  339. * @param {string} data Raw input string
  340. * @returns {string} Raw MD5 string
  341. */
  342. function rstrHMACMD5(key, data) {
  343. var i
  344. var bkey = rstr2binl(key)
  345. var ipad = []
  346. var opad = []
  347. var hash
  348. ipad[15] = opad[15] = undefined
  349. if (bkey.length > 16) {
  350. bkey = binlMD5(bkey, key.length * 8)
  351. }
  352. for (i = 0; i < 16; i += 1) {
  353. ipad[i] = bkey[i] ^ 0x36363636
  354. opad[i] = bkey[i] ^ 0x5c5c5c5c
  355. }
  356. hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8)
  357. return binl2rstr(binlMD5(opad.concat(hash), 512 + 128))
  358. }
  359.  
  360. /**
  361. * Convert a raw string to a hex string
  362. *
  363. * @param {string} input Raw input string
  364. * @returns {string} Hex encoded string
  365. */
  366. function rstr2hex(input) {
  367. var hexTab = '0123456789abcdef'
  368. var output = ''
  369. var x
  370. var i
  371. for (i = 0; i < input.length; i += 1) {
  372. x = input.charCodeAt(i)
  373. output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)
  374. }
  375. return output
  376. }
  377.  
  378. /**
  379. * Encode a string as UTF-8
  380. *
  381. * @param {string} input Input string
  382. * @returns {string} UTF8 string
  383. */
  384. function str2rstrUTF8(input) {
  385. return unescape(encodeURIComponent(input))
  386. }
  387.  
  388. /**
  389. * Encodes input string as raw MD5 string
  390. *
  391. * @param {string} s Input string
  392. * @returns {string} Raw MD5 string
  393. */
  394. function rawMD5(s) {
  395. return rstrMD5(str2rstrUTF8(s))
  396. }
  397.  
  398. /**
  399. * Encodes input string as Hex encoded string
  400. *
  401. * @param {string} s Input string
  402. * @returns {string} Hex encoded string
  403. */
  404. function hexMD5(s) {
  405. return rstr2hex(rawMD5(s))
  406. }
  407.  
  408. /**
  409. * Calculates the raw HMAC-MD5 for the given key and data
  410. *
  411. * @param {string} k HMAC key
  412. * @param {string} d Input string
  413. * @returns {string} Raw MD5 string
  414. */
  415. function rawHMACMD5(k, d) {
  416. return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d))
  417. }
  418.  
  419. /**
  420. * Calculates the Hex encoded HMAC-MD5 for the given key and data
  421. *
  422. * @param {string} k HMAC key
  423. * @param {string} d Input string
  424. * @returns {string} Raw MD5 string
  425. */
  426. function hexHMACMD5(k, d) {
  427. return rstr2hex(rawHMACMD5(k, d))
  428. }
  429.  
  430. /**
  431. * Calculates MD5 value for a given string.
  432. * If a key is provided, calculates the HMAC-MD5 value.
  433. * Returns a Hex encoded string unless the raw argument is given.
  434. *
  435. * @param {string} string Input string
  436. * @param {string} [key] HMAC key
  437. * @param {boolean} [raw] Raw output switch
  438. * @returns {string} MD5 output
  439. */
  440. function md5(string, key, raw) {
  441. if (!key) {
  442. if (!raw) {
  443. return hexMD5(string)
  444. }
  445. return rawMD5(string)
  446. }
  447. if (!raw) {
  448. return hexHMACMD5(key, string)
  449. }
  450. return rawHMACMD5(key, string)
  451. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址