All Projects → drosseau → degob

drosseau / degob

Licence: BSD-2-Clause license
Go library/tool for viewing and reversing Go gob data [Moved to GitLab]

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to degob

pygob
Small Python library that can decode the Go gob format
Stars: ✭ 28 (-17.65%)
Mutual labels:  gob
binview
Binary data view/editor on the terminal
Stars: ✭ 15 (-55.88%)
Mutual labels:  binary-data
fastDummies
The goal of fastDummies is to quickly create dummy variables (columns) and dummy rows.
Stars: ✭ 33 (-2.94%)
Mutual labels:  binary-data
BinaryStream
BinaryStream - a writer and reader for binary data. Best replacement for pack()/unpack().
Stars: ✭ 44 (+29.41%)
Mutual labels:  binary-data
pfp-vim
A vim hex-editor plugin that uses 010 templates to parse binary data using pfp
Stars: ✭ 57 (+67.65%)
Mutual labels:  binary-data
metal
A Java library for parsing binary data formats, using declarative descriptions.
Stars: ✭ 13 (-61.76%)
Mutual labels:  binary-data
BinFind
Perform regex pattern matching on binary data. (Regex-like)
Stars: ✭ 31 (-8.82%)
Mutual labels:  binary-data
FlexBuffersSwift
Swift implementation of FlexBuffers - a sub project of FlatBuffers
Stars: ✭ 24 (-29.41%)
Mutual labels:  binary-data
Hexyl
A command-line hex viewer
Stars: ✭ 6,349 (+18573.53%)
Mutual labels:  binary-data
racket-bitsyntax
Erlang-style binaries/bitstrings for Racket
Stars: ✭ 29 (-14.71%)
Mutual labels:  binary-data
octet
A library that makes working with bytebuffers painless.
Stars: ✭ 79 (+132.35%)
Mutual labels:  binary-data
Sketch-A-XNORNet
An implementation of a variation of Sketch-A-Net using XNOR ConvNets using TensorFlow
Stars: ✭ 52 (+52.94%)
Mutual labels:  binary-data
binary
package binary is a lightweight and high-performance serialization library to encode/decode between go data and []byte.
Stars: ✭ 20 (-41.18%)
Mutual labels:  gob

degob

degob is a reversing tool for gobs. If you have the binary form of a gob, but you don't have to struct to decode it into, this library still allows you to get a more readable representation of the data.

cmds/degob

The easiest way to use all of this is to just build the binary in cmds/degob and send gobs to it either through stdin or from files and then get the output to stdout or to a file. See its README for more info.

Setting environmental variable DEGOB_NORAND=1 will stop the anonymous structs from having that hex suffix. The number stays because that is the type ID defined in the gob. DEGOB_SEED sets a specific seed value.

Usage

Create a new Decoder over your reader using NewDecoder and then decode that into a slice of Gobs with Decode or stream Gobs with DecodeStream. DecodeStream seems fairly stable, but it was difficult to test how it handles all error cases, so be wary of errors. Once you have Gobs you can either play with the types directly or just print them out to a writer using the WriteTypes and WriteValues methods.

The output from the Write methods on Gob should be close to valid Go source.

The provided degob command provides a straightforward sample usage.

Limitations

There are a few limitations that I can't really get around.

  • gobs don't include information about the bit size of the type so all types are their largest possible (int64, uint64, complex128, float64) so as to be able to accept anything. This means that the representations you get aren't exactly the representations that the source was using with respect to bitsizes.
  • bytes are received as uint64, but []byte is correct. There is no type id for a single byte in the gob format.
  • There is no way to differentiate between a type and a pointer to that type.
  • There is an included JSON output format, but, since a gob can be any valid Go type, there are plenty of valid gobs that cannot be accurately represented as JSON. Simple types will not print valid JSON. Bad map types will return an error JSON that contains the SingleLine format of the map under val.
  • GobEncoder, TextEncoder, and BinaryMarshaler are all displayed as []byte since the format is opaque without the actual type definition.

TODO

  • Printing stylized output
  • Some more testing (I'm around ~80%)
  • Include more "bad gob" tests, but to be honest this tool shouldn't be seeing very many bad gobs. It isn't really meant to be doing much validating, so this is pretty low priority, and part of the reason I'm OK with some of the panics and lack of testing around bad gobs.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].