print_to_user(
"Welcome to DubheCTF2024 DayDream! Please proof of work to continue.\n"
)
if
not
proof_of_work():
print_to_user(
"Please proof of work again, exit...\n"
)
exit(
-
1
)
print_to_user(
"Please enter your apk url:"
)
url
=
sys.stdin.readline().strip()
EXP_FILE
=
download_file(url)
if
not
check_apk(EXP_FILE):
print_to_user(
"Invalid apk file.\n"
)
exit(
-
1
)
emulator
=
setup_emulator()
adb([
"wait-for-device"
])
wait_for_device_boot_complete()
adb([
"shell"
,
"su"
,
"root"
,
"pm"
,
"disable"
,
"com.android.settings/.accounts.AddAccountSettings"
])
adb_install(APK_FILE)
adb_activity(f
"{VICTIM}/.MainActivity"
, wait
=
True
)
with
open
(FLAG_FILE,
"r"
) as f:
adb_broadcast(f
"com.tsctf.SET_FLAG"
, f
"{VICTIM}/.FlagReceiver"
, extras
=
{
"flag"
: f.read()})
adb_install(EXP_FILE)
adb_activity(f
"{ATTACKER}/.MainActivity"
)
one_click()
print_to_user(
"One_click finished! The logcat log will be output after 5 seconds.\n"
)
adb([
"shell"
,
"logcat -d -s SecretActivity"
,
">"
,
"/logcat_"
+
str
(ADB_PORT)
+
".txt"
])