Last active
October 24, 2023 20:21
-
-
Save sonic2kk/83330e5a4ebe9c41568a174c4569b531 to your computer and use it in GitHub Desktop.
Parse value from shortcuts.vdf hexadecimal shortcut entry using the hex start pattern using Bash. Does not work with appid unfortunately, as it has a slightly different format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Get value in shortcut entry hex between start and end patterns, with null byte removed, converted to plaintext | |
function get_shortcut_column_value { | |
shortcut_hex="$1" | |
shortcut_pattern_start="$2" | |
shortcut_pattern_end="0001" | |
printf "${shortcut_hex}" | grep -oP "${shortcut_pattern_start}\K.*?(?=${shortcut_pattern_end})" | xxd -r -p | tr -d '\0' | |
} | |
# Example to get appname, you'll need to provide your own shortcuts hex block | |
hex_block="" | |
appname_start_block="(014170704e616d6500|6170706e616d65)" | |
get_shortcut_column_value "${hex_block}" "${appname_start_block}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment