diff --git a/README.md b/README.md index 6e79635..9ee25da 100644 --- a/README.md +++ b/README.md @@ -14,15 +14,22 @@ Its to make this counter above go to 999,999,999 and see what happens.. maybe we ## Demo -![Screencast-from-2024-03-23-19-35-30](https://github.com/Kokolekion/CounterProject/assets/65463088/b7b7f94b-7a6d-4465-8cdd-97992e36d82b) +![The script running on macOS](demo.gif) ## Installation +A Linux/macOS environment is preferred. You can use WSL if you're running Windows Install the following dependencies: -**Requests** +**[Bun](https://bun.sh)** ```bash - pip install requests + curl -fsSL https://bun.sh/install | bash +``` +Node.js would be used for this, but Bun is faster. + +# Running +```bash + ./run.sh ``` ## Contributors @@ -37,12 +44,17 @@ and everyone running this code for some reason XD #### Is this fastest way possible to complete this project? -Most probably not but i sure hope someday we get better and faster ways of doing this! XD +Most probably not but ~~i sure hope someday we get better and faster ways of doing this!~~ the new js version is faster than the python one, but could still be faster XD + +#### Why is there both `run.sh` and `spam.js`? +Running `bun spam.js` will work, but bun seems to constantly memory leak, hogging gigabytes of memory. `run.sh` waits 60 seconds and #### Is this safe, Will i get in trouble of sending so many requests? Yes, the owner of the site has said that its okay, From the owner: "break this :3" +#### Is the code AI generated? +Yes. ## Licenses Used diff --git a/demo.gif b/demo.gif new file mode 100644 index 0000000..651dca7 Binary files /dev/null and b/demo.gif differ diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..87c7093 --- /dev/null +++ b/run.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Function to handle SIGINT signal (Ctrl+C) +sigint_handler() { + # Kill the process if it's running + if [ -n "$process_id" ]; then + kill "$process_id" + fi + exit 0 +} + +# Trap SIGINT signal (Ctrl+C) and call sigint_handler function +trap sigint_handler SIGINT + +# Infinite loop +while : +do + # Start the process (replace "your_process_command" with the actual command) + bun spam.js & + + # Get the process ID of the last background process + process_id=$! + + # Wait for 1 minute + sleep 60 + + # Kill the process + kill $process_id + + # Optionally, wait for a brief moment to ensure the process is killed before restarting + sleep 1 +done \ No newline at end of file diff --git a/spam.js b/spam.js new file mode 100644 index 0000000..d99b33e --- /dev/null +++ b/spam.js @@ -0,0 +1,30 @@ +const http = require('http'); + +let requestsSent = 0; + +function sendRequest(url) { + const options = { + headers: { + 'Referer': 'https://whathow.neocities.org' + } + }; + + http.get(url, options, (res) => { + console.log(`Request to ${url} - Status code: ${res.statusCode}`); + requestsSent++; + console.log(`${requestsSent} requests sent so far.`); + }).on('error', (err) => { + console.error(`Error sending request: ${err.message}`); + }); +} + +function continuousRequests(url) { + setInterval(() => { + for (let i = 0; i < 50; i++) { + sendRequest(url); + } + }, 100); +} + +const url = "https://counter11.freecounterstat.com/private/counter.php?c=pdz4dufhlf9qlk4krksnw7twxbhlez2e&init=1711161297330&init_freecounterstat=0&library=library_counters&coef=0.75&type=193&lenght=9&pv=0"; +continuousRequests(url); diff --git a/spam.py b/spam.py deleted file mode 100644 index e8a6f0e..0000000 --- a/spam.py +++ /dev/null @@ -1,52 +0,0 @@ -import requests -import threading -import time - -countsuc = 0 -countfail = 0 -s = requests.Session() - -def trigger_php_code(url,threadnumberid): - global countsuc - global countfail - while True: - try: - start_time = time.time() - response = s.head(url) - if response.status_code == 200: - countsuc = countsuc + 1 - end_time = time.time() - elapsed_time = end_time - start_time - print(f"Success | SUC: {countsuc} | FAIL: {countfail} | Elapsed time: {elapsed_time:.1f}s | ID: {threadnumberid}") - None - else: - countfail = countfail + 1 - print(f"Failed | SUC: {countsuc} FAIL: {countfail} ID: {threadnumberid}") - None - except Exception as e: - countfail = countfail + 1 - # print(f"An error occurred for ID: {threadnumberid} {e}") - None - -url = "http://counter11.freecounterstat.com/private/counter.php?c=pdz4dufhlf9qlk4krksnw7twxbhlez2e&init=1711160585473&init_freecounterstat=0&library=library_counters&coef=0.75&type=193&lenght=9&pv=0" - -def trigger_php_code_threaded(num_threads): - threads = [] - - for i in range(num_threads): - threadnumberid = i - thread = threading.Thread(target=trigger_php_code, args=(url,threadnumberid)) - threads.append(thread) - thread.start() - print(f"ID: {threadnumberid} Started!") - - for thread in threads: - thread.join() - -num_threads = 450 - -try: - while True: - trigger_php_code_threaded(num_threads) -except KeyboardInterrupt: - print("Execution interrupted by user.") \ No newline at end of file