echo-devim / fhex

A Full-Featured HexEditor compatible with Linux/Windows/MacOS

Repository from Github https://github.comecho-devim/fhexRepository from Github https://github.comecho-devim/fhex

Question about matching

figgis opened this issue · comments

I'm trying to highlight the start of a NAL in H.264 using config.json. Startcode is either 3 or 4 bytes long

00 00 00 01
or
00 00 01

Can't get it to work though. I have found many ways to have the tool segfault on me though

$ ./Fhex_Linux_x64_2.4_qt5.9.6_static_libs ~/static.264 
Exception occurred while parsing json configuration file:
[json.exception.parse_error.101] parse error at line 15, column 16: syntax error while parsing value - invalid string: forbidden character after backslash; last read: '"\x'
QLayout: Attempting to add QLayout "" to QFrame "", which already has a layout
QLayout: Attempting to add QLayout "" to QFrame "", which already has a layout
terminate called after throwing an instance of 'nlohmann::detail::type_error'
  what():  [json.exception.type_error.302] type must be string, but is null
Aborted (core dumped)

How can I match the 3-4 byte pattern using config.json?

The pattern matching engine is still a beta feature, at the moment it doesn't match bytes, but strings (regex). The relevant piece of code is inside PatternMatching::hasMatches ( file patternmatching.cpp ) used to find patterns. The bytes matching is still a todo, sorry :/

Thanks for the reply. It would be cool to do something like

		{
			"hex" : "000001",
			"color" : "rgba(250,200,200,50)",
			"message" : "4 byte NAL"
		}

in the future.

I agree, the next release probably will have this feature. I'll keep this issue open as a reminder.

Thanks!

I worked on Pattern Matching engine. Now, it has also the possibility to find byte sequences. Look at the updated Readme. The commit that fixes this issue is baca5f7. I suggest to try the latest release that includes the fix (version 2.4.1), soon I will add also pre-compiled build for static version and other platforms.
Please, let me know if you find any issue.