Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
tcpw
(TCP Wait) is a tool that waits until TCP endpoints are open.
It is useful for synchronizing the spin-up of interdependent services, such as linked docker containers.
That is yet another alternative to wait-for-it.sh
.
-ldflags="-s -w" -trimpath
and upx
PyPI
-a google.com:80 -a booble.gum:8080 ...
-on f -a google.com:9999 echo "Endpoint is down"
-i 500ms
timeout/interval
in different time units: ns,ms,s,m,h
Download executable file:
sh -c "wget -O tcpw https://raw.githubusercontent.com/jackcvr/tcpw/main/$(uname -m)/tcpw/tcpw && chmod +x tcpw"
or:
pip install tcpw
pip install tcpw[arm64]
pip install tcpw[armv7l]
Usage: tcpw [-t timeout] [-i interval] [-on (s|f|any)] [-q] [-v] [-a host:port ...] [command [args]]
-a value
Endpoint to await, in the form 'host:port'
-i duration
Interval between retries in format N{ns,ms,s,m,h} (default 1s)
-on string
Condition for command execution. Possible values: 's' - after success, 'f' - after failure, 'any' - always (default "s")
-q Do not print anything (default false)
-t duration
Timeout in format N{ns,ms,s,m,h}, e.g. '5s' == 5 seconds. Zero for no timeout (default 0)
-v Verbose mode (default false)
command args
Execute command with arguments after the test finishes (default: if connection succeeded)
Wait 5 seconds for port 80 on www.google.com
, and if it is available, echo the message Google is up
:
$ tcpw -t 5s -a www.google.com:80 echo "Google is up"
2024/08/26 20:06:47.209012 successfully connected to www.google.com:80
Google is up
Next command waits 2 seconds for www.google.com:80 and localhost:5000, checking them every 500 milliseconds
with enabled verbose mode and executes echo
regardless of the result:
$ tcpw -t 2s -i 500ms -v -on any -a www.google.com:80 -a localhost:5000 echo "Printed anyway"
2024/08/26 20:08:24.153240 connecting to localhost:5000...
2024/08/26 20:08:24.153327 connecting to www.google.com:80...
2024/08/26 20:08:24.153541 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/26 20:08:24.179927 successfully connected to www.google.com:80
2024/08/26 20:08:24.654984 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/26 20:08:25.155997 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/26 20:08:25.661397 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/26 20:08:26.161613 dial tcp: lookup localhost: i/o timeout
timeout error
Printed anyway
FAQs
Wait until TCP endpoints are open
We found that tcpw-arm64 demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.