cloudfucked

This commit is contained in:
lolcat 2025-04-26 11:22:09 -04:00
commit 8c3f23c605
2 changed files with 91 additions and 0 deletions

39
README.md Normal file
View File

@ -0,0 +1,39 @@
# Worker proxy
Simple script to deploy an HTTP proxy on any of those meme-ass serverless servers.
## Install (for cloudflare workers)
```
node -v # should output v18.x or v20.x or some shit
sudo npm install -g wrangler
wrangler login # this will open some garbage in a browser tab. authenticate your ass
wrangler init worker-proxy
cd worker-proxy/src
rm index.js
wget https://git.lolcat.ca/lolcat/worker-proxy/raw/branch/master/src/index.js
```
## Configure
Edit line 10 of `index.js` with your favorite text editor. Change the password to something only you knows. A good way to make shit secure is by running the following garbage in a PHP shell:
```
php -a
php > echo bin2hex(random_bytes(21));
605ca86cd0e70b7cb96e2ccc5902e70639afe074aa
```
This way, only (You) can use your proxy.
## Run
```
wrangler dev # Runs proxy locally (useless, but lets you know shit werks)
wrangler publish
```
## Usage
When you run the command `wrangler publish`, Cloudfart should give you some URL. Go and visit it. The front page should read "Fuck off".
To proxy things, visit this endpoint:
/?p={Website}&k={YourKey}
This garbage should mirror all HTTP headers both ways, although cloudshit appends a bunch of useless headers to the response.

52
src/index.js Normal file
View File

@ -0,0 +1,52 @@
export default {
async fetch(request){
const req = new URL(request.url);
const url = req.searchParams.get("p");
const pw = req.searchParams.get("k");
if(
!url ||
!pw ||
pw != "185d7c9bfb0d5b1bd67373f8b4f0a04a85dfa4aa78"
){
return new Response("Fuck off", { status: 404 });
}
// clone headers to send to target
var headers = new Headers(request.headers);
headers.delete("host");
try{
const proxy_req =
await fetch(
url,
{
method: request.method,
headers: headers,
body: request.method !== "GET" && request.method !== "HEAD" ? await request.text() : undefined,
}
);
// send back proxied headers
const headers_recv = new Headers();
proxy_req.headers.forEach(function(value, key){
headers_recv.set(key, value);
});
const proxy_res = await proxy_req.arrayBuffer();
return new Response(proxy_res, {
status: proxy_req.status,
statusText: proxy_req.statusText,
headers: headers_recv
});
}catch(err){
return new Response(err.toString(), { status: 400 });
}
}
};