Ask coding questions

← Back to all posts
(ignore this)
[deleted]

Amount of times this page was viewed:

I told them all to ignore this..

Commentshotnewtop
[deleted]

you have to put it in as an image @inyourface3445

inyourface3445 (30)

@blaster202 this is the add counter link

[deleted]

I know. I made this... You need to put it as in img. So like this:

![](<the url>)

@inyourface3445

AnthonyMouse (64)

ok ill use the counter

Coder100 (12541)

hmm not even effort xd

xxpertHacker (613)

Spamming your counter rn.
Dispatching 300 HTTP requests at a time, concurrently. :)

https://repl.it/@xxpertHacker/NiftyHalfOrigin#index.ts

[deleted]

It went up to 4K LOL
I reset it C:< @xxpertHacker

xxpertHacker (613)

@blaster202 I was getting up to 8k per run at times before the process died from OOM, but yeah, I spammed it until it hit 100k?

[deleted]

Ok... You seriously need to tell me how that script works.. @xxpertHacker

xxpertHacker (613)

@blaster202 Is it unreadable or something?
What about it do you need to know?
It's only 2 files, index.ts, and worker.ts.

[deleted]

is there a way to do it in js instead of ts (considering ts is compiled into js) @xxpertHacker

[deleted]

It's just because I don't understand TypeScript @xxpertHacker

xxpertHacker (613)

@blaster202 What languages do you know?

[deleted]

Like in index.ts row 28 where is this class "Worker" coming from? @xxpertHacker

xxpertHacker (613)

@blaster202 Yes, I just used TS because it's what I default to, but hey, I can transpile it to JS by hand, right now.

[deleted]

Yes plz •—• •‿• @xxpertHacker

xxpertHacker (613)

@blaster202 Done, now it's JavaScript instead.

Worker comes from the global object provided by a conforming ECMAScript implementation.

In a browser, you can test this yourself:

console.log(self.Worker === Worker);

https://developer.mozilla.org/en-US/docs/Web/API/Worker

[deleted]

What is "deno" and is it possible without it? @xxpertHacker

[deleted]

and what does line 19 in index.js do?

	evt?.currentTarget.terminate();

@xxpertHacker

[deleted]

What is that question mark for? @xxpertHacker

[deleted]

I assume this works because I had to make the update counter part allow CORS for the JS API part of it... That's not good but what can I do ¯_(ツ)_/¯ @xxpertHacker

[deleted]

Oh and if I made the update part not allow CORS would you still be able to find a way to do it? (by do it I mean spam the server) @xxpertHacker

xxpertHacker (613)

@blaster202 Deno is an ES runtime, just like Node.js, or a browser. And yes, it is very possible. I could go do it in C++ or Rust instead, but I don't have the time.

xxpertHacker (613)

@blaster202 currentTarget is the worker instance, I'm calling Worker#terminate on it.

I used null chaining ?. because I start with null, not an event.

[deleted]

ok.. Is it possible to do it in js even if CORS was off? @xxpertHacker

xxpertHacker (613)

@blaster202 I'm confident that I could do it 1000 other ways, that was just the most convenient method that had popped in my head :)

xxpertHacker (613)

@blaster202 I could do it with my own browser, no CORS needed.

[deleted]

Huh? Could you do it from pure JS or NodeJS? @xxpertHacker

xxpertHacker (613)

@blaster202 That code was pure JS, that means that I could do it in my own browser, in Node.js, in Deno, in Firefox, in Safari, etc.

Any modern runtime could run that code.

[deleted]

Yeah but fetch won't work if CORS is off... @xxpertHacker

xxpertHacker (613)

@blaster202 Do you want to test that!?
If I put my mind to it, it can be done.

CORS is for browsers to follow, not me.

The HTTP request can still be sent.

[deleted]

yes •‿• @xxpertHacker

[deleted]

I know fetch won't work with CORS off so how can we do it? @xxpertHacker

[deleted]

Teach me the ways of the gods •‿• (lol) @xxpertHacker

xxpertHacker (613)

@blaster202 Feel free to disable CORS whenever you want.

[deleted]

you just made it go to 1000 again xD @xxpertHacker

xxpertHacker (613)

@blaster202

I know fetch won't work with CORS off so how can we do it?

The browser checks CORS headers before allowing JS to use the data, but technically it could ignore it entirely.

You'll have to block my Repl.

[deleted]

I'm gonna make a tiny Node app with CORS off to see if you can do it.. @xxpertHacker

xxpertHacker (613)

@blaster202 Oh, that was an accident, I optimized it, so now it can hit 10k per session.

[deleted]

Did you find a way to do it without CORS @xxpertHacker

xxpertHacker (613)

@blaster202 Your server died after 1.2k requests.

xxpertHacker (613)

@blaster202 If you weren't sending CORS headers, it was working fine.

[deleted]

Are you testing it on the other thing? I made a new thing for no CORS @xxpertHacker

xxpertHacker (613)

@blaster202 Yes, in the new Repl you misspelled setHeader as settHeader.

[deleted]

Yeah I saw it and fixed [email protected]

[deleted]

I know I fixed it.... Plus if you're using the correct links it wouldn't even matter :/ @xxpertHacker

xxpertHacker (613)

@blaster202 Also, quite a coincidence, sending SVG and XHTML:

<svg xmlns='http://www.w3.org/2000/svg' height="27.5">
	<foreignObject width='9999' height='9999'>
		<body xmlns='http://www.w3.org/1999/xhtml'>
			<p style='position: relative; top: -20px; font-family: Monospace; font-size: 20px; font-weight: bolder;'>${txt}</p>
		</body>
	</foreignObject>
</svg>

The same day that I post:
https://repl.it/talk/share/XHTML-Introduction/82997

[deleted]

I just use xhtml from w3.org for embedding html in svgs because I don't think there's any other way to do it @xxpertHacker

[deleted]

Also can you get a mod to unban me from chat on my main account(@Battledash2)? @xxpertHacker

xxpertHacker (613)

@blaster202
It's working flawlessly with Deno, but it's not collecting 100% of the spam because you're using a 50 millisecond interval.

You can make your code shorter and more efficient by removing the loop function, removing the interval, and updating it to this:

fs.writeFileSync("content.txt", ++num, "UTF-8");
// update both, the variable, and the file at once
xxpertHacker (613)

@blaster202 I think there is another way, but there might not be. And XHTML+SVG is super easy, so I don't blame you.

xxpertHacker (613)

@blaster202 What chat, Repl/talk, or the Repl.it Discord?

[deleted]

good idea xD @xxpertHacker

[deleted]

Would it still work without Deno? Like in an html file(or NodeJS)? @xxpertHacker

[deleted]

repl talk (chat) @xxpertHacker

[deleted]

Someone said I was giving out their team code when I wasn't so the mod muted me :/ @xxpertHacker

xxpertHacker (613)

@blaster202 Like I had said, there are 1000 other ways to have done it, I'll probably show off a few more later if you really want.

Omg, I know how to do it even better than I'm doing right now.

My 11200 cap will be no-more.

<a rel="ping">

[deleted]

breh.... plz tell me how and if it's possible in a normal web application @xxpertHacker

[deleted]

I found this:

const arr = new Array(400)
	.fill("https://testnocors.blaster202.repl.co/a/")
	.map(fetch);

await Promise.all(arr);

self.postMessage(null);

but I still can't see why the fetch is being allowed... Can you explain?
@blaster202

[deleted]

keep getting this:

de5d4a0cf2be69d5695d6c5392e023998e57f448.cb4165bf2afdedb298ff.js:1 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': cannot convert to dictionary.
    at de5d4a0cf2be69d5695d6c5392e023998e57f448.cb4165bf2afdedb298ff.js:1
    at Array.map (<anonymous>)
    at <anonymous>:4:10
    at <anonymous>:7:3

@xxpertHacker

[deleted]

Also is there a way to bypass CORS? If so, how can I do it? @xxpertHacker

xxpertHacker (613)

@blaster202 No, you cannot bypass CORS in a browser.

xxpertHacker (613)

@blaster202 A browser has to enforce CORS, a random application can take a good look at a CORS header and completely discard it.
Deno does this, so does Node.js, so do my applications.

xxpertHacker (613)

@blaster202 Ah, time to report a new bug to Deno.

You'll have to use this instead:

new Array(n).fill(null).map(() => fetch(URL));
[deleted]

Is there some sorta exploit to do it?

I found this:

let res = await fetch('https://cors-anywhere.herokuapp.com/https://www.youtube.com');
res = await res.text();

// res is now the html on the page

@xxpertHacker

[deleted]

like maybe a way to override the "Origin" header? @xxpertHacker

xxpertHacker (613)

@blaster202 If you fix the server I'll show how to do it using HTML and JS

[deleted]

Wdym? How is it broken?? @xxpertHacker

[deleted]

Oof... Ok I'm gonna see if I can make it not go offline.. @xxpertHacker

[deleted]

Wdym fix? It's not broken?? @xxpertHacker

[deleted]

I added a new feature to it! You can now modify the counter from Javascript so you don't have to display the number from an image :D

Example Code:

<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
        <script src='https://counter.kcreationstudios.com/s/{CounterID}'></script>
    </head>
    <body>
        This page was viewed <span id='views'>0</span> times!
        <script>
            onload = ()=>{
                Counter.add();
            }
            function update() {
                Counter.get(views=>{
                    document.querySelector('#views').innerText = views;
                });
            }
            setInterval(update, 1000);
            update();
        </script>
    </body>
</html>
AnthonyMouse (64)

this image was from that guy who tried to delete our files @MocaCDeveloper @realTronsi what was his username?

MocaCDeveloper (523)

@AnthonyMouse

Lmao it was? I don’t even remember his pfp.

[deleted]

How is that cheating it? @AnthonyMouse

[deleted]

It just shows the number... Not really a cheat @AnthonyMouse

AnthonyMouse (64)

how did you even know about battledash?

AnthonyMouse (64)

then they’re both a counter because every time I reload the page it ups the count. @blaster202

[deleted]

this adds to the counter and displays nothing

this displays the counter but doesn't actually make it go up
@AnthonyMouse

[deleted]

You can generate your own counter here or here @AnthonyMouse

AnthonyMouse (64)

how do you know battledash? @blaster202

[deleted]

ok......... Blue is sus >:C xD @AnthonyMouse

[deleted]

my profile pic is blue so "Blue is sus" :P @AnthonyMouse

[deleted]

I see you changed your name from Einsten or something lol @AnthonyMouse

realTronsi (842)

@MocaCDeveloper u need to fixx ur bug later since I can't do anything if u dont fix it lel, lmk when you're free

[deleted]

@realTronsi @MocaCDeveloper @AnthonyMouse @Coder100 I dare you to use this counter in one of your codes C:<

[deleted]

updated it @AnthonyMouse

PattanAhmed (1367)

@blaster202 Hi,
Sorry to say, your post doesn't make any sense on Repl.it talk sections.
So, I am reporting this.

Delete this post
Thanks!

[deleted]
[deleted]

You're right.. I should've put it in the "Share" tab @PattanAhmed

[deleted]

lemme fix it

[deleted]

oh wait I can't.. The code is on my main account...... OOF @PattanAhmed

[deleted]

it's glitching and resetting for some reason... @TsunamiOrSumth

Edit:
Or maybe it was just me because I was still testing it?

TsunamiOrSumth (495)

imma singlehandedly get this to 69

angrydoge (311)

THE %$#^ IS THIS COOL THING

[deleted]

I made a view counter on my main account. @dabombdgdzjr

[deleted]

the link didn't work so I updated it @dabombdgdzjr

[deleted]

maybeh C: @AnthonyMouse

AnthonyMouse (64)

Dude. You’re the guy that ruined our whole LITE lang, you know that? @blaster202 @Battledash2

[deleted]

Sorry about that....
The files didn't have that much so it would be easy to remake it. And did you guys say I was giving out your team code because I was 100% not giving it out... @AnthonyMouse

AnthonyMouse (64)

OK, sorry about that. Maybe someone else got the team code. And luckily, you didn’t do a lot a lot of damage. But that still broke up the team. @blaster202

[deleted]

sorry.. @AnthonyMouse

[deleted]

Well I got perm muted for apparently "giving out the code" when I wasn't so......... @AnthonyMouse

[deleted]

I'm banned from the chat @AnthonyMouse

[deleted]

And by the way, they started it by swearing at me... @AnthonyMouse

AnthonyMouse (64)

I get that part, and that was not the best choice from their end, but deleting code is just plain mean. To us, it was like you swearing at US. @blaster202

AnthonyMouse (64)

we worked hard on that code. @blaster202

[deleted]

Thing is, I wasn't swearing. If they hadn't been so rude I wouldn't have deleted the code. I agree I shouldn't of deleted it but ngl they kindda deserved it.. @AnthonyMouse

[deleted]

Bruh... It only had like 7 lines.. Very hard. @AnthonyMouse

AnthonyMouse (64)

also, at the time of erasing (before I restored it and we kept working on it) it had all of our ideas. @blaster202

AnthonyMouse (64)

and anyways, why do you just erase people’s codes? I have a feeling we weren’t the only victim…… @blaster202

[deleted]

nope. you were the only person lol... @AnthonyMouse

AnthonyMouse (64)

Also, it was a bad idea to put it on your profile. @blaster202

AnthonyMouse (64)

It was easy to report you, even if you didn’t do it… @blaster202

[deleted]

Do you watch How to Train Your Dragon? :P @AnthonyMouse

AnthonyMouse (64)

I didn’t know you hadn’t done it… @blaster202

[deleted]

Yeah.. I think the staff need a bit more training on how they investigate things like that. They need to be sure before giving a PERMENANT mute.. @AnthonyMouse

[deleted]

changed it to I eat drinks and drink food. Do you do the same? @AnthonyMouse

[deleted]

How to Train Your Dragon is the best duh :/ @AnthonyMouse

[deleted]

I'm kindda tempted to make a kindda clone of replit for only web development in NodeJS but I'm probably just gonna end up abandoning it like all of my projects xD @AnthonyMouse

AnthonyMouse (64)

we can work together on that maybe @blaster202

[deleted]

but don't be surprised if I completely forget about it lol @AnthonyMouse

AnthonyMouse (64)

lemme get the repl set up. @blaster202

[deleted]

ok... btw I'm a complete noob with NodeJS xD @AnthonyMouse

[deleted]

it's not spam @Coder100

[deleted]

Can you get a mod to unban me from chat? Someone said I was sending out a team code but I wasn't and I got muted anyways... (My main account is Battledash2) @Coder100