{ "info": { "author": "Matan Perelman", "author_email": "matan1008@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Protocol Parser\n\n\nProtocol Parser is a python package that helps you parse and validate unparsed data.\nThe main features of the package are:\n\n - Grouping (like in regex) Type-Length-Value fields\n - Diverging protocol flows\n - Looping on data\n\nThis text you see here is *actually* written in Markdown! To get a feel for Markdown's syntax, type some text into the left window and watch the results in the right.\n\n### Tech\n\nThe package was written and tested in python 2.7, thus having python 2.7 is critical.\nThe package also uses the built-in struct package.\n\nProtocol Parser is an open source project with a [public repository][protocol_parser] on GitHub.\n\n### Installation\n\nProtocl Parser requires [Python 2.7](https://www.python.org/about/) to run.\n\nDownload and extract the [package][protocol_parser] or pip install it.\n\n\n```sh\n$ pip install protocol_parser\n```\n\nReadme can be found here:\n* [Protocol Parser Readme] [git_readme]\n \n\n### Usage\n\nSo, here goes the interesting part - how to use the package.\nThere are two main ways to use the package, the first one is by building \"protocol rule\"\nfrom string and the second one is building it manually. There isn't any difference between the two ways, the first one\njust includes a deserializer that create rule of parsing elements (like the second way).\n\nGlossary:\n- Elements - Basic units that define a protocol.\n- Variables - There is a dictionary of variables that are used during the parsing. \n this variables' values are decided dinamically from variables elements.\n- Match - The action of parsing protocol's data. Each element has a match.\n- Parsing function - In order to make some parsing easier, some elements can have parsing function,\n that will can change the value returned by matching the element.\n the function parameters are: element name, data length, data, variables.\n\nThe basic units of the rule called parsing elements:\n* ConditionElement - This element was made for implementing a if-else like element.\n The element receives two variables, two lists of elements (one for the if and one for the else) and a comparison function.\n* ConstElement - This element is for space holding or validating protocol fields.\n The element receives a const string it should match\n* LengthVariableElement - The main use of this element is for creating a variables in ways that are not supported\n by \"struct\" module, the current option is casting the value to int with a changing base.\n The element receives a name, chars length, casting base, and whether to group the variable or not\n* SizedGroupElement - This element is used in order to group groups with either predefined length or a variable's value length.\n The element receives a name, length (either a number or variable name) and a parsing function.\n* SwitchElement - This element was made for implementing a switch-case like element.\n The element receives a variable, dictionary of variables(keys) and elements lists(values) and a comparison function.\n* TimedLoopElement - This element is used to do loops. Groups that are grouped by the element can be grouped under the loop name or with all the groups.\n The element receives a name, times to loop, elements and whether to group results under its name or not.\n* UnsizedGroupElement - This element is used in order to group groups until the next ConstElement is matched.\n The element receives a name, and a parsing function.\n* UntimedLoopElement - This element is used to do loops until the next ConstElement is matched. Groups that are grouped by the element can be grouped under the loop name or with all the groups.\n The element receives a name, elements and whether to group results under its name or not.\n* VariableElement - The main use of this element is for creating a variables in ways that are supported\n by \"struct\" module.\n The element receives a name, struct type, and whether to group the variable or not\n\nString deserialize format:\n* ConstElement - just the string itself, e.g. \"aaa\".\n* LengthVariableElement - \"{name=variable_name; length=3; group=to_group}\".\n* SizedGroupElement - \"(length = 4; name = group_name; function = f_key)\", length can be also a variable name.\n* TimedLoopElement - \"[times = 3; data = (length = 4); name = name1]\", data can be any string that can be deserialized.\n* UnsizedGroupElement - \"(name = group_name; function = f_key)\".\n* UntimedLoopElement - \"[data = (length = 4); name = name1]\", data can be any string that can be deserialized.\n* VariableElement - \"{name=variable_name; type=\n [git_readme]: ", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/matan1008/protocol_parser/tarball/0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/matan1008/protocol_parser", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "protocol_parser", "package_url": "https://pypi.org/project/protocol_parser/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/protocol_parser/", "project_urls": { "Download": "https://github.com/matan1008/protocol_parser/tarball/0.1", "Homepage": "https://github.com/matan1008/protocol_parser" }, "release_url": "https://pypi.org/project/protocol_parser/0.1/", "requires_dist": null, "requires_python": null, "summary": "package for parsing data easily", "version": "0.1" }, "last_serial": 2485103, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "32b51d35698139d1c666cd4d62972d75", "sha256": "0a97cd64d0b2dece6efdb75bbf0fd88c78ee52d77bd3b8e5ddbb6410c1213235" }, "downloads": -1, "filename": "protocol_parser-0.1.zip", "has_sig": false, "md5_digest": "32b51d35698139d1c666cd4d62972d75", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28260, "upload_time": "2016-11-27T17:41:10", "url": "https://files.pythonhosted.org/packages/83/37/aff96d8d628b4c08764f962aa4f5c75a91fdc067cbaed3656bd679fa584d/protocol_parser-0.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "32b51d35698139d1c666cd4d62972d75", "sha256": "0a97cd64d0b2dece6efdb75bbf0fd88c78ee52d77bd3b8e5ddbb6410c1213235" }, "downloads": -1, "filename": "protocol_parser-0.1.zip", "has_sig": false, "md5_digest": "32b51d35698139d1c666cd4d62972d75", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28260, "upload_time": "2016-11-27T17:41:10", "url": "https://files.pythonhosted.org/packages/83/37/aff96d8d628b4c08764f962aa4f5c75a91fdc067cbaed3656bd679fa584d/protocol_parser-0.1.zip" } ] }