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.
This document is written in Japanese.
bzip3 の非公式 Ruby バインディングです。
require "extbzip3"
Bzip3
module
method | annotation |
---|---|
Bzip3.decode(str, ...) | see Bzip3::Decoder.decode |
Bzip3.encode(str, ...) | see Bzip3::Encoder.encode |
Bzip3.decode(obj, ...) | see Bzip3::Decoder.open |
Bzip3.encode(obj, ...) | see Bzip3::Encoder.open |
Bzip3::Decoder
class
method | annotation |
---|---|
Bzip3::Decoder.decode(str, maxdest = nil, dest = "", *opts) | returns dest with bzip3 decoded |
Bzip3::Decoder.decode(str, dest, *opts) | returns dest with bzip3 decoded |
Bzip3::Decoder.open(obj, *opts) | returns bzip3 decoder |
Bzip3::Decoder.open(obj, *opts) { |decoder| ... } | returns object from yield returned |
Bzip3::Decoder#read(size = nil, dest = "") | returns dest with bzip3 decoded |
Bzip3::Decoder#close | |
Bzip3::Decoder#eof? |
Bzip3::Encoder
class
method | annotation |
---|---|
Bzip3::Encoder.encode(str, maxdest = nil, dest = "", *opts) | returns dest with bzip3'ed sequence |
Bzip3::Encoder.encode(str, dest, *opts) | returns dest with bzip3'ed sequence |
Bzip3::Encoder.open(obj, *opts) | returns bzip3 encoder |
Bzip3::Encoder.open(obj, *opts) { |encoder| ... } | returns object from yield returned |
Bzip3::Encoder#write(src) | returns receiver |
Bzip3::Encoder#flush | returns receiver |
Bzip3::Encoder#close | |
Bzip3::Encoder#eof? |
Bzip3::BlockProcessor
class
method | annotation |
---|---|
Bzip3::BlockProcessor.new(blocksize) | |
Bzip3::BlockProcessor#decode(src, dest, original_size) | returns dest string as original data |
Bzip3::BlockProcessor#encode(src, dest) | returns dest string as bzip3'ed data |
Bzip3::BlockProcessor#blocksize | returns blocksize integer with when new |
using Bzip3
(refinements)
method | annotation |
---|---|
String#to_bzip3(...) | see Bzip3::Encoder.encode |
String#bunzip3(...) | see Bzip3::Decoder.decode |
Object#to_bzip3(...) | see Bzip3::Encoder.open |
Object#bunzip3(...) | see Bzip3::Decoder.open |
Bzip3::BlockProcessor
クラスを使ってください。Bzip3::Encoder.encode
または Bzip3::Decoder.decode
にキーワード引数として format: Bzip3::V1_FRAME_FORMAT
を与えてください。
ストリーム指向 API を「bzip3 フレーム形式」に対応させる予定はありません。事前にシステム上へ bzip3 をインストールしてください。
% sudo gem install extbzip3
require "extbzip3"
src = "123456789"
bin = Bzip3.encode(src)
# => "BZ3v1\x00\x00\x10\x00\x11\x00\x00\x00\t\x00\x00\x00'F\xE3\xEB\xFF\xFF\xFF\xFF123456789"
src1 = Bzip3.decode(bin)
# => "123456789"
require "extbzip3"
# 圧縮処理してファイルとして出力
File.open("/boot/kernel/kernel", "rb") do |src|
File.open("kernel.bz3", "wb") do |dest|
Bzip3.encode(dest) do |bz3|
buf = ""
bz3.write buf while src.read(123456, buf)
end
end
end
# 伸張処理してファイルとして出力
File.open("kernel.bz3", "rb") do |src|
File.open("kernel.1", "wb") do |dest|
Bzip3.decode(src) do |bz3|
buf = ""
dest.write buf while bz3.read(123456, buf)
end
end
end
# ファイルの比較
system "md5 /boot/kernel/kernel kernel.1"
# => MD5 (/boot/kernel/kernel) = 71b8f6c6a29f4d647f45d9501d549cf3
# => MD5 (kernel.1) = 71b8f6c6a29f4d647f45d9501d549cf3
require "extbzip3"
src = "123456789"
bin = Bzip3.encode(src, format: Bzip3::V1_FRAME_FORMAT)
# => "BZ3v1\x00\x00\x10\x00\x01\x00\x00\x00\x11\x00\x00\x00\t\x00\x00\x00'F\xE3\xEB\xFF\xFF\xFF\xFF123456789"
src1 = Bzip3.decode(bin, format: Bzip3::V1_FRAME_FORMAT)
# => "123456789"
FAQs
Unknown package
We found that extbzip3 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.