{"id":27132,"library":"maec","title":"MAEC Python Library","description":"An API for parsing and creating MAEC (Malware Attribute Enumeration and Characterization) content. Latest version 4.1.0.17. Release cadence is irregular, tied to MAEC updates.","status":"active","version":"4.1.0.17","language":"python","source_language":"en","source_url":"https://github.com/MAECProject/maec","tags":["maec","malware","threat-intelligence","stix","cybox","xml"],"install":[{"cmd":"pip install maec","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"MAEC depends on CybOX for observables","package":"cybox","optional":false},{"reason":"XML parsing/binding support","package":"lxml","optional":false},{"reason":"Date handling for timestamps","package":"python-dateutil","optional":true},{"reason":"Common utilities and ID generation","package":"mixbox","optional":true}],"imports":[{"note":"","wrong":"","symbol":"MAEC","correct":"from maec import MAEC"},{"note":"Package is in the maec.package module","wrong":"import maec.Package","symbol":"Package","correct":"from maec.package import Package"},{"note":"MalwareSubject is a separate module","wrong":"from maec import MalwareSubject","symbol":"MalwareSubject","correct":"from maec.malware_subject import MalwareSubject"}],"quickstart":{"code":"from maec import MAEC\nfrom maec.package import Package\n\nmaec = MAEC()\npkg = Package()\nmaec.add_package(pkg)\nprint(maec.to_xml())","lang":"python","description":"Create a minimal MAEC document with a package."},"warnings":[{"fix":"Convert MAEC 3.x documents to 4.1 format using provided migration scripts or manually update XML.","message":"maec 4.x uses MAEC v4.1 schema; incompatible with MAEC v3.x data. Cannot load older MAEC documents without conversion.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Replace binding code with API calls: e.g., use Package() instead of binding.PackageType().","message":"The 'maec.bindings' module is deprecated. Direct binding manipulation is discouraged; use the high-level API instead.","severity":"deprecated","affected_versions":">=4.1.0"},{"fix":"Run: pip install cybox","message":"Missing CybOX dependency: maec requires cybox library. Installation via pip does not automatically install cybox on all systems.","severity":"gotcha","affected_versions":"all"},{"fix":"pip install 'lxml<5.0'","message":"LXML version compatibility: maec 4.1.0.17 may fail with lxml >= 5.0 due to API changes. Pin lxml<5.0 if errors occur.","severity":"gotcha","affected_versions":"4.1.0.17"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from maec import MAEC' or reinstall the package: pip install --upgrade maec","cause":"Incorrect import path or outdated installation.","error":"ImportError: cannot import name 'MAEC' from 'maec'"},{"fix":"Ensure at least one Package is added to the MAEC object before calling to_xml().","cause":"Attempting to serialize an empty MAEC object without adding any packages.","error":"AttributeError: 'NoneType' object has no attribute 'to_xml'"},{"fix":"Verify the input XML is valid and non-empty. Wrap in try/except to catch parsing errors.","cause":"Passing an empty or non-XML string to parsing functions.","error":"lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1"},{"fix":"Update to use the new API: from maec import MAEC; use high-level classes instead of bindings.","cause":"Using pre-4.0 binding code with a 4.x installation.","error":"KeyError: 'maec' not found in namespace map"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}