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.
Coolline is a readline-like library written in pure Ruby.
It offers all of the core readline features, but with a cleaner, simpler implementation, and the ability to easily customize its behaviour.
Customizations include: modifying all key bindings, binding keys custom functions, full control over history and tab completion, and control over what's displayed to the user (transforms).
If you don't need anything fancy, it can work like Ruby's built-in Readline.readline
:
result = Coolline.readline
But, of course you want something fancy, otherwise you'd be using readline
!
Here's how to create a simple REPL with live syntax highlighting and tab completion:
require 'coolline'
require 'coderay'
require 'pp'
cool = Coolline.new do |c|
# Before the line is displayed, it gets passed through this proc,
# which performs syntax highlighting.
c.transform_proc = proc do
CodeRay.scan(c.line, :ruby).term
end
# Add tab completion for constants (and classes)
c.completion_proc = proc do
word = c.completed_word
Object.constants.map(&:to_s).select { |w| w.start_with? word }
end
# Alt-R should reverse the line, because we like to look at our code in the mirror
c.bind "\er" do |cool|
cool.line.reverse!
end
end
loop do
# READ
line = cool.readline
# EVAL
obj = eval(line)
# PRINT
print "=> "
pp obj
# LOOP
end
Coolline automatically loads a config file before starting, which allows adding
new key bindings to it. The file is just a chunk of arbitrary ruby code located
at $XDG_CONFIG_HOME/coolline/coolline.rb
.
Coolline.bind "\C-z" do |cool|
puts "Testing key binding with #{cool}!"
end
gem install coolline
Note: If your Ruby version is less than 1.9.3, you also need to install the io-console
gem.
FAQs
Unknown package
We found that coolline demonstrated a not healthy version release cadence and project activity because the last version was released 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
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.