
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
ImpromptuNinjas.ZStd
Advanced tools
A multi-platform .NET binding of the library build of Facebook's Zstandard project.
ZStd is a multi-platform .NET binding of Facebook's Zstandard library.
Note: ARM support is currently hard-float only, no soft-float platform support unless requested.
Note: In the not too distant future support for 32-bit architectures will likely be dropped.
Take a look at the unit tests to explore its behavior in different situations.
This is in the later stages of development, and features are less likely to be added over time.
This project is heavily inspired by ZstdNet, but shares very little in the way of implementation.
// pick a compression level or use 0, considered 'auto' in most cases
var compressionLevel = 3;
//var compressionLevel = ZStdCompressor.MinimumCompressionLevel; // probably 1
// Note: negative levels do exist as per zstd documentation, but this just calls ZSTD_minCLevel
//var compressionLevel = ZStdCompressor.MaximumCompressionLevel; // probably 22
// allocate a 32kB buffer to build a new dictionary
var dict = new ZStdDictionaryBuilder(32 * 1024);
// or load from some external data
//var dict = new ZStdDictionaryBuilder(someBytes);
//var dict = new ZStdDictionaryBuilder(someBytes, someSize);
// train the dictionary, and retrieve tuned training parameters for future training
var trainedParams = dict.Train(async () => {
// sample your data by returning ArraySegment<byte>s of regions you expect to occur often
// refer to Facebook's Zstd documentation for details on what should be sampled
yield return ArraySegment<byte>(trainingData, 7, 42);
}, compressionLevel);
// optionally save the dictionary to a file somehow
using (var fs = File.Create(path))
dict.WriteTo(fs); // preferred
// fs.Write(dict); // implicitly casts to ReadOnlySpan<byte>
//File.WriteAllBytes("saved_dictionary", ((ArraySegment<byte>)dict).ToArray());
// create an unmanaged reference for use with compression
using var cDict = dict.CreateCompressorDictionary(compressionLevel);
// create an unmanaged reference for use with decompression
using var dDict = dict.CreateDecompressorDictionary();
// be sure to dispose of your compressors/decompressors before your dictionary references
// create a context
using var cCtx = new ZStdCompressor();
// specify the dictionary you want to use, or don't
cCtx.UseDictionary(cDict);
// figure out about how big of a buffer you need
var compressBufferSize = CCtx.GetUpperBound((UIntPtr) inputData.Length);
var compressBuffer = new byte[compressBufferSize];
// set the compressor to the compression level (it may inherit it from the dictionary)
cCtx.Set(CompressionParameter.CompressionLevel, compressionLevel);
// actually perform the compression operation
var compressedSize = cCtx.Compress(compressBuffer, inputData);
// retrieve your compressed frame
var compressedFrame = new ArraySegment<byte>(compressBuffer, 0, (int) compressedSize);
// create a context
var dCtx = new ZStdDecompressor();
// specify the dictionary you want to use, or don't
dCtx.UseDictionary(dDict);
// figure out about how big of a buffer you need
var decompressBufferSize = DCtx.GetUpperBound(compressedFrame);
var decompressBuffer = new byte[decompressBufferSize];
// actually perform the decompression operation
var decompressedSize = dCtx.Decompress(decompressBuffer, compressedFrame);
// retrieve your decompressed frame
var decompressedFrame = new ArraySegment<byte>(decompressBuffer, 0, (int) decompressedSize);
// have somewhere to put the compressed output, any stream will do
using var compressed = new MemoryStream();
// create a compression context over the output stream
using var compressStream = new ZStdCompressStream(compressed);
// ZStdCompressStream.Compressor is just a ZStdCompressor, so you can set parameters and use dictionaries
compressStream.Compressor.Set(CompressionParameter.CompressionLevel, compressionLevel);
// write some data into it
compressStream.Write(someData);
// if you're done writing data and you're not at the end of a frame, it'd be wise to flush
compressStream.Flush();
// consume the compressed input stream with the stream decompressor
using var decompressStream = new ZStdDecompressStream(compressedInput);
// you can access ZStdCompressStream.Decompressor, it's a ZStdDecmpressor, to specify a dictionary and such
// decompress some data..
var decompressed = new byte[someDataSize];
decompressStream.Read(decompressed, 0, decompressed.Length);
FAQs
A multi-platform .NET binding of the library build of Facebook's Zstandard project.
We found that impromptuninjas.zstd 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.