Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
org.webbitserver:webbit
Advanced tools
Prebuilt JARs are available from the central Maven repository or the Sonatype Maven repository.
Alternatively, you can get the latest code from Git and build it yourself:
git clone git://github.com/webbit/webbit.git
cd webbit
Build is done with make
. On OS-X and Linux this should work out of the box. On Solaris, use gmake
. On Windows you will need Cygwin.
make
mvn install
Start a web server on port 8080 and serve some static files:
WebServer webServer = WebServers.createWebServer(8080)
.add(new StaticFileHandler("/web")) // path to web content
.start()
.get();
That was easy.
Now let's build a WebSocketHandler.
public class HelloWebSockets extends BaseWebSocketHandler {
private int connectionCount;
public void onOpen(WebSocketConnection connection) {
connection.send("Hello! There are " + connectionCount + " other connections active");
connectionCount++;
}
public void onClose(WebSocketConnection connection) {
connectionCount--;
}
public void onMessage(WebSocketConnection connection, String message) {
connection.send(message.toUpperCase()); // echo back message in upper case
}
public static void main(String[] args) {
WebServer webServer = WebServers.createWebServer(8080)
.add("/hellowebsocket", new HelloWebSockets())
.add(new StaticFileHandler("/web"));
webServer.start();
System.out.println("Server running at " + webServer.getUri());
}
}
And a page that uses the WebSocket (web/index.html)
<html>
<body>
<!-- Send text to websocket -->
<input id="userInput" type="text">
<button onclick="ws.send(document.getElementById('userInput').value)">Send</button>
<!-- Results -->
<div id="message"></div>
<script>
function showMessage(text) {
document.getElementById('message').innerHTML = text;
}
var ws = new WebSocket('ws://' + document.location.host + '/hellowebsocket');
showMessage('Connecting...');
ws.onopen = function() { showMessage('Connected!'); };
ws.onclose = function() { showMessage('Lost connection'); };
ws.onmessage = function(msg) { showMessage(msg.data); };
</script>
</body>
</html>
mvn clean test
or
make clean test
Autobahn is a WebSocket server implemented in Python that comes with an extensive test suite that can be used to test other WebSocket servers as well.
We're using it to test Webbit.
Installing Autobahn
git submodule update --init
Running Autobahn tests
In shell A:
make echo
In shell B:
make autobahn
Open reports/servers/index.html
to see the results.
FAQs
A Java event based WebSocket and HTTP server
We found that org.webbitserver:webbit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.