Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Parse Outlook MSG (.msg) files to extract email messages and attachments.
The target use case is extracting Outlook message text and accessing attachments. There is no support for modifying messages or creating them from scratch. In addition to message text, other message properties such as sent-date, etc. are also accessible.
Documentation for this project is on GitHub Pages.
pip install python-oxmsg
Occasionally it can be useful to install from a GitHub branch, perhaps to try out a version that has not yet been released. This command would install from the develop
branch:
pip install git+https://github.com/scanny/python-oxmsg@develop
>>> from oxmsg import Message
>>> msg = Message.load("message.msg")
>>> msg.message_class
'IPM.Note'
>>> msg.attachment_count
1
>>> attachment = msg.attachments[0]
>>> attachment.attached_by_value # -- attachment bytes only available when True --
True
>>> attachment.filename
'q1-objectives.pptx'
>>> attachment.mime_type
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
>>> attachment.size
96407
>>> attachment.last_modified.isoformat()
'2023-11-18T16:08:17+00:00'
>>> with open(attachment.filename, "wb") as f:
... f.write(attachment.file_bytes)
python-oxmsg
includes a CLI that may be useful for diagnostic purposes.
$ oxmsg
Usage: oxmsg [OPTIONS] COMMAND [ARGS]...
Utility CLI for `python-oxmsg`.
Provides the subcommands listed below, useful for exploratory or diagnostic
purposes.
Options:
--help Show this message and exit.
Commands:
dump Write a summary of the MSG file's properties to stdout.
storage Summarize low-level "directories and files" structure of MSG...
The dump
sub-command displays all properties available in the message along with the
PID and PTYP information required to access those properties from a Properties
object.
$ oxmsg dump message.msg
------------------
Message Properties
------------------
header-properties
-----------------
recipient_count: 1
distinguished-properties
------------------------
attachment_count: 0
internet_code_page: utf-8
message_class: IPM.Note
sender: from@domain.com
...
other properties
-----------------------------------------+---------------+--------------------
property-id | type | value
-----------------------------------------+---------------+--------------------
0x0017 - PidTagImportance | PtypInteger32 | 00 00 00 01
0x001A - PidTagMessageClass | PtypString8 | 'IPM.Note'
0x0036 - PidTagSensitivity | PtypInteger32 | 00 00 00 00
0x0037 - PidTagSubject | PtypString8 | 'A test message'
0x003B - PidTagSentRepresentingSearchKey | PtypBinary | 21 bytes
0x003D - PidTagSubjectPrefix | PtypString8 | ''
0x0042 - PidTagSentRepresentingName | PtypString8 | 'from@domain.com'
...
The release history including a chronicle of notable changes with each release is recorded in CHANGELOG.md.
FAQs
Extract attachments from Outlook .msg files.
We found that python-oxmsg 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.