Public Class Security_code_reset
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (connect = 1) Then
Dim unlock = New Byte(&H100) {}
Dim security = New Byte(&H100) {}
Dim flex = New Byte(&H100) {}
Dim model = New Byte(&H100) {}
Dim Seem4e1 = New Byte(SeemLength(&H4E, 1)) {}
Dim a As Integer = Seem_Read(&H74, 1, 0, 8, unlock)
Dim b As Integer = Seem_Read(&H76, 1, 0, 12, security)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
Dim i As Integer
For i = 0 To a
TextBox1.Text = TextBox1.Text + Chr(unlock(i)).ToString
Next
For i = 0 To b
TextBox2.Text = TextBox2.Text + Chr(security(i)).ToString
Next
a = Seem_Read(&H17F, 1, 0, Nothing, flex)
For i = 0 To a - 2
If (flex(i) <> 0) Then
TextBox3.Text = TextBox3.Text & Chr(flex(i))
Else
Exit For
End If
Next
Seem_Read(&H132, 1, 0, Nothing, model)
For i = 0 To SeemLength(&H132, 1)
TextBox4.Text = TextBox4.Text & Chr(model(i))
If (model(1 + i) = &HFF) Then
Exit For
End If
Next
Seem_Read(&H4E, 1, 0, Nothing, Seem4e1)
Dim Values(2) As Array
Values(0) = New String(1) {Hex(Seem4e1(&H352)), Hex(Seem4e1(&H353))}
Values(1) = New String(1) {Hex(Seem4e1(&H33E)), Hex(Seem4e1(&H33F))}
Values(2) = New String(2) {Hex(Seem4e1(&H2D9)), Hex(Seem4e1(&H2DA)), Hex(Seem4e1(&H2DB))}
Dim Length = New Integer(2) {4, 4, 6}
For i = 0 To 2
For a = 0 To Values(i).Length - 1
If (Values(i)(a).Length <> 2) Then
Values(i)(a) = "0" & Values(i)(a)
End If
Next
Next
TextBox5.Text = Hex2Dec(Values(0)(0) & Values(0)(1))
TextBox6.Text = Hex2Dec(Values(1)(0) & Values(1)(1))
TextBox7.Text = Hex2Dec(Values(2)(0) & Values(2)(1) & Values(2)(2))
Else
MsgBox("Telefono non connesso", MsgBoxStyle.Critical, "B3nNa's password reader")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If (connect = 1) Then
If (TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox1.TextLength <> 4 Or TextBox2.TextLength <> 6 Or TextBox5.Text = "" Or TextBox6.Text = "" Or TextBox7.Text = "") Then
MsgBox("Impossibile eseguire l'operazione richiesta." & Chr(10) & "Alcuni valori sono errati")
Exit Sub
End If
Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
On Error Resume Next
Dim unlocka
Dim securitya
Dim flexa
Dim modela
Dim unlock = New Byte(8) {0, &H30, 0, &H30, 0, &H30, 0, &H30, 0}
Dim security = New Byte(12) {0, &H30, 0, &H30, 0, &H30, 0, &H30, 0, &H30, 0, &H30, 0}
Dim flex = New Byte(77) {}
Dim model = New Byte(77) {}
unlocka = CInt(TextBox1.Text).ToString.ToCharArray
securitya = CInt(TextBox2.Text).ToString.ToCharArray
Dim l As Integer = TextBox1.TextLength
Dim m As Integer = TextBox2.TextLength
Dim i, n As Integer
For i = 0 To 76
flex(i) = &HFF
Next
For i = 0 To 76
model(i) = &H0
Next
For i = 1 To 8
unlock(i) = Asc(unlocka(n)).ToString
i += 1
n += 1
Next
Seem_Write(&H74, 1, 0, 8, unlock)
n = 0
For i = 1 To 12
security(i) = Asc(securitya(n)).ToString
i += 1
n += 1
Next
Seem_Write(&H76, 1, 0, 12, security)
flexa = TextBox3.Text.ToCharArray
For i = 0 To TextBox3.TextLength - 1
flex(i) = Asc(flexa(i))
Next
flex(TextBox3.TextLength) = 0
Seem_Write(&H17F, 1, 0, SeemLength(&H17F, 1), flex)
modela = TextBox4.Text.ToCharArray
n = 0
model(0) = 0
For i = 1 To TextBox4.TextLength * 2
model(i) = Asc(modela(n))
i += 1
n += 1
Next
Seem_Write(&H132, 1, 0, SeemLength(&H17F, 1), model)
Dim videowithoutTF As String = Hex(TextBox5.Text)
Do
If (videowithoutTF.Length < 4) Then
videowithoutTF = "0" & videowithoutTF
Else
Dim videowithoutTFA(1) As String
videowithoutTFA(0) = videowithoutTF.Substring(0, 2)
videowithoutTFA(1) = videowithoutTF.Substring(2, 2)
Seem_Write(&H4E, 1, &H352, 2, New Byte(1) {Val("&h" & videowithoutTFA(0)), Val("&h" & videowithoutTFA(1))})
Exit Do
End If
Loop
Dim videowithTF As String = Hex(TextBox6.Text)
Do
If (videowithTF.Length < 4) Then
videowithTF = "0" & videowithTF
Else
Dim videowithTFA(1) As String
videowithTFA(0) = videowithTF.Substring(0, 2)
videowithTFA(1) = videowithTF.Substring(2, 2)
Seem_Write(&H4E, 1, &H33E, 2, New Byte(1) {Val("&h" & videowithTFA(0)), Val("&h" & videowithTFA(1))})
Exit Do
End If
Loop
Dim MMS As String = Hex(TextBox7.Text)
Do
If (MMS.Length < 6) Then
MMS = "0" & MMS
Else
Dim MMSA(2) As String
MMSA(0) = MMS.Substring(0, 2)
MMSA(1) = MMS.Substring(2, 2)
MMSA(2) = MMS.Substring(4, 2)
Seem_Write(&H4E, 1, &H2D9, 3, New Byte(2) {Val("&h" & MMSA(0)), Val("&h" & MMSA(1)), Val("&h" & MMSA(2))})
Seem_Write(&H4E, 1, &H345, 3, New Byte(2) {Val("&h" & MMSA(0)), Val("&h" & MMSA(1)), Val("&h" & MMSA(2))})
Exit Do
End If
Loop
Me.Cursor = System.Windows.Forms.Cursors.Default
MsgBox("Operazione completata", MsgBoxStyle.Information, "OK")
Else
MsgBox("Telefono non connesso", MsgBoxStyle.Critical, "B3nNa's password reader")
End If
End Sub
#Region " TextboxX_Changed "
Private Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
On Error Resume Next
If (Char.IsNumber(TextBox2.Text.ToCharArray()(TextBox2.SelectionStart - 1)) = False) Then
TextBox2.Text = TextBox2.Text.Remove(TextBox2.SelectionStart - 1, 1)
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
On Error Resume Next
If (Char.IsNumber(TextBox1.Text.ToCharArray()(TextBox1.SelectionStart - 1)) = False) Then
TextBox1.Text = TextBox1.Text.Remove(TextBox1.SelectionStart - 1, 1)
End If
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
On Error Resume Next
If (Char.IsNumber(TextBox5.Text.ToCharArray()(TextBox5.SelectionStart - 1)) = False Or TextBox5.Text > 65025) Then
TextBox5.Text = TextBox5.Text.Remove(TextBox5.SelectionStart - 1, 1)
End If
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
On Error Resume Next
If (Char.IsNumber(TextBox6.Text.ToCharArray()(TextBox6.SelectionStart - 1)) = False Or TextBox6.Text > 65025) Then
TextBox6.Text = TextBox6.Text.Remove(TextBox6.SelectionStart - 1, 1)
End If
End Sub
Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
On Error Resume Next
If (Char.IsNumber(TextBox7.Text.ToCharArray()(TextBox7.SelectionStart - 1)) = False Or TextBox7.Text > 1024000) Then
TextBox7.Text = TextBox7.Text.Remove(TextBox7.SelectionStart - 1, 1)
End If
End Sub
#End Region
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
connect = P2K_GetStatus()
Select Case connect
Case 0
Label11.Text = "Not connected"
Label11.ForeColor = System.Drawing.Color.Red
Case 1
Label11.Text = "Connected(p2k mode)"
Label11.ForeColor = System.Drawing.Color.Green
End Select
End Sub
End Class