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.
github.com/sacOO7/goWebsocket
Gorilla websocket based simplified client implementation in GO.
This client provides following easy to implement functionality
To install use
go get github.com/sacOO7/gowebsocket
Create instance of Websocket
by passing url of websocket-server end-point
//Create a client instance
socket := gowebsocket.New("ws://echo.websocket.org/")
Important Note : url to websocket server must be specified with either ws or wss.
//This will send websocket handshake request to socketcluster-server
socket.Connect()
package main
import (
"log"
"github.com/sacOO7/gowebsocket"
"os"
"os/signal"
)
func main() {
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
socket := gowebsocket.New("ws://echo.websocket.org/");
socket.OnConnected = func(socket gowebsocket.Socket) {
log.Println("Connected to server");
};
socket.OnConnectError = func(err error, socket gowebsocket.Socket) {
log.Println("Received connect error ", err)
};
socket.OnTextMessage = func(message string, socket gowebsocket.Socket) {
log.Println("Received message " + message)
};
socket.OnBinaryMessage = func(data [] byte, socket gowebsocket.Socket) {
log.Println("Received binary data ", data)
};
socket.OnPingReceived = func(data string, socket gowebsocket.Socket) {
log.Println("Received ping " + data)
};
socket.OnPongReceived = func(data string, socket gowebsocket.Socket) {
log.Println("Received pong " + data)
};
socket.OnDisconnected = func(err error, socket gowebsocket.Socket) {
log.Println("Disconnected from server ")
return
};
socket.Connect()
for {
select {
case <-interrupt:
log.Println("interrupt")
socket.Close()
return
}
}
}
socket.SendText("Hi there, this is my sample test message")
token := make([]byte, 4)
// rand.Read(token) putting some random value in token
socket.SendBinary(token)
socket.Close()
socket.RequestHeader.Set("Accept-Encoding","gzip, deflate, sdch")
socket.RequestHeader.Set("Accept-Language","en-US,en;q=0.8")
socket.RequestHeader.Set("Pragma","no-cache")
socket.RequestHeader.Set("User-Agent","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36")
socket.ConnectionOptions = gowebsocket.ConnectionOptions {
Proxy: gowebsocket.BuildProxy("http://example.com"),
}
socket.ConnectionOptions = gowebsocket.ConnectionOptions {
UseSSL:true,
UseCompression:true,
Subprotocols: [] string{"chat","superchat"},
}
Apache License, Version 2.0
FAQs
Unknown package
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.