Skip to content

Instantly share code, notes, and snippets.

@lifeofcoding
Last active September 7, 2024 03:20
Show Gist options
  • Save lifeofcoding/9a1ad7b01005465bd57a691852f5eb7b to your computer and use it in GitHub Desktop.
Save lifeofcoding/9a1ad7b01005465bd57a691852f5eb7b to your computer and use it in GitHub Desktop.
Unlimited Cox Wifi Free Trial Script
const puppeteer = require("puppeteer");
const sh = require("shelljs");
const random_name = require("node-random-name");
const random_useragent = require("random-useragent");
const fs = require("fs");
const path = require("path");
const macaddress = require("macaddress");
const os = require("os");
var mac = "";
(async function run() {
const name = random_name();
console.log("%c%s", "color: #1d5673", name);
const firstName = name.split(" ")[0];
console.log("%c%s", "color: #f200e2", firstName);
const lastName = name.split(" ")[1];
console.log("%c%s", "color: #731d1d", lastName);
const agent = random_useragent.getRandom(function (ua) {
// console.log(ua);
return !ua.userAgent.includes("Mobile") && ua.userAgent.includes("Windows");
});
// console.log("%c%s", "color: #006dcc", agent);
const args = [
"--user-agent=" + agent,
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-infobars",
"--window-position=0,0",
"--ignore-certifcate-errors",
"--ignore-certifcate-errors-spki-list",
'--user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3312.0 Safari/537.36"',
];
const options = {
args,
headless: true,
ignoreHTTPSErrors: true,
//userDataDir: "./tmp",
};
sh.exec(
"bash /home/lifeofcoding/Macchangerizer.sh && sleep 10",
async (code, output) => {
//sh.echo(`exit code ${code}`);
var result = output.match(/(?<=New MAC: \s*).*?(?=\s* )/gs);
console.log("%c%s", "color: #007300", result[0]);
mac = result[0];
await new Promise((r) => setTimeout(r, 30000));
const browser = await puppeteer.launch(options);
const context = await browser.createIncognitoBrowserContext();
const page = await context.newPage();
const preloadFile = fs.readFileSync("./preload.js", "utf8");
await page.evaluateOnNewDocument(preloadFile);
await page.goto(
`http://cwifi-new.cox.com/?mac-address=${mac}&ap-mac=70:03:7E:E2:F4:10&ssid=CoxWiFi&vlan=103&nas-id=BTNRWAGB01.at.at.cox.net&block=false&unique=$HASH`,
{
waitUntil: "networkidle2",
timeout: 60000,
}
);
await page.screenshot({
path: path.resolve(__dirname) + "/screenshot1.jpeg",
type: "jpeg",
quality: 100,
});
await page.waitForSelector(
"#signIn > .signInText > .freeAccessPassSignup > .floatleft > .coxRegisterButton"
);
await page.keyboard.down("Tab");
await page.keyboard.down("Tab");
await page.keyboard.press("Enter");
//await page.click(".coxRegisterButton");
await page.waitForNavigation({ timeout: 90000 });
var userAgent = await page.evaluate(() => {
return (function () {
//console.log(window.navigator.userAgent)
return window.navigator.userAgent;
})();
});
console.log("%c%s", "color: #d90000", userAgent);
var url = await page.evaluate(() => {
return (function () {
//console.log(window.navigator.userAgent)
return window.location.href;
})();
});
console.log("%c%s", "color: #d90000", url);
await page.setViewport({ width: 1440, height: 779 });
await page.waitForSelector("table #trial_request_voucher_form_firstName");
await page.click("table #trial_request_voucher_form_firstName");
await page.type(
"table #trial_request_voucher_form_firstName",
firstName,
{
delay: 200,
}
);
await page.type("table #trial_request_voucher_form_lastName", lastName, {
delay: 200,
});
await page.waitForSelector("table #trial_request_voucher_form_isp");
await page.click("table #trial_request_voucher_form_isp");
await page.select("table #trial_request_voucher_form_isp", "Verizon");
await page.waitForSelector("table #trial_request_voucher_form_email");
await page.click("table #trial_request_voucher_form_email");
await page.type(
"table #trial_request_voucher_form_email",
`${lastName}.${firstName}@gmail.com`,
{
delay: 200,
}
);
console.log(`${lastName}.${firstName}@gmail.com`);
await page.waitForSelector(
".decisionBlock > table > tbody > tr > .top:nth-child(2)"
);
await page.click(
".decisionBlock > table > tbody > tr > .top:nth-child(2)"
);
await page.waitForSelector(
"table #trial_request_voucher_form_serviceTerms"
);
await page.click("table #trial_request_voucher_form_serviceTerms");
await page.keyboard.down("Tab");
await page.keyboard.down("Tab");
await page.keyboard.press("Enter");
await page.waitForNavigation({ timeout: 90000 });
const data = await page.evaluate(
() => document.querySelector("*").outerHTML
);
console.log("%c%s", "color: #188c82", data);
await page.screenshot({
path: path.resolve(__dirname) + "/screenshot.jpeg",
type: "jpeg",
quality: 100,
});
await browser.close();
setTimeout(run, 60000 * 60);
}
);
})();
@glhj2814
Copy link

Hello I'm new to this, how do you execute this? I keep getting a 800a03ea when I try to open the file

@glhj2814
Copy link

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment