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 project provides Python bindings for the Rust-based shr_parser
library, which is designed to parse and handle SHR files. The SHR file format includes a file header and multiple sweeps, each with its own header and data. This library uses memory mapping for efficient file reading and Rayon for parallel processing of sweeps.
To install the Python bindings, you need to build the Rust library and install it as a Python module using maturin
. Make sure you have Rust and Python installed on your system.
Install maturin
:
pip install maturin
Build and install the module:
maturin develop
Here's an example of how to use the SHR file parser from Python:
import shr_parser
# Define the file path and parsing type
file_path = "path/to/your/shrfile.shr"
parsing_type = 0 # SHRParsingType::Peak
# Create a SHRParser instance and use its methods
parser = shr_parser.SHRParser(file_path, parsing_type)
print(parser.get_file_path())
print(parser.get_file_header())
for sweep in parser.get_sweeps():
print(sweep)
parser.to_csv("output.csv")
SHRParser
ClassA class representing a parser for SHR files.
__init__(self, file_path: str, parsing_type: int) -> SHRParser
to_str(self) -> str
to_csv(self, path: str) -> None
get_file_path(self) -> str
get_file_header(self) -> str
get_sweeps(self) -> List[Tuple[int, int, float, float]]
Here is an example usage of the SHRParser class:
import shr_parser
# Define the file path and parsing type
file_path = "path/to/your/shrfile.shr"
parsing_type = 0 # SHRParsingType::Peak
# Create a parser instance
parser = shr_parser.SHRParser(file_path, parsing_type)
# Get file path
print(parser.get_file_path())
# Get file header
print(parser.get_file_header())
# Get sweeps
for sweep in parser.get_sweeps():
print(sweep)
# Export to CSV
parser.to_csv("output.csv")
For detailed documentation on the shr_parser
library, refer to the Rust documentation. To generate the documentation locally, run:
cargo doc --open
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the GPLv3 License. See the LICENSE
file for details.
FAQs
Parses sweeps from a Signal Hound Spike file.
We found that shr-parser 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.
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.