{"id":13397197,"url":"https://github.com/dmulyalin/ttp","last_synced_at":"2026-01-14T11:39:29.093Z","repository":{"id":37333771,"uuid":"216000389","full_name":"dmulyalin/ttp","owner":"dmulyalin","description":"Template Text Parser","archived":false,"fork":false,"pushed_at":"2025-10-27T10:06:51.000Z","size":1290,"stargazers_count":369,"open_issues_count":39,"forks_count":39,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-10-27T12:07:49.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmulyalin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://paypal.me/dmulyalin"]}},"created_at":"2019-10-18T10:33:52.000Z","updated_at":"2025-10-27T10:06:55.000Z","dependencies_parsed_at":"2024-10-25T13:47:40.084Z","dependency_job_id":null,"html_url":"https://github.com/dmulyalin/ttp","commit_stats":{"total_commits":371,"total_committers":4,"mean_commits":92.75,"dds":0.008086253369272267,"last_synced_commit":"7d10950ff05926f8becf7472e97e291557e5e99e"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/dmulyalin/ttp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmulyalin%2Fttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmulyalin%2Fttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmulyalin%2Fttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmulyalin%2Fttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmulyalin","download_url":"https://codeload.github.com/dmulyalin/ttp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmulyalin%2Fttp/sbom","scorecard":{"id":348413,"data":{"date":"2025-08-11","repo":{"name":"github.com/dmulyalin/ttp","commit":"d6476d387ca2078e0306c2546148850d3ceb246c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 2/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/dmulyalin/ttp/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/dmulyalin/ttp/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/dmulyalin/ttp/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/dmulyalin/ttp/main.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:27","Warn: pipCommand not pinned by hash: .github/workflows/main.yml:55","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"25 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: PYSEC-2024-230 / GHSA-248v-346w-9cwc","Warn: Project is vulnerable to: PYSEC-2023-135 / GHSA-xqr8-7jwr-rhp7","Warn: Project is vulnerable to: PYSEC-2024-4 / GHSA-2mqj-m65w-jghx","Warn: Project is vulnerable to: PYSEC-2023-165 / GHSA-cwvm-v4w8-q58c","Warn: Project is vulnerable to: PYSEC-2023-137 / GHSA-pr76-5cm5-w9cj","Warn: Project is vulnerable to: PYSEC-2023-161 / GHSA-wfm5-v35h-vwf4","Warn: Project is vulnerable to: PYSEC-2024-60 / GHSA-jjg7-2v4v-x38h","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: GHSA-gmj6-6f8f-6699","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h","Warn: Project is vulnerable to: GHSA-xgfm-fjx6-62mj","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: GHSA-34jh-p97f-mpxf","Warn: Project is vulnerable to: PYSEC-2023-212 / GHSA-g4mx-q9vg-27p4","Warn: Project is vulnerable to: GHSA-pq67-6m6q-mj2v","Warn: Project is vulnerable to: PYSEC-2023-192 / GHSA-v845-jxx5-vc9f","Warn: Project is vulnerable to: PYSEC-2024-187 / GHSA-rqc4-2hc7-8c8v","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T07:43:37.321Z","repository_id":37333771,"created_at":"2025-08-18T07:43:37.321Z","updated_at":"2025-08-18T07:43:37.321Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2024-07-30T18:01:12.527Z","updated_at":"2026-01-14T11:39:29.088Z","avatar_url":"https://github.com/dmulyalin.png","language":"Python","funding_links":["https://paypal.me/dmulyalin"],"categories":["Python","Network Automation","Library"],"sub_categories":["SD-WAN","NETCONF"],"readme":"[![Downloads](https://pepy.tech/badge/ttp)](https://pepy.tech/project/ttp)\n[![PyPI versions](https://img.shields.io/pypi/pyversions/ttp.svg)](https://pypi.python.org/pypi/ttp/)\n[![Documentation status](https://readthedocs.org/projects/ttp/badge/?version=latest)](http://ttp.readthedocs.io/?badge=latest)\n[![Tests](https://github.com/dmulyalin/ttp/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/dmulyalin/ttp/actions/workflows/main.yml)\n\n# Template Text Parser\n\nTTP is a Python library for semi-structured text parsing using templates.\n\n## Why?\n\nTo save ones time on transforming raw text into structured data and beyond.\n\n## How?\n\nRegexes, regexes everywhere... but, dynamically formed out of TTP templates with added capabilities to simplify the  process of getting desired outcome.\n\n## What?\n\nIn essence TTP can help to:\n  - Prepare, sort and load text data for parsing\n  - Parse text using regexes dynamically derived out of templates\n  - Process matches on the fly using broad set of built-in or custom functions\n  - Combine match results in a structure with arbitrary hierarchy\n  - Transform results in desired format to ease consumption by humans or machines\n  - Return results to various destinations for storage or further processing\n\nReference [documentation](https://ttp.readthedocs.io) for more information.\n\nTTP [Networktocode Slack channel](https://networktocode.slack.com/archives/C018HMJQECB)\n\nCollection of [TTP Templates](https://github.com/dmulyalin/ttp_templates)\n\n## Example - as simple as it can be\n\nSimple interfaces configuration parsing example\n\n\u003cdetails\u003e\u003csummary\u003eCode\u003c/summary\u003e\n\n```python\nfrom ttp import ttp\nimport pprint\n\ndata = \"\"\"\ninterface Loopback0\n description Router-id-loopback\n ip address 192.168.0.113/24\n!\ninterface Vlan778\n description CPE_Acces_Vlan\n ip address 2002::fd37/124\n ip vrf CPE1\n!\n\"\"\"\n\ntemplate = \"\"\"\ninterface {{ interface }}\n ip address {{ ip }}/{{ mask }}\n description {{ description }}\n ip vrf {{ vrf }}\n\"\"\"\n\nparser = ttp(data, template)\nparser.parse()\npprint.pprint(parser.result(), width=100)\n\n# prints:\n# [[[{'description': 'Router-id-loopback',\n#     'interface': 'Loopback0',\n#     'ip': '192.168.0.113',\n#     'mask': '24'},\n#    {'description': 'CPE_Acces_Vlan',\n#     'interface': 'Vlan778',\n#     'ip': '2002::fd37',\n#     'mask': '124',\n#     'vrf': 'CPE1'}]]]\n```\n\u003c/details\u003e\n\n## Example - a bit more complicated\n\nFor this example lets say we want to parse BGP peerings output, but combine state with configuration data, at the end we want to get pretty looking text table printed to screen.\n\n\u003cdetails\u003e\u003csummary\u003eCode\u003c/summary\u003e\n\n```python\ntemplate=\"\"\"\n\u003cdoc\u003e\nThis template first parses \"show bgp vrf CUST-1 vpnv4 unicast summary\" commands\noutput, forming results for \"bgp_state\" dictionary, where peer ip is a key.\n\nFollowing that, \"show run | section bgp\" output parsed by group \"bgp_cfg\". That\ngroup uses nested groups to form results structure, including absolute path\n\"/bgp_peers*\" with path formatter to produce a list of peers under \"bgp_peers\"\npath.\n\nFor each peer \"hostname\" and local bgp \"local_asn\" added using previous matches.\nAdditionally, group lookup function used to lookup peer state from \"bgp_state\"\ngroup results, adding found data to peer results.\n\nFinally, \"bgp_peers\" section of results passed via \"tabulate_outputter\" to\nfrom and print this table to terminal:\n\nhostname           local_asn    vrf_name    peer_ip    peer_asn    uptime    state    description    afi    rpl_in           rpl_out\n-----------------  -----------  ----------  ---------  ----------  --------  -------  -------------  -----  ---------------  ---------------\nucs-core-switch-1  65100        CUST-1      192.0.2.1  65101       00:12:33  300      peer-1         ipv4   RPL-1-IMPORT-v4  RPL-1-EXPORT-V4\nucs-core-switch-1  65100        CUST-1      192.0.2.2  65102       03:55:01  idle     peer-2         ipv4   RPL-2-IMPORT-V6  RPL-2-EXPORT-V6\n\nRun this script with \"python filename.py\"\n\u003c/doc\u003e\n\n\u003cvars\u003e\nhostname=\"gethostname\"\nchain_1 = [\n    \"set('vrf_name')\",\n    \"lookup('peer_ip', group='bgp_state', update=True)\"\n]\n\u003c/vars\u003e\n\n\u003cgroup name=\"bgp_state.{{ peer }}\" input=\"bgp_state\"\u003e\n{{ peer }}  4 65101      20      21       43    0    0 {{ uptime }} {{ state }}\n\u003c/group\u003e\n\n\u003cgroup name=\"bgp_cfg\" input=\"bgp_config\"\u003e\nrouter bgp {{ asn | record(asn) }}\n  \u003cgroup name=\"vrfs.{{ vrf_name }}\" record=\"vrf_name\"\u003e\n  vrf {{ vrf_name }}\n    \u003cgroup name=\"/bgp_peers*\" chain=\"chain_1\"\u003e\n    neighbor {{ peer_ip }}\n      {{ local_asn | set(asn) }}\n      {{ hostname | set(hostname) }}\n      remote-as {{ peer_asn }}\n      description {{ description }}\n      address-family {{ afi }} unicast\n        route-map {{ rpl_in }} in\n        route-map {{ rpl_out }} out\n\t\u003c/group\u003e\n  \u003c/group\u003e\n\u003c/group\u003e\n\n\u003coutput\nname=\"tabulate_outputter\"\nformat=\"tabulate\"\npath=\"bgp_peers\"\nreturner=\"terminal\"\nheaders=\"hostname, local_asn, vrf_name, peer_ip, peer_asn, uptime, state, description, afi, rpl_in, rpl_out\"\n/\u003e\n\"\"\"\n\ndata_bgp_state = \"\"\"\nucs-core-switch-1#show bgp vrf CUST-1 vpnv4 unicast summary\nNeighbor   V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd\n192.0.2.1  4 65101      32      54       42    0    0 00:12:33       300\n192.0.2.2  4 65101      11      45       99    0    0 03:55:01       idle\n\"\"\"\n\ndata_bgp_config = \"\"\"\nucs-core-switch-1#show run | section bgp\nrouter bgp 65100\n  vrf CUST-1\n    neighbor 192.0.2.1\n      remote-as 65101\n      description peer-1\n      address-family ipv4 unicast\n        route-map RPL-1-IMPORT-v4 in\n        route-map RPL-1-EXPORT-V4 out\n    neighbor 192.0.2.2\n      remote-as 65102\n      description peer-2\n      address-family ipv4 unicast\n        route-map RPL-2-IMPORT-V6 in\n        route-map RPL-2-EXPORT-V6 out\n\"\"\"\n\nfrom ttp import ttp\n\nparser = ttp()\nparser.add_template(template)\nparser.add_input(data=data_bgp_state, input_name=\"bgp_state\")\nparser.add_input(data=data_bgp_config, input_name=\"bgp_config\")\nparser.parse()\n```\n\u003c/details\u003e\n\n# Contributions\n\nFeel free to submit an issue, report a bug or ask a question, feature requests are welcomed.\n\n# Community Contributions\n\nList of community resources:\n\n- [Sandbox to test TTP templates](http://textfsm.nornir.tech/) by [tbotnz](https://github.com/tbotnz)\n- [TTP Video Tutorials](https://pynet.twb-tech.com/videos/ttp/ttp.html) by [Kirk Byers](https://github.com/ktbyers)\n- [TTP Standalone editor](https://github.com/roc-ops/TTP-Editor) by [roc-ops](https://github.com/roc-ops), [Online Sandbox to test it](https://roc-ops.github.io/TTP-Editor/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmulyalin%2Fttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmulyalin%2Fttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmulyalin%2Fttp/lists"}