lucapiccolboni / crylogger

CRYLOGGER: Detecting Crypto Misuses for Android and Java Apps Dynamically
MIT License
149 stars 13 forks source link

There is no application.cryptolog. in /data/data/com.example.aes/cache/ #4

Open Rocksnake opened 3 years ago

Rocksnake commented 3 years ago

I followed the instructions in the README and executed the commands in order, but when I reached the 'Collect the logs' step, 'cryptolog | failed' was printed. By looking at the script file, I found the problem was that there was no no application.cryptolog. in /data/data/com.example.aes/cache/, which led to The run_cmd function returns Error, I want to know how to solve it.

Thanks in advance.

image

Rocksnake commented 3 years ago

Learn from your previous Issue, I just run the test application that is included in the folder app-test, but it still was error.

lucapiccolboni commented 3 years ago

Hi, can you please check if there are other files in the directory /data/data/com.example.aes/? There should be a file called aes.log in one of the subdirectories. Can you confirm that the file aes.log is there? This is to make sure that the application was executed successfully. Can you report the content of this file?

Rocksnake commented 3 years ago

Yeah, there is file aes.log in the directory /data/data/com.example.aes/, and the content is: [decrypted: The quick brown fox jumps over the lazy dog]

lucapiccolboni commented 3 years ago

Ok, great. Can you please go inside the directory android-emu/libcore and run the command git status?

Rocksnake commented 3 years ago

I created the emulator manually and did not use the method in the README, so there is no android-emu directory in my root directory. I didn't execute these commands in the picture below. image

lucapiccolboni commented 3 years ago

Thanks! Sorry, but you need to create the emulator by using the method explained in the README. We modified the Java library to print the log. If you use a different emulator, you use the standard Java library and therefore the file application.cryptolog is not created.

Rocksnake commented 3 years ago

Okay, thanks for your reply, I will try your method first, and then tell you the result of my attempt

hanyuancheung commented 3 years ago

Thanks! Sorry, but you need to create the emulator by using the method explained in the README. We modified the Java library to print the log. If you use a different emulator, you use the standard Java library and therefore the file application.cryptolog is not created.

Little personal suggestion is that u can add this requirement which need to create the emulator as README doing to the supplementary document, so that others wont meet the same problem as above ~~ Great thanks a lot ~~

baoyilee commented 3 years ago

Thanks! Sorry, but you need to create the emulator by using the method explained in the README. We modified the Java library to print the log. If you use a different emulator, you use the standard Java library and therefore the file application.cryptolog is not created.

Hi, could you please provide the modified Java library

baoyilee commented 3 years ago

Thanks! Sorry, but you need to create the emulator by using the method explained in the README. We modified the Java library to print the log. If you use a different emulator, you use the standard Java library and therefore the file application.cryptolog is not created.

Maybe you provided, but I didn't find it, could you please tell me where it is

lucapiccolboni commented 3 years ago

Hi, if you build the emulator as explained in the instructions (the emulator you run from the directory emulator-emu that is created with the script scripts/setup/setup_emu.py) you will run your applications with our modified Java library. You can find the modifications to the Java library in scripts/deltas/libcore/ojluni/src/main/java. Thanks

baoyilee commented 3 years ago

Hi, if you build the emulator as explained in the instructions (the emulator you run from the directory emulator-emu that is created with the script scripts/setup/setup_emu.py) you will run your applications with our modified Java library. You can find the modifications to the Java library in scripts/deltas/libcore/ojluni/src/main/java. Thanks

Many thanks for your reply and guide

baoyilee commented 3 years ago

Hi, if you build the emulator as explained in the instructions (the emulator you run from the directory emulator-emu that is created with the script scripts/setup/setup_emu.py) you will run your applications with our modified Java library. You can find the modifications to the Java library in scripts/deltas/libcore/ojluni/src/main/java. Thanks

Hi, I built the emulator as explained in the structions, but now I have a problem. When I entered the script "emulator" or "emulator -writable-system", a line of instruction, “emulator: ERROR: No initial system image for this configuration”, will appear. Then I searched it in google, but no satisfying results occured. Could you please give me some guidance? Many thanks! 2021-05-07 17-07-50 的屏幕截图

lucapiccolboni commented 3 years ago

Hi, I think there is some sort of issue with the compilation process. Please go inside the directory android-emu and then do the following:

source ./build/envsetup.sh
lunch sdk_phone_x86-userdebug
make

This re-compiles the emulator. Is the compilation successful?

Thanks

baoyilee commented 3 years ago

Hi, I think there is some sort of issue with the compilation process. Please go inside the directory android-emu and then do the following:

source ./build/envsetup.sh
lunch sdk_phone_x86-userdebug
make

This re-compiles the emulator. Is the compilation successful?

Thanks

Hi, When I followed your instructions, a new problem occured. Both "./build/envsetup.sh" and "lunch sdk_phone_x86-userdebug" are successful, but when I entered "make", a line of instruction, "failed to build some targets ", appeared. Maybe you have encountered this kind of problem before, Could you please give me some guidance? Many thanks!

liyuxi@liyuxi-All-Series:~/crylogger/android-emu$ source ./build/envsetup.sh including device/generic/car/vendorsetup.sh including device/generic/mini-emulator-arm64/vendorsetup.sh including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh including device/generic/mini-emulator-mips64/vendorsetup.sh including device/generic/mini-emulator-mips/vendorsetup.sh including device/generic/mini-emulator-x86_64/vendorsetup.sh including device/generic/mini-emulator-x86/vendorsetup.sh including device/generic/uml/vendorsetup.sh including device/google/crosshatch/vendorsetup.sh including device/google/cuttlefish/vendorsetup.sh including device/google/marlin/vendorsetup.sh including device/google/muskie/vendorsetup.sh including device/google/taimen/vendorsetup.sh including device/linaro/hikey/vendorsetup.sh including sdk/bash_completion/adb.bash liyuxi@liyuxi-All-Series:~/crylogger/android-emu$ lunch sdk_phone_x86-userdebug

============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=9 TARGET_PRODUCT=sdk_phone_x86 TARGET_BUILD_VARIANT=userdebug TARGET_BUILD_TYPE=release TARGET_ARCH=x86 TARGET_ARCH_VARIANT=x86 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-5.8.0-50-generic-x86_64-Ubuntu-20.04.2-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=PQ3A.190505.001 OUT_DIR=out

liyuxi@liyuxi-All-Series:~/crylogger/android-emu$ make

PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=9 TARGET_PRODUCT=sdk_phone_x86 TARGET_BUILD_VARIANT=userdebug TARGET_BUILD_TYPE=release TARGET_ARCH=x86 TARGET_ARCH_VARIANT=x86 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-5.8.0-50-generic-x86_64-Ubuntu-20.04.2-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=PQ3A.190505.001 OUT_DIR=out

ninja: no work to do. ninja: no work to do. wildcard(out/target/product/generic_x86/clean_steps.mk) was changed, regenerating... No need to regenerate ninja file [ 0% 1/79616] host C++: aapt <= frameworks/base/tools/aapt/Main.cpp FAILED: out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.o /bin/bash -c "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -I frameworks/base/tools/aapt -I out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates -I out/host/linux-x86/gen/EXECUTABLES/aapt_intermediates -I libnativehelper/include_jni \$(cat out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/import_includes) -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I libnativehelper/include -I frameworks/native/include -I frameworks/native/opengl/include -I frameworks/av/include -c -Wa,--noexecstack -fPIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -DSTDC_FORMAT_MACROS -DSTDC_CONSTANT_MACROS --gcc-toolchain=prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 --sysroot prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot -fstack-protector-strong -m64 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -fdebug-prefix-map=\$PWD/= -target x86_64-linux-gnu -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin -Wsign-promo -Wno-inconsistent-missing-override -Wno-null-dereference -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-thread-safety-negative -Wno-gnu-include-next -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8 -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/backward -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/x86_64-linux -std=gnu++14 -DAAPT_VERSION=\\"\$(cat out/build_number.txt)\\" -Wall -Werror -fPIE -D_USING_LIBCXX -DANDROID_STRICT -nostdinc++ -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -MD -MF out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.d -o out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.o frameworks/base/tools/aapt/Main.cpp" prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory [ 0% 6/79616] build out/target/commo...PACKAGING/hiddenapi-dark-greylist.txt ninja: build stopped: subcommand failed. 17:37:37 ninja failed with: exit status 1

failed to build some targets (02:28 (mm:ss))

baoyilee commented 3 years ago

Hi, I think there is some sort of issue with the compilation process. Please go inside the directory android-emu and then do the following:

source ./build/envsetup.sh
lunch sdk_phone_x86-userdebug
make

This re-compiles the emulator. Is the compilation successful? Thanks

Hi, When I followed your instructions, a new problem occured. Both "./build/envsetup.sh" and "lunch sdk_phone_x86-userdebug" are successful, but when I entered "make", a line of instruction, "failed to build some targets ", appeared. Maybe you have encountered this kind of problem before, Could you please give me some guidance? Many thanks!

liyuxi@liyuxi-All-Series:~/crylogger/android-emu$ source ./build/envsetup.sh including device/generic/car/vendorsetup.sh including device/generic/mini-emulator-arm64/vendorsetup.sh including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh including device/generic/mini-emulator-mips64/vendorsetup.sh including device/generic/mini-emulator-mips/vendorsetup.sh including device/generic/mini-emulator-x86_64/vendorsetup.sh including device/generic/mini-emulator-x86/vendorsetup.sh including device/generic/uml/vendorsetup.sh including device/google/crosshatch/vendorsetup.sh including device/google/cuttlefish/vendorsetup.sh including device/google/marlin/vendorsetup.sh including device/google/muskie/vendorsetup.sh including device/google/taimen/vendorsetup.sh including device/linaro/hikey/vendorsetup.sh including sdk/bash_completion/adb.bash liyuxi@liyuxi-All-Series:~/crylogger/android-emu$ lunch sdk_phone_x86-userdebug

============================================

PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=9 TARGET_PRODUCT=sdk_phone_x86 TARGET_BUILD_VARIANT=userdebug TARGET_BUILD_TYPE=release TARGET_ARCH=x86 TARGET_ARCH_VARIANT=x86 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-5.8.0-50-generic-x86_64-Ubuntu-20.04.2-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=PQ3A.190505.001 OUT_DIR=out

liyuxi@liyuxi-All-Series:~/crylogger/android-emu$ make

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=9 TARGET_PRODUCT=sdk_phone_x86 TARGET_BUILD_VARIANT=userdebug TARGET_BUILD_TYPE=release TARGET_ARCH=x86 TARGET_ARCH_VARIANT=x86 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-5.8.0-50-generic-x86_64-Ubuntu-20.04.2-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=PQ3A.190505.001 OUT_DIR=out ninja: no work to do. ninja: no work to do. wildcard(out/target/product/generic_x86/clean_steps.mk) was changed, regenerating... No need to regenerate ninja file [ 0% 1/79616] host C++: aapt <= frameworks/base/tools/aapt/Main.cpp FAILED: out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.o /bin/bash -c "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -I frameworks/base/tools/aapt -I out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates -I out/host/linux-x86/gen/EXECUTABLES/aapt_intermediates -I libnativehelper/include_jni $(cat out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/import_includes) -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I libnativehelper/include -I frameworks/native/include -I frameworks/native/opengl/include -I frameworks/av/include -c -Wa,--noexecstack -fPIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -DSTDC_FORMAT_MACROS -DSTDC_CONSTANT_MACROS --gcc-toolchain=prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 --sysroot prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot -fstack-protector-strong -m64 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -fdebug-prefix-map=$PWD/= -target x86_64-linux-gnu -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin -Wsign-promo -Wno-inconsistent-missing-override -Wno-null-dereference -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-thread-safety-negative -Wno-gnu-include-next -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8 -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/backward -isystem prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/include/c++/4.8/x86_64-linux -std=gnu++14 -DAAPT_VERSION=\"$(cat out/build_number.txt)\" -Wall -Werror -fPIE -D_USING_LIBCXX -DANDROID_STRICT -nostdinc++ -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -MD -MF out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.d -o out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.o frameworks/base/tools/aapt/Main.cpp" prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory [ 0% 6/79616] 2021-05-07 17-52-18 的屏幕截图 build out/target/commo...PACKAGING/hiddenapi-dark-greylist.txt ninja: build stopped: subcommand failed. 17:37:37 ninja failed with: exit status 1

failed to build some targets (02:28 (mm:ss))

2021-05-07 17-52-16 的屏幕截图

lucapiccolboni commented 3 years ago

Hi, thank you. The compilation process can be a little complicated because there are several dependencies. In your case, it looks like the error is "error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory". Try to install this library in Ubuntu. Thanks!

baoyilee commented 3 years ago

Hi, thank you. The compilation process can be a little complicated because there are several dependencies. In your case, it looks like the error is "error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory". Try to install this library in Ubuntu. Thanks!

Hi, many thanks for your patient reply and guidance! The compilation is successful! And I tested the given application mentioned in the file "readme" successfully. But when I tested other apps, a line of instruction, "install | failed", appeared. Could you please give me some guidance? Many thanks! 2021-05-08 18-40-54 的屏幕截图 2021-05-08 18-41-00 的屏幕截图

lucapiccolboni commented 3 years ago

Great! Please make sure you use the following naming convention for your app: <package_name>_<version>.apk, where <package_name> is the package name of the Android app and <version> is its version number. If you don't know the version number put "0", but please follow the naming convention. Also note that you might need to change the number of random events to send to the app. By default it is 100 as you can see here. Thanks

baoyilee commented 3 years ago

Great! Please make sure you use the following naming convention for your app: <package_name>_<version>.apk, where <package_name> is the package name of the Android app and <version> is its version number. If you don't know the version number put "0", but please follow the naming convention. Also note that you might need to change the number of random events to send to the app. By default it is 100 as you can see here. Thanks2021-05-09 09-39-26 的屏幕截图Hi, I followed your instructions, and I named the app qq "qq_0.apk", and changed the number of random events(100 --> 90; 100 --> 150), but still failed. Could you please give me some guidance? Many thanks! 2021-05-09 09-38-46 的屏幕截图

2021-05-09 09-38-59 的屏幕截图

2021-05-09 09-39-58 的屏幕截图

baoyilee commented 3 years ago

Great! Please make sure you use the following naming convention for your app: <package_name>_<version>.apk, where <package_name> is the package name of the Android app and <version> is its version number. If you don't know the version number put "0", but please follow the naming convention. Also note that you might need to change the number of random events to send to the app. By default it is 100 as you can see here. Thanks

Hi, If I downloaded apps from Google Play Store in emulator, can I test it directly?

baoyilee commented 3 years ago

Great! Please make sure you use the following naming convention for your app: <package_name>_<version>.apk, where <package_name> is the package name of the Android app and <version> is its version number. If you don't know the version number put "0", but please follow the naming convention. Also note that you might need to change the number of random events to send to the app. By default it is 100 as you can see here. Thanks

Hi, If I downloaded apps from Google Play Store in emulator, can I test it directly?

2021-05-09 10-34-56 的屏幕截图 2021-05-09 10-35-16 的屏幕截图

baoyilee commented 3 years ago

Great! Please make sure you use the following naming convention for your app: <package_name>_<version>.apk, where <package_name> is the package name of the Android app and <version> is its version number. If you don't know the version number put "0", but please follow the naming convention. Also note that you might need to change the number of random events to send to the app. By default it is 100 as you can see here. Thanks

Hi, some apps I downloaded successfully, but it can not pin and uninstall. Could you give me some guidance? Many thanks! 2021-05-09 11-02-38 的屏幕截图

lucapiccolboni commented 3 years ago

Yes you can run apps from the Google Play Store. However, some apps cannot be run on an emulator for a variety of reasons. Were you able to run these apps manually instead of using the script run.py?

To debug, when you run an app and something fails you should get a file called crash.log in the directory scripts. You can check this file and see what failed for that specific app. Please note that we keep appending information to crash.log so delete this file before a new run. Thanks

baoyilee commented 3 years ago

Yes you can run apps from the Google Play Store. However, some apps cannot be run on an emulator for a variety of reasons. Were you able to run these apps manually instead of using the script run.py?

To debug, when you run an app and something fails you should get a file called crash.log in the directory scripts. You can check this file and see what failed for that specific app. Please note that we keep appending information to crash.log so delete this file before a new run. Thanks

Many thanks for your patient reply and guidance! Can I use CRYLOGGER to generate cryptologs for the app which I can run from the Google Play Store? If I can, what should I do? Could you please give me some guidance? Many thanks again!

baoyilee commented 3 years ago

Yes you can run apps from the Google Play Store. However, some apps cannot be run on an emulator for a variety of reasons. Were you able to run these apps manually instead of using the script run.py?

To debug, when you run an app and something fails you should get a file called crash.log in the directory scripts. You can check this file and see what failed for that specific app. Please note that we keep appending information to crash.log so delete this file before a new run. Thanks

Hi, can I use “lunch sdk_phone_x86_64-userdebug” or "lunch sdk_phone_armeabi-v7a-userdebug" instead of “lunch sdk_phone_x86-userdebug”? When I downloaded some apps, a line of instruction "Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]" appeared in the crash.log.

lucapiccolboni commented 3 years ago

Yes, you can run apps downloaded from the Google Play Store. If an app fails because of missing libraries, it might not be possible to run it on the emulator. I've never tried the target lunch sdk_phone_armeabi-v7a-userdebug.

You might need to increase the number of random events generated with Monkey because usually 100 is too low to execute some cryptographic APIs. If you don't find the log after the execution you can try to execute more events, e.g., 10k. Note that some apps require login credentials, thus it is more difficult to run them with Monkey.

Rocksnake commented 3 years ago

Yes, you can run apps downloaded from the Google Play Store. If an app fails because of missing libraries, it might not be possible to run it on the emulator. I've never tried the target lunch sdk_phone_armeabi-v7a-userdebug.

You might need to increase the number of random events generated with Monkey because usually 100 is too low to execute some cryptographic APIs. If you don't find the log after the execution you can try to execute more events, e.g., 10k. Note that some apps require login credentials, thus it is more difficult to run them with Monkey.

Excuse me, if the tested apk is of ARM or x86_64 architecture, it may conflict with the architecture of the simulator(Because the emulator we create is x86 architecture.). We all know that for a complete apk, it is more difficult to edit the build.gradle file file and recompile the apk by reverse engineering. Then can you recommend some apk that you tested successfully, the apk I downloaded currently has this problem. Thanks!

lucapiccolboni commented 3 years ago

Hi, for many apps you can download the apks that target a specific architecture, e.g., x86. You do not need to reverse engineer the apps and recompile them. Alternatively as you suggested in your previous comment you can change the target architecture. Thanks!

baoyilee commented 3 years ago

Yes, you can run apps downloaded from the Google Play Store. If an app fails because of missing libraries, it might not be possible to run it on the emulator. I've never tried the target lunch sdk_phone_armeabi-v7a-userdebug.

You might need to increase the number of random events generated with Monkey because usually 100 is too low to execute some cryptographic APIs. If you don't find the log after the execution you can try to execute more events, e.g., 10k. Note that some apps require login credentials, thus it is more difficult to run them with Monkey.

Hi, If I run apps downloaded from the Google Play Store, what shoule I do to get cryptologs of these apps with CRYLOGGER?

lucapiccolboni commented 3 years ago

The process is similar to the app we provided in this repository. The only differences are that you need to download the app from the Google Play Store and change the number of random events. To download a set of apps, I used an apk crawler that used the Google Play Store website to download the APKs. Unfortunately this is no longer available... but you may be able to find something similar that downloads the app for the architecture you want to use. Thanks

baoyilee commented 3 years ago

The process is similar to the app we provided in this repository. The only differences are that you need to download the app from the Google Play Store and change the number of random events. To download a set of apps, I used an apk crawler that used the Google Play Store website to download the APKs. Unfortunately this is no longer available... but you may be able to find something similar that downloads the app for the architecture you want to use. Thanks

Sorry, I mean what command should I enter. According to the instructions given, I will enter "python run.py --work_dir data --session emulator-", but the apps I downloaded directly from the Google Play Store in the given emulator will not provide an apk file. Many thanks!

baoyilee commented 3 years ago

The process is similar to the app we provided in this repository. The only differences are that you need to download the app from the Google Play Store and change the number of random events. To download a set of apps, I used an apk crawler that used the Google Play Store website to download the APKs. Unfortunately this is no longer available... but you may be able to find something similar that downloads the app for the architecture you want to use. Thanks

Hi, could you please recommend some apps that you tested successfully? Many thanks!

lucapiccolboni commented 3 years ago

Sorry for misunderstanding. The script run.py assumes that you have the apk of the app to install. If the app is already installed on the emulator, e.g., by using the marketplace, you need to modify the script to skip the installation step and find a way to provide the name and the package to the script. So you need to modify manually the Python script as it does not provide the functionality that you're asking.

Regarding the apps, I tested several apps. Please try some of the Google Play Store. If the installation is successful and the app works correctly, you should be able to get the log of the cryptographic APIs. If you don't find the log it means that the app has not been executed for enough time. In one of your previous screenshots, an app was running successfully, please try to extract the log from that one. The log should be in the directory /data/data/<app-package>/cache.

I hope this helps.

baoyilee commented 3 years ago

Sorry for misunderstanding. The script run.py assumes that you have the apk of the app to install. If the app is already installed on the emulator, e.g., by using the marketplace, you need to modify the script to skip the installation step and find a way to provide the name and the package to the script. So you need to modify manually the Python script as it does not provide the functionality that you're asking.

Regarding the apps, I tested several apps. Please try some of the Google Play Store. If the installation is successful and the app works correctly, you should be able to get the log of the cryptographic APIs. If you don't find the log it means that the app has not been executed for enough time. In one of your previous screenshots, an app was running successfully, please try to extract the log from that one. The log should be in the directory /data/data/<app-package>/cache.

I hope this helps.

Many thanks for your patient reply and guidance! I have already solved all the problems mentioned above. Maybe someone added a necessary snippet code to the file "build.gradle" in his app so that the app can be installed in the given X86 emulator, but others did not do like this.

kyangl commented 3 years ago

Hi! I also have trouble installing apps from Google Play Store onto the emulator. I have successfully run crylogger on the given example app and am trying to run it to test other top apps from Google Play Store. Here's what I did:

  1. use chrome extension to download apk files from Google Play to my mac, and transfer the .apk file to the remote server (where the emulator is located) (app info: phone, x86, android 9.0)

    Screen Shot 2021-06-16 at 11 12 40 AM Screen Shot 2021-06-16 at 11 12 57 AM
  2. Then I tried to do adb -s emulator-5554 install -g data/apks/voila-ai-new_27.apk, but I always got the error message saying "broken pipe (32)" as below

    Screen Shot 2021-06-16 at 5 31 24 PM

    I tried to uninstall "com.example.aes" and reinstall it again, but it output the same error. (Sometimes, the error message may be saying transaction failure).

I have tried adb kill-server and adb start-server and restart the emulator multiple times (as suggested on some posts online), but it still did not work. Have you met similar problem before? Or do you have any suggestions on this? Thank you!

lucapiccolboni commented 3 years ago

Hi, sorry I've never seen that error message before. I'm not sure what it is going on. Thanks.

kyangl commented 3 years ago

No worries, thank you for you reply! I have tried several times more and it still didn't work. In this case, I am going to try to install Ubuntu and run this on mac to see what happens.

jpf-njtech commented 3 years ago

Sorry for misunderstanding. The script run.py assumes that you have the apk of the app to install. If the app is already installed on the emulator, e.g., by using the marketplace, you need to modify the script to skip the installation step and find a way to provide the name and the package to the script. So you need to modify manually the Python script as it does not provide the functionality that you're asking. Regarding the apps, I tested several apps. Please try some of the Google Play Store. If the installation is successful and the app works correctly, you should be able to get the log of the cryptographic APIs. If you don't find the log it means that the app has not been executed for enough time. In one of your previous screenshots, an app was running successfully, please try to extract the log from that one. The log should be in the directory /data/data/<app-package>/cache. I hope this helps.

Many thanks for your patient reply and guidance! I have already solved all the problems mentioned above. Maybe someone added a necessary snippet code to the file "build.gradle" in his app so that the app can be installed in the given X86 emulator, but others did not do like this. 你好,我也发现了这个问题,适用于arm架构的apk在x86架构的模拟器上安装会出现错误,而且目前国内应用arm是主流,请问你是怎么解决的呢。