kifurushi: a little python library for your protocol implementation

a set of pillars maintaining a structure
Photo by Jon Tyson on Unsplash

Foreword

Installation

pip install kifurushi
poetry add kifurushi

Usage

  • You create a new protocol by inheriting the Packet class. In this example, the protocol Disney has three fields.
  • A two-bytes integer field called mickey whose default value is 2.
  • A one byte integer field called minnie whose default value is 3. You notice the hex keyword set to true. It is to tell that we prefer the hexadecimal representation when displaying this field information.
  • The last field is a four-byte field. It is slightly different from the first two (notice the Enum in the class name) . It takes a third mandatory argument which is an enum, or a dict mapping values to a literal representation easier to remember for the user.
  • The list of all fields is available here.
  • You can set packet attributes using the field name like on line 26.
  • To get the binary representation of a packet, you use its raw property (line 28).
  • To get a packet instance from raw bytes, we use the from_bytes class method (line 30).

--

--

--

Déserteur camerounais résidant désormais en France. Passionné de programmation, sport, de cinéma et mangas. J’écris en français et en anglais dû à mes origines.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

TryHackMe — Jr Penetration Tester | Introduction to Web Hacking | Command Injection |Part-2

AND WHAT DO YOU KNOW ABOUT GIT?

Debate and Discourse

AWS to introduce Exam-Labs for the AWS Certified SysOps Administrator — Associate (SOA-C02)

ALTER 2022 Roadmap: Chat, Channels, and Beyond

Microsoft Dynamics 365 Business Central — DFYN Technologies

Test checker

BRINGING MANKIND CLOSER TO TECHNOLOGY

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kevin Tewouda

Kevin Tewouda

Déserteur camerounais résidant désormais en France. Passionné de programmation, sport, de cinéma et mangas. J’écris en français et en anglais dû à mes origines.

More from Medium

Philips Hue with python

Python philips hue

好簡單 Ubuntu 安裝 Tensorflow2.1.0 GPU

How to display X11 windows on your local machine while remotely debugging in VSCode

Scripting in LUA: PART 2 [Functions, Parameters, Scope, Returning & Conditionals]