@leejungkiin/awkit 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/VERSION +1 -1
- package/bin/awk.js +1 -1
- package/core/GEMINI.md +54 -25
- package/package.json +2 -2
- package/skills/beads-manager/SKILL.md +298 -181
- package/skills/smali-to-kotlin/SKILL.md +521 -0
- package/skills/smali-to-kotlin/library-patterns.md +189 -0
- package/skills/smali-to-kotlin/smali-reading-guide.md +310 -0
- package/skills/smali-to-swift/SKILL.md +749 -0
- package/skills/smali-to-swift/framework-patterns.md +189 -0
- package/skills/smali-to-swift/objc-reading-guide.md +388 -0
- package/workflows/expert/codeExpert.md +25 -10
- package/workflows/expert/planExpert.md +37 -14
- package/workflows/lifecycle/plan.md +13 -9
- package/workflows/mobile/reverse-android-build.md +232 -0
- package/workflows/mobile/reverse-android-scan.md +158 -0
- package/workflows/mobile/reverse-android.md +106 -0
- package/workflows/mobile/reverse-ios-build.md +248 -0
- package/workflows/mobile/reverse-ios-scan.md +155 -0
- package/workflows/mobile/reverse-ios.md +114 -0
|
@@ -42,13 +42,34 @@ description: 📝 Thiết kế tính năng (Expert Mode - Zero Questions)
|
|
|
42
42
|
- Medium: 6 phases (+ Database + Integration)
|
|
43
43
|
- Complex: 8+ phases (+ Auth + Deploy + Monitoring)
|
|
44
44
|
|
|
45
|
-
### 4. Sync to Beads
|
|
45
|
+
### 4. Sync to Beads (Hierarchical — v6.5)
|
|
46
46
|
```bash
|
|
47
|
+
# Step 1: Create epic (1 per plan)
|
|
48
|
+
EPIC_ID=$(bd create "<Feature Name>" -t epic -p 1 \
|
|
49
|
+
--description "<feature summary>" \
|
|
50
|
+
--acceptance "<high-level acceptance>" \
|
|
51
|
+
--design "<architecture approach>" \
|
|
52
|
+
--json | jq -r '.id')
|
|
53
|
+
|
|
54
|
+
# Step 2: Create phase tasks as children of epic
|
|
47
55
|
for each phase:
|
|
48
|
-
bd create "Phase X: [Name]"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
PHASE_ID=$(bd create "Phase X: [Name]" \
|
|
57
|
+
--parent $EPIC_ID -p 1 \
|
|
58
|
+
--description "<phase summary>" \
|
|
59
|
+
--json | jq -r '.id')
|
|
60
|
+
|
|
61
|
+
# Step 3: Create subtasks as children of phase
|
|
62
|
+
for each task in phase:
|
|
63
|
+
bd create "[Task Name]" \
|
|
64
|
+
--parent $PHASE_ID -p 2 \
|
|
65
|
+
--acceptance "<definition of done>" \
|
|
66
|
+
--json
|
|
67
|
+
|
|
68
|
+
# Step 4: Set inter-phase dependencies
|
|
69
|
+
bd dep add $PHASE2_ID $PHASE1_ID # Sequential phases
|
|
70
|
+
|
|
71
|
+
# Step 5: Save to brain/active_plans.json
|
|
72
|
+
# → { "current": { "epic_id": $EPIC_ID, "feature": "...", "phases": [...] } }
|
|
52
73
|
```
|
|
53
74
|
|
|
54
75
|
### 5. Report
|
|
@@ -59,16 +80,17 @@ for each task in phase:
|
|
|
59
80
|
📋 Spec: docs/specs/shopping-cart_spec.md
|
|
60
81
|
|
|
61
82
|
📊 **Structure:**
|
|
62
|
-
-
|
|
63
|
-
-
|
|
83
|
+
- 🏔️ 1 Epic
|
|
84
|
+
- 📦 6 Phases (sequential dependencies)
|
|
85
|
+
- 📝 42 Subtasks (with acceptance criteria)
|
|
64
86
|
- Estimated: 3-4 sessions
|
|
65
87
|
|
|
66
|
-
📿 **Beads:**
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
- Ready
|
|
88
|
+
📿 **Beads (Hierarchical):**
|
|
89
|
+
- Epic: bd-xxxx
|
|
90
|
+
- Tree: bd list --parent bd-xxxx --tree
|
|
91
|
+
- Ready: bd ready --parent bd-xxxx
|
|
70
92
|
|
|
71
|
-
➡️ **Next:** /codeExpert
|
|
93
|
+
➡️ **Next:** /codeExpert (auto-picks first ready subtask)
|
|
72
94
|
```
|
|
73
95
|
|
|
74
96
|
---
|
|
@@ -107,6 +129,7 @@ Options:
|
|
|
107
129
|
|
|
108
130
|
## Integration
|
|
109
131
|
|
|
110
|
-
- **Brain:** Auto-save to `brain/active_plans.json`
|
|
111
|
-
- **Beads:** Auto-create
|
|
132
|
+
- **Brain:** Auto-save epic mapping to `brain/active_plans.json` (with epic_id + phase IDs)
|
|
133
|
+
- **Beads:** Auto-create epic → phase → subtask hierarchy with dependencies
|
|
134
|
+
- **Skill:** Uses `plan_to_beads()` from `beads-manager` skill v6.5
|
|
112
135
|
- **Git:** Auto-commit plan files (optional)
|
|
@@ -46,8 +46,10 @@ description: 📝 Thiết kế tính năng (Dual-Mode v5.0)
|
|
|
46
46
|
### Phase 3: Plan Generation
|
|
47
47
|
1. **Action:** Tạo folder structure và file markdown (như v2).
|
|
48
48
|
2. **Sync Beads:** (Nếu user đồng ý ở Phase 1)
|
|
49
|
-
-
|
|
50
|
-
- Loop qua từng
|
|
49
|
+
- `bd create -t epic` → Create root epic
|
|
50
|
+
- Loop qua từng Phase → `bd create --parent <epic-id>`
|
|
51
|
+
- Loop qua từng Step → `bd create --parent <phase-id> --acceptance "..."`
|
|
52
|
+
- `bd dep add` cho inter-phase dependencies
|
|
51
53
|
|
|
52
54
|
### Phase 4: Handoff
|
|
53
55
|
1. **Report:** Hiển thị chi tiết Plan và Link Beads.
|
|
@@ -63,15 +65,17 @@ description: 📝 Thiết kế tính năng (Dual-Mode v5.0)
|
|
|
63
65
|
|
|
64
66
|
## 🧠 Brain & Beads Integration Details
|
|
65
67
|
|
|
66
|
-
### 1. Auto-Sync Logic
|
|
67
|
-
Khi tạo
|
|
68
|
-
1.
|
|
69
|
-
2.
|
|
70
|
-
3.
|
|
68
|
+
### 1. Auto-Sync Logic (Hierarchical — v6.5)
|
|
69
|
+
Khi tạo plan, hệ thống sẽ:
|
|
70
|
+
1. `bd create "<Feature>" -t epic --json` → Create root epic
|
|
71
|
+
2. For each phase: `bd create "Phase X" --parent <epic-id> --json`
|
|
72
|
+
3. For each task: `bd create "Task" --parent <phase-id> --acceptance "..." --json`
|
|
73
|
+
4. `bd dep add <phase-N+1> <phase-N>` → Sequential phase dependencies
|
|
74
|
+
5. Ghi epic mapping → `brain/active_plans.json`
|
|
71
75
|
|
|
72
76
|
### 2. Context Retention
|
|
73
|
-
- Lưu
|
|
74
|
-
- Khi User gõ `/next`, hệ thống
|
|
77
|
+
- Lưu `epic_id` + phase IDs vào `brain/active_plans.json`.
|
|
78
|
+
- Khi User gõ `/next`, hệ thống dùng `bd ready --parent <epic-id>` để suggest task.
|
|
75
79
|
|
|
76
80
|
---
|
|
77
81
|
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 🏗️ RE Android Phase 2 — Data Layer, Utils, UI, SDK Integration & Parity Check
|
|
3
|
+
parent: reverse-android
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /re-android-build — Build & Verify
|
|
7
|
+
|
|
8
|
+
> **Parent:** [`/reverse-android`](reverse-android.md) → Step 2-6
|
|
9
|
+
> **Prerequisite:** Hoàn thành [`/re-android-scan`](reverse-android-scan.md)
|
|
10
|
+
> **Skill:** `smali-to-kotlin` | **Smali Guide:** `skills/smali-to-kotlin/smali-reading-guide.md`
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 💾 Step 2: Data Layer Reconstruction
|
|
15
|
+
|
|
16
|
+
> **Input:** Smali files cho network, models, database logic
|
|
17
|
+
|
|
18
|
+
### 2.1: Network Layer → Retrofit interfaces
|
|
19
|
+
|
|
20
|
+
```kotlin
|
|
21
|
+
interface UserApi {
|
|
22
|
+
@GET("users/{id}")
|
|
23
|
+
suspend fun getUser(@Path("id") id: String): UserDto
|
|
24
|
+
|
|
25
|
+
@POST("auth/login")
|
|
26
|
+
suspend fun login(@Body request: LoginRequest): TokenDto
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2.2: DTOs (Kotlin Serialization)
|
|
31
|
+
|
|
32
|
+
```kotlin
|
|
33
|
+
@Serializable
|
|
34
|
+
data class UserDto(
|
|
35
|
+
@SerialName("user_id") val userId: String,
|
|
36
|
+
@SerialName("full_name") val fullName: String,
|
|
37
|
+
@SerialName("email") val email: String,
|
|
38
|
+
)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2.3: Room Database (nếu có local DB)
|
|
42
|
+
|
|
43
|
+
- Entity với `@Entity` + `@PrimaryKey`
|
|
44
|
+
- DAO với `@Dao` + `Flow<>` return types
|
|
45
|
+
- `OnConflictStrategy.REPLACE` cho upsert
|
|
46
|
+
|
|
47
|
+
### 2.4: Repository Pattern
|
|
48
|
+
|
|
49
|
+
- Domain: `interface UserRepository` (Flows + Results)
|
|
50
|
+
- Data: `UserRepositoryImpl @Inject constructor(api, dao)` — offline-first
|
|
51
|
+
|
|
52
|
+
### ✅ Checkpoint Step 2
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 🧮 Step 3: Core Logic & Utils
|
|
57
|
+
|
|
58
|
+
> **CRITICAL:** Output phải match 100% với app gốc
|
|
59
|
+
|
|
60
|
+
### 3.1: Nhận diện từ Smali
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
javax/crypto/Cipher → AES/DES encryption
|
|
64
|
+
java/security/MessageDigest → MD5/SHA hashing
|
|
65
|
+
android/util/Base64 → Base64 encoding
|
|
66
|
+
Custom XOR/shift loops → Custom obfuscation
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3.2: Kotlin objects
|
|
70
|
+
|
|
71
|
+
```kotlin
|
|
72
|
+
object CryptoUtils {
|
|
73
|
+
fun hashMd5(input: String): String {
|
|
74
|
+
val md = MessageDigest.getInstance("MD5")
|
|
75
|
+
return md.digest(input.toByteArray())
|
|
76
|
+
.joinToString("") { "%02x".format(it) }
|
|
77
|
+
}
|
|
78
|
+
fun encryptAes(data: String, key: String): String { /* from Smali */ }
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3.3: Unit Test verification (BẮT BUỘC cho crypto)
|
|
83
|
+
|
|
84
|
+
```kotlin
|
|
85
|
+
class CryptoUtilsTest {
|
|
86
|
+
@Test
|
|
87
|
+
fun `md5 hash matches original`() {
|
|
88
|
+
assertEquals("expected_hash", CryptoUtils.hashMd5("test_input"))
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### ✅ Checkpoint Step 3
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 🎨 Step 4: UI & ViewModel (Per Screen — Loop)
|
|
98
|
+
|
|
99
|
+
> **Input:** `res/layout/*.xml` + Activity/Fragment Smali
|
|
100
|
+
> **Lặp lại** cho MỌI màn hình từ Step 1
|
|
101
|
+
|
|
102
|
+
### 4.0: Thứ tự ưu tiên
|
|
103
|
+
|
|
104
|
+
1. SplashScreen → 2. Auth → 3. Home → 4. Detail → 5. Settings/Profile
|
|
105
|
+
|
|
106
|
+
### 4.1: Resource Extraction (On-Demand only)
|
|
107
|
+
|
|
108
|
+
Chỉ copy resources cho màn hình hiện tại: drawables, strings, colors, dimens, fonts.
|
|
109
|
+
|
|
110
|
+
### 4.2: XML Layout → Compose
|
|
111
|
+
|
|
112
|
+
Pattern cho mỗi screen:
|
|
113
|
+
|
|
114
|
+
```kotlin
|
|
115
|
+
@Composable
|
|
116
|
+
fun [Screen]Screen(
|
|
117
|
+
viewModel: [Screen]ViewModel = hiltViewModel(),
|
|
118
|
+
onNavigateTo[Next]: () -> Unit
|
|
119
|
+
) {
|
|
120
|
+
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
|
121
|
+
// LaunchedEffect for events
|
|
122
|
+
// Scaffold with content
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 4.3: ViewModel Pattern
|
|
127
|
+
|
|
128
|
+
```kotlin
|
|
129
|
+
@HiltViewModel
|
|
130
|
+
class [Screen]ViewModel @Inject constructor(
|
|
131
|
+
private val useCase: [Feature]UseCase
|
|
132
|
+
) : ViewModel() {
|
|
133
|
+
private val _uiState = MutableStateFlow([Screen]UiState())
|
|
134
|
+
val uiState = _uiState.asStateFlow()
|
|
135
|
+
|
|
136
|
+
private val _events = MutableSharedFlow<[Screen]Event>()
|
|
137
|
+
val events = _events.asSharedFlow()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
data class [Screen]UiState(val isLoading: Boolean = false, val error: String? = null)
|
|
141
|
+
sealed interface [Screen]Event { /* navigation, snackbar */ }
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### ✅ Checkpoint Step 4 (Per Screen)
|
|
145
|
+
|
|
146
|
+
> **Loop:** Quay lại 4.0 cho screen tiếp. Hết screen → Step 5.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 📦 Step 5: SDK & Native Library Integration
|
|
151
|
+
|
|
152
|
+
> **Input:** Library Report từ Step 0
|
|
153
|
+
|
|
154
|
+
### 5.1: Native Libraries (.so) → JNI Bridge
|
|
155
|
+
|
|
156
|
+
```kotlin
|
|
157
|
+
class NativeBridge {
|
|
158
|
+
companion object { init { System.loadLibrary("name") } }
|
|
159
|
+
external fun nativeMethod(param: String): ByteArray
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 5.2: Application class
|
|
164
|
+
|
|
165
|
+
```kotlin
|
|
166
|
+
@HiltAndroidApp
|
|
167
|
+
class App : Application() {
|
|
168
|
+
override fun onCreate() { super.onCreate(); setupTimber(); setupFirebase() }
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 5.3: Hilt DI Modules
|
|
173
|
+
|
|
174
|
+
- `NetworkModule`: OkHttpClient + Retrofit + Interceptors
|
|
175
|
+
- `DatabaseModule`: Room database + DAOs
|
|
176
|
+
- `RepositoryModule`: Bind implementations
|
|
177
|
+
|
|
178
|
+
### ✅ Checkpoint Step 5
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## ✅ Step 6: Parity Check & Quality Gate
|
|
183
|
+
|
|
184
|
+
### 6.1: Edge Case checklist (từ Smali branches)
|
|
185
|
+
|
|
186
|
+
```markdown
|
|
187
|
+
- [ ] Login empty/invalid input
|
|
188
|
+
- [ ] Network timeout/offline
|
|
189
|
+
- [ ] Empty list states
|
|
190
|
+
- [ ] Null server responses
|
|
191
|
+
- [ ] App lifecycle (bg/fg)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 6.2: API Parity
|
|
195
|
+
|
|
196
|
+
- [ ] Base URL, headers, body format matches
|
|
197
|
+
- [ ] Response parsing correct
|
|
198
|
+
- [ ] Error handling matches
|
|
199
|
+
|
|
200
|
+
### 6.3: Data Parity
|
|
201
|
+
|
|
202
|
+
- [ ] Encryption/hash output matches
|
|
203
|
+
- [ ] Date formatting matches
|
|
204
|
+
- [ ] Local storage works correctly
|
|
205
|
+
|
|
206
|
+
### 6.4: Build & Test
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
./gradlew assembleDebug && ./gradlew test && ./gradlew lint
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 🎉 Final Summary
|
|
213
|
+
|
|
214
|
+
```markdown
|
|
215
|
+
## Complete!
|
|
216
|
+
- Screens: [count] | Libs reused: [count] | Replaced: [count]
|
|
217
|
+
- Tests: [pass/fail] | Lint: [pass/warnings]
|
|
218
|
+
|
|
219
|
+
⏭️ Next: /test → /deploy → /code-janitor
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 🔗 Related
|
|
225
|
+
|
|
226
|
+
- **Parent:** [`/reverse-android`](reverse-android.md)
|
|
227
|
+
- **Previous:** [`/re-android-scan`](reverse-android-scan.md) (Step 0-1)
|
|
228
|
+
- **Smali Guide:** `skills/smali-to-kotlin/smali-reading-guide.md`
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
*re-android-build v2.0.0 — Phase 2: Build & Verify*
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 📦 RE Android Phase 1 — Library Scanner + Manifest Analysis + Project Bootstrap
|
|
3
|
+
parent: reverse-android
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /re-android-scan — Library Scanner & Manifest Analysis
|
|
7
|
+
|
|
8
|
+
> **Parent:** [`/reverse-android`](reverse-android.md) → Step 0 + Step 1
|
|
9
|
+
> **Skill:** `smali-to-kotlin` | **Reference:** `skills/smali-to-kotlin/library-patterns.md`
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 📦 Step 0: Library Scanner (BẮT BUỘC)
|
|
14
|
+
|
|
15
|
+
> Nhận diện toàn bộ thư viện **trước khi code bất kỳ thứ gì**.
|
|
16
|
+
|
|
17
|
+
### 0.3: Quét Smali directories
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Top-level packages
|
|
21
|
+
find [apktool_dir]/smali -maxdepth 3 -type d | sed 's|[apktool_dir]/smali/||' | sort
|
|
22
|
+
|
|
23
|
+
# Multi-dex
|
|
24
|
+
find [apktool_dir] -name "smali*" -maxdepth 1 -type d
|
|
25
|
+
find [apktool_dir]/smali_classes2 -maxdepth 3 -type d 2>/dev/null | sort
|
|
26
|
+
|
|
27
|
+
# Native libraries & Assets
|
|
28
|
+
find [apktool_dir]/lib -name "*.so" 2>/dev/null
|
|
29
|
+
ls [apktool_dir]/assets/ 2>/dev/null
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 0.4: Tạo Library Detection Report
|
|
33
|
+
|
|
34
|
+
Dùng patterns từ `library-patterns.md`, phân loại:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
## 📦 Library Detection Report — [App Name]
|
|
38
|
+
|
|
39
|
+
### ✅ Reuse (build.gradle)
|
|
40
|
+
| Library | Package Detected | Version | Notes |
|
|
41
|
+
|---------|-----------------|---------|-------|
|
|
42
|
+
| Retrofit | com/squareup/retrofit2 | 2.9.0 | Keep |
|
|
43
|
+
| OkHttp | com/squareup/okhttp3 | 4.12.0 | Keep |
|
|
44
|
+
|
|
45
|
+
### 🔄 Replace (Legacy → Modern)
|
|
46
|
+
| Old Library | Detected | Replacement |
|
|
47
|
+
|-------------|----------|-------------|
|
|
48
|
+
| Volley | com/android/volley | Retrofit + OkHttp |
|
|
49
|
+
| AsyncTask | android.os.AsyncTask | Coroutines |
|
|
50
|
+
|
|
51
|
+
### 🔵 Firebase/Google SDKs
|
|
52
|
+
| SDK | Detected | Action |
|
|
53
|
+
|-----|----------|--------|
|
|
54
|
+
|
|
55
|
+
### 📱 Native (.so) — Giữ nguyên
|
|
56
|
+
| File | Architecture | Notes |
|
|
57
|
+
|------|-------------|-------|
|
|
58
|
+
|
|
59
|
+
### 🏷️ App Code (Rebuild in Kotlin)
|
|
60
|
+
| Package | Module |
|
|
61
|
+
|---------|--------|
|
|
62
|
+
|
|
63
|
+
### ❓ Unknown (Cần điều tra)
|
|
64
|
+
| Package | Path | Possible |
|
|
65
|
+
|---------|------|----------|
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 0.5: User approval
|
|
69
|
+
|
|
70
|
+
> **GATE:** Không tiếp tục Step 1 khi chưa có user approval report.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 📄 Step 1: AndroidManifest Analysis & Project Bootstrap
|
|
75
|
+
|
|
76
|
+
> **Input:** `[apktool_dir]/AndroidManifest.xml`
|
|
77
|
+
|
|
78
|
+
### 1.1: Phân tích Manifest
|
|
79
|
+
|
|
80
|
+
Trích xuất:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
extract:
|
|
84
|
+
- application_id, package_name
|
|
85
|
+
- min_sdk, target_sdk
|
|
86
|
+
- permissions: [network, storage, camera, location, other]
|
|
87
|
+
- entry_points: [application_class, splash_activity, main_activity]
|
|
88
|
+
- components: [activities, services, receivers, providers]
|
|
89
|
+
- deep_links, features
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 1.2: Đề xuất project structure
|
|
93
|
+
|
|
94
|
+
Mapping activities → Compose screens (xem SKILL.md Step 1):
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
SplashActivity → presentation/screens/splash/SplashScreen.kt
|
|
98
|
+
MainActivity → presentation/screens/main/MainScreen.kt
|
|
99
|
+
LoginActivity → presentation/screens/auth/LoginScreen.kt
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 1.3: Tạo `build.gradle.kts` skeleton
|
|
103
|
+
|
|
104
|
+
```kotlin
|
|
105
|
+
plugins {
|
|
106
|
+
alias(libs.plugins.android.application)
|
|
107
|
+
alias(libs.plugins.kotlin.android)
|
|
108
|
+
alias(libs.plugins.kotlin.compose)
|
|
109
|
+
alias(libs.plugins.hilt.android)
|
|
110
|
+
alias(libs.plugins.ksp)
|
|
111
|
+
alias(libs.plugins.kotlin.serialization)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
android {
|
|
115
|
+
namespace = "[package_name]"
|
|
116
|
+
compileSdk = [target_sdk]
|
|
117
|
+
defaultConfig {
|
|
118
|
+
applicationId = "[application_id]"
|
|
119
|
+
minSdk = [min_sdk]
|
|
120
|
+
targetSdk = [target_sdk]
|
|
121
|
+
}
|
|
122
|
+
buildFeatures { compose = true; buildConfig = true }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
dependencies {
|
|
126
|
+
// Compose BOM + Material3 + Navigation
|
|
127
|
+
// Coroutines + Hilt DI
|
|
128
|
+
// Network: Retrofit + OkHttp (từ Library Report)
|
|
129
|
+
// Local: Room + DataStore
|
|
130
|
+
// Image: Coil + Logging: Timber
|
|
131
|
+
// [Thêm libs từ "Reuse" section]
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### ✅ Checkpoint Step 1
|
|
136
|
+
|
|
137
|
+
```markdown
|
|
138
|
+
## ✅ Step 1 Complete
|
|
139
|
+
|
|
140
|
+
- Package: [package_name]
|
|
141
|
+
- Entry points: [list]
|
|
142
|
+
- Screens to rebuild: [list]
|
|
143
|
+
|
|
144
|
+
⏭️ Next: `/re-android-build` — Step 2 (Data Layer)
|
|
145
|
+
Cung cấp Smali: smali/[package]/network/, model/, data/
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 🔗 Related
|
|
151
|
+
|
|
152
|
+
- **Next:** [`/re-android-build`](reverse-android-build.md) (Step 2-6)
|
|
153
|
+
- **Parent:** [`/reverse-android`](reverse-android.md)
|
|
154
|
+
- **Library patterns:** `skills/smali-to-kotlin/library-patterns.md`
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
*re-android-scan v2.0.0 — Phase 1: Discovery & Bootstrap*
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 🔧 Dịch ngược APK Android (Apktool output) → App Kotlin hiện đại với Jetpack Compose, Clean Architecture, và Library Scanner tự động.
|
|
3
|
+
skill: smali-to-kotlin
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /reverse-android — Android APK Reverse Engineering Workflow
|
|
7
|
+
|
|
8
|
+
> **Skill:** `smali-to-kotlin` | **Tech:** Kotlin + Compose + Hilt + Retrofit + Room
|
|
9
|
+
> **Philosophy:** "Read Smali to understand WHAT & WHY → Write Kotlin for HOW"
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ⚡ QUICK START
|
|
14
|
+
|
|
15
|
+
User cung cấp: Apktool output dir, `AndroidManifest.xml`, hoặc nói "reverse engineer APK này".
|
|
16
|
+
Workflow dẫn dắt từng bước — **không bao giờ nhảy cóc**.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🔵 Session Setup
|
|
21
|
+
|
|
22
|
+
### Bước 0.1: Khởi tạo session state
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
reverse_session:
|
|
26
|
+
project_name: "[TBD - từ manifest]"
|
|
27
|
+
apktool_dir: "[path]"
|
|
28
|
+
current_step: 0
|
|
29
|
+
library_report_done: false
|
|
30
|
+
manifest_analyzed: false
|
|
31
|
+
completed_screens: []
|
|
32
|
+
pending_screens: []
|
|
33
|
+
decisions: []
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Bước 0.2: Xác nhận input
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
🔧 Android Reverse Engineering bắt đầu!
|
|
40
|
+
|
|
41
|
+
Em cần biết:
|
|
42
|
+
1. Thư mục Apktool output ở đâu?
|
|
43
|
+
2. Tên app gốc? Package name?
|
|
44
|
+
|
|
45
|
+
Chưa chạy Apktool? → apktool d your-app.apk -o ./decompiled/
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 📋 Pipeline Overview (7 Steps)
|
|
51
|
+
|
|
52
|
+
| Step | Phase | Sub-workflow | Gate |
|
|
53
|
+
|------|-------|-------------|------|
|
|
54
|
+
| 0 | 📦 Library Scanner | [`/re-android-scan`](reverse-android-scan.md) | User approve report |
|
|
55
|
+
| 1 | 📄 Manifest & Bootstrap | [`/re-android-scan`](reverse-android-scan.md) | Checkpoint |
|
|
56
|
+
| 2 | 💾 Data Layer | [`/re-android-build`](reverse-android-build.md) | Checkpoint |
|
|
57
|
+
| 3 | 🧮 Core Logic & Utils | [`/re-android-build`](reverse-android-build.md) | Checkpoint |
|
|
58
|
+
| 4 | 🎨 UI & ViewModel | [`/re-android-build`](reverse-android-build.md) | Per-screen loop |
|
|
59
|
+
| 5 | 📦 SDK Integration | [`/re-android-build`](reverse-android-build.md) | Checkpoint |
|
|
60
|
+
| 6 | ✅ Parity Check | [`/re-android-build`](reverse-android-build.md) | Final QA |
|
|
61
|
+
|
|
62
|
+
### Execution Flow
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Session Setup → Step 0+1 (/re-android-scan) → Step 2-6 (/re-android-build)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Chạy tuần tự:** Xong `/re-android-scan` → chuyển sang `/re-android-build`.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🚫 WORKFLOW RULES
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
never_skip:
|
|
76
|
+
- Step 0 (Library Scanner) — always first
|
|
77
|
+
- User approval of Library Report — gate before Step 1
|
|
78
|
+
- Checkpoint after each step — no silent progress
|
|
79
|
+
|
|
80
|
+
never_do:
|
|
81
|
+
- Mass-copy resources from APK (on-demand only)
|
|
82
|
+
- Use deprecated libraries without replacement plan
|
|
83
|
+
- Skip parity check for encryption utils
|
|
84
|
+
- Proceed to next step without user confirmation
|
|
85
|
+
|
|
86
|
+
always_do:
|
|
87
|
+
- Document decisions in session state
|
|
88
|
+
- Present Library Report before any coding
|
|
89
|
+
- Unit test all crypto/hash functions
|
|
90
|
+
- Update session state after each screen in Step 4
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 🔗 Related
|
|
96
|
+
|
|
97
|
+
- **Sub-workflows:** [`/re-android-scan`](reverse-android-scan.md) · [`/re-android-build`](reverse-android-build.md)
|
|
98
|
+
- **Skill:** `smali-to-kotlin` (core knowledge & rules)
|
|
99
|
+
- **Library DB:** `skills/smali-to-kotlin/library-patterns.md`
|
|
100
|
+
- **Smali Guide:** `skills/smali-to-kotlin/smali-reading-guide.md`
|
|
101
|
+
- **Sibling:** `/reverse-ios` (iOS counterpart)
|
|
102
|
+
- **After RE done:** `/test`, `/deploy`, `/code-janitor`
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
*reverse-android workflow v2.0.0 — Modular RE Pipeline*
|