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.
pip install redis_decorator
from redis_dec import Cache
from redis import StrictRedis
redis = StrictRedis(decode_responses=True)
cache = Cache(redis)
Make sure you have redis up and running.(https://redis.io/)
from time import sleep
from datetime import datetime
@cache.ttl(300)
def pseudo_calc():
sleep(1)
print("Computation in progress")
return str(datetime.now())
for i in range(10):
print(pseudo_calc())
# Set cache's time to live to 300 seconds (expires in 300 seconds)
# If left blank, e.g. @cache.df(), cache will stay forever. Don't recommended.
import pandas as pd
@cache.df(300)
def return_a_df(*args, **kwargs):
sleep(1)
print("Computation in progress")
return pd.DataFrame({"time": [str(datetime.now()) for _ in range(5)], "foo": list(range(5))})
for i in range(5):
print(return_a_df(1, 5))
@cache.dict(60)
def return_a_dict(*args, **kwargs):
sleep(1)
print("Computation in progress")
return {"now": str(datetime.now())}
for i in range(5):
print(return_a_dict())
@cache.float(60)
def return_a_float(*args, **kwargs):
return random()
for i in range(5):
print(return_a_float())
# Delete cache by function and signature
cache.delete_cache(return_a_float, 2, b=3)
# Delete cache by function
cache.delete_cache(return_a_float)
# Delete all caches
cache.delete_cache()
FAQs
Using redis as external redis_dec by one line of code
We found that redis-decorator demonstrated a healthy version release cadence and project activity because the last version was released less than 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.