Skip to content

Convert byte strings often found in MySQL logs to hexadecimal literals

Notifications You must be signed in to change notification settings

dbnski/hexify-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexify

A minimal utility that transforms byte strings often found in MySQL log files into hexadecimal literal representation.

Features

  • Detects 'binstring', binary 'binstring', and _binary 'binstring' patterns and replaces them with 0x... literals
  • Handles escape sequences (\\, \', \", \0, etc.)

Notes

  • Aborts conversion for byte strings longer than the declared limit
  • Lnog byte strings can be retained or replaced with placeholder text
  • Full-line comments are preserved unchanged regardless their content

Build

make

Usage

$ echo "SELECT * FROM table WHERE id = BINARY '1234567890';" | ./hexify -l 256
SELECT * FROM table WHERE id = 0x31323334353637383930;
$ echo "SELECT * FROM table WHERE id = BINARY '1234567890';" | ./hexify -l 8
SELECT * FROM table WHERE id = binary '<byte string: 10 bytes>';
$ echo "SELECT * FROM table WHERE id = BINARY '1234567890';" | ./hexify -l 8 -k
SELECT * FROM table WHERE id = binary '1234567890';

About

Convert byte strings often found in MySQL logs to hexadecimal literals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published