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.
This library wraps GNU Go's version of the Go Text Protocol or GTP. It runs GNU Go in a separate process and communicates with the program over a pipe using the GTP protocol. This makes it easy to:
This library is available as a gem, so you can install it with a command like:
gem install go_gtp
The above command may need super user privileges.
This library requires an install of GNU Go to communicate with. You will need to install that separately.
This code would load an SGF file and show the current state of the game in that file:
require "go/gtp"
go = Go::GTP.run_gnugo
go.loadsgf("game.sgf") or abort "Failed to load file"
puts go.showboard
go.quit
This shows the two main types of GTP methods. Methods like showboard()
return the indicated content. In this case, you actually get back a Go::GTP::Board
object which can indexed into, or just converted into a String
for display as it is used here.
Other methods, like loadsgf()
, are just called for their side effects and they don't return anything. For these, you get a boolean result telling you if the call succeeded (true
) or triggered an error (false
). You can always check the success?()
of either type of call after the fact and retrieve the last_error()
when there is one, so these return values are just a convenience. As another convenience, these boolean methods can be called with Ruby's query syntax as well: loadsgf?()
.
When working with a GNU Go process, it's a good idea to remember to call quit()
so the pipe can be closed. One way to ensure that happens is to use the block form of run_gnugo()
to have it done for you. Given that, the following example is another way to handle loading and displaying a game:
require "go/gtp"
Go::GTP.run_gnugo do |go|
go.loadsgf?("game.sgf") or abort "Failed to load file"
puts go.showboard
end # quit called automatically after this block
You can customize how GNU Go is invoked, by passing parameters to run_gnugo()
. Probably the two most useful are the :directory
where the executable lives and any :arguments
you would like to pass it. For example:
require "go/gtp"
go = Go::GTP.run_gnugo( directory: "/usr/local/bin",
arguments: "--boardsize 9" )
# ...
Of course, you could also set the board size after the connection is open with go.boardsize(9)
.
See the example directory for more ideas about how to use this library.
The method names are literally the command names right out of the GTP documentation. That's intended to make it easy to figure out what you can do with this library. Return values are Rubified into nice objects, when it makes sense to do so.
FAQs
Unknown package
We found that go_gtp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.