Code Monkey home page Code Monkey logo

vscode-hexeditor's Introduction

A custom editor extension for Visual Studio Code which provides a hex editor for viewing and manipulating files in their raw hexadecimal representation.

Features

  • Opening files as hex
  • A data inspector for viewing the hex values as various different data types
  • Editing with undo, redo, copy, and paste support
  • Find and replace

User opens a text file named release.txt and switches to the hex editor via command palette. The user then navigates and edits the document

How to Use

There are three ways to open a file in the hex editor:

  1. Right click a file -> Open With -> Hex Editor
  2. Trigger the command palette (F1) -> Open File using Hex Editor
  3. Trigger the command palette (F1) -> Reopen With -> Hex Editor

The hex editor can be set as the default editor for certain file types by using the workbench.editorAssociations setting. For example, this would associate all files with extensions .hex and .ini to use the hex editor by default:

"workbench.editorAssociations": {
    "*.hex": "hexEditor.hexedit",
    "*.ini": "hexEditor.hexedit"
},

Configuring the Data Inspector

By default, the data inspector is shown just to the right of the data grid (or decoded text if enabled), but it can be configured (via the hexeditor.inspectorType setting) to instead show up while hovering over a data cell.

Another option is to give the data inspector a dedicated activity bar entry on the left (by setting hexeditor.inspectorType to sidebar) that appears when the hex editor is opened, causing the explorer or whatever sidebar you had opened to be hidden. If preferred, the hex editor view can be dragged into another view by dragging the โฌก icon onto one of the other views. This can be used in combination with the hexeditor.dataInspector.autoReveal setting to avoid revealing the sidebar containing the data inspector altogether.

Known Issues

To track existing issues or report a new one, please visit the GitHub Issues page at https://github.com/microsoft/vscode-hexeditor/issues

vscode-hexeditor's People

Contributors

brabli avatar cmxl avatar connor4312 avatar deitry avatar dependabot[bot] avatar fython avatar gustavoasc avatar haneefdm avatar ingilizadam avatar ipeevski avatar jeanp413 avatar jogo- avatar jwr1 avatar liudonghua123 avatar lorsanta avatar lramos15 avatar lszomoru avatar mjbvz avatar moralcode avatar natecraddock avatar nlsdg avatar ohcanep avatar p3tray avatar paamand avatar profesor08 avatar rzhao271 avatar tomilho avatar tyriar avatar varblane avatar vulpivia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-hexeditor's Issues

Iteration Plan June 2020

Plan Items

Below is a summary of the top level plan items.

Legend of annotations:

Mark Description
๐Ÿƒโ€โ™‚๏ธ work in progress
๐Ÿ”Ž researching
๐Ÿ’ช stretch goal

Features

  • Ability to edit the bytes in the middle column and modify the file #17
  • Ability to edit the decoded text in the right column and modify the file. #17
  • ๐Ÿ’ช Ability to edit inside the data inspector #17

Bugs / Fixes

  • Files over 18MB couldn't be opened #3
  • Focus is difficult to see #24
  • Data inspector font can appear fuzzy #35

Edit and Writing Feature Requestment(Strongly)

Dear M$:
I am Embedded developer, and we often need to edit hex/bin files, and I've been looking for a plug-in that can edit these files in VSCode, because VSCode is my favorite code development tool. Now I've finally got a hexEditor, so we are STRONGLY recommend that writing-operations.
THANKS very much!

Hex diff - Hex compare

Thank you for this marvelous extension. Editing and viewing binary files is quite cumbersome. This extension definitely helps here!

Especially when binary files were changed, it is really handy to compare them in HEX. That way I can easily check that I didn't destroy anything. Therefore the question: Is it possible to add support for comparison / compare editors in HEX?

I am only aware of the Total Commander being capable to do that (all I want to say is this is a really helpful feature, which not many tools out there support). Unfortunately I do not speak Java- nor Typescript...

Home/end behavior

I notice https://hexed.it/ uses home and end to go to the start and end of the document respectively, is this standard across all hex editors? It would be better if we aligned with the editor imo and have home/end go to the start/end of the line and ctrl/cmd+home/end go to the start/end of the file.

Display the byte groups in 1 byte, 2 bytes, 4 bytes, 8 bytes, and/or 16 bytes

This is a feature request.

I would like to be able to group the bytes with a dropdown menu in:

  • 1 byte (current feature)
  • 2 bytes
  • 4 bytes
  • 8 bytes
  • 16 bytes

We currently have 1-byte grouping right now. I humbly request and wish to be able to group bytes like so:

2-bytes groups:

image

4-bytes groups:

image

8-bytes groups:

image

16-bytes groups:

image

Thank you so much for this hex editing support. I really hope this extension kicks off greatly!

Search for bytes, based on byte values, or byte patterns

This is a feature request.

Currently, we have the ability to read the bytes of a file, based on the memory offset and the decoded text.

I would like to be able to search for particular bytes in the file, to be able to pinpoint where in the file are byte patterns found. This can be helpful for viewing data chunks and data wrappers where a particular byte pattern is used commonly in the file, making it easier to navigate and locate the data needed.

It would be even wonderful, as another feature, if we could search by decoded text and look for the matching byte values in the hex editor. I don't know if Regular Expressions can work for decoded text, but 'tis a dream.

Support multi-cell selection

Currently only a single cell can be selected and trying to drag show an overlay that looks like it's dragging the whole document like an image:

image

When viewing hex values, there should be a way to select multiple hex values for copying

Currently, you can only select 1 byte value at a time, both in the Hex Value (center column) and in the Decoded Text (right column). I don't know what the center column is called, and I wished there is a name for it. ("Memory"?)

image

You cannot copy hex values from the Data Inspector, the Hex Values, and the Decoded Text. If we are able to select multiple byte values for copying, then the Data Inspector and the Decoded Text should also be allowed to do copy operations for multiple byte values.

Hex editor should be accessible

Hey Logan, just kreating this so we keep it in mind.
The hex editor should be accessible, that means that all fields should be navigalbe by keyboard and that when you navigate the screen reader always reads the correct content.

For more details we can also sync. Feel free to ping me

Support for binary templates

Hex editors are usually used for binary file formats. Currently only the file bytes are displayed (in hex), and to see a UInt32 value you have to know where it is in the file and move the cursor to it.

Most hex editors include a feature that allows to define binary templates for different file formats and view the parsed results as JSON or similar.

Update: This is no longer about one specific template format, but on supporting templates at all - see #50 (comment)


Original:

The cross-editor standard for binary templates is Kaitai Struct - https://kaitai.io/

It supports integration with many programming languages, it is free and open source, and it has a lot of community-contributed templates for many popular file formats - https://formats.kaitai.io/

The templates are defined using YAML, with a .ksy file extension.

Example template:

seq:
  - id: length
    type: u32
  - id: contents
    type: str
    size: length
    encoding: UTF-8
  - id: has_crc
    type: u1
  - id: crc32
    type: u4
    if: has_crc32 != 0

This will generate a JS class that you can pass the file data to and it will give you the parsed result.

Kaitai Struct also has a small web editor to try out templates that you can draw inspiration from:
image

Unfortunately Kaitai Struct doesn't support editing the parsed results and writing them back to the file, but the parsing is the important part.

What do you think?

Add menu entry to open/edit file in HexView

Hello,
Please add a menu entry to an Editor Tab and in the Explorer view to open a file in the HexEditor. I had to visit the issues tracker to actually figure our how to open a file in the HexEditor view.

Thanks

Reverting a file isn't implemented

Executing the revert file command currently does not work for hex files. This is because the feature isn't implemented yet and is something that should be looked into.

Some visual UI element to switch back to view file in 'normal' view.

Thank you for developing hexeditor for vscode.
I installed and opened file in hex editor. Next I did want to switch back to view file in normal edition mode. Did not fiqure out how to do it. Plead add some Ui element/visual cue to hexeditor to switch back to normal mode.

Allow unsaved files to be reopened with Hex Editor

To reproduce:

  • Ctrl + N
  • type some text
  • Ctrl + Shift + P -> File: Reopen With... -> Hex Editor

Actual:
An error occurs: Unable to open 'Untitled-1': Unable to resolve filesystem provider with relative file path 'untitled:Untitled-1'.

Expected:
A Hex Editor opens. This is useful, e.g. for copy-pasting content from elsewhere without having to save to a temporary file first

How do you use this extension?

I can't figure out how to open the hex view for a given file. There isn't a hex language mode, any hex-related options in the command palette, or any context menu options for viewing files as hex. Please consider adding usage information to the readme.

Hexdump of clipboardtext

I need the ability to showing hexdump of text from the clipboard.
Without having to save it in a file first.

Support IDA style masked bytes search & replace

I know it's very early but I'm excited about this very useful extension and therefore this feature request. I'd like to search for a byte pattern as suggested in #45 with regex but more precisely in IDA style byte masking with ??. As it's a very common format to share malware patterns and all.
Example pattern: 3d ac ?? 25 9d ?? ?? 2f.

Iteration Plan for May 2020

Plan Items

Below is a summary of the top level plan items.

Legend of annotations:

Mark Description
๐Ÿƒโ€โ™‚๏ธ work in progress
๐Ÿ”Ž researching
๐Ÿ’ช stretch goal

Features

  • Ability to open files as hex in a read-only manner
  • Ability to select a hex cell and associated decoded text
  • Hover support
  • Add headers to the editor for improved readability
  • Style editor for various VS Code themes
  • ๐Ÿƒโ€โ™‚๏ธWidget to show hex in various formats
  • ๐Ÿ’ช Simple find support

Bugs / Fixes

  • Large files cause editor to crash, should show error
  • Some decoded text is still control characters, need to narrow list of characters
  • Resizing the editor causes structure to fall apart (needs a scrollbar)

Incorrect adresses for Intel and motorola formats

The memory offset column always starts from 0000 0000, which is true for bin files, but hex files in intel and motorola format can have blocks, which starts at later adresses. Can be the real offset shown?

The focus border is too subtle

It's too difficult imo to tell the difference between selected unfocused:

image

And selected focused:

image

The only difference is it looks slightly blurry.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.