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.
A simple tree structure for working with FilePath objects in ruby. I simply took the simple_tree module from https://github.com/ealdent/simple-tree and hacked it into Pathname from the std-lib. This means you get all the awesome features of working with Pathname, as well as making it easy to examine a filepath's ancestors and descendants.
install with: gem install filetree
require "filetree"
tree = FileTree.new('/home/user/test/test1/test2')
# => #<FileTree:/home/user/test/test1/test2>
tree.parent
# => #<FileTree:/home/user/test/test1>
tree.ancestors
# => [#<FileTree:/home/user/test>,
# #<FileTree:/home/user>,
# #<FileTree:/home>,
# #<FileTree:/>]
tree.descendants
# => [#<FileTree:/home/user/test/test1/test2/testee>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4/myfile.txt>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3/no>,
# #<FileTree:/home/user/test/test1/test2/testee/test4>,
# #<FileTree:/home/user/test/test1/test2/testee/test4/myfile.txt>,
# #<FileTree:/home/user/test/test1/test2/testee/test3>,
# #<FileTree:/home/user/test/test1/test2/testee/test3/no>]
des_arr = tree.descendants.map { |e| FileTree.new(e.relative_path_from(FileTree.new('/home/user'))) }
# => [#<FileTree:test/test1/test2/testee>,
# #<FileTree:test/test1/test2/testee/testeggg>,
# #<FileTree:test/test1/test2/testee/testeggg/test4>,
# #<FileTree:test/test1/test2/testee/testeggg/test4/myfile.txt>,
# #<FileTree:test/test1/test2/testee/testeggg/test3>,
# #<FileTree:test/test1/test2/testee/testeggg/test3/no>,
# #<FileTree:test/test1/test2/testee/test4>,
# #<FileTree:test/test1/test2/testee/test4/myfile.txt>,
# #<FileTree:test/test1/test2/testee/test3>,
# #<FileTree:test/test1/test2/testee/test3/no>]
des_arr.first
# => #<FileTree:test/test1/test2/testee>
des_arr.last.ancestors # infinite loop. "ancestors" depends on hitting "/" to stop.
# the "tree_rep" method provides prettyprinting for creating your own to_s methods
puts tree.tree_rep
# => nil
# >> #<FileTree:/home/user/test/test1/test2>
# >> \- #<FileTree:/home/user/test/test1/test2/testee>
# >> \- #<FileTree:/home/user/test/test1/test2/testee/testeggg>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4>
# >> | | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4/myfile.txt>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3>
# >> | | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3/no>
# >> \- #<FileTree:/home/user/test/test1/test2/testee/test4>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/test4/myfile.txt>
# >> \- #<FileTree:/home/user/test/test1/test2/testee/test3>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/test3/no>
View the docs.
All credit belongs to the following persons, I just cobbled this together from their work:
Distributed under the BSD license, please see LICENSE for more information.
FAQs
Unknown package
We found that filetree 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.