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.
github.com/sourcegraph/go-webkit2
go-webkit2 provides Go bindings for the WebKitGTK+ 2 API. It permits headless operation of WebKit as well as embedding a WebView in a GTK+ application.
You can specify Go build tags to omit bindings in
gotk3 for later versions of GTK
(e.g., go build -tags gtk_3_10
).
sudo apt-get install libwebkit2gtk-3.0-dev
Pass -tags gtk_3_10
to the go tool if you have GTK 3.10 installed.
sudo add-apt-repository ppa:gnome3-team/gnome3-staging
sudo apt-get update
sudo apt-get install libwebkit2gtk-3.0-dev
sudo add-apt-repository ppa:gnome3-team/gnome3
sudo apt-get update
sudo apt-get install libwebkit2gtk-3.0-dev
sudo pacman -S webkitgtk
Make sure you install WebKitGTK+ 2, not version 1. After installation, you
should have an include file that satisfies #include <webkit2/webkit2.h>
.
package webkit2_test
import (
"fmt"
"runtime"
"github.com/gotk3/gotk3/glib"
"github.com/gotk3/gotk3/gtk"
"github.com/sourcegraph/go-webkit2/webkit2"
"github.com/sqs/gojs"
)
func Example() {
runtime.LockOSThread()
gtk.Init(nil)
webView := webkit2.NewWebView()
defer webView.Destroy()
webView.Connect("load-failed", func() {
fmt.Println("Load failed.")
})
webView.Connect("load-changed", func(_ *glib.Object, i int) {
loadEvent := webkit2.LoadEvent(i)
switch loadEvent {
case webkit2.LoadFinished:
fmt.Println("Load finished.")
fmt.Printf("Title: %q\n", webView.Title())
fmt.Printf("URI: %s\n", webView.URI())
webView.RunJavaScript("window.location.hostname", func(val *gojs.Value, err error) {
if err != nil {
fmt.Println("JavaScript error.")
} else {
fmt.Printf("Hostname (from JavaScript): %q\n", val)
}
gtk.MainQuit()
})
}
})
glib.IdleAdd(func() bool {
webView.LoadURI("https://www.google.com/")
return false
})
gtk.Main()
// output:
// Load finished.
// Title: "Google"
// URI: https://www.google.com/
// Hostname (from JavaScript): "www.google.com"
}
See the documentation and the test files for usage information and examples.
For more information about the underlying WebKitGTK+ 2 API, refer to the WebKit2 docs.
The included webkit-eval-js
program runs the contents of a JavaScript file in the context of
a web page. Run with:
$ go get -tags gtk_3_10 github.com/sourcegraph/go-webkit2/webkit-eval-js
$ webkit-eval-js https://example.com scriptfile.js
For example:
$ echo document.title | webkit-eval-js https://google.com /dev/stdin
"Google"
The following projects use go-webkit2:
go test ./webkit2
Note: The tests require an X display. If you are not running in a graphical environment, you can use Xvfb:
Xvfb :1 &
export DISPLAY=:1
go test ./webkit2
See the AUTHORS file for a list of contributors.
Submit contributions via GitHub pull request. Patches should include tests and should pass golint.
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
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.