
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
epub-conversion
Advanced tools
Create text corpuses using epubs and wiki dumps. This is a python package with a Converter for epub and xml (wiki dumps) to text, lines, or Python generators.
To convert epubs to text files, usage is straightforward. First create a converter object:
converter = Converter("my_ebooks_folder/")
Then using this converter let's concatenate all the text within the ebooks into a single mega text file:
converter.convert("my_succinct_text_file.gz")
You can also proceed line by line:
from epub_conversion.utils import open_book, convert_epub_to_lines
book = open_book("twilight.epub")
lines = convert_epub_to_lines(book)
Suppose you are interested in all redirections in a given Wikipedia dump file that is still compressed, then you can access the dump as follows:
wiki = epub_conversion.wiki_decoder.almost_smart_open("enwiki.bz2")
Taking this dump as our input let us now use a generator to output all pairs of title
and redirection title
in this dump:
redirections = {redirect_from:redirect_to
for redirect_from, redirect_to in epub_conversion.wiki_decoder.get_redirection_list(wiki)
}
Suppose you are interested in the lines within each page's text section only, then:
for line in epub_conversion.wiki_decoder.convert_wiki_to_lines(wiki):
process_line( line )
epub_conversion
to process Wikipedia dumps and output only the lines that contain page to page links, with the link anchor texts extracted, and all markup removed.FAQs
Python package for converting xml and epubs to text files
We found that epub-conversion 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
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.