T2b
Dev tools
binary file generator
SHOW HN2018
How HN took it
5 positive, 17 neutral or asking, 1 mixed, 6 critical, out of 29 comments about the project. Thread score 0.00.
Idea: 5 for, 3 againstDesign: 0 for, 2 againstExecution: 0 for, 1 against
The thread, comment by comment
Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.
positive neutral or mixed critical about another commenter or something else the maker
What HN said
What people liked
Useful niche tool; fun hacking spirit
From 2 comments
Not sure if I will use it, but I like it. This is as close to raw bytes as it gets despite some HLL like features. This to me is real hacking, saying what the heck and writing a…
vinayms on HNI use fasm for this very use case. It has a wonderful macro language that can be used to programmatically generate binary data on top of being able to emit instructions. It's…
emily-c on HN
Good idea for generating binary data and intermediate formats
From 2 comments
Looks good. I can see this being a great intermediate format for hacks etc. Alternatively you could use some kind of fluent API to write binary data. Depends on your use case of…
brad0 on HNI really wanted something like this when embedding serial numbers and keys in ROMs. At the time I was mostly working in C and PHP, so I was imagining something closer to a…
rmgraham on HN
Objections
Global hex mode toggle is confusing; use explicit modifiers or commands
From 4 comments
Interesting. I have several suggestions though: - the hex modifier does both turning mode on and off, which will be confusing in a longer file - it would be good if prefixes such…
yoz-y on HNCool idea! Clear and nicely organized too :) Wouldn’t it be more readable and less error-prone to have separate commands for turning hex mode on and off? Such as `hex on` and…
edudobay on HNWas the first thing that stood out to me as well. Toggled modes like this are also quite annoying when shuffling around sections of the file. Copy one hex too many and suddenly…
ygra on HNI think it might be more intuitive as an explicit stream modifier: hex, decimal, etc. No reason to turn anything “off”, which is actually the activation of a diffferent mode.…
abtinf on HN
Existing tools like pack, struct, and Kaitai already cover this
From 2 comments
Trying not to be a downer, but I wouldn't think of writing such a tool. I'd use Perl's pack or Python's struct. Of course there might be some value in something less than a full…
emmelaich on HNHow does it compare to https://kaitai.io ?
benatkin on HN
Trailing whitespace in input is mishandled
From 1 comment
Neat! I could used this for generating mixed binary/ASCII payloads for network protocol testing. One issue, though -- it seems like trailing whitespace in the input isn't handled…
memeslayer on HN
Requests
Endianness control
From 2 comments
Interesting. I have several suggestions though: - the hex modifier does both turning mode on and off, which will be confusing in a longer file - it would be good if prefixes such…
yoz-y on HNLength-prefixed strings would be useful for some file formats. You'd need to be able to pick a size for the length-prefix, such as u8,u16,etc. Also some ability to length-prefix…
skissane on HN
Length-prefixed strings and TLV support
From 2 comments
Length-prefixed strings would be useful for some file formats. You'd need to be able to pick a size for the length-prefix, such as u8,u16,etc. Also some ability to length-prefix…
skissane on HN> Also some ability to length-prefix the output of a macro might be useful for tag-length-value-like formats. Exactly. TLV (tag-length-value) support is really what I expected to…
childintime on HN
Octal and binary modes, and 0x/0b literal prefixes
From 3 comments
It surprised me that an octal mode wasn't available, or a binary one. But that's a minor gripe. The only other thing I could see being useful is the ability to define "structs",…
stevekemp on HNWhy have hex mode toggles at all? Just use 0xa1b2, and so on. 0x... -> hex, 0... -> octal -- invent a syntax for binary.
cryptonector on HNInteresting. I have several suggestions though: - the hex modifier does both turning mode on and off, which will be confusing in a longer file - it would be good if prefixes such…
yoz-y on HN
Bit-level field support
From 1 comment
It would be great if I could specify the number of bits per field like in Elixir/Erlang/C++ bit fields and then also specify what the extra bits should be set to if the total…
Adamantcheese on HN
Fluent API or library header
From 2 comments
Looks good. I can see this being a great intermediate format for hacks etc. Alternatively you could use some kind of fluent API to write binary data. Depends on your use case of…
brad0 on HNThanks! Some sort of API would be pretty cool... I'll add that if this takes off. At the very least, the function to execute T2B scripts could be exposed in a simple header.
thosakwe on HN
Questions
Does the GPL apply to prebuilt binaries?
From 1 comment
If you use the prebuilt binaries, does the GPL apply?
iffycan on HN
How does it compare to Kaitai?
From 1 comment
How does it compare to https://kaitai.io ?
benatkin on HN
Alternatives named
Perl pack and Python struct
From 1 comment
Trying not to be a downer, but I wouldn't think of writing such a tool. I'd use Perl's pack or Python's struct. Of course there might be some value in something less than a full…
emmelaich on HN
Kaitai Struct
From 1 comment
How does it compare to https://kaitai.io ?
benatkin on HN
fasm macros
From 2 comments
I use fasm for this very use case. It has a wonderful macro language that can be used to programmatically generate binary data on top of being able to emit instructions. It's…
emily-c on HNThere is already https://flatassembler.net/ which uses macros to emit ELF and PE headers.
labdsf on HN
Construct and suitcase for Python
From 2 comments
For Python, suitcase (https://pypi.org/project/suitcase/) makes dealing with structured binary data easier.
rcfox on HNOr Construct: https://construct.readthedocs.io/en/latest/
unscaled on HN