当前位置:网站首页>The 2nd Shanxi Province Network Security Skills Competition (Enterprise Group) Partial WP (10)
The 2nd Shanxi Province Network Security Skills Competition (Enterprise Group) Partial WP (10)
2022-07-30 04:30:00 【[email protected]】
前言
有幸参加了2022年山西省第二届网络安全技能大赛企业组的比赛,这是第一次参加ctf比赛,本着积累实战经验的目的去的,排名有点意外.
提示:以下是本篇文章正文内容.
一、题目
题目:
apk逆向题.
附件:
schoolboy.apk
二、解题步骤
1.解题思路
反汇编apk文件,Find the startup page,查看算法,撸代码.
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.复盘:对BaseBitwise XOR of the decrypted string,Eject the original string
}
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由此而来
可知,flagin the resource filemysecret字串.
found in the following directorymysecret字串:
资源文件/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}三、总结
比赛时APKDecompiled software has temperaments,Failed to decompile normally.Replaced one offlineOK了.
版权声明
本文为[[email protected] one word]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/211/202207300416449459.html
边栏推荐
- phpoffice edit excel document
- Pytorch框架学习记录4——数据集的使用(torchvision.dataset)
- 共建共享数字世界的根:阿里云打造全面的云原生开源生态
- BGP的简单实验
- Azure 开发者新闻快讯丨开发者7月大事记一览
- 2.6归并排序
- Pytorch框架学习记录1——Dataset类代码实战
- How to compare struct, slice, map for equality and the difference between several comparison methods in golang
- Pytorch框架学习记录3——Transform的使用
- Charles replaces the interface response information
猜你喜欢

DAY17:弱口令的探测与测试

网页元素解析a标签

海外多家权威媒体热议波场TRON:为互联网去中心化奠定基础

WEB penetration of information collection

MYSQL unique constraint

【C语言】程序环境和预处理

Install MySQL Database on Kylin V10 Operating System

Discourse 自定义头部链接(Custom Header Links)

QT(39)-vs开发qt程序提示无法打开源文件
![[SQL] at a certain correlation with a table of data update another table](/img/66/4dff4383509e5d25890d8a24720de6.png)
[SQL] at a certain correlation with a table of data update another table
随机推荐
GCC Rust获批将被纳入主线代码库,或将于GCC 13中与大家见面
2.6归并排序
Reverse Theory Knowledge 3 [UI Modification]
A brief introduction to the SSM framework
我的Go+语言初体验——祝福留言小系统,让她也可以感受到你的祝福
【周周有奖】云原生编程挑战赛“边缘容器”赛道邀你来战!
What is CDH/CDP?
[SQL] at a certain correlation with a table of data update another table
How to Effectively Conduct Retrospective Meetings (Part 1)?
2021山东省网络搭建与应用赛项试题
Pytorch框架学习记录2——TensorBoard的使用
Eureka Registry
Go 学习笔记(84)— Go 项目目录结构
MySQL 安装报错的解决方法
【C语言】程序环境和预处理
C. Qualification Rounds(思维,特情)
PyG搭建R-GCN实现节点分类
Unity3D Application模拟进入前后台及暂停
2.6 Merge Sort
How to extract year, month and day data in date type in SQL Server