{"id":26794603,"url":"https://github.com/rusticata/ipsec-parser","last_synced_at":"2025-04-05T23:12:21.610Z","repository":{"id":47105323,"uuid":"73721328","full_name":"rusticata/ipsec-parser","owner":"rusticata","description":"IPsec (IKEv2) parser written in rust with nom","archived":false,"fork":false,"pushed_at":"2025-03-18T07:40:03.000Z","size":146,"stargazers_count":22,"open_issues_count":5,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T01:52:28.884Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rusticata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-14T15:56:07.000Z","updated_at":"2024-02-07T11:02:15.000Z","dependencies_parsed_at":"2022-08-29T14:12:10.438Z","dependency_job_id":null,"html_url":"https://github.com/rusticata/ipsec-parser","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusticata%2Fipsec-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusticata%2Fipsec-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusticata%2Fipsec-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusticata%2Fipsec-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusticata","download_url":"https://codeload.github.com/rusticata/ipsec-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411239,"owners_count":20934653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-29T17:28:14.284Z","updated_at":"2025-04-05T23:12:21.588Z","avatar_url":"https://github.com/rusticata.png","language":"Rust","readme":"# ipsec-parser\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE-MIT)\n[![Apache License 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE-APACHE)\n[![Build Status](https://travis-ci.org/rusticata/ipsec-parser.svg?branch=master)](https://travis-ci.org/rusticata/ipsec-parser)\n\n\u003c!-- cargo-sync-readme start --\u003e\n\n# IPsec parsers\n\nThis crate contains several parsers using for IPsec: IKEv2, and reading the envelope of ESP\nencapsulated messages.\nThis parser provides the base functions to read and analyze messages, but does not handle the\ninterpretation of messages.\n\nESP is supported, but only to read the envelope of the payload.\n\nEncapsulated ESP is supported, to differentiate between IKE and ESP headers.\n\n# IKEv2 parser\n\nAn IKEv2 (RFC7296) parser, implemented with the [nom](https://github.com/Geal/nom)\nparser combinator framework.\n\nThe code is available on [Github](https://github.com/rusticata/ipsec-parser)\nand is part of the [Rusticata](https://github.com/rusticata) project.\n\nTo parse an IKE packet, first read the header using `parse_ikev2_header`, then use the type\nfrom the header to parse the remaining part:\n\n\n```rust\nuse ipsec_parser::*;\nuse nom::IResult;\n\nstatic IKEV2_INIT_RESP: \u0026'static [u8] = include_bytes!(\"../assets/ike-sa-init-resp.bin\");\n\nfn test_ikev2_init_resp() {\n    let bytes = IKEV2_INIT_RESP;\n    match parse_ikev2_header(\u0026bytes) {\n        Ok( (rem, ref hdr) ) =\u003e {\n            match parse_ikev2_payload_list(rem,hdr.next_payload) {\n                Ok( (_, Ok(ref p)) ) =\u003e {\n                    // p is a list of payloads\n                    // first one is always dummy\n                    assert!(p.len() \u003e 0);\n                    assert_eq!(p[0].content, IkeV2PayloadContent::Dummy);\n                    for payload in p {\n                        match payload.content {\n                            IkeV2PayloadContent::SA(ref sa) =\u003e { /* .. */ },\n                            _ =\u003e ()\n                        }\n                    }\n                },\n                e =\u003e { eprintln!(\"Parsing payload failed: {:?}\", e); },\n            }\n        },\n        _ =\u003e { eprintln!(\"Parsing header failed\"); },\n    }\n}\n```\n\n\u003c!-- cargo-sync-readme end --\u003e\n\n## Changelog\n\n### 0.7.0\n\n- Upgrade to nom 7\n- Set MSRV to 1.46\n\n### 0.6.0\n\n- Upgrade to nom 6\n- Convert all macro-based parsers to functions\n\n### 0.5.0\n\n- Upgrade to nom 5\n\n### 0.4.1\n\n- o not use glob imports in `use` groups (compatibility with rust 1.24)\n\n### 0.4.0\n\n- Upgrade to nom 4\n\n### 0.3.0\n\n* Add function `parse_ikev2_message` to read header and payload list\n* `init_spi` and `resp_spi` fields have been changed from `\u0026[u8]` to `u64`\n\n## Rusticata\n\nThis parser is part of the [rusticata](https://github.com/rusticata) project.\nThe goal of this project is to provide **safe** parsers, that can be used in other projects.\n\nTesting of the parser is done manually, and also using unit tests and\n[cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz). Please fill a bugreport if you find any issue.\n\nFeel free to contribute: tests, feedback, doc, suggestions (or code) of new parsers etc. are welcome.\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusticata%2Fipsec-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusticata%2Fipsec-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusticata%2Fipsec-parser/lists"}