Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Redis to a collection. There and back again.
Redis To Collection dumps Redis to and loads Redis from a collection. Only a tiny subset of the Redis data structure is supported, and that is how it is intended to remain. This is not supposed to be used as any form of backup (please, please don't do this); rather, it is a very small tool to assist with using fixtures in testing. To that end, the collection format is intentionally verbose, and should be quite readable with a little practice.
More sleep lost by tiredpixel.
Install using:
gem 'redis-to-collection'
The default Ruby version supported is defined in .ruby-version
.
Any other versions supported are defined in .travis.yml
.
Create a Redis connection and require Redis To Collection:
require 'redis'
redis = Redis.new
require 'redis-to-collection'
Dump all Redis keys to a collection:
collection = RedisToCollection.dump(redis)
Or dump a subset of Redis keys to a collection:
collection = RedisToCollection.dump(redis, '*PATTERN*')
Load a collection to Redis:
RedisToCollection.load(redis, collection)
That's it!
Load the following example collection to Redis:
collection = {:format=>"redis-to-collection", :version=>1, :data=>[{:k=>"And crawled head downward", :t=>:s, :v=>"down a blackened wall"}, {:k=>"The river bears no", :t=>:h, :v=>{"empty"=>"bottles", "sandwich"=>"papers", "silk"=>"handkerchiefs", "cardboard"=>"boxes", "cigarette"=>"ends"}}, {:k=>"London Bridge is", :t=>:l, :v=>["falling down", "falling down", "falling down"]}, {:k=>"165", :t=>:e, :v=>["HURRY", "UP", "PLEASE", "ITS", "TIME"]}, {:k=>"And if it rains", :t=>:z, :v=>[["The hot water", 10.0], ["a closed car", 4.0]]}]}
RedisToCollection.load(redis, collection)
Dump all Redis keys to create a JSON fixture:
require 'json'
puts JSON.pretty_generate(RedisToCollection.dump(redis))
{
"format": "redis-to-collection",
"version": 1,
"data": [
{
"k": "165",
"t": "e",
"v": [
"ITS",
"PLEASE",
"UP",
"HURRY",
"TIME"
]
},
{
"k": "And crawled head downward",
"t": "s",
"v": "down a blackened wall"
},
{
"k": "The river bears no",
"t": "h",
"v": {
"empty": "bottles",
"sandwich": "papers",
"silk": "handkerchiefs",
"cardboard": "boxes",
"cigarette": "ends"
}
},
{
"k": "London Bridge is",
"t": "l",
"v": [
"falling down",
"falling down",
"falling down"
]
},
{
"k": "And if it rains",
"t": "z",
"v": [
[
"a closed car",
4.0
],
[
"The hot water",
10.0
]
]
}
]
}
Dump all Redis keys to create a YAML fixture:
require 'yaml'
puts RedisToCollection.dump(redis).to_yaml
---
:format: redis-to-collection
:version: 1
:data:
- :k: '165'
:t: :e
:v:
- ITS
- PLEASE
- UP
- HURRY
- TIME
- :k: And crawled head downward
:t: :s
:v: down a blackened wall
- :k: The river bears no
:t: :h
:v:
empty: bottles
sandwich: papers
silk: handkerchiefs
cardboard: boxes
cigarette: ends
- :k: London Bridge is
:t: :l
:v:
- falling down
- falling down
- falling down
- :k: And if it rains
:t: :z
:v:
- - a closed car
- 4.0
- - The hot water
- 10.0
We have a Librelist mailing list! To subscribe, send an email to redis.to.collection@librelist.com. To unsubscribe, send an email to redis.to.collection-unsubscribe@librelist.com. There be archives. That was easy.
You can also become a watcher on GitHub. And don't forget you can become a stargazer if you are so minded. :D
Contributions are embraced with much love and affection! Please fork the repository and wizard your magic. Then send me a pull request. Simples! If you'd like to discuss what you're doing or planning to do, or if you get stuck on something, then just wave. :)
Do whatever makes you happy. We'll probably still like you. :)
May you find peace, and help others to do likewise.
© tiredpixel 2014.
It is free software, released under the MIT License, and may be redistributed
under the terms specified in LICENSE
.
FAQs
Unknown package
We found that redis-to-collection 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.