当前位置:网站首页>山西省第二届网络安全技能大赛(企业组)部分赛题WP(十)
山西省第二届网络安全技能大赛(企业组)部分赛题WP(十)
2022-07-30 04:17:00 【菜@就一个字】
前言
有幸参加了2022年山西省第二届网络安全技能大赛企业组的比赛,这是第一次参加ctf比赛,本着积累实战经验的目的去的,排名有点意外。
提示:以下是本篇文章正文内容。
一、题目
题目:
apk逆向题。
附件:
schoolboy.apk
二、解题步骤
1.解题思路
反汇编apk文件,找出启动页,查看算法,撸代码。
2.解题过程
反编译后,在com/example.worker/MainActivity可看到如下代码:
package com.example.worker;
import android.os.Bundle;
import android.util.Base64;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.io.UnsupportedEncodingException;
/* loaded from: classes.dex */
public class MainActivity extends AppCompatActivity {
public static int num = 0;
public String b64Decrypt(String encodeWord) throws UnsupportedEncodingException {
String decodeWord = new String(Base64.decode(encodeWord, 2), "utf-8");
return decodeWord;
}
public String getFlag(String flag) throws Exception {
String flag2 = b64Decrypt(flag); // 2.复盘:对flag进行base64解密
byte[] c = flag2.getBytes();
for (int i = 0; i < flag2.length(); i++) {
c[i] = (byte) (c[i] ^ i); // 3.复盘:对Base解密字串按位异或,推出原始字串
}
String result = new String(c, 0, c.length);
return result;
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, android.app.Activity
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button studyButton = (Button) findViewById(R.id.button);
final TextView studyTime = (TextView) findViewById(R.id.studytime);
studyButton.setOnClickListener(new View.OnClickListener() { // from class: com.example.worker.MainActivity.1
@Override // android.view.View.OnClickListener
public void onClick(View v) {
MainActivity.num++;
studyTime.setText("\n你已经学习了" + MainActivity.num + "个小时\n");
if (MainActivity.num == Integer.MAX_VALUE) {
try {
TextView textView = studyTime;
StringBuilder sb = new StringBuilder();
sb.append("\n");
MainActivity mainActivity = MainActivity.this;
sb.append(mainActivity.getFlag(mainActivity.getResources().getString(R.string.mysecret))); // 1.复盘:flag由此而来
sb.append("\n");
textView.setText(sb.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
}由
sb.append(mainActivity.getFlag(mainActivity.getResources().getString(R.string.mysecret))); // 1.复盘:flag由此而来
可知,flag为资源文件里的mysecret字串。
在如下目录里找到mysecret字串:
资源文件/resources.arsc/values/strings.xml
<string name="mysecret">REBRQFBDfWY5MDgzOj9vbiNzdCcicXBxeiwteS0vfHtDQhZAFRwfWggJCgsMDQ4P</string>
万事具备,开始撸码:
>>> mysecret='REBRQFBDfWY5MDgzOj9vbiNzdCcicXBxeiwteS0vfHtDQhZAFRwfWggJCgsMDQ4P'
>>> import base64
>>> flag2=base64.b64decode(mysecret).decode("utf-8")
>>> flag2
'[email protected]@PC}f9083:?on#st\'"qpqz,-y-/|{CB\[email protected]\x15\x1c\x1fZ\x08\t\n\x0b\x0c\r\x0e\x0f'
>>> flag=[chr(ord(flag2[i])^i) for i in range(len(flag2))]
>>> flag
['D', 'A', 'S', 'C', 'T', 'F', '{', 'a', '1', '9', '2', '8', '6', '2', 'a', 'a', '3', 'b', 'f', '4', '6', 'd', 'f', 'f', 'b', '5', '7', 'b', '1', '2', 'b', 'd', 'c', 'c', '4', 'c', '1', '9', '9', '}', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
>>> print(''.join(flag))
DASCTF{a192862aa3bf46dffb57b12bdcc4c199}
>>> flag为:
DASCTF{a192862aa3bf46dffb57b12bdcc4c199}三、总结
比赛时APK反编译软件有脾气,没能正常反编译。线下换了一个OK了。
边栏推荐
- SQL Server data type conversion function cast () and convert () explanation
- Hongji was once again shortlisted in the Gartner 2022 RPA Magic Quadrant and achieved a significant jump in position
- 海外多家权威媒体热议波场TRON:为互联网去中心化奠定基础
- Data Lake: Data Integration Tool DataX
- RRU, BBU, AAU
- Thinkphp 5.0.24变量覆盖漏洞导致RCE分析
- redis分布式锁的原子保证
- Mysql版本升级,直接复制Data文件,查询特别慢
- Advanced [C] array to participate in the function pointer
- 图像视角矫正之透视变换矩阵(单应矩阵)/findHomography 与 getPerspectiveTransformd的区别
猜你喜欢

Eureka Registry

swagger使用教程——快速使用swagger

MySQL 安装报错的解决方法

基于OpenCV实现的图像拼接(配准)案例
![[The Mystery of Cloud Native] Cloud Native Background && Definition && Detailed explanation of related technologies?](/img/eb/0cd6891fcc00d2c01ba8bd7f8d0822.png)
[The Mystery of Cloud Native] Cloud Native Background && Definition && Detailed explanation of related technologies?

Shell script basic editing specifications and variables

Has been empty, a straightforward, continue to copy the top off!

The implementation and basic operation of sub-database sub-table, ER table, global table, fragmentation rules, global sequence, etc. in MyCat

How does the AI intelligent security video platform EasyCVR configure the simultaneous transmission of audio and video?

Atomic Guarantees of Redis Distributed Locks
随机推荐
Shell脚本基本编辑规范及变量
[Driver] udev sets the owner, group and permissions after GPIO is loaded
Boutique: Taobao/Tmall Get Order Details API for Purchased Products
SSM框架简单介绍
2.5快速排序
Pytorch框架学习记录1——Dataset类代码实战
Usage of exists in sql
骁龙7系芯片表现如何?Reno8 Pro佐证新一代神U
Flink学习第一天——什么是批量、流式计算?
Many overseas authoritative media hotly discuss TRON: laying the foundation for the decentralization of the Internet
The first day of Flink learning - what is batch and streaming computing?
Shell script basic editing specifications and variables
Pytorch framework learning record 7 - convolutional layer
Pytorch framework learning record 4 - the use of datasets (torchvision.dataset)
Boss Rush (二分答案 + 状压DP)
Pytorch framework learning record 5 - the use of DataLoader
golang八股文整理(持续搬运)
逆向分析实战2
Thinkphp 5.0.24变量覆盖漏洞导致RCE分析
What are Redis server startup after the operation?