
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Simple TCP/IP Communication Lib
This lib creates a wrapper of sorts around the node.js's net.createServer and net.connect. It sets up encrypted communication between a client and server using DiffieHellman Key Exchange, and aes-256-cbc encryption from node.js's crypto. It also takes care of message compression and splitting.
##Install
npm install ca-net
##API
ca-net.client(Host, Port, API, callback)
Wrapper for net.connect
Parameters
Host: string, Address of Server
Port: int, Port of Server
API: function, [optional] Called on('data') will pass arguments
objCon,Buffercallback: function, [optional] Called on('connect') will pass arguments
net.Socket,objCon
ca-net.server(Port, API, callback)
Wrapper for net.createServer
Parameters
Port: int, Port to listen on
API: function, [optional] Called on('data') will pass arguments
objCon,Buffercallback: function, [optional] Called on('listening') will pass arguments
net.Server,{'token':objCon}
objData
internal class
ca-net.objData.objData(objCon, data)
internal class
Parameters
objCon: objCon, internal class
data: Buffer, internal class
ca-net.objData.destruct()
internal function called at the tail of a recursive
objData.combine,objData.unpack,objData.packor whenobjDatatimes out onobjData.ttltimeout
ca-net.objData.combine(aObjData)
internal function called to join together data that has been split by
objData.packParameters
aObjData: objData, internal function called to join together data that has been split by
objData.pack
ca-net.objData.send(data)
internal function Prepends
dataBuffer with length and writes it socketParameters
data: Buffer, Data to send
ca-net.objData.recieve()
internal function Processes Prepended length and split
dataBuffer if longer than length calls .unpack() ondatacreates newobjDatafor remainingdataand calls .recieve() on newobjData
ca-net.objData.pack(c, z, s)
internal function processes
objData.databefore callingobjData.sendzip? > encrypt? > split?Parameters
c: bool, [optional] toEncrypt flag
z: bool, [optional] toZip flag
s: bool, [optional] Special Flag used for pubKey syncing
ca-net.objData.unpack()
internal function process
objData.databefore passingobjData.datatoobjData.objCon.APIjoin? > decrypt? > unzip?
objCon
internal class
ca-net.objCon.objCon(con, token, address, API)
internal class
Parameters
con: net.Socket, internal class
token: string, [optional]
address: string, [optional]
API: function, [optional]
ca-net.objCon.API(c, r)
Handles encryption setup on initial connection
Parameters
c: objCon, Handles encryption setup on initial connection
r: Buffer, Handles encryption setup on initial connection
ca-net.objCon.destruct()
destroys objCon on time out
ca-net.objCon.keepAlive()
updates
objCon.ttlto keep connection from self destructing
ca-net.objCon.send(msg, flg)
send messages to remote connection
Parameters
msg: Buffer, Message to send to remote connection
flg: bool, internal var for connection initilization
##Known Issues:
Fixed ... needs updated in npm
...\ca-net\index.js:468 delete tConns[this.token]; ^ ReferenceError: tConns is not defined
##TODO:
Coding:
create objCon class for uniformity betwen Cli & Servcreate objData class for simulated low level exchangeobjData Send/RecieveobjData ZippingobjData EncryptionobjData pubKey Sync- add functionality for externaly checking if objCon.destruct() has been called
- change .onError() so that host script is informed
Testing / Doc:
Test Send / RecieveTest ZippingTest EncryptionTest Splittingremove cb from source & testingupdate testing w/ random dataTest Zip > Encrypt > Split > Send\Recieve > Join > Decrypt > UnzipTest objConDoc API- Add Example Code
Eventualy:
- Rewrite objData.pack() and objData.unpack() to use a fixed length binnary header instead of dirty string manipulation
####Disclaimer: This is a toy project, and should not be used for production grade anything ... use at your own risk
FAQs
Network Communication Mod
We found that ca-net demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.