Guest User

Untitled

a guest
Jul 6th, 2012
406
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================
  2. // Predicting domains for the attack described here:
  3. // http://blog.unmaskparasites.com/2012/06/22/runforestrun-and-pseudo-random-domains/
  4. // This code assume that your JS environment supports the "print()" function for output
  5. //=============================================
  6.  
  7. function nextRandomNumber(){
  8.     var hi = this.seed / this.Q;
  9.     var lo = this.seed % this.Q;
  10.     var test = this.A * lo - this.R * hi;
  11.     if(test > 0){
  12.         this.seed = test;
  13.     }
  14.     else {
  15.         this.seed = test + this.M;
  16.     }
  17.     return (this.seed * this.oneOverM);
  18. }
  19.  
  20. function RandomNumberGenerator(unix){
  21.     var d = new Date(unix*1000);
  22.     var s = d.getHours() > 12 ? 1 : 0;
  23.     this.seed = 2345678901 + (d.getMonth() * 0xFFFFFF) + (d.getDate() * 0xFFFF)+ (Math.round(s * 0xFFF));
  24.     this.A = 48271;
  25.     this.M = 2147483647;
  26.     this.Q = this.M / this.A;
  27.     this.R = this.M % this.A;
  28.     this.oneOverM = 1.0 / this.M;
  29.     this.next = nextRandomNumber;
  30.     return this;
  31. }
  32.  
  33. function createRandomNumber(r, Min, Max){
  34.     return Math.round((Max-Min) * r.next() + Min);
  35. }
  36.  
  37. function generatePseudoRandomString(unix, length, zone){
  38.     var rand = new RandomNumberGenerator(unix);
  39.     var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
  40.     var str = '';
  41.     for(var i = 0; i < length; i ++ ){
  42.         str += letters[createRandomNumber(rand, 0, letters.length - 1)];
  43.     }
  44.     return str + '.' + zone;
  45. }
  46.  
  47. var dt = new Date(2012, 6, 1, 1, 0, 0, 0); // July 1, 2012
  48. var out = '';
  49. var numberOfDays = 100
  50. for (i=0; i<numberOfDays*2; i++) {
  51.     dt.setTime(dt.getTime() + (12*60*60*1000));
  52.     var unix = Math.round(+dt/1000);
  53.     var domainName = generatePseudoRandomString(unix, 16, 'ru');
  54.     out = domainName+"    // " + dt.toString();
  55.     print(out);
  56. }
RAW Paste Data