Send a load of requests with nodejs using cluster and with/without Tor for anonymisation
MIT License
⚠️ Disclamer, This repo has been created for an educative purpose. I am not related to any person who might use this project for the wrong reason. ⚠️
Check your node version, it must be 17.6.0, otherwise you can use nvm
as follow
nvm install 17
nvm use 17
The following steps are optional and only needed if you want to use the anonymisation
First, you need to install Tor
on your machine since the requests will transit through
it in order to get anonymous requests.
# On Mac OS
brew install tor
Or follow the link here or here
you can then find the configuration file located here (on mac os)
/usr/local/etc/tor/torrc.sample
. You can remove the .sample
to make it effective.
Finally, you can start your tor service
# On Mac OS
tor & # & make tor running as a background process
alternativaly, you can also install the Tor browser
Start by populating targets.json
with the websites you want to test.
Here is how to fill the json file
{
"data": [
"http://127.0.0.1:80"
]
}
Update the config.json
file to customise the test.
Here is the example config.json
.
{
"requestPerBatch": 20,
"logEveryMs": 150,
"delayBetweenBatch": 500,
"cpuUsageRatio": 1,
"socksProxies": ["socks5h://127.0.0.1:9050"]
}
The
socksProxies
configuration is optional and correspond to the anonymisation using TOR as explained in the Getting started section. It correspond to a set of Tor sockets that will be used as proxy for the requests.
Run the following commands to be able to launch your servers and the load test on it.
npm run start-server:test
npm run start
this command npm run start-server:test
will start a local sever on which you can try to
send some requests. Find your public IP and open a port on your router to redirect
the request to your local server. Then, add your public IP and port prefixed with
the protocol in target.json
file.
To really start the load test, you only need to fill your target.json
file with
the websites you want to test and eventually update your config.json
file.
then run the command npm run start
only.
Contributions are welcome! You can look at the contribution guidelines