This repository has been archived by the owner on May 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
848 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,191 @@ | ||
(async()=>{const s="http://144.126.221.48:31300",d=[400,450],{Logger:e,Time:m,BG:f,Net:o,Image:h}=await import(chrome.runtime.getURL("utils.js"));async function w({task:e,task_img:t,images:a}){for(;"Online"!==await f.exec("get_server_status");)await m.sleep(1e3);var r={y:"h",j:"c",i:a,g:1,t:e,a:t,v:chrome.runtime.getManifest().version},r=await o.fetch(s,{method:"POST",body:JSON.stringify(r)});try{var i=JSON.parse(r);if("error"in i)return 13===i.error?(await m.sleep(1e3),await w({task:e,task_img:t,images:a})):(10===i.error?await u():14===i.error&&await f.exec("set_server_status",{status:"Slow"}),{job_id:null,clicks:null});else{var c=i.data;for(;;){await m.sleep(500);var n=await o.fetch(s+"?id="+c);try{var l=JSON.parse(n);if("error"in l){if(12!=l.error)return await{job_id:c,clicks:null};continue}return await{job_id:c,clicks:l.data}}catch(e){}}return await void 0}}catch(e){await u()}return{job_id:null,clicks:null}}async function u(){await f.exec("set_server_status",{status:"Offline"})}function g(e){const t=e.style.background?.trim()?.match(/(?!^)".*?"/g);return t&&0!==t.length?t[0].replaceAll('"',""):null}let p=null;async function _(){if(e.debug){let e=await f.exec("get_cache",{name:"hcaptcha_pass"}),t=await f.exec("get_cache",{name:"hcaptcha_fail"});null===e&&(e=0),null===t&&(t=0);0<e+t&&Math.round(100*e/(e+t))}}async function t(e){if("block"===document.querySelector("div.check")?.style.display)return r||(await f.exec("inc_cache",{name:"hcaptcha_pass"}),await _(),r=true),void(e.debug&&window.location.reload());r=false,await m.sleep(e.open_delay),document.querySelector("#checkbox")?.click()}async function a(e){y=!(y||!function(){const e=document.querySelector(".display-error");return"true"!==e?.getAttribute("aria-hidden")}())&&(await f.exec("inc_cache",{name:"hcaptcha_fail"}),await _(),true);c=100;const{task:t,task_url:a,cells:r,urls:i}=await new Promise(l=>{let s=false;const o=setInterval(()=>{if(!s){s=true;var e=document.querySelector("h2.prompt-text")?.innerText?.replace(/\s+/g," ")?.trim();if(e){var t=document.querySelector(".challenge-example > .image > .image"),t=g(t);if(t&&""!==t){var a=document.querySelectorAll(".task-image");if(9!==a.length)s=false;else{const i=[],c=[];for(const n of a){var r=n.querySelector("div.image");if(!r)return void(s=false);r=g(r);if(!r||""===r)return void(s=false);i.push(n),c.push(r)}a=JSON.stringify(c);if(p!==a)return p=a,clearInterval(o),s=false,l({task:e,task_url:t,cells:i,urls:c});s=false}}else s=false}else s=false}},c)});var c,n=await h.encode(a);const l=[];for(const u of i)l.push(await h.encode(u));var s=m.time(),o=(await w({task:t,task_img:n,images:l}))["clicks"];if(o){n=e.solve_delay-(m.time()-s);0<n&&await m.sleep(n),await m.random_sleep(...d);for(let e=0;e<o.length;e++)false!==o[e]&&"true"!==r[e].getAttribute("aria-pressed")&&r[e].click();await m.random_sleep(...d);try{document.querySelector(".button-submit").click()}catch(e){}}}let r=false,y=false;for(;;){await m.sleep(1e3);var i=await f.exec("get_settings");i&&(e.debug=i.debug,i.auto_open&&null!==document.querySelector("div.check")?await t(i):i.auto_solve&&null!==document.querySelector("h2.prompt-text")&&await a(i))}})(); | ||
(async () => { | ||
const s = "http://144.126.221.48:31300" | ||
, d = [400, 450] | ||
, { Logger: e, Time: m, BG: f, Net: o, Image: h } = await import(chrome.runtime.getURL("utils.js")); | ||
async function w({ task: e, task_img: t, images: a }) { | ||
for (; "Online" !== await f.exec("get_server_status");) | ||
await m.sleep(1e3); | ||
var r = { | ||
y: "h", | ||
j: "c", | ||
i: a, | ||
g: 1, | ||
t: e, | ||
a: t, | ||
v: chrome.runtime.getManifest().version | ||
} | ||
, r = await o.fetch(s, { | ||
method: "POST", | ||
body: JSON.stringify(r) | ||
}); | ||
try { | ||
var i = JSON.parse(r); | ||
if ("error" in i) | ||
return 13 === i.error ? (await m.sleep(1e3), | ||
await w({ | ||
task: e, | ||
task_img: t, | ||
images: a | ||
})) : (10 === i.error ? await u() : 14 === i.error && await f.exec("set_server_status", { | ||
status: "Slow" | ||
}), | ||
{ | ||
job_id: null, | ||
clicks: null | ||
}); | ||
else { | ||
var c = i.data; | ||
for (; ;) { | ||
await m.sleep(500); | ||
var n = await o.fetch(s + "?id=" + c); | ||
try { | ||
var l = JSON.parse(n); | ||
if ("error" in l) { | ||
if (12 != l.error) | ||
return await { | ||
job_id: c, | ||
clicks: null | ||
}; | ||
continue | ||
} | ||
return await { | ||
job_id: c, | ||
clicks: l.data | ||
} | ||
} catch (e) { } | ||
} | ||
return await void 0 | ||
} | ||
} catch (e) { | ||
await u() | ||
} | ||
return { | ||
job_id: null, | ||
clicks: null | ||
} | ||
} | ||
async function u() { | ||
await f.exec("set_server_status", { | ||
status: "Offline" | ||
}) | ||
} | ||
function g(e) { | ||
const t = e.style.background?.trim()?.match(/(?!^)".*?"/g); | ||
return t && 0 !== t.length ? t[0].replaceAll('"', "") : null | ||
} | ||
let p = null; | ||
async function _() { | ||
if (e.debug) { | ||
let e = await f.exec("get_cache", { | ||
name: "hcaptcha_pass" | ||
}) | ||
, t = await f.exec("get_cache", { | ||
name: "hcaptcha_fail" | ||
}); | ||
null === e && (e = 0), | ||
null === t && (t = 0); | ||
0 < e + t && Math.round(100 * e / (e + t)) | ||
} | ||
} | ||
async function t(e) { | ||
if ("block" === document.querySelector("div.check")?.style.display) | ||
return r || (await f.exec("inc_cache", { | ||
name: "hcaptcha_pass" | ||
}), | ||
await _(), | ||
r = true), | ||
void (e.debug && window.location.reload()); | ||
r = false, | ||
await m.sleep(e.open_delay), | ||
document.querySelector("#checkbox")?.click() | ||
} | ||
async function a(e) { | ||
y = !(y || !function () { | ||
const e = document.querySelector(".display-error"); | ||
return "true" !== e?.getAttribute("aria-hidden") | ||
}()) && (await f.exec("inc_cache", { | ||
name: "hcaptcha_fail" | ||
}), | ||
await _(), | ||
true); | ||
c = 100; | ||
const { task: t, task_url: a, cells: r, urls: i } = await new Promise(l => { | ||
let s = false; | ||
const o = setInterval(() => { | ||
if (!s) { | ||
s = true; | ||
var e = document.querySelector("h2.prompt-text")?.innerText?.replace(/\s+/g, " ")?.trim(); | ||
if (e) { | ||
var t = document.querySelector(".challenge-example > .image > .image") | ||
, t = g(t); | ||
if (t && "" !== t) { | ||
var a = document.querySelectorAll(".task-image"); | ||
if (9 !== a.length) | ||
s = false; | ||
else { | ||
const i = [] | ||
, c = []; | ||
for (const n of a) { | ||
var r = n.querySelector("div.image"); | ||
if (!r) | ||
return void (s = false); | ||
r = g(r); | ||
if (!r || "" === r) | ||
return void (s = false); | ||
i.push(n), | ||
c.push(r) | ||
} | ||
a = JSON.stringify(c); | ||
if (p !== a) | ||
return p = a, | ||
clearInterval(o), | ||
s = false, | ||
l({ | ||
task: e, | ||
task_url: t, | ||
cells: i, | ||
urls: c | ||
}); | ||
s = false | ||
} | ||
} else | ||
s = false | ||
} else | ||
s = false | ||
} | ||
} | ||
, c) | ||
} | ||
); | ||
var c, n = await h.encode(a); | ||
const l = []; | ||
for (const u of i) | ||
l.push(await h.encode(u)); | ||
var s = m.time() | ||
, o = (await w({ | ||
task: t, | ||
task_img: n, | ||
images: l | ||
}))["clicks"]; | ||
if (o) { | ||
n = e.solve_delay - (m.time() - s); | ||
0 < n && await m.sleep(n), | ||
await m.random_sleep(...d); | ||
for (let e = 0; e < o.length; e++) | ||
false !== o[e] && "true" !== r[e].getAttribute("aria-pressed") && r[e].click(); | ||
await m.random_sleep(...d); | ||
try { | ||
document.querySelector(".button-submit").click() | ||
} catch (e) { } | ||
} | ||
} | ||
let r = false | ||
, y = false; | ||
for (; ;) { | ||
await m.sleep(1e3); | ||
var i = await f.exec("get_settings"); | ||
i && (e.debug = i.debug, | ||
i.auto_open && null !== document.querySelector("div.check") ? await t(i) : i.auto_solve && null !== document.querySelector("h2.prompt-text") && await a(i)) | ||
} | ||
} | ||
)(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
(async()=>{var{}=await import(chrome.runtime.getURL("utils.js"));let a=null,t=false,r=false;function n(e,t,r=false){e&&(r||a!==e)&&(true===t&&"false"===e.getAttribute("aria-pressed")||false===t&&"true"===e.getAttribute("aria-pressed"))&&e.click()}document.addEventListener("mousedown",e=>{"false"===e?.target?.parentNode?.getAttribute("aria-pressed")?(t=true,r=true):"true"===e?.target?.parentNode?.getAttribute("aria-pressed")&&(t=true,r=false),a=e?.target?.parentNode}),document.addEventListener("mouseup",e=>{t=false,a=null}),document.addEventListener("mousemove",e=>{t&&(a!==e?.target?.parentNode&&null!==a&&n(a,r,true),n(e?.target?.parentNode,r))})})(); | ||
(async () => { | ||
var { } = await import(chrome.runtime.getURL("utils.js")); | ||
let a = null | ||
, t = false | ||
, r = false; | ||
function n(e, t, r = false) { | ||
e && (r || a !== e) && (true === t && "false" === e.getAttribute("aria-pressed") || false === t && "true" === e.getAttribute("aria-pressed")) && e.click() | ||
} | ||
document.addEventListener("mousedown", e => { | ||
"false" === e?.target?.parentNode?.getAttribute("aria-pressed") ? (t = true, | ||
r = true) : "true" === e?.target?.parentNode?.getAttribute("aria-pressed") && (t = true, | ||
r = false), | ||
a = e?.target?.parentNode | ||
} | ||
), | ||
document.addEventListener("mouseup", e => { | ||
t = false, | ||
a = null | ||
} | ||
), | ||
document.addEventListener("mousemove", e => { | ||
t && (a !== e?.target?.parentNode && null !== a && n(a, r, true), | ||
n(e?.target?.parentNode, r)) | ||
} | ||
) | ||
} | ||
)(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,98 @@ | ||
const $log=document.querySelector("#log"),logs=[];function log(e){$log&&(logs.push(e),$log.innerHTML=logs.join("\n"),$log.scrollTop=$log.scrollHeight)}class BG{static exec(t,s){return new Promise(e=>{try{chrome.runtime.sendMessage({method:t,data:s},e)}catch{e()}})}}async function set_switch(e,t){const s=document.querySelector(`input#${e}[type="checkbox"]`);if(s){var n=s.dataset?.disables?.split(",");if(n)for(const c of n){const o=document.querySelector("#"+c);o.disabled=!t}log(`set_switch ${e} `+t),s.checked=t,await BG.exec("set_settings",{id:e,value:t})}}async function set_field(e,t){const s=document.querySelector(`input#${e}[type="text"]`);if(s){try{t=parseInt(t)}catch{t=0}log(`set_field ${e} `+(t=999999<(t=(t=isNaN(t)?0:t)<0?0:t)?999999:t)),s.value=t,await BG.exec("set_settings",{id:e,value:t})}}async function set_select(e,t){const s=document.querySelector("select#"+e);s&&(log(`set_select ${e} `+t),s.value=t,await BG.exec("set_settings",{id:e,value:t}))}async function main(){document.querySelector("#footer").addEventListener("click",async()=>{await BG.exec("open_tab",{url:"https://discord.gg/gpudrops"})});var e=await BG.exec("get_settings");log(JSON.stringify(e));for(const s in e)await set_switch(s,e[s]),await set_field(s,e[s]),await set_select(s,e[s]);for(const n of document.querySelectorAll('.settings_group input[type="checkbox"]'))n.addEventListener("change",()=>set_switch(n.id,n.checked));for(const c of document.querySelectorAll('.settings_group input[type="text"]'))c.addEventListener("input",()=>set_field(c.id,c.value));for(const o of document.querySelectorAll(".settings_group select"))o.addEventListener("change",()=>set_select(o.id,o.value));async function t(){var e=await BG.exec("get_server_status");if(["Online","Offline","Slow","Update Required"].includes(e)){const t=document.querySelector("#server_status");t.innerHTML=e,t.classList.remove("green"),t.classList.remove("yellow"),t.classList.remove("red"),"Online"===e?t.classList.add("green"):"Offline"===e?t.classList.add("red"):"Slow"!==e&&"Update Required"!==e||t.classList.add("yellow")}}await t(),setInterval(t,1e3)}document.addEventListener("DOMContentLoaded",main); | ||
const $log = document.querySelector("#log") | ||
, logs = []; | ||
function log(e) { | ||
$log && (logs.push(e), | ||
$log.innerHTML = logs.join("\n"), | ||
$log.scrollTop = $log.scrollHeight) | ||
} | ||
class BG { | ||
static exec(t, s) { | ||
return new Promise(e => { | ||
try { | ||
chrome.runtime.sendMessage({ | ||
method: t, | ||
data: s | ||
}, e) | ||
} catch { | ||
e() | ||
} | ||
} | ||
) | ||
} | ||
} | ||
async function set_switch(e, t) { | ||
const s = document.querySelector(`input#${e}[type="checkbox"]`); | ||
if (s) { | ||
var n = s.dataset?.disables?.split(","); | ||
if (n) | ||
for (const c of n) { | ||
const o = document.querySelector("#" + c); | ||
o.disabled = !t | ||
} | ||
log(`set_switch ${e} ` + t), | ||
s.checked = t, | ||
await BG.exec("set_settings", { | ||
id: e, | ||
value: t | ||
}) | ||
} | ||
} | ||
async function set_field(e, t) { | ||
const s = document.querySelector(`input#${e}[type="text"]`); | ||
if (s) { | ||
try { | ||
t = parseInt(t) | ||
} catch { | ||
t = 0 | ||
} | ||
log(`set_field ${e} ` + (t = 999999 < (t = (t = isNaN(t) ? 0 : t) < 0 ? 0 : t) ? 999999 : t)), | ||
s.value = t, | ||
await BG.exec("set_settings", { | ||
id: e, | ||
value: t | ||
}) | ||
} | ||
} | ||
async function set_select(e, t) { | ||
const s = document.querySelector("select#" + e); | ||
s && (log(`set_select ${e} ` + t), | ||
s.value = t, | ||
await BG.exec("set_settings", { | ||
id: e, | ||
value: t | ||
})) | ||
} | ||
async function main() { | ||
document.querySelector("#footer").addEventListener("click", async () => { | ||
await BG.exec("open_tab", { | ||
url: "https://discord.gg/gpudrops" | ||
}) | ||
} | ||
); | ||
var e = await BG.exec("get_settings"); | ||
log(JSON.stringify(e)); | ||
for (const s in e) | ||
await set_switch(s, e[s]), | ||
await set_field(s, e[s]), | ||
await set_select(s, e[s]); | ||
for (const n of document.querySelectorAll('.settings_group input[type="checkbox"]')) | ||
n.addEventListener("change", () => set_switch(n.id, n.checked)); | ||
for (const c of document.querySelectorAll('.settings_group input[type="text"]')) | ||
c.addEventListener("input", () => set_field(c.id, c.value)); | ||
for (const o of document.querySelectorAll(".settings_group select")) | ||
o.addEventListener("change", () => set_select(o.id, o.value)); | ||
async function t() { | ||
var e = await BG.exec("get_server_status"); | ||
if (["Online", "Offline", "Slow", "Update Required"].includes(e)) { | ||
const t = document.querySelector("#server_status"); | ||
t.innerHTML = e, | ||
t.classList.remove("green"), | ||
t.classList.remove("yellow"), | ||
t.classList.remove("red"), | ||
"Online" === e ? t.classList.add("green") : "Offline" === e ? t.classList.add("red") : "Slow" !== e && "Update Required" !== e || t.classList.add("yellow") | ||
} | ||
} | ||
await t(), | ||
setInterval(t, 1e3) | ||
} | ||
document.addEventListener("DOMContentLoaded", main); |
Oops, something went wrong.