Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes/1.1 #303

Merged
merged 5 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,14 @@ docker run -it -v "$(pwd):/t" -e HASH_PATCH=aa64af18e7d086041ac127cc4bc50c5e -e
# Linux, Windows

EXAMPLE BUILD ANDROID ARM64:
```bash
docker run -e WAIT=300 -e x64=0 -e arm=0 -e HASH_PATCH=<Snapshot_Hash> -e COMMIT=<Engine_commit> --rm -iv${PWD}:/t reflutter
```

FLAGS:
-e x64=0 <disables building for x64 architecture, use to reduce building time>
-e arm64=0 <disables building for arm64 architecture, use to reduce building time>
-e arm=0 <disables building for arm32 architecture, use to reduce building time>
-e WAIT=300 <the amount of time in seconds you need to edit source code>
-e HASH_PATCH=[Snapshot_Hash] <here you need to specify snapshot hash which matches the engine_commit line of enginehash.csv table best. It is used for proper patch search in reFlutter and for successfull compilation>
-e COMMIT=[Engine_commit] <here you specify commit for your engine version, take it from enginehash.csv table or from flutter/engine repo>
FLAGS:<br/>
-e x64=0 <disables building for x64 architecture, use to reduce building time><br/>
-e arm64=0 <disables building for arm64 architecture, use to reduce building time><br/>
-e arm=0 <disables building for arm32 architecture, use to reduce building time><br/>
-e WAIT=300 <the amount of time in seconds you need to edit source code><br/>
-e HASH_PATCH=[Snapshot_Hash] <here you need to specify snapshot hash which matches the engine_commit line of enginehash.csv table best. It is used for proper patch search in reFlutter and for successfull compilation><br/>
-e COMMIT=[Engine_commit] <here you specify commit for your engine version, take it from enginehash.csv table or from flutter/engine repo><br/>
2 changes: 1 addition & 1 deletion scripts/build-engine
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ echo 'solutions = [{"managed": False,"name": "src/flutter","url": "'"$ROOT_DIR"/
gclient sync
reflutter "$SNAPSHOT_HASH" -l
cd "$ROOT_DIR"
export PATH=$PATH:$(pwd)/depot_tools && sudo xcode-select -s /Applications/Xcode.app && customEngine/src/flutter/tools/gn --ios --ios-cpu=arm64 --runtime-mode=release && ninja -C customEngine/src/out/ios_release
export PATH=$PATH:$(pwd)/depot_tools && sudo xcode-select -s /Applications/Xcode.app && customEngine/src/flutter/tools/gn --ios --runtime-mode=release && ninja -C customEngine/src/out/ios_release
cp customEngine/src/out/ios_release/Flutter.framework/Flutter Flutter
cd "$ROOT_DIR"
export PATH=$PATH:$(pwd)/depot_tools && customEngine/src/flutter/tools/gn --no-goma --android --android-cpu=arm64 --runtime-mode=release && ninja -C customEngine/src/out/android_release_arm64
Expand Down
27 changes: 14 additions & 13 deletions scripts/get_flutter_engine.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

"""
Get snapshot hash
Get Flutter Engine Hash
"""
import re
import string
Expand All @@ -11,7 +11,7 @@


def usage():
print('[-] Usage: python {} [flutter_engine_library]'.format(sys.argv[0]))
print('[-] Usage: python {} [libflutter.so]'.format(sys.argv[0]))
sys.exit(1)


Expand All @@ -20,33 +20,34 @@ def usage():


def is_hash_valid(string_hash: str) -> bool:
return get(f'https://github.com/flutter/engine/tree/{string_hash}').status_code == 200
return get(f'https://github.com/flutter/engine/commit/{string_hash}').status_code == 200


fname = sys.argv[1]
min = 40
file_name = sys.argv[1]
min_hash_length = 40
if sys.version_info >= (3, 0):
f = open(fname, errors='ignore')
f = open(file_name, errors='ignore')
else:
f = open(fname, 'rb')
f = open(file_name, 'rb')

libappHash = []
lib_app_hash = []
excluded_hashes = ['0000000000000000000000000000000000000000', '6666666666666660666666666666666666666666',
'a2a2a2a2a2a2aa4a2aa4a2aa4a2aa4a2aa4a2a2a', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'a2a2a2a2a2a2aa4a2aa4a2aa4a2aa4a2aa4a2a2a']
'a2a2a2a2a2a2aa4a2aa4a2aa4a2aa4a2aa4a2a2a', '3333333333333333333333333333333333333333']
result = ''
counter = 0
for c in f.read():
if c in string.printable:
result += c
continue
if len(result) >= min:
if len(result) >= min_hash_length:
hashT = re.findall(r'([a-f\d]{40})', result)
if len(hashT) == 1 and (hashT[0] not in excluded_hashes):
libappHash.append(hashT[0])
for _hash in hashT:
if _hash not in excluded_hashes:
lib_app_hash.append(_hash)
f.close()
result = ''

for _hash in libappHash:
for _hash in lib_app_hash:
if is_hash_valid(_hash):
print(_hash)
20 changes: 10 additions & 10 deletions scripts/get_snapshot_hash.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

"""
Get snapshot hash
Get Snapshot Hash
"""

import re
Expand All @@ -10,32 +10,32 @@


def usage():
print('[-] Usage: python {} [lib_app_library]'.format(sys.argv[0]))
print('[-] Usage: python {} [libapp.so]'.format(sys.argv[0]))
sys.exit(1)


if len(sys.argv) != 2:
usage()

fname = sys.argv[1]
min = 32
file_name = sys.argv[1]
min_hash_length = 32
if sys.version_info >= (3, 0):
f = open(fname, errors="ignore")
f = open(file_name, errors="ignore")
else:
f = open(fname, 'rb')
f = open(file_name, 'rb')

libappHash = ""
lib_app_hash = ""
result = ""
for c in f.read():
if c in string.printable:
result += c
continue
if len(result) >= min:
if len(result) >= min_hash_length:
hashT = re.findall(r"([a-f\d]{32})", result)
if len(hashT) > 0:
libappHash = hashT[0]
lib_app_hash = hashT[0]
break
f.close()
result = ""

print(libappHash)
print(lib_app_hash)
2 changes: 0 additions & 2 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ def patchSource(hashS, ver):
replaceFileText('src/third_party/boringssl/src/ssl/ssl_x509.cc',
'static int ssl_crypto_x509_session_verify_cert_chain(SSL_SESSION *session,\n SSL_HANDSHAKE *hs,\n uint8_t *out_alert) {',
'static int ssl_crypto_x509_session_verify_cert_chain(SSL_SESSION *session,\n SSL_HANDSHAKE *hs,\n uint8_t *out_alert) {return 1;')

# fix for > 3.22.0. weird huh
replaceFileText('src/third_party/boringssl/src/ssl/ssl_x509.cc', """static bool ssl_crypto_x509_session_verify_cert_chain(SSL_SESSION *session,
SSL_HANDSHAKE *hs,
uint8_t *out_alert) {""", """static bool ssl_crypto_x509_session_verify_cert_chain(SSL_SESSION *session,
Expand Down
Loading