
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Another interaction library for Ruby, with an interesting twist: the user can go back in time to re-answer questions.
Copyright 2011, Alex Suraci. Licensed under the MIT license, please see the LICENSE file. All rights reserved.
require "rubygems"
require "interact"
class MyInteractiveClass
include Interactive
def run
first = ask "Some question?"
second = ask "Boolean default?", :default => true
third = ask "Stringy default?", :default => "foo"
fourth = ask "Multiple choice?", :choices => ["foo", "bar", "fizz"]
some_mutation = []
fifth = ask "Multiple choice, indexed list?",
:choices => ["foo", "bar", "fizz"],
:indexed => true
some_mutation << fifth
finalize
sixth = ask "Password", :echo => "*", :forget => true
p [first, second, third, fourth, fifth, sixth]
end
end
MyInteractiveClass.new.run
After running this, the user will be prompted with each question one-by-one. Interact supports basic editing features such as going to the start/end, editing in the middle of the text, backspace, forward delete, and backwards-kill-word.
In addition, the user can hit the up arrow to go "back in time" and re-answer questins.
Make sure you call finalize
after doing any mutation performed based on user
input; this will prevent them from rewinding to before this took place. Or you
can just disable rewinding if it's too complicated (see below).
Anyway, here's an example session:
Some question?: hello<enter>
Boolean default? [Yn]: <up>
Some question? ["hello"]: trying again<enter>
Boolean default? [Yn]: n<enter>
Stringy default? ["foo"]: <up>
Boolean default? [yN]: y<enter>
Stringy default? ["foo"]: <enter>
Multiple choice? ("foo", "bar", "fizz"): f<enter>
Please disambiguate: foo or fizz?
Multiple choice? ("foo", "bar", "fizz"): fo<enter>
1: foo
2: bar
3: fizz
Multiple choice, indexed list?: 2<enter>
Password: ******<enter>
["trying again", true, "foo", "foo", "bar", "secret"]
Note that the user's previous answers become the new defaults for the question if they rewind.
Interact provides a nifty user-friendly "rewinding" feature, which allows the
user to go back in time and re-answer a question. If you don't want this
feature, simply call disable_rewind
in your class. You can re-enable it with
enable_rewind
in subclasses.
class NoRewind
include Interactive
disable_rewind
def run
res = ask "Is there no return?", :default => true
if res == rewind_enabled?
puts "You're right!"
else
puts "Nope! It's disabled."
end
end
end
NoRewind.new.run
FAQs
Unknown package
We found that interact 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.