Skip to content

Instantly share code, notes, and snippets.

@stealthbomber10
Created August 30, 2017 02:21
Show Gist options
  • Save stealthbomber10/de83264887bd20db8da854d0a35896ac to your computer and use it in GitHub Desktop.
Save stealthbomber10/de83264887bd20db8da854d0a35896ac to your computer and use it in GitHub Desktop.
This script opens 2 tabs in your browser and automatically searches the top 1000 keywords for Google Ad Sense on Google
// copied from here: https://jsfiddle.net/icefrogcode/kqdx7cyb/1/
// ALL CREDITS GO TO ICEFROG
// the associated html page for reference:
// <div>
// <h1>
// Google Advertisment Scanner
// </h1>
// <p>
// <b>What does it do?</b> This script opens 2 tabs in your browser and automatically searches the top 1000 keywords for Google Ad Sense on Google. Google Ad Sense is the Advertisement service google runs.
// </p>
// <p>
// <b>What is it for?</b> This script is for experimentation purposes only, it was developed to analyze advertisement tracking. To determine how well Google knows your specific browsing history, and the Advertisements they display based on<br><br>Click the Button Below to Start.
// </p>
// <button id="run">
// START
// </button>
// </div>
var CrawlerCount = 1; // Number must be 1 or an even number
//var keywordsURI = "https://raw.githubusercontent.com/CodefagoCbrgLyIyM/Alphabet/master/keywords";
var keywordsURI = "https://gist.githubusercontent.com/anonymous/e2cce2ce92f2a64913ff34e623860b36/raw/d2600878621f921ed719c0c31969e0cacc79ec0c/gistfile1.txt";
var googleURI = "https://www.google.com/search?hl=en&site=webhp&source=hp&q=";
var dummyTabs = [];
var swatch = 0;
var keywords = [];
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function shuffle(a) {
for (let i = a.length; i; i--) {
let j = Math.floor(Math.random() * i);
[a[i - 1], a[j]] = [a[j], a[i - 1]];
}
}
async function Crawl(tabCount){
var i = 0
var m = keywords.length / tabCount;
dummyTabs = [];
for(var i = 0; i < tabCount; i++){
var x = window.open("http://google.com",'newwindow' + i,'width=200, height=200', "_blank");
dummyTabs.push(x);
}
while (i < m) {
dummyTabs[swatch].location = googleURI + keywords[(swatch * m + i)];
dummyTabs[swatch].focus();
swatch++;
if(swatch == tabCount){
swatch = 0;
i++;
}
await sleep(60000);
}
for(var i = 0; i < tabCount; i++){
dummyTabs[i].close();
}
Init();
}
function Init()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var a = xmlhttp.responseText.split(/\n/);
shuffle(a);
keywords = a;
Crawl(CrawlerCount);
}
}
xmlhttp.open("GET", keywordsURI, false);
xmlhttp.send();
}
var button = document.querySelector('#run');
button.onclick = function(){ Init(); }
new Promise(resolve => {
let db,
on = () => resolve(true),
off = () => resolve(false),
tryls = () => {
try {
localStorage.length ? off() : (localStorage.x = 1, localStorage.removeItem("x"), off())
} catch (e) {
on()
}
}
// Blink
window.webkitRequestFileSystem ? webkitRequestFileSystem(window.TEMPORARY, 1, off, on)
// FF
: "MozAppearance" in document.documentElement.style ? (db = indexedDB.open("test"), db.onerror = on, db.onsuccess = off)
// Safari
: /constructor/i.test(window.HTMLElement) ? tryls()
// IE10+ & edge
: !window.indexedDB && (window.PointerEvent || window.MSPointerEvent) ? on()
// Rest
: off()
}).then(enabled => {
if(!enabled) alert('We have detected you are not running this in Incognito or Private browsing mode, for the best scripting experience use the script in a Incognito or Private browser.')
})
//Init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment