add daddy's link protector, add image captcha support, improve frontend

pull/4/head
aria 3 months ago
parent 5b155e9a8e
commit 8a1b5c1bc9
Signed by: a
GPG Key ID: E851AE999FFCBC37
  1. 1
      docs/SITES.md
  2. 111
      extractors/dlp.js
  3. 8
      extractors/generic.js
  4. 11
      lib.js
  5. 23
      static/app.js

@ -18,6 +18,7 @@ Redirects not directly linking to our site may be NSFW and are not endorsements
|**`cpmlink.net`**|Axios|Yes|[https://cpmlink.net/i7FyAQ](https://cpmlink.net/i7FyAQ)||
|**`cutw.in`**|Puppeteer + Adblocker + Stealth|Yes|[https://cutw.in/8q9wzl](https://cutw.in/8q9wzl)|||
|**`cshort.org`**|Axios|No|[https://cshort.org/8i8dwPx0](https://cshort.org/8i8dwPx0)|
|**`DaddyScripts`**|Axios|Sometimes, not always required|[https://lnk.snahp.eu/EBRs14BxyZ5oIlvrEx4EZGPlrwGm31VeNZ1Uo](https://lnk.snahp.eu/EBRs14BxyZ5oIlvrEx4EZGPlrwGm31VeNZ1Uo) (no password), [https://lnk.snahp.eu/W4hPgdadk7F9WtY5hb00uCdWzHZK5n5kt32ZG](https://lnk.snahp.eu/W4hPgdadk7F9WtY5hb00uCdWzHZK5n5kt32ZG) (password: `bifm`)|||
|**`exe.io`**|Puppeteer + Stealth|Yes|[https://exe.io/ZaKsUgDc](https://exe.io/ZaKsUgDc)|`exey.io`||
|**`ity.im`**|Axios|No|[http://ity.im/1QZh2](http://ity.im/1QZh2)|||
|**`karung.in`**|Axios|No|[http://karung.in/Gyucc](http://karung.in/Gyucc) redirects to `https://drive.google.com/uc?id=0B263gKU-C09_WW5rbURLeXN5QXc&export=download`.||Passworded links are currently not supported.|

@ -0,0 +1,111 @@
const axios = require("axios");
const cheerio = require("cheerio");
const scp = require("set-cookie-parser");
const lib = require("../lib");
module.exports = {
hostnames: [],
requiresCaptcha: false,
get: async function(url, opt) {
try {
if (lib.config().debug == true) console.log("[dlp] Requesting page...");
let header = lib.config().defaults?.axios.headers;
if (opt.referer) header.Referer = opt.referer;
let proxy;
if (lib.config().defaults?.axios.proxy) {
if (lib.config().defaults?.axios.proxy?.type == "socks5") {
const agent = require("socks-proxy-agent");
let prox = `socks5://${lib.config().defaults?.axios.proxy?.host}:${lib.config().defaults?.axios.proxy?.port}`;
proxy = {httpsAgent: (new agent.SocksProxyAgent(prox))};
} else {
proxy = {};
}
}
let resp = await axios({
method: "GET",
url: url,
headers: header,
...proxy
});
if (lib.config().debug == true) console.log("[dlp] Got page. Parsing page...");
let $ = cheerio.load(resp.data);
let pw = $("#wrapper > #content > p").text().includes("Password");
let b;
if (lib.config().debug == true) console.log("[dlp] Parsed. Forming body data...");
if (pw == true) {
// passworded
if (!opt.password) throw "Incorrect password.";
b = `Pass1=${encodeURIComponent(opt.password)}&Submit0=Submit`;
} else {
let c = lib.cookieString(scp(resp.headers["set-cookie"]));
header["Cookie"] = c;
let cap = $("#wrapper > #content > form > p > img").attr("src");
cap = await fetchCaptcha(cap, url, header);
cap = await lib.solve(cap, "image");
b = `security_code=${cap}&submit1=Submit`;
}
if (lib.config().debug == true) console.log("[dlp] Sending body data...");
resp = await axios({
method: "POST",
url: url,
data: b,
headers: header
});
if (lib.config().debug == true) console.log("[dlp] Sent body data. Parsing response...");
$ = cheerio.load(resp.data);
let links = [];
await ($("#wrapper > #content > center a").each(function(a) {
let h = $("#wrapper > #content > center a")[a].attribs?.href;
if (h !== null) {
if (!h.startsWith("/")) links.push(h);
}
}));
if (links.length == 0) {
if ($(".error").length > 0) {
throw $(".error").text();
} else {
throw "An unknown error has occured.";
}
} else if (links.length == 1) {
return links[0];
} else {
return links;
}
} catch(err) {
throw err;
}
}
}
async function fetchCaptcha(url, ref, h) {
url = `${new URL(ref).protocol}//${new URL(ref).hostname}/${url}`;
if (lib.config().debug == true) console.log("[dlp] Fetching CAPTCHA image...", url);
h["Accept"] = "image/avif,image/webp,*/*";
h["Accept-Encoding"] = "gzip, deflate";
h["Connection"] = "keep-alive";
h["Referer"] = ref;
h["Sec-Fetch-Dest"] = "image";
h["Sec-Fetch-Mode"] = "no-cors";
h["Sec-Fetch-Site"] = "same-origin";
h["TE"] = "Trailers";
let resp = await axios({
responseType: "arraybuffer",
method: "GET",
headers: h,
url: url
});
return `data:${resp.headers["content-type"]};base64,${Buffer.from(resp.data).toString("base64")}`;
}

@ -170,6 +170,14 @@ module.exports = {
return (await afl.get(url, opt));
}
// daddy's link protector
if (lib.config().debug == true) console.log("[generic] Done. Checking if link is DLP link...");
if ($("#wrapper > #footer > center a[target='_blank'][href='http://www.daddyscripts.com']")) {
if (lib.config().debug == true) console.log("[generic] Link is an DLP link, switching to DLP extractor...");
const dlp = require("./dlp");
return (await dlp.get(url, opt));
}
throw "Redirect not found.";
} catch(err) {
throw err;

@ -180,6 +180,11 @@ module.exports = {
d.destinations = [...new Set(d.destinations)]; // removes duplicates
if (f.destinations.length == 0) {
if (config.debug == true) console.log("[lib] Destination array size is 0, throwing error...");
throw "Invalid response from backend.";
}
if (config.db.active == true) {
if (opt.allowCache !== false) {
d.destinations = JSON.stringify(d.destinations);
@ -216,7 +221,7 @@ module.exports = {
if (config.captcha.active == false) return null;
if (config.captcha.service == "2captcha") {
const tc = new two.Solver(config["captcha"]["key"]);
let ref = opt.referer;
let ref = (opt?.referer || "unknown location");
if (config.debug == true) console.log(`[captcha] Requesting CAPTCHA solve for a ${type} @ "${ref}"...`);
let a;
@ -230,6 +235,10 @@ module.exports = {
a = (await tc.hcaptcha(sitekey, ref)).data;
if (config.debug == true) console.log(`[captcha] Solved ${type} for "${ref}".`);
return a;
case "image":
a = (await(tc.imageCaptcha(sitekey))).data;
if (config.debug == true) console.log("[captcha] Solved image captcha.", a);
return a;
default:
console.log(`[captcha] Invalid parameters were given to CAPTCHA solver.`)
throw "Parameters for CAPTCHA solver are incorrect.";

@ -39,8 +39,18 @@ function bypass() {
a.href = escapeHtml(d.destination);
a.rel = "noreferer nofollow";
a.target = "_blank";
a.innerHTML = d.destination;
a.innerHTML = `${d.destination} `;
p.append(a);
let btn = document.createElement("button");
btn.setAttribute("data-url", d.destination);
btn.setAttribute("data-referer", url);
btn.innerHTML = "Bypass this URL";
btn.onclick = function() {
document.getElementById("url").value = this.getAttribute("data-url");
document.getElementById("referer").value = this.getAttribute("data-referer");
bypass();
}
p.append(btn);
sd.append(p);
} else if (d.destinations) {
p.innerHTML = "Results: <br>";
@ -50,7 +60,16 @@ function bypass() {
a.href = escapeHtml(d.destinations[b]);
a.rel = "noreferer nofollow";
a.target = "_blank";
a.innerHTML = d.destinations[b];
a.innerHTML = `${d.destinations[b]} `;
let btn = document.createElement("button");
btn.setAttribute("data-url", d.destination);
btn.setAttribute("data-referer", url);
btn.innerHTML = "Bypass this URL";
btn.onclick = function() {
document.getElementById("url").value = this.getAttribute("data-url");
document.getElementById("referer").value = this.getAttribute("data-referer");
bypass();
}
br = document.createElement("br");
p.append(a);
p.append(br);

Loading…
Cancel
Save