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.
Remedy is a console interaction framework along the lines of Curses written in pure Ruby. It is modular, making it easy to use what you need and ignore the rest.
If you have any suggestions or find any bugs, drop them in GitHub/issues so I can keep track of them. Thanks!
Add this line to your application's Gemfile:
gem 'remedy'
If you're only going to use part of Remedy, you can tell Bundler to not automatically require the whole thing:
gem 'remedy', require: false
And then execute:
$ bundle
Or install it yourself as:
$ gem install remedy
Remedy makes a few different classes and modules available to allow straight forward half-duplex communication with users via the console.
There are objects for input as well as output, including low level console keystroke reads and screen drawing.
The Interaction
object wraps raw keyboard reads and streamlines some aspects of accepting keyboard input.
For instance to get a keypress from the terminal and display it:
include Remedy
user_input = Interaction.new
user_input.loop do |key|
puts key
end
Viewport
is the object that draws on your screen, you can give it any compatible Remedy::Partial
object, or something that responds like one.
include Remedy
joke = Content.new
joke << "Q: What's the difference between a duck?"
joke << "A: Purple, because ice cream has no bones!"
screen = Viewport.new
screen.draw joke
Content in Remedy::Partial
s will be truncated as needed to accommodate the header and footer and the dimensions of the console. You can also specify the cursor/scroll position of the content being drawn, and when specifying headers or footers, you must.
include Remedy
title = Partial.new
title << "Someone Said These Were Good"
jokes = Content.new
jokes << %q{1. A woman gets on a bus with her baby. The bus driver says: 'Ugh, that's the ugliest baby I've ever seen!' The woman walks to the rear of the bus and sits down, fuming. She says to a man next to her: 'The driver just insulted me!' The man says: 'You go up there and tell him off. Go on, I'll hold your monkey for you.'}
jokes << %q{2. I went to the zoo the other day, there was only one dog in it, it was a shitzu.}
disclaimer = Partial.new
disclaimer << "According to a survey they were funny. I didn't make them."
screen = Viewport.new
screen.draw jokes, Size.new(0,0), title, disclaimer
If you want easy access to some lower level console commands, you can use Console
.
The most interesting function in my opinion is the callback that gets triggered when the user resizes the console window.
include Remedy
screen = Viewport.new
Console.set_console_resized_hook! do |size|
notice = Partial.new
notice << "You just resized your screen!\n\nNew size:"
notice << size
screen.draw notice
end
Remedy was originally written for my own console-based game which was sort of like Dwarf Fortress. Most of the project files were lost, but since Remedy was extracted from it and open-sourced it has lived on.
Here are some projects that use Remedy:
Check them out!
The examples
directory has a couple of running implementations to get you started!
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that remedy 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
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.