Sublime Forum

Binary File Reading Plugin

#25

Thanks to bizoo, we now have faster binary loading on the master branch. Thanks again.

0 Likes

#26

Goofing around and added a pop up inspector panel to show info about the word, byte, etc that is selected (only works on single byte selection). It is not on the master branch yet, I need to cleanup a number of things.

The panel can be turned on or off and the endian of the value scan be configured to show it the data how you like.

I copied the naming convention from XVI32 (if you have a better suggestion, let me know). If I figure out the proper way in Python to display IEEE singles and doubles, I will add those as well.

0 Likes

#27

All planned features are in. I finished up the reverse selection of hex bytes when ascii characters are selected. The old hex view panel is removed. Fixed a small issue were the address displayed was 1 byte off.

Also polished up the inspector panel and themed it a little.


I will commit it sometime this weekend, but it is not up on the master branch yet.

0 Likes

#28

Hex Viewer plugin is now in testing phase. If you can help identify bugs (if any), it would be very helpful. No new features are currently planned before release. Changes are on the master branch.

Current commit added a lot of stuff.
-Add Hex Inspector panel
-Add Hex Inspector styling
-Adjust format of hex output to allow for better isolation of ascii table; this helps to quickly identify ascii to byte index referencing.
-Adjust hex output styling for new format
-Remove Hex view panel (only toggle to hex view now)
-Adjust defaults settings
-Bug Fix: address view was one byte off
-Add menu items for settings
-Remove debug code


0 Likes

#29

The viewer is pretty much done. I got the float and double added to the hex inspector, some bug fixes and general cleanup. I added key bindings etc.

I am going to give it a bit before I add it to package manager. I am trying to get some form of editing going on in an experimental branch. If it isn’t going well by the end of the week, I will go ahead and add the viewer to package manager and continue the endeavor in the weeks ahead. If the edit coding is going great, I will try and get it in before the official release. I do have some rough “edit” code in right now, but no “export to bin” code yet. It looks promising though.

0 Likes

#30

Played around with the code a little bit on my lunch break today; editing is going to be coming before official release.

Currently on the experimental branch (which is has not been committed yet), I have basic editing.

You can only make changes on one line at a time. You simply select the number of bytes you want to edit and press the edit shortcut key and you can edit the bytes directly. If you want to write an ascii string directly, you would simply give the prompt the string specifier “s:” like so:

s:this will be written as hex

As long as the hex bytes returned are actual hex and are no greater or lesser in number than what is selected, the buffer will be updated. Edits will be highlighted to show you there are changes. ( I would use the dirty indicator in the tab, except it is misleading; the dirty indicator is really referring to the formatted hex output, and not the actual file it is tied to, and if I enable it, it will keep prompting the user when the tab is closed to save the file. Saving the hex view tab mealy saves the formatted hex output as a file, and then you loose the association with the actual file. I cannot use the save method either, I need to export the data directly. If the Sublime Text API allowed for the canceling of “save” and “save as” on presave, I could directly tap into that and export instead of save giving the experience a more integrated feel, but that is not possible right now.)

After that you can use the export shortcut to write it back to file. I will see if I can come up with an “export as” method as well.

I have already done some basic testing of editing a file and writing the bin. It is looking pretty good. Block pasting will not be allowed, at least not in the first official release.

0 Likes

#31

What’s that? Editing in Hex Viewer? You don’t say…

You can see edited bytes highlighted with red underlines. Also, clips of the UI elements.

The experimental branch is here if you want to try it out.
I still need to add some knobs in the settings to tweak and do more testing.

0 Likes

#32

FYI, there was a regression with exporting to a new file; changing the export path when dumping the bin file does not currently work. The export path is not getting updated.

Use caution, with the experimental branch. All things will be in flux until I can get back to the main branch. The experimental branch is just to get feedback on the general UI and such while I am polishing it up.

0 Likes

#33

Didn’t have as much to do as I thought. Hex editing is now on the Master Branch. I made sure the exporting to a different file works. I also added a number of confirmation panels to make sure you don’t change the view if you have edits. I can’t really protect the hex edits if you accidentally close the file. ST2 doesn’t really allow you to cancel events like closing etc (I wish it did). If I leave the dirty indicator, it can be confusing to users when they are prompted to save; save does not export the bin file, but simply saves the text representation of it to a file. I might implement a failsafe to export to a temp file if a close is invoked while the hex view is dirty and then alert the user and ask them if they want to keep it or not, but that will be later in the week.

I did add overwrite protection, so if the file exists, it will make you confirm you want to overwrite. The master branch should be safe to use.

At this point, I am just trying to shake out any bugs left before release, that and maybe add the failsafe I talked about earlier.

You may need to restart ST2 if you drop this in while ST2 is running. This is due to dependencies.

Let me know if anyone runs into issues.

0 Likes

#34

[quote=“facelessuser”]

Can you provide more in depth explanation to BMP structure headers? Is there an hex editor that does this sort of thing that I could view as an example? I would like to take a look into this before I give a yes or a no.[/quote]

http://www.hexworkshop.com/ is the only editor I’ve seen that does this. The screenshot they have on the front page sort of shows the feature – the lower left is displaying the contents of some pre-defined structure. Looking at their screen shots page at http://www.hexworkshop.com/screen_shots.html I see they’ve done a lot since the last time I eval’d their tool.

[quote]

Yes, you just use the standard key binding methodology. I will post an example in a bit.[/quote]

Got it; thanks!

0 Likes

#35

Should have a release by this weekend or sooner. I have some protection in now for a hex tab getting closed with unsaved edits. There doesn’t seem to be a way to catch the entire window getting closed…so don’t close your window unless you are done :smile: .

I opted to just save the buffer and settings in memory if the tab was closed with unsaved edit. A panel will then be displayed that asks if you would like to restore the tab, if the panel is dismissed or the default “no” is entered, then the saved data will be dismissed. If you type in “yes” to confirm, then the tab will be restored with all your edits. (I may flip the logic on this to restore by default).

I should have these changes up by tonight. After that, I just need to make sure everything is stable and officially release it and then get it in Package Control.

0 Likes

#36

I will consider it possibly for the future. There would be a lot of overhead to do this depending on what kind of structure it is analyzing, so it may not be something that gets done.

If I were to add something like this, I would try and add a general framework that would allow structure maps to be defined and added without having to continually modify the core code for new structures. I will just have to see.

Thanks for the suggestion though.

0 Likes

#37

Made a pull request for Package Control. Tonight or tomorrow, I will create an official forum thread in the plugin section.

0 Likes

#38

Let’s say you have a file (binary or otherwise) and you wanted to get the md5 checksum of it. Well, that is no problem.

Just open open a hex view of the file and execute the checksum command. Also, there is an option to show the checksum on export.

It is also configurable to use md5, sha1, sha224, sha256, sha384, sha512.

This will be in tonights commit

0 Likes

#39

Checksum feature now on Master. Also a highlighting bug fix. I need to open an official thread, but it is Friday and I have spent to much time on the recently.

Oh, HexViewer is on Package Control.

0 Likes

#40

there are three things off
1.it should be seperated into bytes, not groups of 2 bytes
2.there should be 16 bytes every line, that’s how most hex editors work
3.because of the last reason, the offset on the left should go up by 16 (only the second digit, the first doesn’t move)
also, i can’t tell from the picture but it should also seperate sectors

other then that this looks nice, though i already got a hex editing program i am comfortable with

0 Likes

#41

What? I very much disagree.

I’ve used many hex editors and this not true, and some are configurable, and I like those. If you are adamant on limiting yourself to 16 bytes on every line, feel free to configure yours to be that way.

I am more comfortable with it going up by what ever it is configured to go up by.

But…then why the suggestions?

0 Likes

#42

I want it to get better even if i’m not using it, for other people

0 Likes

#43

if all these options are configurable than that is ok
and yes, i have seen lots of hex programs, they work byte by byte because the bytes shouldn’t be connected, they have nothing to do with each other other than being in the same file

0 Likes

#44

Well, there is a whole documentation site for the plugin in case you need to know what it does.

I…seriously? They have nothing to do with each other. Not even a little? Like they couldn’t be part of a 32bit value maybe?

As an engineer that works with lots of binary files and register dumps, being able to group bytes into logical units is very useful for me. I’m sorry that my approach is not satisfactory, but I find it quite practical. I appreciate your input, but I think we will continue in the direction of allowing bytes to commingle. And if byte mingling is found to be undesirable, the user can configure them to be segregated.

0 Likes