-
-
Notifications
You must be signed in to change notification settings - Fork 305
/
HttpCaptureInterceptor.kt
65 lines (53 loc) · 1.55 KB
/
HttpCaptureInterceptor.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package dev.capture
import dev.utils.common.cipher.Encrypt
/**
* detail: Http 抓包拦截器 ( 存在存储抓包数据逻辑 )
* @author Ttt
*/
class HttpCaptureInterceptor(
// 模块名 ( 要求唯一性 )
private val moduleName: String,
// 抓包数据加密中间层
private val encrypt: Encrypt? = null,
// Http 拦截过滤器
private val httpFilter: IHttpFilter? = null,
// 是否进行 Http 抓包拦截
private var capture: Boolean = true,
// Http 抓包事件回调
eventIMPL: IHttpCaptureEvent = object : HttpCaptureEventIMPL() {
override fun callEnd(info: CaptureInfo) {
}
}
) : BaseInterceptor(true, eventIMPL) {
// 抓包信息隐藏字段
private val captureRedact = CaptureRedact()
// ================
// = IHttpCapture =
// ================
override fun getModuleName(): String {
return moduleName
}
override fun getEncrypt(): Encrypt? {
return encrypt
}
override fun getHttpFilter(): IHttpFilter? {
return httpFilter
}
override fun isCapture(): Boolean {
return capture
}
override fun setCapture(capture: Boolean) {
this.capture = capture
}
override fun captureRedact(): CaptureRedact {
return captureRedact
}
override fun getModulePath(): String {
return Utils.getModulePath(moduleName)
}
override fun getModuleHttpCaptures(): MutableList<CaptureItem> {
return Utils.getModuleHttpCaptures(
moduleName, encrypt != null
)
}
}