-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fucker.ts
187 lines (171 loc) Β· 7.6 KB
/
fucker.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
if (process.argv.includes("--help")) {
await import("./modules/help.ts");process.exit(0)
}
const colors = require('colors');
import { mkdir } from "node:fs/promises";
import * as readline from 'node:readline/promises'; // This uses the promise-based APIs
import { stdin as input, stdout as output } from 'node:process';
import scraper from "./modules/scraper"
import reporter from "./modules/reporter"
import filters from "./modules/filters"
async function prompt(ask:string) {
const rl = readline.createInterface({ input, output });
let res = await rl.question(ask);
rl.close();
return res;
}
console.log("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
console.clear();
console.log("Surfskip Fucker 2.0".rainbow + " | ".gray + "by: rare1k\n".blue.bold);
console.log("π§βπΎ" + " Scraping Method: ".blue)
console.log("| ".gray + "π" + " [1]".brightBlue.bold + " links.surfskip.com")
console.log("| ".gray + "π" + " [2]".brightBlue.bold + " Google Docs")
console.log("| ".gray + "π" + " [3]".yellow.bold + " BOTH".bold)
console.log("| ".gray + "πͺ" + " [0]".brightRed.bold + " Exit".red.bold)
console.log("| ".gray);
let method;
while (true) {
if (process.argv.indexOf("--method") != -1) {
method = (process.argv.indexOf("--method")) + 1
if (!process.argv[method] || !Number(process.argv[method])) {
console.log("\nβ" + " Use --method followed by a number.".brightRed.bold);
console.log("πͺ" + " Exiting...");
process.exit(0)
}
console.log("| Type your option: ".gray + process.argv[method] + " (from stdin)".gray)
method = process.argv[method];
} else {
method = await prompt("| Type your option: ".gray);
}
if (Number(method) == 0) {
console.log("\nπͺ" + " Exiting...");
process.exit(0)
} else
if (Number(method) && [1,2,3].includes(Number(method))) {
break;
} else {
console.log("β" + " Not a valid choice.".brightRed.bold);
if (process.argv.indexOf("--method") != -1) {
console.log("πͺ" + " Exiting...");
process.exit(1)
}
}
}
// console.log("\nπ¬" + " Starting Report".blue + " (to content keeper)".gray)
console.log("π¬" + " Starting Report".blue + " (to lightspeed)".gray)
let email = ""
if (process.argv.indexOf("--email") == -1) {
email = await prompt("| ".gray + "π¨ Report Email".blue + " [anonymous]".gray + ": ".blue);
if (email.trim() == "" || !email) {
email = "[email protected]"
console.write("\u001b[K")
console.write("\u001b[1A")
console.write("| ".gray + "π¨ Report Email:".blue + " anonymous \n")
console.log("| ".gray + " Using [email protected]");
}
} else {
let stdinEmail = (process.argv.indexOf("--email") + 1)
if (!process.argv[stdinEmail]) {
console.log("| ".gray + "π¨ Report Email:".blue + ` ${"invalid".brightRed.bold}`)
console.log("| ".gray + "Use anonymous, none, or default if you want to use defaults.".brightRed.bold)
process.exit(1);
}
if (process.argv[stdinEmail].includes("@") && !["anonymous","none","default"].includes(process.argv[stdinEmail])) {
email = process.argv[stdinEmail]
console.log("| ".gray + "π¨ Report Email:".blue + ` ${process.argv[stdinEmail]} ${"(from stdin)".gray}`)
} else {
if (["anonymous","none","default"].includes(process.argv[stdinEmail])) {
email = "[email protected]"
console.log("| ".gray + "π¨ Report Email:".blue + ` anonymous ${"(from stdin)".gray}`)
console.log("| ".gray + " Using [email protected]");
} else {
console.log("| ".gray + "π¨ Report Email:".blue + ` ${"invalid".brightRed.bold}\n`)
process.exit(1);
}
}
}
let reason;
if (process.argv.indexOf("--reason") != -1) {
reason = process.argv[process.argv.indexOf("--reason") + 1]
if (!reason) {
console.log("| ".gray + "β Report Reason:".blue + " invalid".bold.brightRed)
console.log("| ".gray + "Use none or default to use the defaults.".bold.brightRed)
}
if (reason == "none" || reason == "default") {
reason = "Surfskip Proxy"
}
console.log("| ".gray + "β Report Reason: ".blue + reason + " (from stdin)".gray)
} else {
reason = await prompt("| ".gray + "β Report Reason".blue + " [Surfskip Proxy]".gray + ": ".blue);
if (reason.trim() == "" || !reason) {
reason = "Surfskip Proxy"
console.write("\u001b[K")
console.write("\u001b[1A")
console.write("| ".gray + "β Report Reason:".blue + " Surfskip Proxy \n")
}
}
console.log("\nπ" + " Scraping links...".blue)
let links:string[] = [];
switch (Number(method)) {
case 1:
links = await scraper.scrapeLinks();
console.log("| ".gray + "π" + " Got ".blue + String(links.length).green.bold + " links!".blue);
break;
case 2:
links = await scraper.scrapeGoogleDoc();
console.log("| ".gray + "π" + " Got ".blue + String(links.length).green.bold + " links!".blue);
break;
case 3:
links = await scraper.scrapeGoogleDoc();
links = links.concat(await scraper.scrapeLinks())
console.log("| ".gray + "π" + " Got ".blue + String(links.length).green.bold + " links!".blue);
break;
}
await mkdir(new URL("./tmp/", import.meta.url), { recursive: true });
let file = Bun.write(new URL("./tmp/out.txt", import.meta.url),links.join("\n"))
console.log("| ".gray + "πΎ" + " For your convenience, the scraped links are in: ".green + "tmp/out.txt".bold);
console.log("| ".gray);
console.log("\nπ€‘" + " Reporting links... ".rainbow + "MUAHAHAHAHA!".red.bold.underline);
console.write("\n\n")
let remove = ["status.surfskip.com/status/surfskip","whynotprivacy.com/blogs/privacy/proxies"]
let skipped = 0;
for (let i = 0; i < links.length; i++) {
console.write("\u001b[2A")
console.write("\u001b[32D")
let category = await filters.lightspeed(links[i])
try {
// console.write(category[0]) //debug
if (remove.includes(links[i].replace("https://",""))) {
// silently skip for formatting purposes
skipped++;
} else
if (String(category[0]).includes("security") || String(category[0]).includes("proxy") || String(category[1]).includes("security") || String(category[1]).includes("proxy") ) {
console.log("| ".gray + `β Skipped ${links[i].replace("https://","").replaceAll("/","")} because already blocked`.red);
skipped++;
} else {
let reportOK = true
if (process.argv.indexOf("--demo") == -1) {
reportOK = await reporter.reportLightspeed(email,links[i].replace("https://","").replaceAll("/",""),reason)
}
if (reportOK) {
console.log("| ".gray + `β
Sent ${links[i].replace("https://","").replaceAll("/","")} to lightspeed!`.green);
} else {
console.log("| ".gray + `β Failed to report ${links[i]}.`.red); skipped++;
}
}
} catch (e) {
console.log("| ".gray + `β Skipped ${links[i].replace("https://","").replaceAll("/","")} because ${e} (Debug: ${category})`.red);
skipped++;
}
console.write(" \n")
console.write(" \n")
console.write("\u001b[K")
console.write("\u001b[2A")
console.write("| ".gray + `π€‘ Reported ${String((i+1) - skipped).bold} links!`.blue )
console.write("\u001b[1B")
console.write("\u001b[32D")
console.write("| ".gray + `π€‘ Skipped ${String(skipped).bold} links!`.blue )
console.write("\u001b[1B")
}
console.write("\u001b[32D")
console.write("\n")