baptx

2letters_domains_available

Aug 16th, 2015
264
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var https = require("https");
  2. var fs = require("fs");
  3. var ws = fs.createWriteStream("2letters_domains_available.txt");
  4.  
  5. var domain = "aa.lc"; // format: aa.tld
  6. var numbers = false; // include numbers
  7.  
  8. function apiParse(body)
  9. {
  10.     var status = JSON.parse(body)[0].available;
  11.     if (status == "pending")
  12.         apiRequest();
  13.     else
  14.     {
  15.         console.log(domain + ": " + status);
  16.         if (status == "available")
  17.             ws.write(domain + "\n");
  18.         var ascii = domain.charCodeAt(1);
  19.         if (ascii > 96 && ascii < 122) // > 'a' - 1 && < 'z' character
  20.             domain = domain.substring(0, 1) + String.fromCharCode(ascii + 1) + domain.substring(2);
  21.         else if (numbers && (ascii == 122 || ascii < 57)) // < '9' character
  22.         {
  23.             if (ascii == 122)
  24.                 ascii = 47; // '0' character - 1
  25.             domain = domain.substring(0, 1) + String.fromCharCode(ascii + 1) + domain.substring(2);
  26.         }
  27.         else if ((ascii = domain.charCodeAt(0)) > 96 && ascii < 122)
  28.         {
  29.             domain = domain.substring(0, 1) + 'a' + domain.substring(2);
  30.             domain = String.fromCharCode(ascii + 1) + domain.substring(1);
  31.         }
  32.         else if (numbers && (ascii == 122 || ascii < 57))
  33.         {
  34.             if (ascii == 122)
  35.                 ascii = 47;
  36.             domain = domain.substring(0, 1) + 'a' + domain.substring(2);
  37.             domain = String.fromCharCode(ascii + 1) + domain.substring(1);
  38.         }
  39.         else
  40.         {
  41.             ws.end();
  42.             return;
  43.         }
  44.         apiRequest();
  45.     }
  46. }
  47.  
  48. function apiResponse(res)
  49. {
  50.     var body = "";
  51.     res.on("data", function(d) {
  52.         body += d;
  53.     });
  54.     res.on("end", function() {
  55.         apiParse(body);
  56.     });
  57. }
  58.  
  59. function apiRequest()
  60. {
  61.     console.log("checking " + domain);
  62.     https.get("https://www.gandi.net/domain/suggest/verbose_tlds?currency=EUR&tld=" + domain, apiResponse);
  63. }
  64.  
  65. apiRequest();
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×