IPIDProvider.smali
6.8 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
.class public Lcom/bytedance/applog/convert/IPIDProvider;
.super Ljava/lang/Object;
.source "IPIDProvider.java"
# interfaces
.implements Lcom/bytedance/applog/convert/IIdProvider;
# direct methods
.method public constructor <init>()V
.locals 0
.line 24
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static getLocalIpv6Address(Ljava/util/Enumeration;)Ljava/lang/String;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Enumeration<",
"Ljava/net/InetAddress;",
">;)",
"Ljava/lang/String;"
}
.end annotation
const-string v0, "empty"
if-nez p0, :cond_0
return-object v0
.line 85
:cond_0
:goto_0
invoke-interface {p0}, Ljava/util/Enumeration;->hasMoreElements()Z
move-result v1
if-eqz v1, :cond_1
.line 86
invoke-interface {p0}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/net/InetAddress;
.line 87
instance-of v2, v1, Ljava/net/Inet6Address;
if-eqz v2, :cond_0
invoke-virtual {v1}, Ljava/net/InetAddress;->isLinkLocalAddress()Z
move-result v2
if-eqz v2, :cond_0
.line 88
invoke-virtual {v1}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
move-result-object v0
goto :goto_0
:cond_1
return-object v0
.end method
# virtual methods
.method public getClientAnpi()Ljava/lang/String;
.locals 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/net/SocketException;,
Ljava/net/UnknownHostException;
}
.end annotation
const-string v0, "wlan0"
.line 66
invoke-static {v0}, Ljava/net/NetworkInterface;->getByName(Ljava/lang/String;)Ljava/net/NetworkInterface;
move-result-object v0
if-eqz v0, :cond_0
.line 68
invoke-virtual {v0}, Ljava/net/NetworkInterface;->getInetAddresses()Ljava/util/Enumeration;
move-result-object v1
invoke-static {v1}, Lcom/bytedance/applog/convert/IPIDProvider;->getLocalIpv6Address(Ljava/util/Enumeration;)Ljava/lang/String;
move-result-object v1
invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v1
.line 69
invoke-virtual {v0}, Ljava/net/NetworkInterface;->getHardwareAddress()[B
move-result-object v0
if-eqz v0, :cond_0
.line 70
array-length v2, v0
const/4 v3, 0x6
if-ne v2, v3, :cond_0
const-string v2, "fe80"
invoke-virtual {v1, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_0
.line 71
invoke-static {v1}, Ljava/net/Inet6Address;->getByName(Ljava/lang/String;)Ljava/net/InetAddress;
move-result-object v2
invoke-virtual {v2}, Ljava/net/InetAddress;->getAddress()[B
move-result-object v2
const/16 v3, 0xa
.line 72
aget-byte v3, v2, v3
const/4 v4, 0x2
aget-byte v4, v0, v4
if-ne v3, v4, :cond_0
const/16 v3, 0xd
aget-byte v3, v2, v3
const/4 v4, 0x3
aget-byte v4, v0, v4
if-ne v3, v4, :cond_0
const/16 v3, 0xe
aget-byte v3, v2, v3
const/4 v4, 0x4
aget-byte v4, v0, v4
if-ne v3, v4, :cond_0
const/16 v3, 0xf
aget-byte v2, v2, v3
const/4 v3, 0x5
aget-byte v0, v0, v3
if-ne v2, v0, :cond_0
goto :goto_0
:cond_0
const-string v1, ""
:goto_0
return-object v1
.end method
.method public getClientTun()Ljava/lang/String;
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/net/SocketException;
}
.end annotation
const-string v0, "dummy0"
.line 52
invoke-static {v0}, Ljava/net/NetworkInterface;->getByName(Ljava/lang/String;)Ljava/net/NetworkInterface;
move-result-object v0
if-eqz v0, :cond_0
.line 55
invoke-virtual {v0}, Ljava/net/NetworkInterface;->getInetAddresses()Ljava/util/Enumeration;
move-result-object v0
invoke-static {v0}, Lcom/bytedance/applog/convert/IPIDProvider;->getLocalIpv6Address(Ljava/util/Enumeration;)Ljava/lang/String;
move-result-object v0
invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
move-result-object v0
goto :goto_0
:cond_0
const-string v0, "empty"
:goto_0
const-string v1, "fe80"
.line 57
invoke-virtual {v0, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v1
if-eqz v1, :cond_1
goto :goto_1
:cond_1
const-string v0, ""
:goto_1
return-object v0
.end method
.method public getIdAndSetIntoJson(Lorg/json/JSONObject;Landroid/content/Context;)V
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Lorg/json/JSONException;
}
.end annotation
const/4 p2, 0x0
.line 30
:try_start_0
invoke-virtual {p0}, Lcom/bytedance/applog/convert/IPIDProvider;->getClientTun()Ljava/lang/String;
move-result-object v0
:try_end_0
.catch Ljava/net/SocketException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v0
.line 32
invoke-virtual {v0}, Ljava/net/SocketException;->printStackTrace()V
move-object v0, p2
.line 34
:goto_0
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v1
if-nez v1, :cond_0
const-string v1, "client_tun"
.line 35
invoke-virtual {p1, v1, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
.line 39
:cond_0
:try_start_1
invoke-virtual {p0}, Lcom/bytedance/applog/convert/IPIDProvider;->getClientAnpi()Ljava/lang/String;
move-result-object p2
:try_end_1
.catch Ljava/net/SocketException; {:try_start_1 .. :try_end_1} :catch_2
.catch Ljava/net/UnknownHostException; {:try_start_1 .. :try_end_1} :catch_1
goto :goto_1
:catch_1
move-exception v0
.line 43
invoke-virtual {v0}, Ljava/net/UnknownHostException;->printStackTrace()V
goto :goto_1
:catch_2
move-exception v0
.line 41
invoke-virtual {v0}, Ljava/net/SocketException;->printStackTrace()V
.line 45
:goto_1
invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-nez v0, :cond_1
const-string v0, "client_anpi"
.line 46
invoke-virtual {p1, v0, p2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
:cond_1
return-void
.end method