Created
May 9, 2022 18:21
-
-
Save Smart123s/ca5a3b84f27f4aa5ff2bb3fdf9874f00 to your computer and use it in GitHub Desktop.
Re-calculates and updates the value of `check` in me.pou.app_preferences.xml for the Android game Pou
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
#!/bin/bash | |
# Read the value of state from me.pou.app_preferences.xml | |
state=$(grep -oPm1 '(?<=<string name="state">)[^<]+' me.pou.app_preferences.xml) | |
# Format state to the hashable string & calculate it's hash | |
check=$(echo -n "p@v_4"${state//"/\"} | md5sum | awk '{ print $1 }') | |
# Update the value of check in the me.pou.app_preferences.xml | |
# Regex from https://stackoverflow.com/a/17333829/9767089 | |
sed -i -r 's/(<string name="check">)[^<]*/<string name="check">'$check'/g' me.pou.app_preferences.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment