Skip to content

Commit

Permalink
Add development scripts (see description) 🔨
Browse files Browse the repository at this point in the history
- Removed nothing.txt 🔥
- Improved security for username selection 🔒
- Fixed an issue where you can't send empty message, instead, it move your cursor back like nothing happened 🐛
- Visuality updates 💄 🍀
- Dev build scripts added 🔨
  • Loading branch information
0xSnowflakeXD committed Mar 23, 2024
1 parent 7f3532f commit e021a3d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
.git
client.exe
server.exe
cfg.json
cfg.json
.gitignore
17 changes: 14 additions & 3 deletions tcp-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ try {
* @returns
*/
nameVerificator(input="") {
let _verfrx = /[`~!@#$%^&*()_+={}\[\]|\\:;“’<,>.?๐฿]+/gmi
let _verfrx = /[`'"~!@#$%^&*()_+={}\[\]|\\:;“’<,>.?๐฿\s]+/gmi
if(!_verfrx.test(input)) {
return false
} else {
Expand Down Expand Up @@ -244,8 +244,9 @@ try {
*/
async function listener(d=new Buffer()) {
NAME = d.toString().trim().slice(0,12)
if(clnt.nameVerificator(NAME)) {
process.stdout.moveCursor(-d?.length, -2)
if(clnt.nameVerificator(NAME) || NAME.length < 1) {
process.stdout.moveCursor(-d?.length, -3)
process.stdout.clearScreenDown()
process.stdout.write("Your username contain disallowed special characters.\n")
return;
}
Expand Down Expand Up @@ -296,6 +297,10 @@ try {
if(a !== true) {
return false
}
if(d.toString().trim().length < 1) {
process.stdout.moveCursor(0, -2)
return false
}
// New payload
const pl = new Payload(d.toString("utf-8").trim(), clnt.getUUID())
if(pl.content === "\u0003") { // If raw mode was true, this is going to be useed
Expand All @@ -304,6 +309,12 @@ try {
process.stdout.moveCursor(-d.length, -2) // Stay in place, move to the very left
process.stdout.clearLine() // Clear line
clnt.send(pl) // Send payload to the server. It seem to be impossible to send a class, right?
})
process.on("beforeExit", (_) => {
clnt.getCurrSocketInterface().destroySoon()
})
process.on("exit", (_) => {
clnt.getCurrSocketInterface().destroySoon()
})
});
} catch(e) {
Expand Down
27 changes: 0 additions & 27 deletions tcp-client/nothing.txt

This file was deleted.

5 changes: 5 additions & 0 deletions tcp-client/tasks/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
cd ../
pkg index.js -t node18-win -o client
echo Sucessful build!
pause
2 changes: 1 addition & 1 deletion tcp-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Parsing packets according to TTELCP (TCP Toolkit Exclusively Live Communication
// Referrence only!
try {
let data = d.toString("utf-8")
let InvalidCharsRegEx = /[`~!@#$%^&*()_+={}\[\]|\\:;“’<,>.?๐฿]+/gmi
let InvalidCharsRegEx = /[`'"~!@#$%^&*()_+={}\[\]|\\:;“’<,>.?๐฿\s]+/gmi
let UUIDValidateRegEx = /([a-f]|[0-9]){8}-([a-f]|[0-9]){4}-([a-f]|[0-9]){4}-([a-f]|[0-9]){8}/gm
if(!JSON.parse(data).name || !!InvalidCharsRegEx.test(JSON.parse(data).name) || JSON.parse(data).name.length > 12) {
socket.end(() => {console.log("Ended %s", socket.address)})
Expand Down
5 changes: 5 additions & 0 deletions tcp-server/tasks/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
cd ../
pkg index.js -t node18-win -o server
echo Sucessful build!
pause

0 comments on commit e021a3d

Please sign in to comment.