Skip to content

Instantly share code, notes, and snippets.

@1Conan
Last active July 18, 2016 01:39
Show Gist options
  • Select an option

  • Save 1Conan/b73e07ed046e8a093dc0fe1b61554d83 to your computer and use it in GitHub Desktop.

Select an option

Save 1Conan/b73e07ed046e8a093dc0fe1b61554d83 to your computer and use it in GitHub Desktop.
[ANDROID][ROOT][SHELL]Iruna Account Switcher
#!/system/bin/sh
#
# Iruna Account Switcher
# (c) 1Conan, 2016
#
# For support, e-mail me at
# admin[at]1conan.com
# Or comment at
# https://git.io/vK20L
#
#Variables
DIR="/data/data/com.asobimo.iruna_en/shared_prefs"
#Just some additional credits. I like it lol.
echo "Iruna Account Switcher by 1Conan"
echo "ROOT IS NEEDED"
echo "https://1conan.com\n"
#Help text. Not so obvious
help () {
echo "sh IAS.sh (command) [options]"
echo "Available Commands:"
echo "help - Display this help"
echo "delete - delete account file to link new account"
echo "delbkup (name) - Delete a backup file"
echo "backup (name) - Copy account info to (name)"
echo "switch (name) - Switch to (name)"
}
#Root access checking
#You can't access /data without root bruh.
if [ "$UID" -ne 0 ]; then
echo "IAS Error: Root access needed!";
exit 1;
#Check if directory exists.
#Not having this directory means Iruna is not
#installed/
elif [ ! -d "$DIR" ]; then
echo "IAS Error: Iruna Online not installed!";
exit 1;
#Argument checking
#A script does nothing without instructions :)
elif [ -z "$1" ]; then
echo "IAS: Missing Arguments!\n";
help;
exit 1;
#Your basic help
elif [ "$1" == "help" ]; then
help;
#Delete the account file
#Mostly gonna be used for linking
#New accounts
elif [ "$1" == "delete" ]; then
if [ ! -f "$DIR/ASOBIMO_ACCOUNT.xml" ]; then
echo "IAS Error: Account file not found";
exit 1;
fi
rm -rf "$DIR/ASOBIMO_ACCOUNT.xml"
echo "IAS: Account file deleted!"
echo "IAS NOTE: No characters are lost"
#Delete a backup :|
elif [ "$1" == "delbkup" ]; then
if [ ! -f "$DIR/$2.IAS_backup" ]; then
echo "IAS Error: $2 not found";
exit 1;
fi
rm -rf "$DIR/$2.IAS_backup"
echo "IAS Deleting $2 done!"
#The account backup function. Copies stuff.
elif [ "$1" == "backup" ]; then
#Just the old lame argument checking.
if [ -z "$2" ]; then
echo "IAS: Missing Arguments!\n";
help;
exit 1;
#How the heck can we backup if the file
#is not there?! lol
elif [ ! -f "$DIR/ASOBIMO_ACCOUNT.xml" ]; then
echo "IAS Error: Account file not found";
exit 1;
#Make sure not to overwrite stuff
elif [ -f "$DIR/$2.IAS_backup" ]; then
echo "IAS Error: $2 exists!";
exit 1;
#Copy the account to a file.
else
cp "$DIR/ASOBIMO_ACCOUNT.xml" "$DIR/$2.IAS_backup";
echo "IAS: Backup done!"
fi
#NOT THE ACCOUNT SWITCHING FUNCTION
elif [ "$1" == "switch" ]; then
#Another one of those old lame
#argument checking :|
if [ -z "$2" ]; then
echo "IAS: Missing Arguments!\n";
help;
exit 1;
#Dude, how can we switch if the
#backup is not there?
elif [ ! -f "$DIR/$2.IAS_backup" ]; then
echo "IAS Error: Backup $2 not found";
exit 1;
else
#Remove the account file without any
#Confirmation. Not my fault
#if anything bad happens.
rm -rf "$DIR/ASOBIMO_ACCOUNT.xml";
#Copy the backup and use it as the account
#Renaming would make things harder :)
cp "$DIR/$2.IAS_backup" "$DIR/ASOBIMO_ACCOUNT.xml";
#idk what user should be the owner on
#other devices so let's just make it r
#for all users. If it gets stolen by a malware
#it's the user's fault :p
chmod 744 "$DIR/ASOBIMO_ACCOUNT.xml";
echo "IAS: Switching done!"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment