-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathGuide.cs
321 lines (295 loc) · 10.6 KB
/
Guide.cs
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
using FirehoseFinder.Properties;
using System;
using System.Collections.Generic;
using Telegram.Bot;
namespace FirehoseFinder
{
class Guide
{
///<summary>
///Справочник типов программного обеспечения из сертификата
///</summary>
internal readonly Dictionary<string, string> SW_ID_type = new Dictionary<string, string>(32)
{
{ "0", "SBL1 image" },
{ "1", "MBA image" },
{ "2", "Modem image hashtable" },
{ "3", "Firehose programmer" },
{ "4", "lpass etc running on ADSP" },
{ "5", "Device configuration image" },
{ "6", "Reserved" },
{ "7", "TZBSP image" },
{ "8", "Reserved" },
{ "9", "APPSBL" },
{ "A", "RPM firmware" },
{ "B", "Reserved" },
{ "C", "TrustZone applications - Playready/TrustZone" },
{ "D", "Pronto/WCN image" },
{ "E", "Venus image" },
{ "F", "Reserved" },
{ "11", "STI image" },
{ "12", "System debug image" },
{ "13", "ACPI image" },
{ "14", "GPU Microcode" },
{ "15", "Hypervisor image" },
{ "16", "PMIC" },
{ "17", "Reserved" },
{ "18", "Sensor Low Power Island (SLPI)" },
{ "19", "EOS firmware image" },
{ "1A", "Validated image programmer (VIP)" },
{ "1B", "EFS TARfile" },
{ "1C", "ABL image" },
{ "1D", "IPA firmware" },
{ "1E", "TrustZone TEE" },
{ "1F", "TrustZone LIB" },
{ "200", "Debug Policy" }
};
/// <summary>
/// Справочник типов памяти
/// </summary>
internal enum MEM_TYPE
{
eMMC,
UFS
}
/// <summary>
/// Дубликаты CPU
/// </summary>
internal readonly Dictionary<string, string> Double_CPU = new Dictionary<string, string>(48)
{
{ "009F00E1", "APQ8056" },
{ "009710E1", "APQ8056" },
{ "007190E1", "APQ8056" },
{ "009830E1", "APQ8076" },
{ "009D00E1", "APQ8076" },
{ "009000E1", "APQ8084" },
{ "009010E1", "APQ8084" },
{ "009300E1", "APQ8092" },
{ "009630E1", "APQ8092" },
{ "008000E1", "MSM8226" },
{ "009150E1", "MSM8226" },
{ "007210E1", "MSM8930" },
{ "0072C0E1", "MSM8930" },
{ "0090B0E1", "MSM8939" },
{ "050E10E1", "MSM8939" },
{ "000460E1", "MSM8953" },
{ "F00460E1", "MSM8953" },
{ "009700E1", "MSM8956" },
{ "009B00E1", "MSM8956" },
{ "007B00E1", "MSM8974" },
{ "007B20E1", "MSM8974" },
{ "007B40E1", "MSM8974AB" },
{ "007BA0E1", "MSM8974AB" },
{ "006B10E1", "MSM8974AC" },
{ "007B60E1", "MSM8974AC" },
{ "009640E1", "MSM8992" },
{ "009690E1", "MSM8992" },
{ "000630E1", "MSM8996AU" },
{ "0006F0E1", "MSM8996AU" },
{ "1006F0E1", "MSM8996AU" },
{ "4006F0E1", "MSM8996AU" },
{ "30020000", "MSM8998" },
{ "0005E0E1", "MSM8998" },
{ "00FFF0E1", "MSM8998" },
{ "000020E1", "MSM8998" },
{ "30070000", "SDM630" },
{ "0007E0E1", "SDM630" },
{ "000AC0E1", "SDM636" },
{ "000CC0E1", "SDM636" },
{ "F00CC0E1", "SDM636" },
{ "30060000", "SDM660" },
{ "0008C0E1", "SDM660" },
{ "0009C0E1", "SDM660" },
{ "0007D0E1", "SDM660" },
{ "001080E1", "SDM712" },
{ "60040000", "SDM712" },
{ "60000000", "SDM845" },
{ "0008B0E1", "SDM845" }
};
/// <summary>
/// Список признаков отношения файла к шлангу
/// </summary>
internal enum FH_magic_numbers : uint
{
ELF = 2135247942, //7F454C46 - ELF
ELE = 2135247941, //7F454C45 - ELE
OLD = 3520875396, //D1DC4B84 - Старый программер
PATCHEDOLD = 1442835967, //55FFEDFF - Паченый старый программер
ZTEEncode = 3973917226, //ECDD2A2A - ZTE программер зашифрованный
ARMPRG = 117440512, //07000000 - самый старый программер
ARM9 = 218103808, //0D000000 - ARMPRG 9
ARM412 = 2484117477, //94109FE5 - ARMPRG 0412
ARM12 = 4094730213, //F4109FE5 - ARMPRG 120001
ARM14 = 83886080, //05000000 - ARMPRG 140000
UFSEncoding = 1684108385, //64617461 - Закодированный UFS программер
XiUFSEnc = 2358991973, //8C9B5C65 - Xiaomi закодированный UFS программер
OLDasus = 930790575, //377ABCAF - Старый Асус программер
OLDESTasus = 1347093252 //504B0304 - Ещё один старый Асус программер
}
/// <summary>
/// Список признаков типа архитектуры эльф-файла
/// </summary>
internal enum ELF_AArch : byte
{
Invalid,
bit32,
bit64
}
internal enum ELF_Data : byte
{
Little_endian = 0x01,
Big_endian = 0x02
}
/// <summary>
/// Признак алгоритма подписи сертификата в коде программера
/// </summary>
internal readonly Dictionary<string, int> SHA_magic_numbers = new Dictionary<string, int>(5)
{
{ "06092A864886F70D010101", 0 }, //SHA384 - старые серты
{ "06092A864886F70D010105", 1 }, //SHA256 - старые серты
{ "06092A864886F70D01010B", 2 }, //SHA256 - нормальные серты
{ "06092A864886F70D01010A", 3 }, //SHA384 - новые серты
{ "06072A8648CE3D020106052B81040022", 4 } //SHA384 - паченый старый программер
};
/// <summary>
/// Список файлов, которые нужно удалить после закрытия программы
/// </summary>
internal readonly List<string> FilesToClean = new List<string>(19)
{
{"commandop01.bin" },
{"commandop02.bin" },
{"commandop03.bin" },
{"commandop07.bin" },
{"work.xml" },
{"p_r.xml" },
{"port_trace.txt" },
{"gpt_backup0.bin" },
{"gpt_backup1.bin" },
{"gpt_backup2.bin" },
{"gpt_backup3.bin" },
{"gpt_backup4.bin" },
{"gpt_backup5.bin" },
{"gpt_main0.bin" },
{"gpt_main1.bin" },
{"gpt_main2.bin" },
{"gpt_main3.bin" },
{"gpt_main4.bin" },
{"gpt_main5.bin" }
};
/// <summary>
/// Список процессов, которые необходимо подчистить
/// </summary>
internal readonly List<string> ProcessToClean = new List<string>(4)
{
{"qsaharaserver" },
{"fh_loader" },
{"adb" },
{"fastboot" }
};
/// <summary>
/// Канал Firehose-Finder issues
/// </summary>
internal readonly long channel = -1001227261414;
/// <summary>
/// Бот "Hoplik-Bot"
/// </summary>
internal static ITelegramBotClient _botClient = new TelegramBotClient(Resources.bot);
}
class GPT_Struct
{
public int StartAdress;
public int Length;
public string ValueString;
public GPT_Struct(int startAdress, int length, string value)
{
StartAdress = startAdress;
Length = length;
ValueString = value;
}
public GPT_Struct()
{
}
}
class GPT_Table
{
public string StartLBA;
public string EndLBA;
public string BlockName;
public string BlockLength;
public string BlockBytes;
public string SectorSize;
public GPT_Table(string startLBA, string endLBA, string blockname, string blocklength, string blockbytes, string sectorsize)
{
StartLBA = startLBA;
EndLBA = endLBA;
BlockName = blockname;
BlockLength = blocklength;
BlockBytes = blockbytes;
SectorSize=sectorsize;
}
public GPT_Table()
{
}
}
/// <summary>
/// Параметры выбранного диска, обязательные для использования.
/// </summary>
class Flash_Disk
{
public int Total_Sectors;
public int Sector_Size;
public int Count_Lun;
public Flash_Disk(int total_sectors, int sector_size, int count_lun)
{
Total_Sectors = total_sectors;
Sector_Size = sector_size;
Count_Lun = count_lun;
}
}
class Search_Hex
{
public List<string> FullFileNames;
public string SearchString;
public Search_Hex(List<string> fullfilenames, string searchstring)
{
FullFileNames = fullfilenames;
SearchString = searchstring;
}
}
class Search_Result
{
public string Adress_hex;
public string Result_String;
public string File_Name;
public Search_Result(string adress_hex, string result_string, string file_name)
{
Adress_hex = adress_hex;
Result_String = result_string;
File_Name = file_name;
}
}
class USB_DEV_Props
{
public string PortNum;
public string PortName;
public USB_DEV_Props(string portnum, string portname)
{
PortNum = portnum;
PortName = portname;
}
}
class Users_Rating
{
internal string User_fullname;
internal int User_mess;
internal int User_reactions;
internal DateTime Last_post_date;
public Users_Rating(string user_fullname, int user_mess, int user_reactions, DateTime last_post_date)
{
User_fullname = user_fullname;
User_mess = user_mess;
User_reactions = user_reactions;
Last_post_date = last_post_date;
}
}
}