Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Notepad++ as HEX-Editor

I'm using Notepad++, version 7.8.5 64bit on Windows 10. I'd like to use it as a Hex Editor.

I open a binfile, but Notepad shows it to me as a text with strange characters. In order to visualize the Hex-numbers, I select a part of the text, go and click on the voice

Plugins/Converter/ASCII-->HEX 

and it shows me the hex-numbers of the selected part. Now I'd like to see the whole file in hex, but it doesn't work. It seems that selecting some parts it works, other parts it doesn't.

I need to convert or visualize the whole file in HEX.

I have also tried:

Plugins/Plugins Admin…

but the HEX-Editor isn't there.

Thanks 4 help

like image 294
Uwe_98 Avatar asked Mar 11 '20 17:03

Uwe_98


People also ask

Does Windows have a built in hex editor?

Windows do not have any pre-installed hex editor in their operating systems. Hex files can be stored in the text format or binary format. If you have a text-based hex file, then it can be opened with text editors like notepad.

How do you edit text in hex editor?

From the Hex Editor toolbar, choose Edit > Allow Edit content. Right-click in the edit pane choose Allow Edit content from the context menu.


2 Answers

Edit:

Please note - the installation has been adapted for 64 bit in the meantime.

  • Please update to e.g. Notepad++ 8.1.9 (64-bit)
  • Go to the menu Plugins > Plugins Admin
  • Enter Hex in the search field.
  • Select Hex-Editor and press ìnstall.

It seems to me you tried to install a hex editor and ended up in the wrong tool (Plug-In) Converter (ASCII -> HEX) as mentioned in your question above.

The installation process of the HexEditor is somewhat confusing because it is currently available only in the Plugins Admin for the 32-bit version.

A simple solution is to install a Notepad++ x32 version on a USB stick (e.g. using PortableApps).

But, and thanks to Peter Jones, here is a download link to the x64 version. and explanation to actually perform the manual install:

  • unzip the appropriate downloaded zipfile and open that containing folder (or have the zipfile open in windows explorer)
  • In Notepad++, use Plugins > Open Plugins Folder.
  • In the newly-opened plugins folder, add a subfolder HexEditor.
  • Copy the HexEditor.dll from the zipfile into the HexEditor subfolder… so it should be at ...\notepad++\plugins\HexEditor\HexEditor.dll
  • Close all open windows of Notepad++.
  • Restart Notepad++ again.
  • HexEditor should be available in the Plugins menu, and HexEditor.dll should be listed in the ? > Debug Info plugins list.

Successfully tested by Notepad++ Version 7.8.5 64bit on Windows 10. For further information see the links above. Please note a UAC problem, i.e. run Notepad++ as Administrator.

like image 157
help-info.de Avatar answered Oct 09 '22 00:10

help-info.de


Answer from help-info.de is working.

However it is not that great if you are in a context where you need to copy paste the result of the hex output provided by the plugin.


For example let's say the following bytes are displayed by the NPP_HexEdit window:

00 06 12 0b

If you select from left to right, copy then paste (in a new text file), you will get:

20 06 12 0b

For some reason, '0x00' are converted into UTF-8 '20' and since '0x20' are also converted into UTF-8 '20' you can't really use the copy + paste feature here.

If you select from right to left, copy then paste (in a new text file), you will get:

12 01 0e 0d

I will not even try to convert this one, clearly unusable....


Solution (Windows)

  • From Plugins > Plugins Admin select and install NppExec, restart npp.

  • Select Plugins > NppExec > Npp Execute... and enter the following:

     SET local OUTFILE = "$(FULL_CURRENT_PATH).hex.txt"
     cmd /c <XXD_DIRECTORY>\xxd.exe -p $(FULL_CURRENT_PATH) >$(OUTFILE)
     NPP_OPEN $(OUTFILE)
    
  • From the same window save your script, for example bin_to_hex.

  • From Plugins > NppExec > Advanced Options select your script from Associated script: and add it with Add/Modify then press Ok and restart npp.

  • In npp, open your bin file.

  • Select Plugins > NppExec > bin_to_hex and you are done!, should get your bin as HEX in a new tab.

xxd.exe can be recovered from multiple location such as:

  • C:\Program Files (x86)\Vim\vim74
  • (I used this on my side, from Cmder) C:\Cmder\vendor\git-for-windows\usr\bin

Edited Instead of using xxd.exe, you can use the following powershell approach (better format but longer to execute). Replace the script with:

    SET local OUTFILE = "$(FULL_CURRENT_PATH).hex.txt"
    cmd /c powershell -command "format-hex $(FULL_CURRENT_PATH) > $(OUTFILE);exit"
    NPP_OPEN $(OUTFILE)
like image 25
Greg7000 Avatar answered Oct 09 '22 01:10

Greg7000