Essay on Security for Software

Submitted By Reitzdan1
Words: 972
Pages: 4

Imports System.Net
Imports System.Text
Imports System.IO

Public Class Form4

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim mas() As String

If Len(TextBox1.Text) = 19 Then mas = Split(TextBox1.Text, "-") If UBound(mas) = 3 Then TextBox1.Text = mas(0) TextBox2.Text = mas(1) TextBox3.Text = mas(2) TextBox4.Text = mas(3) Button2.Focus() Exit Sub End If End If

If Len(TextBox1.Text) > 4 Then TextBox1.Text = Mid(TextBox1.Text, Len(TextBox1.Text) - 4, 4) ElseIf Len(TextBox1.Text) = 4 Then TextBox2.Focus() End If End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged If Len(TextBox2.Text) > 4 Then TextBox2.Text = Mid(TextBox2.Text, Len(TextBox2.Text) - 4, 4) ElseIf Len(TextBox2.Text) = 4 Then TextBox3.Focus() End If End Sub

Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged If Len(TextBox3.Text) > 4 Then TextBox3.Text = Mid(TextBox3.Text, Len(TextBox3.Text) - 4, 4) ElseIf Len(TextBox3.Text) = 4 Then TextBox4.Focus() End If End Sub

Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged If Len(TextBox4.Text) > 4 Then TextBox4.Text = Mid(TextBox4.Text, Len(TextBox4.Text) - 4, 4) ElseIf Len(TextBox4.Text) = 4 Then Button2.Focus() End If End Sub

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear()

TextBox1.Focus() End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim temp As Date

temp = FormatDateTime(My.Computer.Registry.GetValue("HKEY_CURRENT_USER\GuruListPuller", "RegDate", Nothing), DateFormat.ShortDate) If DateDiff("d", Now, temp) > 5 Then Application.Exit() Else Me.Close() End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ' Pattern: G _ _ T - U _ _ S - R _ _ I - U _ _ L ' -> GURU (1st positions) ' <- LIST (4th positions) ' Middle symbols: random number and random letter (whatever order)

Dim temp As String Dim key1 As String Dim key2 As String

On Error GoTo WrongKey

'Validate key

temp = TextBox1.Text If Len(temp) = 4 Then If UCase(Mid(temp, 1, 1)) = "G" And UCase(Mid(temp, 4, 1)) = "T" Then key1 = Mid(temp, 2, 1) key2 = Mid(temp, 3, 1) If Not ((Asc(key1) >= 48 And Asc(key1) <= 57 And Asc(key2) >= 65 And Asc(key2) <= 90) Or (Asc(key2) >= 48 And Asc(key2) <= 57 And Asc(key1) >= 65 And Asc(key1) <= 90)) Then GoTo WrongKey End If Else GoTo WrongKey End If Else GoTo WrongKey End If

temp = TextBox2.Text If Len(temp) = 4 Then If UCase(Mid(temp, 1, 1)) = "U" And UCase(Mid(temp, 4, 1)) = "S" Then key1 = Mid(temp, 2, 1) key2 = Mid(temp, 3, 1) If Not ((Asc(key1) >= 48 And Asc(key1) <= 57 And Asc(key2) >= 65 And