-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathIdentifyIPSW.vb
508 lines (458 loc) · 18.8 KB
/
IdentifyIPSW.vb
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
Imports System.Security.Cryptography
Imports System.IO
Imports System.Text
Imports System.Threading
Imports System.Windows.Forms
Imports System.Management
Public Class IdentifyIPSW
Public MD51 As Boolean = False
Public ipswhash As String
Private WithEvents get_MD5 As System.ComponentModel.BackgroundWorker
Public Sub get_MD5_hash(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles get_MD5.DoWork
'MD5 hash provider for computing the hash of the file
Dim md5 As New MD5CryptoServiceProvider()
'open the file
Dim stream As New FileStream(ipsw, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
'calculate the files hash
md5.ComputeHash(stream)
'close our stream
stream.Close()
'byte array of files hash
Dim hash As Byte() = md5.Hash
'string builder to hold the results
Dim sb As New StringBuilder()
'loop through each byte in the byte array
For Each b As Byte In hash
'format each byte into the proper value and append
'current value to return value
sb.Append(String.Format("{0:X2}", b))
Next
'return the MD5 hash of the file
ipswhash = sb.ToString.ToLower
End Sub
Private Sub get_md5_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles get_MD5.RunWorkerCompleted
MDIMain.MenuStrip1.Enabled = True
Back.Enabled = True
If ipswhash = "7c1c714f24a89c2f2c71e26d37cde3f0" Then
IPSWVersion = "4.3.2"
IPSWvers.Text = "4.3.2 (8H7) IPSW Verified!"
ihelper.Text = "iPhone 3GS"
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
iPhoneModel = "iPhone 3GS"
Status.Show()
Status.Image = My.Resources.reflectionImage2
statuslabelgood.Show()
Statuslabelbad.Hide()
Button1.Enabled = False
Button1.Text = "Done!"
arrow.Image = My.Resources.Arrow
arrow.Enabled = True
PictureBox1.Image = My.Resources.iPhone3GS
Usepod2gsAwesomeKernelExploit = False
RootFSsize = 850
iDevWarn.MdiParent = MDIMain
iDevWarn.Show()
ElseIf ipswhash = "8cb3a9964a2a99414030f662d3009deb" Then
IPSWVersion = "4.3.2"
IPSWvers.Text = "4.3.2 (8H7) IPSW Verified!"
ihelper.Text = "iPhone 4"
ModelVar = "n90ap"
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
iPhoneModel = "iPhone 4"
Status.Show()
Status.Image = My.Resources.reflectionImage2
statuslabelgood.Show()
Statuslabelbad.Hide()
Button1.Enabled = False
Button1.Text = "Done!"
arrow.Image = My.Resources.Arrow
arrow.Enabled = True
iBootyMethod = True
PictureBox1.Image = My.Resources.i4
Usepod2gsAwesomeKernelExploit = False
'iDevWARN.Show()
'iDevWARN.BringToFront()
RootFSsize = 950
ElseIf ipswhash = "30fc03783453d23aaa0d13f89fd36c28" Then
IPSWVersion = "4.2.7"
IPSWvers.Text = "4.2.7 (8E303) IPSW Verified!"
ihelper.Text = "iPhone 4 (Verizon)"
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
iPhoneModel = "iPhone 4"
ModelVar = "n92ap"
Status.Show()
Status.Image = My.Resources.reflectionImage2
statuslabelgood.Show()
Statuslabelbad.Hide()
Button1.Enabled = False
Button1.Text = "Done!"
arrow.Image = My.Resources.Arrow
arrow.Enabled = True
iBootyMethod = True
PictureBox1.Image = My.Resources.i4
Usepod2gsAwesomeKernelExploit = False
'iDevWARN.Show()
'iDevWARN.BringToFront()
RootFSsize = 950
ElseIf ipswhash = "7f831b30d33f80c7f92442cb041227ab" Then
IPSWVersion = "4.3.2"
IPSWvers.Text = "4.3.2 (8H7) IPSW Verified!"
ihelper.Text = "iPod Touch 3G"
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
iPhoneModel = "iPod Touch 3G"
Status.Show()
Status.Image = My.Resources.reflectionImage2
statuslabelgood.Show()
Statuslabelbad.Hide()
Button1.Enabled = False
Button1.Text = "Done!"
arrow.Image = My.Resources.Arrow
arrow.Enabled = True
PictureBox1.Image = My.Resources.ipt3
Usepod2gsAwesomeKernelExploit = False
'iDevWARN.Show()
'iDevWARN.BringToFront()
RootFSsize = 850
ElseIf ipswhash = "4a002a4596a681efd9cdbf6f2fd72e74" Then
IPSWVersion = "4.3.2"
IPSWvers.Text = "4.3.2 (8H7) IPSW Verified!"
ihelper.Text = "iPod Touch 4"
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
iPhoneModel = "iPod Touch 4"
Status.Show()
Status.Image = My.Resources.reflectionImage2
statuslabelgood.Show()
Statuslabelbad.Hide()
Button1.Enabled = False
Button1.Text = "Done!"
arrow.Image = My.Resources.Arrow
arrow.Enabled = True
PictureBox1.Image = My.Resources.ipt4
Usepod2gsAwesomeKernelExploit = False
'iDevWARN.Show()
'iDevWARN.BringToFront()
RootFSsize = 930
ElseIf ipswhash = "24027c4381a6cdfdd8a03a17177d1d6c" Then
IPSWVersion = "4.3.2"
IPSWvers.Text = "4.3.2 (8H7) IPSW Verified!"
ihelper.Text = "iPad"
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
iPhoneModel = "iPad"
Status.Show()
Status.Image = My.Resources.reflectionImage2
statuslabelgood.Show()
Statuslabelbad.Hide()
Button1.Enabled = False
Button1.Text = "Done!"
arrow.Image = My.Resources.Arrow
arrow.Enabled = True
PictureBox1.Image = My.Resources.ipad
Usepod2gsAwesomeKernelExploit = False
iBootyMethod = True
RootFSsize = 1100
ElseIf ipswhash = "893cdf844a49ae2f7368e781b1ccf6d1" Then
IPSWVersion = "4.3"
IPSWvers.Text = "4.3 (8F202) IPSW Verified!"
ihelper.Text = "Apple TV 2"
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
iPhoneModel = "Apple TV 2"
Status.Show()
Status.Image = My.Resources.reflectionImage2
statuslabelgood.Show()
Statuslabelbad.Hide()
Button1.Enabled = False
Button1.Text = "Done!"
arrow.Image = My.Resources.Arrow
arrow.Enabled = True
PictureBox1.Image = My.Resources.atv2
Usepod2gsAwesomeKernelExploit = False
iBootyMethod = True
RootFSsize = 800
PartitionSize = 800
'iDevWARN.Show()
'iDevWARN.BringToFront()
ElseIf ipswhash = "449dc57f61c44033695cd3ccfeef2b04" Then
Status.Show()
Status.Image = My.Resources.X
Statuslabelbad.Show()
statuslabelgood.Hide()
Label3.Visible = True
Label1.Visible = True
ortxt.Visible = True
PictureBox2.Visible = False
dragtxt.Visible = True
ListBox1.Visible = True
MsgBox("Sorry, the iPad 2 is currently NOT supported.", MsgBoxStyle.Critical)
ElseIf ipswhash = "dfdc5e4c5844d4d6c56e05c3ce4e7258" Then
Status.Show()
Status.Image = My.Resources.X
Statuslabelbad.Show()
statuslabelgood.Hide()
Label3.Visible = True
Label1.Visible = True
ortxt.Visible = True
PictureBox2.Visible = False
dragtxt.Visible = True
ListBox1.Visible = True
MsgBox("Sorry, the iPad 2 is currently NOT supported.", MsgBoxStyle.Critical)
ElseIf ipswhash = "b1bfc67402a6fcee09271d562666d7c4" Then
Status.Show()
Status.Image = My.Resources.X
Statuslabelbad.Show()
statuslabelgood.Hide()
Label3.Visible = True
Label1.Visible = True
ortxt.Visible = True
PictureBox2.Visible = False
dragtxt.Visible = True
ListBox1.Visible = True
MsgBox("Sorry, the iPad 2 is currently NOT supported.", MsgBoxStyle.Critical)
Else
Status.Show()
Status.Image = My.Resources.X
Statuslabelbad.Show()
statuslabelgood.Hide()
Label3.Visible = True
Label1.Visible = True
ortxt.Visible = True
PictureBox2.Visible = False
dragtxt.Visible = True
ListBox1.Visible = True
End If
Button1.Visible = True
Label2.Visible = False
PictureBox2.Visible = False
If Button1.Text = "Done!" Then
Button1.Visible = False
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Status.Hide()
Statuslabelbad.Hide()
iDevLoaded = False
ipsw = ""
ipsw = FileOpenDialog("*.ipsw", "Desktop")
If ipsw <> "" Then
'save form position for progress form
'
ProgressTop = MDIMain.Top
ProgressLeft = MDIMain.Left
Back.Enabled = False
MDIMain.MenuStrip1.Enabled = False
get_MD5 = New System.ComponentModel.BackgroundWorker
get_MD5.WorkerReportsProgress = True
get_MD5.WorkerSupportsCancellation = True
get_MD5.RunWorkerAsync()
dragtxt.Visible = False
Label2.Visible = True
Label3.Visible = False
ortxt.Visible = False
Label1.Visible = False
Button1.Visible = False
ListBox1.Visible = False
PictureBox2.Visible = True
'ipswhash = getFilesMD5Hash(ipsw)
End If
Catch Ex As Exception
MsgBox(Err.Description)
End Try
End Sub
Private Sub ListBox1_DragEnter(ByVal sender As Object, ByVal e As _
System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.All
End If
End Sub
Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As _
System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop
Status.Hide()
Statuslabelbad.Hide()
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim MyFiles() As String
Dim i As Int32
' Assign the files to an array.
MyFiles = e.Data.GetData(DataFormats.FileDrop)
' Loop through the array and add the files to the list.
For i = 0 To MyFiles.Length - 1
ListBox1.Items.Add(MyFiles(i))
Next
Call DragNDrop()
End If
End Sub
Public Sub DragNDrop()
If ListBox1.Items.Count = 1 Then
ipsw = ""
MDIMain.Activate()
ipsw = ListBox1.Items.Item(0)
Back.Enabled = False
MDIMain.MenuStrip1.Enabled = False
get_MD5 = New System.ComponentModel.BackgroundWorker
get_MD5.WorkerReportsProgress = True
get_MD5.WorkerSupportsCancellation = True
get_MD5.RunWorkerAsync()
Label2.Visible = True
Label3.Visible = False
Label1.Visible = False
ortxt.Visible = False
Button1.Visible = False
ListBox1.Visible = False
PictureBox2.Visible = True
dragtxt.Visible = False
ListBox1.Items.Clear()
Else
ListBox1.Items.Clear()
MsgBox("Drag only one IPSW at a time!", MsgBoxStyle.Critical)
End If
End Sub
Private Sub eForm4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MDIMain.MenuStrip1.Enabled = True
PictureBox2.Visible = False
Label2.Visible = False
Button1.Visible = True
Label1.Visible = True
Label3.Visible = True
This3GSisold = False
iPhoneModel = ""
IPSWvers.Text = ""
Status.Hide()
Statuslabelbad.Hide()
statuslabelgood.Hide()
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
End Sub
Public Function getFilesMD5Hash(ByVal file As String) As String
'MD5 hash provider for computing the hash of the file
Dim md5 As New MD5CryptoServiceProvider()
'open the file
Dim stream As New FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
'calculate the files hash
md5.ComputeHash(stream)
'close our stream
stream.Close()
'byte array of files hash
Dim hash As Byte() = md5.Hash
'string builder to hold the results
Dim sb As New StringBuilder()
'loop through each byte in the byte array
For Each b As Byte In hash
'format each byte into the proper value and append
'current value to return value
sb.Append(String.Format("{0:X2}", b))
Next
'return the MD5 hash of the file
Return sb.ToString.ToLower()
iDevLoaded = True
End Function
Private Function FileOpenDialog(ByVal strExtension As String, ByVal strInitDir As String) As String
Dim oFileDialog As New System.Windows.Forms.OpenFileDialog()
Dim strfilter As String = BuildFilter(strExtension)
FileOpenDialog = ""
With oFileDialog
.Filter = "iPhone/iPod Software File (*.ipsw) |*.ipsw;"
.DefaultExt = strExtension
.InitialDirectory = strInitDir
.ShowDialog()
If Windows.Forms.DialogResult.OK Then
FileOpenDialog = .FileName
ElseIf Windows.Forms.DialogResult.Cancel Then
End If
End With
End Function
Private Function BuildFilter(ByVal strExtension As String) As String
BuildFilter = ""
If strExtension.PadLeft(1) <> "." Then
BuildFilter = "(*." & strExtension & ")|" & "*." & strExtension
ElseIf strExtension.PadLeft(1) = "." Then
BuildFilter = "(*" & strExtension & ")|" & "*" & strExtension
End If
End Function
Private Sub logo2_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logo2.MouseEnter
logo2.Image = My.Resources.Flakeselect
End Sub
Private Sub logo2_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logo2.MouseLeave
logo2.Image = My.Resources.Flake
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
About.ShowDialog()
End Sub
Private Sub arrow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Expert.MdiParent = MDIMain
Expert.Show()
Me.Close()
End Sub
Private Sub ihelper_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ihelper.TextChanged
ihelper.Left = (Me.Width / 2) - (ihelper.Width / 2)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Expert.MdiParent = MDIMain
Expert.Show()
Me.Close()
End Sub
Private Sub Back_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Back.Click
Form1.MdiParent = MDIMain
Form1.Show()
Form1.Enabled = True
Me.Dispose()
End Sub
Private Sub Back_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Back.MouseDown
Back.Image = My.Resources.CancelClicked
End Sub
Private Sub Back_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Back.MouseEnter
Back.Image = My.Resources.CancelClicked
End Sub
Private Sub Back_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Back.MouseLeave
Back.Image = My.Resources.Cancel
End Sub
Private Sub Back_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Back.MouseUp
Back.Image = My.Resources.Cancel
End Sub
Private Sub arrow_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arrow.Click
PartitionSize = RootFSsize
If iPhoneModel = "Apple TV 2" Then
ebuilding.MdiParent = MDIMain
ebuilding.Show()
Me.Dispose()
Exit Sub
End If
SelectMode.MdiParent = MDIMain
SelectMode.Show()
Me.Dispose()
End Sub
Private Sub arrow_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arrow.MouseEnter
arrow.Image = My.Resources.Arrowhilite
End Sub
Private Sub arrow_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles arrow.MouseDown
arrow.Image = My.Resources.arrowpress
End Sub
Private Sub arrow_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arrow.MouseLeave
arrow.Image = My.Resources.Arrow
End Sub
Private Sub arrow_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles arrow.MouseUp
arrow.Image = My.Resources.Arrowhilite
End Sub
Private Sub dragtxt_DragEnter(ByVal sender As Object, ByVal e As _
System.Windows.Forms.DragEventArgs) Handles dragtxt.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.All
End If
End Sub
Private Sub dragtxt_DragDrop(ByVal sender As Object, ByVal e As _
System.Windows.Forms.DragEventArgs) Handles dragtxt.DragDrop
Status.Hide()
Statuslabelbad.Hide()
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim MyFiles() As String
Dim i As Int32
' Assign the files to an array.
MyFiles = e.Data.GetData(DataFormats.FileDrop)
' Loop through the array and add the files to the list.
For i = 0 To MyFiles.Length - 1
ListBox1.Items.Add(MyFiles(i))
Next
Call DragNDrop()
End If
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
Process.Start("http://felixbruns.de/iPod/firmware")
End Sub
End Class