Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Integer#pack_* methods for uint* and int* types #430

Open
24 tasks
postmodern opened this issue May 30, 2023 · 3 comments
Open
24 tasks

Add Integer#pack_* methods for uint* and int* types #430

postmodern opened this issue May 30, 2023 · 3 comments
Labels
binary Binary data core_ext Core Extension feature New Feature help-wanted Extra attention is needed

Comments

@postmodern
Copy link
Member

postmodern commented May 30, 2023

Add Integer#pack_* methods for all uint* and int* types for quickly packing Integers to common C types. These methods should pass the C type Symbol to pack along with **kwargs.

  • Integer#pack_uint8
  • Integer#pack_uint16
  • Integer#pack_uint32
  • Integer#pack_uint64
  • Integer#pack_int8
  • Integer#pack_int16
  • Integer#pack_int32
  • Integer#pack_int64

The following methods should not accept **kwargs as they use little-endian or big-endian:

  • Integer#pack_uint8_le
  • Integer#pack_uint16_le
  • Integer#pack_uint32_le
  • Integer#pack_uint64_le
  • Integer#pack_int8_le
  • Integer#pack_int16_le
  • Integer#pack_int32_le
  • Integer#pack_int64_le
  • Integer#pack_uint8_be
  • Integer#pack_uint16_be
  • Integer#pack_uint32_be
  • Integer#pack_uint64_be
  • Integer#pack_int8_be
  • Integer#pack_int16_be
  • Integer#pack_int32_be
  • Integer#pack_int64_be

Alias the *_be method to *_ne or *_net?

The documentation and specs can be copy/pasted from Integer#pack.

This will give ronin-support parity with pwnlib.util.packing.

@postmodern postmodern added binary Binary data core_ext Core Extension feature New Feature labels May 30, 2023
@postmodern postmodern added this to the 1.1.0 milestone May 30, 2023
@gfvcastro
Copy link
Contributor

Hey @postmodern, I can work on it. Can you assign me this issue?

@postmodern
Copy link
Member Author

An idea, Integer#pack_uint8 could probably be optimized to simply return self & 0xff.

@postmodern
Copy link
Member Author

Did a Mastodon poll about _ne vs. _net suffix, and appears most people say to just use _be when referring to network-byte-order types. So maybe hold off on the _ne/_net aliases until someone eventually requests them?
https://infosec.exchange/@postmodern/110459088606261323

@postmodern postmodern added the help-wanted Extra attention is needed label Sep 4, 2023
@postmodern postmodern removed this from the 1.1.0 milestone Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary Binary data core_ext Core Extension feature New Feature help-wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants