ll-hax-docs/sifas/apk-patching/index.html
2025-02-23 20:27:29 -06:00

1223 lines
No EOL
38 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="canonical" href="https://ll.hax.sif.moe/sifas/apk-patching/">
<link rel="prev" href="../easy-install/">
<link rel="next" href="../../sif2/">
<link rel="icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.39">
<title>Patching the apk - LL Hax Docs</title>
<link rel="stylesheet" href="../../assets/stylesheets/main.8c3ca2c6.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/palette.06af60db.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../../style/better.css">
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="pink" data-md-color-accent="deep-purple">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#patching_android_binary" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../.." title="LL Hax Docs" class="md-header__button md-logo" aria-label="LL Hax Docs" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
LL Hax Docs
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Patching the apk
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="pink" data-md-color-accent="deep-purple" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_0">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg>
</label>
<input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="pink" data-md-color-accent="deep-purple" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_0" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg>
</label>
</form>
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../.." title="LL Hax Docs" class="md-nav__button md-logo" aria-label="LL Hax Docs" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
LL Hax Docs
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." class="md-nav__link">
<span class="md-ellipsis">
Home
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../pugu/" class="md-nav__link">
<span class="md-ellipsis">
Puchiguru
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
<span class="md-ellipsis">
SIF
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
SIF
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../sif/" class="md-nav__link">
<span class="md-ellipsis">
SIF - Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../sif/private-servers/" class="md-nav__link">
<span class="md-ellipsis">
Private (self hostable) servers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../sif/apk-patching/" class="md-nav__link">
<span class="md-ellipsis">
Patching the apk
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../sif/ipa-patching/" class="md-nav__link">
<span class="md-ellipsis">
Patching the ipa
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../sifac/" class="md-nav__link">
<span class="md-ellipsis">
SIFAC
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" checked>
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
<span class="md-ellipsis">
SIFAS
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
SIFAS
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../" class="md-nav__link">
<span class="md-ellipsis">
SIFAS - Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../private-server/" class="md-nav__link">
<span class="md-ellipsis">
Private (self hostable) servers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../easy-install/" class="md-nav__link">
<span class="md-ellipsis">
Easy install
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Patching the apk
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Patching the apk
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#patching_android_binary" class="md-nav__link">
<span class="md-ellipsis">
Patching android binary
</span>
</a>
<nav class="md-nav" aria-label="Patching android binary">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#unpacking_the_apk" class="md-nav__link">
<span class="md-ellipsis">
Unpacking the apk
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#packing_the_binary_to_unlock_the_game_features" class="md-nav__link">
<span class="md-ellipsis">
Packing the binary to unlock the game features
</span>
</a>
<nav class="md-nav" aria-label="Packing the binary to unlock the game features">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#easy_way_out" class="md-nav__link">
<span class="md-ellipsis">
Easy way out
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#directly_edit_the_binaries" class="md-nav__link">
<span class="md-ellipsis">
Directly edit the binaries
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#doing_things_properly" class="md-nav__link">
<span class="md-ellipsis">
Doing things properly
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#patching_the_rsa_key_and_the_server_address" class="md-nav__link">
<span class="md-ellipsis">
Patching the RSA key and the server address
</span>
</a>
<nav class="md-nav" aria-label="Patching the RSA key and the server address">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#using_the_metadata_string_editor_gui" class="md-nav__link">
<span class="md-ellipsis">
Using the MetaData String Editor GUI
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#using_the_metadata_string_editor_cli" class="md-nav__link">
<span class="md-ellipsis">
Using the MetaData String Editor CLI
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#changing_the_package_name_app_name_and_icon" class="md-nav__link">
<span class="md-ellipsis">
Changing the package name, app name, and icon
</span>
</a>
<nav class="md-nav" aria-label="Changing the package name, app name, and icon">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#changing_the_package_name" class="md-nav__link">
<span class="md-ellipsis">
Changing the package name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#changing_the_app_name" class="md-nav__link">
<span class="md-ellipsis">
Changing the app name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#changing_the_app_icon" class="md-nav__link">
<span class="md-ellipsis">
Changing the app icon
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#repacking_the_apk" class="md-nav__link">
<span class="md-ellipsis">
Repacking the apk
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#patching_android_client_to_new_address_with_frida" class="md-nav__link">
<span class="md-ellipsis">
Patching Android client to new address with frida
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<span class="md-ellipsis">
SIF2
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
SIF2
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../sif2/" class="md-nav__link">
<span class="md-ellipsis">
SIF2 - Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../sif2/private-servers/" class="md-nav__link">
<span class="md-ellipsis">
Private (self hostable) servers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../sif2/easy-install/" class="md-nav__link">
<span class="md-ellipsis">
Easy install
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../contributing/" class="md-nav__link">
<span class="md-ellipsis">
Contributing
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#patching_android_binary" class="md-nav__link">
<span class="md-ellipsis">
Patching android binary
</span>
</a>
<nav class="md-nav" aria-label="Patching android binary">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#unpacking_the_apk" class="md-nav__link">
<span class="md-ellipsis">
Unpacking the apk
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#packing_the_binary_to_unlock_the_game_features" class="md-nav__link">
<span class="md-ellipsis">
Packing the binary to unlock the game features
</span>
</a>
<nav class="md-nav" aria-label="Packing the binary to unlock the game features">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#easy_way_out" class="md-nav__link">
<span class="md-ellipsis">
Easy way out
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#directly_edit_the_binaries" class="md-nav__link">
<span class="md-ellipsis">
Directly edit the binaries
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#doing_things_properly" class="md-nav__link">
<span class="md-ellipsis">
Doing things properly
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#patching_the_rsa_key_and_the_server_address" class="md-nav__link">
<span class="md-ellipsis">
Patching the RSA key and the server address
</span>
</a>
<nav class="md-nav" aria-label="Patching the RSA key and the server address">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#using_the_metadata_string_editor_gui" class="md-nav__link">
<span class="md-ellipsis">
Using the MetaData String Editor GUI
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#using_the_metadata_string_editor_cli" class="md-nav__link">
<span class="md-ellipsis">
Using the MetaData String Editor CLI
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#changing_the_package_name_app_name_and_icon" class="md-nav__link">
<span class="md-ellipsis">
Changing the package name, app name, and icon
</span>
</a>
<nav class="md-nav" aria-label="Changing the package name, app name, and icon">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#changing_the_package_name" class="md-nav__link">
<span class="md-ellipsis">
Changing the package name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#changing_the_app_name" class="md-nav__link">
<span class="md-ellipsis">
Changing the app name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#changing_the_app_icon" class="md-nav__link">
<span class="md-ellipsis">
Changing the app icon
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#repacking_the_apk" class="md-nav__link">
<span class="md-ellipsis">
Repacking the apk
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#patching_android_client_to_new_address_with_frida" class="md-nav__link">
<span class="md-ellipsis">
Patching Android client to new address with frida
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1>Patching the apk</h1>
<p>The original 3.12 clients are designed to only serve as a EOS notice. Howerver, the functionalities are still (mostly) there, so we can patch it to work.</p>
<p>This docs will outline the necessary steps and how to do them, should you need to make your own clients. This docs assume we start with a stock clients. You can get these by dumping the app from Google Playstore or from other apk distribution sites.</p>
<h2 id="patching_android_binary">Patching android binary<a class="headerlink" href="#patching_android_binary" title="Permanent link">&para;</a></h2>
<p>Note that some of these steps will not be necessary depending on what you started with and what you want to do.</p>
<p>Also note that some commands might become outdated after the tools are updated. If this is the case, try getting the specific version used or try to adapt the command yourself.</p>
<h3 id="unpacking_the_apk">Unpacking the apk<a class="headerlink" href="#unpacking_the_apk" title="Permanent link">&para;</a></h3>
<p>The first step is to unpack the apk so we can modify it.</p>
<p>We will do this with <a href="https://apktool.org/">apktool</a>, version <code>2.9.3</code> to be exact.</p>
<p>We can either use the wrapper or .jar directly. Of course, <a href="https://www.java.com">java</a> will be necessary.</p>
<p>Open up a terminal (command prompt) in the same directory(folder) as the <code>.apk</code> and run the following:</p>
<pre><code>apktool d LLAS_GL_3.12.0.apk
</code></pre>
<p>After unpacking, you should have a folder that has the same name as the <code>.apk</code> except for the extension, so <code>LLAS_GL_3.12.0</code> in our case.</p>
<p>The <code>LLAS_GL_3.12.0.apk</code> is just the file name, here it refer to LLAS, GL, version 3.12.0, but you can rename the apk to pretty much anything.</p>
<p>After that, you can do the relevant modifcation, then finally <a href="#repacking-the-apk">repack it</a></p>
<h3 id="packing_the_binary_to_unlock_the_game_features">Packing the binary to unlock the game features<a class="headerlink" href="#packing_the_binary_to_unlock_the_game_features" title="Permanent link">&para;</a></h3>
<p>By default, the game only show the EOS screen. Helpfully for us, the developer left in everything, and the EOS screen is triggered by a check function. To make the game work, we need to patch away this check. Furthermore, some feature are also time-sensitive, so they requires or will require other check later on.</p>
<h4 id="easy_way_out">Easy way out<a class="headerlink" href="#easy_way_out" title="Permanent link">&para;</a></h4>
<p>You can use these <a href="https://github.com/arina999999997/elichika/releases/tag/clients">clients</a> that has the binary patch in them, and do the later modification step if necessary.</p>
<h4 id="directly_edit_the_binaries">Directly edit the binaries<a class="headerlink" href="#directly_edit_the_binaries" title="Permanent link">&para;</a></h4>
<p>The file we need to patch is <code>libil2cpp.so</code>, we can find it in <code>LLAS_GL_3.12.0/lib/arm64-v8a/</code> (64 bit), or <code>LLAS_GL_3.12.0/lib/armeabi-v7a/</code> (32 bit).</p>
<p>We will need to change some specific bytes in the <code>libil2cpp.so</code> file to make the client work.</p>
<p>Tool and the relevant patch for editing is <a href="https://github.com/arina999999997/sifas-tools/tree/master/scripted_hex_editor">here</a>. Either build the tool and run it with the relevant patch, or make the edit manually using any binary editor.</p>
<h4 id="doing_things_properly">Doing things properly<a class="headerlink" href="#doing_things_properly" title="Permanent link">&para;</a></h4>
<p>If we want to make other binary modification, then we have to understand things properly. This is a very indepth topic, so here is a summary and resource to get started:</p>
<ul>
<li>SIFAS uses <code>il2cpp</code> with <code>Unity</code>. This means that their higher level code eventually get compiled to <code>C/C++</code> code, and then machine code (<code>.so</code>).</li>
<li>This is done for better performance, but it also allow us to use the various reverse engineer tools that are developed for <code>il2cpp</code>.</li>
<li>More precisely, <a href="https://github.com/djkaty/Il2CppInspector">Il2CppInspector</a> and <a href="https://github.com/Perfare/Il2CppDumper">Il2CppDumper</a> can read the project and provide more information.</li>
<li>So we can setup <code>libil2cpp.so</code> inside <a href="https://ghidra-sre.org/">Ghidra</a>, and see what the code is doing more easily.</li>
<li>After that, we can analyse the code and see what the game is actually doing, and then perform the relevant modification.</li>
<li>The prepade patch explains what we need to do, you can look at the same address in Ghidra to see the difference.</li>
<li>If you want to do modification, it might be better to directly patch the binary rather than doing the modification in Ghidra then exporting it.</li>
</ul>
<h3 id="patching_the_rsa_key_and_the_server_address">Patching the RSA key and the server address<a class="headerlink" href="#patching_the_rsa_key_and_the_server_address" title="Permanent link">&para;</a></h3>
<p>The RSA key and server address are stored in the <code>global-metadata.dat</code> of the <code>apk</code>. So in our case, we can find it at <code>LLAS_GL_3.12.0/assets/bin/Data/Managed/Metadata/global-metadata.dat</code>.</p>
<p>In short, this is just the way the game stores string literals, and we need to edit the relevant strings:</p>
<ul>
<li>The server address is the URL or the IP of the server, it's just the address that the client connect to.</li>
<li>
<p>The RSA key is used in communication between the client and the server.</p>
<ul>
<li>The client has the public key, and the server has the private key.</li>
<li>Because we don't have the private key for the public key that come with the client, we have to generate our own private-public key pairs</li>
<li>And then we have to change the public key for the client.</li>
</ul>
</li>
</ul>
<h4 id="using_the_metadata_string_editor_gui">Using the MetaData String Editor GUI<a class="headerlink" href="#using_the_metadata_string_editor_gui" title="Permanent link">&para;</a></h4>
<p>First download <a href="https://github.com/JeremieCHN/MetaDataStringEditor">MetaData String Editor</a>.</p>
<p>It is written in C#, and the <code>.exe</code> need Windows to run.</p>
<p>To change the address string, open the tool, then press the top left button and open up the <code>global-metadata.dat</code> file. You can find it in:</p>
<p>You will see many strings. Search for the current values using the textbox at the top. Double click on the string, click on the popup thing, and you will see another window pop up. You can edit that data to any other data. You will need to change:</p>
<ul>
<li>
<p>The server address:</p>
<ul>
<li>For gl client, the original address is "https://gl-real-prod-8f2jln5l4evlw5l1.llas.bushimo.jp/ep3120"</li>
<li>For jp client, the original address is "https://jp-real-prod-v4tadlicuqeeumke.llas.bushimo.jp/ep3120"</li>
<li>For <a href="https://github.com/arina999999997/elichika/releases/tag/clients">elichika's clients</a>, the original address is "http://127.0.0.1:8080" or "http://localhost:8080".</li>
<li>
<p>You can change the address to anything you want, but keep in mind the following:</p>
<ul>
<li>Do not have <code>/</code> at the end of the address.</li>
<li>For <code>https</code>, you might run into problems with trust certificate if you don't set things up properly.</li>
<li>The RSA key:</li>
</ul>
</li>
<li>
<p>Both gl and jp clients user the same original RSA key, the prefix is: "<RSAKeyValue><Modulus>v2VElqvCwrhdiXJ"</p>
</li>
<li>
<p>Elchika's RSA key is: </p>
<p><code>&lt;RSAKeyValue&gt;&lt;Modulus&gt;1r6QjkBr1hIGrgq95ZEEDnXqCYa+81hvhejsGoUcfCZ/kkngBuUbq8/rqRfoFVEZOmDRG8DKrhtfFoWQyftqycCrQj8ELQeGCQJFtdXg+eljb3HDP8Zzzh+9YXJHNIswCYfMFYXlBHP90QniFfZqfERVSqK9V1uJU8EyxHMismU=&lt;/Modulus&gt;&lt;Exponent&gt;AQAB&lt;/Exponent&gt;&lt;/RSAKeyValue&gt;</code>
- The key is in XML format, so if you want to use your own RSA keys then you have to convert it.</p>
</li>
</ul>
</li>
</ul>
<p>After editing the data, click the bottom right button to change it. After that, click the middle button on the top left of the program. Save the metadata as some other file, as you can't overwrite to the current file. After that you can close the tool, remove the original <code>global-metadata.dat</code> and rename the new file to <code>global-metadata.dat</code>. </p>
<h4 id="using_the_metadata_string_editor_cli">Using the MetaData String Editor CLI<a class="headerlink" href="#using_the_metadata_string_editor_cli" title="Permanent link">&para;</a></h4>
<p>Instead of the GUI, you can use the <a href="https://github.com/arina999999997/sifas-tools/tree/master/metadata_string_editor">Metadata String Editor</a> CLI that can replace string or edit strings by ids.</p>
<p>It also come with the relevant patches for SIFAS.</p>
<h3 id="changing_the_package_name_app_name_and_icon">Changing the package name, app name, and icon<a class="headerlink" href="#changing_the_package_name_app_name_and_icon" title="Permanent link">&para;</a></h3>
<p>Aside from changing metadata and binary, we can also change a few things about the app itself.</p>
<h4 id="changing_the_package_name">Changing the package name<a class="headerlink" href="#changing_the_package_name" title="Permanent link">&para;</a></h4>
<p>If you want to keep multiple clients, either for testing or for playing on multiple servers, you will have to change the package name as android systems don't allow multiple apps with the same package name.</p>
<p>To do this, you need to change the manifest file at <code>LLAS_GL_3.12.0/AndroidManifest.xml</code>.</p>
<p>Assume the package name is <code>com.klab.lovelive.allstars.global</code>, and we want to change it to <code>com.klab.lovelive.allstars.global.mod</code>, then we have to change every instance of <code>com.klab.lovelive.allstars.global</code> to <code>com.klab.lovelive.allstars.global.mod</code> except for the instance that say <code>com.klab.lovelive.allstars.global.GlobalUnsafeMainActivity</code>.</p>
<h4 id="changing_the_app_name">Changing the app name<a class="headerlink" href="#changing_the_app_name" title="Permanent link">&para;</a></h4>
<p>To change the app name, you will have to change the field <code>"app_name"</code> to what you want in <code>LLAS_GL_3.12.0/res/values/strings.xml</code>.</p>
<h4 id="changing_the_app_icon">Changing the app icon<a class="headerlink" href="#changing_the_app_icon" title="Permanent link">&para;</a></h4>
<p>You can also modify the icon in <code>LLAS_GL_3.12.0/res/mipmap...</code>. Note that this depend on your DPI, so you might have to edit them all.</p>
<h3 id="repacking_the_apk">Repacking the apk<a class="headerlink" href="#repacking_the_apk" title="Permanent link">&para;</a></h3>
<p>First, use <a href="https://apktool.org/">apktool</a> to build the <code>.apk</code>:</p>
<pre><code>apktool b LLAS_GL_3.12.0
</code></pre>
<p>After <code>apktool</code> is done, you can find the output <code>.apk</code> at <code>LLAS_GL_3.12.0/dist/LLAS_GL_3.12.0.apk</code></p>
<p>However, this <code>.apk</code> is not completed, we need to sign it before it can be installed in standard devices.</p>
<p>The easiest way to do this is to use the <a href="https://github.com/patrickfav/uber-apk-signer/releases">uber-apk-signer</a>. If you know how to do it in other ways (i.e. with apksigner), feel free to do so.</p>
<p>Download <a href="https://github.com/patrickfav/uber-apk-signer/releases">uber-apk-signer-<version>.jar</a>, then run:</p>
<pre><code>java -jar uber-apk-signer-&lt;version&gt;.jar -a LLAS_GL_3.12.0/dist/LLAS_GL_3.12.0.apk
</code></pre>
<p>You can find the output apk in the same folder as the input one:</p>
<pre><code>LLAS_GL_3.12.0/dist/LLAS_GL_3.12.0-aligned-debugSigned.apk
</code></pre>
<p>After this, you can install that <code>.apk</code>. If you already have a version of SIFAS, you might get an error saying that the signature doesn't match. You can uninstall the old version or <a href="#changing-the-package-name-app-name-and-icon">change the client package name</a> to have a different app entirely.</p>
<h3 id="patching_android_client_to_new_address_with_frida">Patching Android client to new address with frida<a class="headerlink" href="#patching_android_client_to_new_address_with_frida" title="Permanent link">&para;</a></h3>
<p>It's possible to use <a href="https://github.com/vfsfitvnm/frida-il2cpp-bridge">frida</a> to change the address and avoid having to patch the <code>.apk</code>, as demonstated by <code>sarah</code> in the LL Hax discord. If you don't want to use the above patching process, you might want to try that.</p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../..", "features": [], "search": "../../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../../assets/javascripts/bundle.525ec568.min.js"></script>
</body>
</html>