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.
@ridi/comic-parser
Advanced tools
Common comic data parser for Ridibooks services
npm install @ridi/comic-parser
Basic:
import { ComicParser } from '@ridi/comic-parser';
// or const { ComicParser } = require('@ridi/comic-parser');
const parser = new ComicParser('./foo/bar.zip' or './unzippedPath');
parser.parse(/* { parseOptions } */).then((book) => {
parser.readItems(items/*, { readOptions } */).then((results) => {
...
});
...
});
with AesCryptor:
import { CryptoProvider, AesCryptor } from '@ridi/comic-parser';
// or const { CryptoProvider, AesCryptor } = require('@ridi/comic-parser');
const { Purpose } = CryptoProvider;
const { Mode, Padding } = AesCryptor;
class ContentCryptoProvider extends CryptoProvider {
constructor(key) {
super();
this.cryptor = new AesCryptor(Mode.ECB, { key });
}
getCryptor(filePath, purpose) {
return this.cryptor;
}
// If use as follows:
// const provider = new ContentCryptoProvider(...);
// const parser = new ComicParser('encrypted.zip', provider);
// const book = await parser.parse({ unzipPath: ... });
// const firstImage = await parser.readItem(book.items[0]);
//
// It will be called as follows:
// 1. run(data, 'encrypted.zip', Purpose.READ_IN_DIR)
// 2. run(data, '0001.jpg', Purpose.READ_IN_ZIP)
// ...
// 4. run(data, '0001.jpg', Purpose.WRITE)
// ...
// 5. run(data, '0001.jpg', Purpose.READ_IN_DIR)
//
run(data, filePath, purpose) {
const cryptor = this.getCryptor(filePath, purpose);
const padding = Padding.AUTO;
if (purpose === Purpose.READ_IN_DIR) {
return cryptor.decrypt(data, { padding });
} else if (purpose === Purpose.WRITE) {
return cryptor.encrypt(data, { padding });
}
return data;
}
}
const cryptoProvider = new ContentCryptoProvider(key);
const parser = new ComicParser('./encrypted.zip' or './unzippedPath', cryptoProvider);
Log level setting:
import { LogLevel, ... } from '@ridi/comic-parser';
const parser = new ComicParser(/* path */, /* cryptoProvider */, /* logLevel */)
// or const parser = new ComicParser(/* path */, /* logLevel */)
parser.logger.logLevel = LogLevel.VERBOSE; // SILENT, ERROR, WARN(default), INFO, DEBUG, VERBOSE
Returns Promise<ComicBook>
with:
Or throw exception.
?object
Returns string
or Buffer
in Promise
with:
If readOptions.base64
is true
:
string
Other:
Buffer
or throw exception.
?object
Returns string[]
or Buffer[]
in Promise
with:
If readOptions.base64
is true
:
string
Other:
Buffer
or throw exception.
?object
Returns Promise<boolean>
with:
true
, unzip is successful or has already been unzipped.Or throw exception.
string
boolean
Tells the progress of parser through callback
.
const { Action } = ComicParser; // PARSE, READ_ITEMS
parser.onProgress = (step, totalStep, action) => {
console.log(`[${action}] ${step} / ${totalStep}`);
}
?string
If specified, unzip to that path.
only using if input is Zip file.
Default: undefined
boolean
If true, overwrite to unzipPath when unzip.
only using if unzipPath specified.
Default: true
string[]
File extension to allow when extracting lists.
Default: ['jpg', 'jpeg', 'png', 'bmp', 'gif']
boolean|number
If true, image size parse. (parse may be slower.)
Default: false
If true, ignore any exceptions that occur within parser.
Default: false
boolean
If false, reads image into a buffer.
Default: false
[0.7.0 (2020-10-31)]
unzipper
with adm-zip
.CryptoProvider
methods.CryptoProvider
to not handle stream in chunks.FAQs
Common comic data parser for Ridibooks services
The npm package @ridi/comic-parser receives a total of 150 weekly downloads. As such, @ridi/comic-parser popularity was classified as not popular.
We found that @ridi/comic-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers 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.