axlmcc

0x0ACE d34dc0d3 Solver

Mar 17th, 2017
1,465
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         0x0ACE d34dc0d3 solver
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to solve the code at http://5.9.247.121/d34dc0d3
  6. // @author       /u/axlc
  7. // @match        http://5.9.247.121/d34dc0d3
  8. // @grant        none
  9. // @require      http://code.jquery.com/jquery-3.2.0.min.js
  10. // @require      http://cdnjs.cloudflare.com/ajax/libs/mathjs/3.10.0/math.min.js
  11. // ==/UserScript==
  12.  
  13.  
  14. var nums = $('.challenge').text();
  15. var textArray = nums.split(',');
  16. var lower = parseInt(textArray[0].substring(2));
  17. var upper = parseInt(textArray[2].substring(0, textArray[2].length - 1));
  18.  
  19. var primes = new Array();
  20.  
  21. for (var i = lower + 2; i < upper - 2; i+=2) {
  22.     if (math.isPrime(i)) {
  23.         primes.push(i);
  24.     }
  25. }
  26.  
  27. //$('body').append("<br><br><pre>Primes: " + primes + "</pre>");
  28.  
  29. $('input[name=solution]').val(primes);
  30. $('input[type=submit]').click();
RAW Paste Data