Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Simple websocket server and client with callback-based API.
Table of Contents
pip install simple-websockets
Here is a example of websocket echo server:
from simplews import SimpleWSServer
server = SimpleWSServer(host="",
port=8765,
print_details=True, # Print basic logs
print_messages=True) # Print every message received
@server.on_connect
async def on_connect(ws): # called when a client connects
print(f'Client {ws.remote_address} connected')
@server.on_message
async def on_message(ws, message): # called when a message is received from a client
await ws.send(message) # send the message back to the client
@server.on_close
async def on_close(ws): # called when a client disconnects
print(f'Client {ws.remote_address} disconnected')
server.serve() # serve forever
Here is a example of websocket client:
from simplews import SimpleWSClient
client = SimpleWSClient(uri="ws://localhost:8765",
print_details=True, # Print basic logs
print_messages=True) # Print every message received
@client.on_connect
async def on_connect(ws): # called when the connection is established
print(f'Connected to {ws.remote_address}')
@client.on_message
async def on_message(ws, message): # called when a message is received
print(f'Received: {message}')
@client.on_close
async def on_close(ws): # called when the connection is closed
print(f'Connection to {ws.remote_address} closed')
client.connect() # connect to the server
async
.await
.ws
argument, see WebSocketServerProtocol for server and WebSocketClientProtocol for client.await
is needed.simple-websockets
is distributed under the terms of the GPL-3.0-only license.
FAQs
Simple websocket server and client with callback-based API.
We found that simple-websockets 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.