Skip to content

Commit

Permalink
Communication finally possible! NO WS!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSnowflakeXD committed Jan 22, 2024
1 parent 15db3dd commit 6c0c9d0
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 8 deletions.
11 changes: 11 additions & 0 deletions performance-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Performance test
A simple performance test designed to compute hash in a high frequent and multithreading. Always be improved!
# Requirement
- Node (lastest)
- Windows (For batch files) or Linux (for .sh files)
# (Possible) Consenquences
1. May cause the system to freeze, lag, unstable and become unresponsive. Please keep track on this thing using Task Manager. If your system become snail, kill it using killswitch.
2. If ran in a long time, it may cause some possible damage to the hardware, decreasing the system durability. Please be careful
3. May be harmful for old PCs, of course
# DENIAL OF RESPONSIBILITY
THE CREATOR HEREBY DENY ALL THE DAMAGE CAUSED BY THIS PROGRAM. PLEASE BE CAREFUL USING THIS AS THIS MAY CAUSE SOME DAMAGE TO YOUR SYSTEM. PLEASE DO NOT CONTACT US FOR HELP OR FIX ISSUES BY THIS PROGRAM.
16 changes: 10 additions & 6 deletions performance-test/hash.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
const crypto = require("crypto")

// Compute hashes
function hash() {
return crypto.createHash("sha512")
.update(crypto.createHash("sha512")
.update(Date.now().toString())
.digest("hex")
.replace(/e/gi, Date.now().toString().repeat(57))
return crypto.createHash("sha3-512").update(crypto.createHash("sha3-512")
.update(crypto.createHash("sha3-512")
.update(crypto.createHmac("sha3-512", crypto.randomBytes(16)).update(crypto.createHash("sha3-512").update(Date.now().toString().repeat(1000)).digest("base64").toString().repeat(5000)).toString().repeat(50000))
.digest("hex")
.replace(/e/gi, Date.now().toString().repeat(80))
.toString()
.repeat(6000))
.digest("hex")
.toString()
.repeat(5005))
.digest("hex")
.toString()
.repeat(5000)
.repeat(5000) // Longer strings might work on stdout (stdout stress)
}

setInterval(() => {
Expand Down
2 changes: 1 addition & 1 deletion performance-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ function multithread() {
multithread()

setInterval(() => {
process.stdout.write(hash() + "\n")
process.stdout.write(hash())
}, 1)
17 changes: 16 additions & 1 deletion performance-test/start.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
@echo off
start "Lagg" node .
REM # | performance-test by Nullified.
REM # | You're responsible for any damage caused by this tool
REM # | Please be careful using this. We (the creators) will
REM # | NOT responsible for any damage caused by this tool.
REM # | Thanks for using. Part of tcp-toolkit
choice /M "Press A to cancel, B to start, C for README.md" /C abc /N
if %errorlevel%==3 (
start readme.md
exit
)
if %errorlevel%==2 (
start "Lagg" node .
)
if %errorlevel%==1 (
exit
)
8 changes: 8 additions & 0 deletions tcp-client/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Designed to run with tcp-toolkit/tcp-server
// NOTICE: PARTIALLY WORK WITH tcp-server UNTOUCHED! PLEASE DON'T CHANGE THE SERVER PORT OTHERWISE IT WONT WORK
// TODO: make it works

/**
Expand Down Expand Up @@ -48,6 +49,13 @@ function UUIDGen() {
return uuid.join('-')
}

const UUID = UUIDGen()

const client = net.createConnection(55674, "0.0.0.0", () => {
console.log("Connected to server.")
client.write("Hi! I am " + UUID)
})

// setInterval(() => {
// process.stdout.write(UUIDGen() + "\n")
// }, 1)
30 changes: 30 additions & 0 deletions tcp-server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// TCP Server designed to wirk with 0xSnowflakeXD/tcp-toolkit/tcp-client
// Who know how it works?
// I'll provide a wiki soon as i officially release this.
// NOTICE: tcp-client ONLY PARTIALLY WORK WITH tcp-server UNTOUCHED! PLEASE DON'T CHANGE THE SERVER PORT OTHERWISE IT'LL CORRUPT!

const net = require('net')
const fs = require('fs')
const path = require('path')
const { stdout: stdout, stdin: stdin } = require('process')

if(!fs.existsSync(path.resolve('./cfg.json'))) {
fs.appendFileSync(path.resolve('./cfg.json'), JSON.stringify({backlog: 256, port: 55674}))
}
const options = require('./cfg.json')

const server = net.createServer()
server.on("connection", (socket) => {
stdout.write("Client connected!" + '\n')
socket.on("data", (d) => {
console.log(d.toString('utf-8'))
})
socket.on("end", () => {
console.log("Ended connection!")
})
socket.on("error", (err) => {})
})

server.listen(options.port, '0.0.0.0', options.backlog, () => {
stdout.write('Server started! Listening on ' + server.address().address + ':' + server.address().port + '\n')
})
19 changes: 19 additions & 0 deletions tcp-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "tcp-server",
"version": "1.0.0",
"description": "TCP Server",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "._thunderstrike",
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/0xSnowflakeXD/tcp-toolkit.git"
},
"bugs": {
"url": "https://github.com/0xSnowflakeXD/tcp-toolkit/issues"
},
"homepage": "https://github.com/0xSnowflakeXD/tcp-toolkit#readme"
}

0 comments on commit 6c0c9d0

Please sign in to comment.