This Python script extracts IMAP and SMTP login parameters from a .mobileconfig
file, which is a configuration file used by Apple devices for email accounts.
- Python 3 (accessible as
python3
) - OpenSSL (usually installed on macOS and Linux)
-
Place the
.mobileconfig
file in the same directory as the script, or provide the full path. -
Run the script from the command line:
python3 extract_imap.py <path_to_mobileconfig_file>
Replace
<path_to_mobileconfig_file>
with the actual path to your.mobileconfig
file.
Assuming you have a file named firstname_lastname_imap.mobileconfig
in the current directory:
python3 extract_imap.py firstname_lastname_imap.mobileconfig
This will output something like:
Extracted IMAP Settings:
account_type: IMAP
email_address: [email protected]
server_hostname: wmailetu.univ-artois.fr
server_port: 993
use_ssl: True
username: [email protected]
authentication: EmailAuthPassword
Extracted SMTP Settings:
server_hostname: thq01.univ-artois.fr
server_port: 587
use_ssl: True
username: [email protected]
authentication: EmailAuthPassword
- Uses OpenSSL to extract the property list (plist) content from the signed
.mobileconfig
file. - Parses the plist data to find the email account configuration.
- Extracts and displays key IMAP and SMTP settings such as server hostname, port, username, and authentication method.
- The script assumes the
.mobileconfig
file contains IMAP and SMTP email account configurations. - If the file is not properly signed or formatted, the script may fail.
- This script is for educational purposes and demonstrates file parsing and data extraction in Python.