Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class frmStudy
- 'Name :Zach Griffin
- 'Forum Handle :Tasmainia300
- 'Date started :3/7/2016
- 'Purpose :Submission for the TekSyndicate community Just Do It Challenge
- 'Functionality :This program is designed to help you study for a CompTIA Certification. First iterations will likely include limited functionality such as -
- 'a flash-card-style port number quiz. Possible future iterations may enable you to customize functionality and input the information you want to study.
- 'Source :Thanks to blogs.getcertifiedgetahead.com for acting as my source of port number information
- 'Version :1.0
- 'Build :1
- 'Build Details :Includes port number information rated for CompTIA A+, Network+ and Security+ exams, as well as practice quiz to test your knowledge.
- 'Credit for Icon :Henrik Lund Mikkelsen on The Noun Project. Licensed under Creative Commons.
- Public score As Integer = 0
- Public failNum As Integer = 0
- Public subjectComplete As Integer = 0
- Public subjectTracker As Double = 0
- Public scoreTotal As String
- 'setting up a score system
- Private Sub lstSubject_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstSubject.SelectedIndexChanged
- Me.AcceptButton = btnSubject
- '^^ Allowing the user to hit enter instead of clicking the button
- Select Case lstSubject.Text 'handles what to do in case of a selection within the list box
- Case "Port Numbers"
- rtbQuestion.Clear()
- subjectTracker = 1 'tracks which subject is currently selected to handle conditional statements later in code
- lstSubject.Items.Clear()
- lstSubject.Items.AddRange(IO.File.ReadAllLines("F:\My Stuff\Visual Basic Projects\Port Number Quiz TS Challenge v0.1\prtNumbers.txt"))
- '^^ Maintains fidelity of the list boxes contents
- Case "Port 20" 'handles the information for the "Port Study" subject
- rtbQuestion.Text = "Port 20 is commonly used by FTP(File Transfer Protocol) to transfer data."
- Case "Port 21"
- rtbQuestion.Text = "Port 21 is commonly used by FTP(File Transfer Protocol) to listen for commands."
- Case "Port 22"
- rtbQuestion.Text = "Port 22 is commonly used by SSH(Secure Shell), and other protocols that use SSH, such as SCP(Secure Copy) and SFTP(Secure File Transfer Protocol)."
- Case "Port 23"
- rtbQuestion.Text = "Port 23 is used by TELNET."
- Case "Port 25"
- rtbQuestion.Text = "Port 25 is commonly used by SMTP(Simple Mail Transport Protocol) for outgoing mail."
- Case "Port 49"
- rtbQuestion.Text = "Port 49 is commonly used by TACACS(Termincal Access Controller Access-Control System) for authentication."
- Case "Port 53"
- rtbQuestion.Text = "Port 53 is commonly used by DNS(Domain Name Service)."
- Case "Port 67"
- rtbQuestion.Text = "Port 67 is used by DHCP(Dynamic Host Configuration Protocol) servers."
- Case "Port 68"
- rtbQuestion.Text = "Port 68 is used by DHCP(Dynamic Host Configuration Protocol) clients."
- Case "Port 69"
- rtbQuestion.Text = "Port 69 is used by TFTP(Trivial File Transport Protocol)."
- Case "Port 80"
- rtbQuestion.Text = "Port 80 is used by HTTP(Hypertext Transfer Protocol) for web traffic."
- Case "Port 88"
- rtbQuestion.Text = "Port 88 is commonly used by Kerberos for authentication."
- Case "Port 110"
- rtbQuestion.Text = "Port 110 is commonly used by POP3(Post-Office-Protocol) for incoming mail."
- Case "Port 119"
- rtbQuestion.Text = "Port 119 is used by NNTP(Network News Transfer Protocol) for news traffic."
- Case "Port 123"
- rtbQuestion.Text = "Port 123 is used by NTP(Network Time Protocol) to synchronize clocks."
- Case "Port 143"
- rtbQuestion.Text = "Port 143 is used by IMAP4(Internet Message Access Protocol v4)."
- Case "Port 161"
- rtbQuestion.Text = "Port 161 is used by SNMP(Simple Network Management Protocol) for network monitoring."
- Case "Port 162"
- rtbQuestion.Text = "Port 162 is used by SNMP Trap(Simple Network Management Protocol Trap) for alerts."
- Case "Port 389"
- rtbQuestion.Text = "Port 389 is commonly used by LDAP(Lightweight Directory Access Protocol)."
- Case "Port 443"
- rtbQuestion.Text = "Port 443 is commonly used by HTTPS(Hypertext Transfer Protocol Secure) for web traffic and by SSL VPN(Secure Sockets Layer VPN)."
- Case "Port 500"
- rtbQuestion.Text = "Port 500 is commonly used by IPsec(Internet Protocol Security) over ISAKMP(Internet Security Association and Key Management Protocol[VPN])."
- Case "Port 514"
- rtbQuestion.Text = "Port 514 is commonly used by Syslog."
- Case "Port 1701"
- rtbQuestion.Text = "Port 1701 is commonly used by L2TP(Layer 2 Tunneling Protocol)."
- Case "Port 1723"
- rtbQuestion.Text = "Port 1723 is commonly used by PPTP(Point-to-Point Tunneling Protocol)."
- Case "Port 3389"
- rtbQuestion.Text = "Port 3389 is used by RDP(Remote Desktop Protocol) for connections."
- End Select
- End Sub
- Private Sub btnSubject_Click(sender As Object, e As EventArgs) Handles btnSubject.Click
- 'setting score to 0 at start of new subject selection
- score = 0
- If lstSubject.Text = " -Port Numbers Quiz" Then
- 'setting up the port number quiz
- lstSubject.Items.Clear()
- lstSubject.Items.AddRange(IO.File.ReadAllLines("F:\My Stuff\Visual Basic Projects\Port Number Quiz TS Challenge v0.1\prtNumbers.txt"))
- '^^Maintains the listbox's contents
- subjectTracker = 1.2
- 'tracks which subject is active for conditional statements
- scoreTotal = "/27"
- 'sets score total as a variable for scalability. i.e I can more easily add extra questions to the port number quiz as i only need to change the value once
- txtScore.Text = score & scoreTotal
- '^^ sets the score visible to the user
- lblAnswer.Visible = True
- txtAnswer.Visible = True
- txtAnswer.Focus()
- btnNext.Visible = True
- btnPrev.Visible = True
- rtbQuestion.Visible = True
- btnAnswer.Visible = True
- lblScore.Visible = True
- txtScore.Visible = True
- '^"fetches" all the controls needed for the quiz
- Me.AcceptButton = btnAnswer
- '^^Allowing the user to hit enter instead of clicking the button
- rtbQuestion.Text = "What port does HTTP operate over?"
- ElseIf lstSubject.Text = " -Port Numbers Study" Then
- lstSubject.Items.AddRange(IO.File.ReadAllLines("F:\My Stuff\Visual Basic Projects\Port Number Quiz TS Challenge v0.1\Port Numbers.txt"))
- subjectTracker = 1.1
- '^^^Tracks active subject for future conditional statements
- 'Variables are strictly for my reference in code and should remain commented out in published builds to save memory space.
- 'Dim http As Integer = 80
- 'Dim ftp As Integer = 21
- 'Dim telnet As Integer = 23
- 'Dim smtp As Integer = 25
- 'Dim popthree As Integer = 110
- 'Dim https As Integer = 443
- 'Dim ssh As Integer = 22
- 'Dim dns As Integer = 53
- 'Dim dhcpClient As Integer = 68
- 'Dim dhcpServer As Integer = 67
- 'Dim tftp As Integer = 69
- 'Dim ntp As Integer = 123
- 'Dim imap4 As Integer = 143
- 'Dim snmp As Integer = 161
- 'Dim ipsec As Integer = 500
- 'Dim rdp As Integer = 3389
- 'Dim sftp As Integer = 22
- 'Dim scp As Integer = 22
- 'Dim sslVpn As Integer = 443
- 'Dim tacacs As Integer = 49
- 'Dim kerberos As Integer = 88
- 'Dim nntp As Integer = 119
- 'Dim snmpTrap As Integer = 162
- 'Dim ldap As Integer = 389
- 'Dim syslog As Integer = 514
- 'Dim l2tp As Integer = 1701
- 'Dim pptp As Integer = 1723
- rtbQuestion.Visible = True 'fetches controls needed for port number studying.
- rtbQuestion.Clear()
- txtScore.Visible = False
- lblScore.Visible = False
- btnAnswer.Visible = False
- lblAnswer.Visible = False
- btnNext.Visible = False
- btnPrev.Visible = False
- txtAnswer.Visible = False
- End If
- End Sub
- Private Sub btnAnswer_Click(sender As Object, e As EventArgs) Handles btnAnswer.Click
- 'This is gonna be long... until I figure out how to condense it... which is probably incredibly easy...
- If subjectTracker = 1.2 Then 'uses subjectTracker to determine which quiz is being taken
- If rtbQuestion.Text = "What port does FTP operate on?" Then 'if port number quiz, initialize answer checking based on contents of rtbQuestion -
- If txtAnswer.Text = "21" Then 'because I couldn't figure out how else to do it...
- rtbQuestion.Text = "Correct! File Transfer Protocol operates on port 21"
- score += 1
- txtScore.Text = score & scoreTotal
- 'determines and updates score
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand) 'plays a sound to alert the user of an error
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1 'Counter to fail those who miss 10.
- 'handles wrong answers^^^^
- End If
- End If
- If rtbQuestion.Text = "What port does HTTP operate over?" Then
- If txtAnswer.Text = "80" Then
- rtbQuestion.Text = "Correct! HyperText Transfer Protocol operates on port 80"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does TELNET operate over?" Then
- If txtAnswer.Text = "23" Then
- rtbQuestion.Text = "Correct! TELNET operates on port 23"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does SMTP operate on?" Then
- If txtAnswer.Text = "25" Then
- rtbQuestion.Text = "Correct! Simple Mail Transfer Protocol operates on port 25"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does POP3 operate on?" Then
- If txtAnswer.Text = "110" Then
- rtbQuestion.Text = "Correct! POP3 operates on port 110"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does HTTPS operate over?" Then
- If txtAnswer.Text = "443" Then
- rtbQuestion.Text = "Correct! HyperText Transfer Protocol Secure operates on port 443"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does SSH use?" Then
- If txtAnswer.Text = "22" Then
- rtbQuestion.Text = "Correct! Secure Shell uses port 22"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does TACACS use?" Then
- If txtAnswer.Text = "49" Then
- rtbQuestion.Text = "Correct! Terminal Access Controller Access-Control System uses port 49"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does Kerberos use?" Then
- If txtAnswer.Text = "88" Then
- rtbQuestion.Text = "Correct! Kerberos uses port 88"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does NTP operate on?" Then
- If txtAnswer.Text = "123" Then
- rtbQuestion.Text = "Correct! Network Time Protocol uses port 123"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does NNTP operate over?" Then
- If txtAnswer.Text = "119" Then
- rtbQuestion.Text = "Correct! Network News Transfer Protocol uses port 119"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does TFTP operate on?" Then
- If txtAnswer.Text = "69" Then
- rtbQuestion.Text = "Correct! Trivial File Transport Protocol uses port 69"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does SSL VPN operate over?" Then
- If txtAnswer.Text = "443" Then
- rtbQuestion.Text = "Correct! SSL VPN uses port 443"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does PPTP use?" Then
- If txtAnswer.Text = "1723" Then
- rtbQuestion.Text = "Correct! Point-to-Point Tunneling Protocol uses port 1723"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does L2TP operate on?" Then
- If txtAnswer.Text = "1701" Then
- rtbQuestion.Text = "Correct! Layer 2 Tunneling Protocol uses port 1701"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does RDP use?" Then
- If txtAnswer.Text = "3389" Then
- rtbQuestion.Text = "Correct! Remote Desktop Protocol uses port 3389"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port is used by Syslog?" Then
- If txtAnswer.Text = "514" Then
- rtbQuestion.Text = "Correct! Syslog uses port 514"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does LDAP operate on?" Then
- If txtAnswer.Text = "389" Then
- rtbQuestion.Text = "Correct! Lightweight Directory Access Protocol uses port 389"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does a DHCP server use?" Then
- If txtAnswer.Text = "67" Then
- rtbQuestion.Text = "Correct! A Dynamic Host Configuration Protocol Server uses port 67"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does a DHCP client use?" Then
- If txtAnswer.Text = "68" Then
- rtbQuestion.Text = "Correct! A Dynamic Host Configuration Protocol Client uses port 68"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port is used by DNS?" Then
- If txtAnswer.Text = "53" Then
- rtbQuestion.Text = "Correct! Domain Name System uses port 53"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port is used by SFTP?" Then
- If txtAnswer.Text = "22" Then
- rtbQuestion.Text = "Correct! Secure File Transfer Protocol uses port 22"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does SCP use?" Then
- If txtAnswer.Text = "22" Then
- rtbQuestion.Text = "Correct! Secure Copy uses port 22"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port is used by SNMP?" Then
- If txtAnswer.Text = "161" Then
- rtbQuestion.Text = "Correct! Simple Network Managment Protocol uses port 161"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port is used by SNMP Trap?" Then
- If txtAnswer.Text = "162" Then
- rtbQuestion.Text = "Correct! Simple Network Management Protocol Trap uses port 162"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port does IMAP4 use?" Then
- If txtAnswer.Text = "143" Then
- rtbQuestion.Text = "Correct! Internet Message Access Protocol version 4 uses port 143"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If rtbQuestion.Text = "What port is used by IPsec?" Then
- If txtAnswer.Text = "500" Then
- rtbQuestion.Text = "Correct! Internet Protocol Security uses port 500"
- score += 1
- txtScore.Text = score & scoreTotal
- ElseIf txtAnswer.Text = "" Then 'Fixes undesirable functionality where accidentaly hitting enter or submit answer before typing one will raise the fail counter.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("You didn't enter anything!", "Error")
- txtAnswer.Focus()
- Else
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Hand)
- MessageBox.Show("Wrong, please try again. (Provide ports as integers please)", "Oops!")
- txtAnswer.Clear()
- txtAnswer.Focus()
- failNum += 1
- End If
- End If
- If txtScore.Text = "27/27" Then 'handles a pass state for the port number quiz.
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation)
- MessageBox.Show("Good Job! Go get certified!", "Congratulations!")
- subjectComplete += 1
- txtAnswer.Clear()
- rtbQuestion.Clear()
- lstSubject.Items.Clear()
- txtScore.Clear()
- lblAnswer.Visible = False
- txtAnswer.Visible = False
- btnNext.Visible = False
- btnPrev.Visible = False
- rtbQuestion.Visible = False
- btnAnswer.Visible = False
- lstSubject.Items.AddRange(IO.File.ReadAllLines("F:\My Stuff\Visual Basic Projects\Port Number Quiz TS Challenge v0.1\lstSubject.txt"))
- 'resets program upon passing a subject, and sets an invisible score for future quizes.
- End If
- If failNum = 10 Then
- My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Asterisk)
- MessageBox.Show("Oops, seems you need to study more!", "RIP")
- txtAnswer.Clear()
- txtScore.Clear()
- rtbQuestion.Clear()
- rtbQuestion.Text = "What port does HTTP operate over?"
- failNum = 0
- 'Resets quiz upon failure (10 failed answers)
- End If
- End If
- End Sub
- '^^^^^ I'm aware this block of code is probably painfully atrocious in terms of how tedious it is, and it's probably horrifying to think how easy it would -
- 'be to condense it with a function, sub, array, etc. But until I learn more about those this is the best I could come up with, and I look forward to updating it.
- Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click
- txtAnswer.Clear()
- txtAnswer.Focus()
- Select Case rtbQuestion.Text 'handles fetching next answer if the previous question was answered correctly. This block of code -
- 'fits tightly together with the btnAnswer.click sub and the btnPrev.click sub like an interwoven mesh. It is incredibly deliberate.
- 'This case block tests to see if you answered the previous question correctly based on the contents of rtbQuestion, and then presents the next question.
- Case "Correct! HyperText Transfer Protocol operates on port 80"
- rtbQuestion.Text = "What port does FTP operate on?"
- Case "Correct! File Transfer Protocol operates on port 21"
- rtbQuestion.Text = "What port does POP3 operate on?"
- Case "Correct! POP3 operates on port 110"
- rtbQuestion.Text = "What port does HTTPS operate over?"
- Case "Correct! HyperText Transfer Protocol Secure operates on port 443"
- rtbQuestion.Text = "What port does SMTP operate on?"
- Case "Correct! Simple Mail Transfer Protocol operates on port 25"
- rtbQuestion.Text = "What port does TELNET operate over?"
- Case "Correct! TELNET operates on port 23"
- rtbQuestion.Text = "What port is used by IPsec?"
- Case "Correct! Internet Protocol Security uses port 500"
- rtbQuestion.Text = "What port is used by DNS?"
- Case "Correct! Domain Name System uses port 53"
- rtbQuestion.Text = "What port is used by SNMP?"
- Case "Correct! Simple Network Managment Protocol uses port 161"
- rtbQuestion.Text = "What port does LDAP operate on?"
- Case "Correct! Lightweight Directory Access Protocol uses port 389"
- rtbQuestion.Text = "What port is used by SFTP?"
- Case "Correct! Secure File Transfer Protocol uses port 22"
- rtbQuestion.Text = "What port does a DHCP client use?"
- Case "Correct! A Dynamic Host Configuration Protocol Client uses port 68"
- rtbQuestion.Text = "What port does PPTP use?"
- Case "Correct! Point-to-Point Tunneling Protocol uses port 1723"
- rtbQuestion.Text = "What port does RDP use?"
- Case "Correct! Remote Desktop Protocol uses port 3389"
- rtbQuestion.Text = "What port does Kerberos use?"
- Case "Correct! Kerberos uses port 88"
- rtbQuestion.Text = "What port is used by SNMP Trap?"
- Case "Correct! Simple Network Management Protocol Trap uses port 162"
- rtbQuestion.Text = "What port does IMAP4 use?"
- Case "Correct! Internet Message Access Protocol version 4 uses port 143"
- rtbQuestion.Text = "What port is used by Syslog?"
- Case "Correct! Syslog uses port 514"
- rtbQuestion.Text = "What port does a DHCP server use?"
- Case "Correct! A Dynamic Host Configuration Protocol Server uses port 67"
- rtbQuestion.Text = "What port does SCP use?"
- Case "Correct! Secure Copy uses port 22"
- rtbQuestion.Text = "What port does L2TP operate on?"
- Case "Correct! Layer 2 Tunneling Protocol uses port 1701"
- rtbQuestion.Text = "What port does SSL VPN operate over?"
- Case "Correct! SSL VPN uses port 443"
- rtbQuestion.Text = "What port does TACACS use?"
- Case "Correct! Terminal Access Controller Access-Control System uses port 49"
- rtbQuestion.Text = "What port does NTP operate on?"
- Case "Correct! Network Time Protocol uses port 123"
- rtbQuestion.Text = "What port does SSH use?"
- Case "Correct! Secure Shell uses port 22"
- rtbQuestion.Text = "What port does NNTP operate over?"
- Case "Correct! Network News Transfer Protocol uses port 119"
- rtbQuestion.Text = "What port does TFTP operate on?"
- Case "Correct! Trivial File Transport Protocol uses port 69"
- End Select
- End Sub
- Private Sub btnPrev_Click(sender As Object, e As EventArgs) Handles btnPrev.Click
- txtAnswer.Clear()
- txtAnswer.Focus()
- Select Case rtbQuestion.Text 'Allows user to return to previously passed questions (for whatever reason)
- 'This case block tests if you have answered the current question correctly, and then transfers you to the previous one regardless
- Case "Correct! Trivial File Transport Protocol uses port 69", "What port does TFTP operate on?"
- If rtbQuestion.Text = "Correct! Trivial File Transport Protocol uses port 69" Then 'penalizes score for backpedaling. Prevents score exploit to pass quiz -
- 'without answering all questions.
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does NNTP operate over?"
- txtScore.Text = score & scoreTotal
- Case "Correct! Network News Transfer Protocol uses port 119", "What port does NNTP operate over?"
- If rtbQuestion.Text = "Correct! Network News Transfer Protocol uses port 119" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does SSH use?"
- txtScore.Text = score & scoreTotal
- Case "Correct! Secure Shell uses port 22", "What port does SSH use?"
- If rtbQuestion.Text = "Correct! Secure Shell uses port 22" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does NTP operate on?"
- txtScore.Text = score & scoreTotal
- Case "Correct! Network Time Protocol uses port 123", "What port does NTP operate on?"
- If rtbQuestion.Text = "Correct! Network Time Protocol uses port 123" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does TACACS use?"
- txtScore.Text = score & scoreTotal
- Case "Correct! Terminal Access Controller Access-Control System uses port 49", "What port does TACACS use?"
- If rtbQuestion.Text = "Correct! Terminal Access Controller Access-Control System uses port 49" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does SSL VPN operate over?"
- txtScore.Text = score & scoreTotal
- Case "What port does SSL VPN operate over?", "Correct! SSL VPN uses port 443"
- If rtbQuestion.Text = "Correct! SSL VPN uses port 443" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does L2TP operate on?"
- txtScore.Text = score & scoreTotal
- Case "What port does L2TP operate on?", "Correct! Layer 2 Tunneling Protocol uses port 1701"
- If rtbQuestion.Text = "Correct! Layer 2 Tunneling Protocol uses port 1701" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does SCP use?"
- txtScore.Text = score & scoreTotal
- Case "What port does SCP use?", "Correct! Secure Copy uses port 22"
- If rtbQuestion.Text = "Correct! Secure Copy uses port 22" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does a DHCP server use?"
- txtScore.Text = score & scoreTotal
- Case "What port does a DHCP server use?", "Correct! A Dynamic Host Configuration Protocol Server uses port 67"
- If rtbQuestion.Text = "Correct! A Dynamic Host Configuration Protocol Server uses port 67" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port is used by Syslog?"
- txtScore.Text = score & scoreTotal
- Case "What port is used by Syslog?", "Correct! Syslog uses port 514"
- If rtbQuestion.Text = "Correct! Syslog uses port 514" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does IMAP4 use?"
- txtScore.Text = score & scoreTotal
- Case "What port does IMAP4 use?", "Correct! Internet Message Access Protocol version 4 uses port 143"
- If rtbQuestion.Text = "Correct! Internet Message Access Protocol version 4 uses port 143" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port is used by SNMP Trap?"
- txtScore.Text = score & scoreTotal
- Case "What port is used by SNMP Trap?", "Correct! Simple Network Management Protocol Trap uses port 162"
- If rtbQuestion.Text = "Correct! Simple Network Management Protocol Trap uses port 162" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does Kerberos use?"
- txtScore.Text = score & scoreTotal
- Case "What port does Kerberos use?", "Correct! Kerberos uses port 88"
- If rtbQuestion.Text = "Correct! Kerberos uses port 88" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does RDP use?"
- txtScore.Text = score & scoreTotal
- Case "What port does RDP use?", "Correct! Remote Desktop Protocol uses port 3389"
- If rtbQuestion.Text = "Correct! Remote Desktop Protocol uses port 3389" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does PPTP use?"
- txtScore.Text = score & scoreTotal
- Case "What port does PPTP use?", "Correct! Point-to-Point Tunneling Protocol uses port 1723"
- If rtbQuestion.Text = "Correct! Point-to-Point Tunneling Protocol uses port 1723" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does a DHCP client use?"
- txtScore.Text = score & scoreTotal
- Case "What port does a DHCP client use?", "Correct! A Dynamic Host Configuration Protocol Client uses port 68"
- If rtbQuestion.Text = "Correct! A Dynamic Host Configuration Protocol Client uses port 68" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port is used by SFTP?"
- txtScore.Text = score & scoreTotal
- Case "What port is used by SFTP?", "Correct! Secure File Transfer Protocol uses port 22"
- If rtbQuestion.Text = "Correct! Secure File Transfer Protocol uses port 22" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does LDAP operate on?"
- txtScore.Text = score & scoreTotal
- Case "What port does LDAP operate on?", "Correct! Lightweight Directory Access Protocol uses port 389"
- If rtbQuestion.Text = "Correct! Lightweight Directory Access Protocol uses port 389" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port is used by SNMP?"
- txtScore.Text = score & "/27"
- Case "What port is used by SNMP?", "Correct! Simple Network Managment Protocol uses port 161"
- If rtbQuestion.Text = "Correct! Simple Network Managment Protocol uses port 161" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port is used by DNS?"
- txtScore.Text = score & scoreTotal
- Case "What port is used by DNS?", "Correct! Domain Name System uses port 53"
- If rtbQuestion.Text = "Correct! Domain Name System uses port 53" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port is used by IPsec?"
- txtScore.Text = score & scoreTotal
- Case "What port is used by IPsec?", "Correct! Internet Protocol Security uses port 500"
- If rtbQuestion.Text = "Correct! Internet Protocol Security uses port 500" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does TELNET operate over?"
- txtScore.Text = score & scoreTotal
- Case "What port does TELNET operate over?", "Correct! TELNET operates on port 23"
- If rtbQuestion.Text = "Correct! TELNET operates on port 23" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does SMTP operate on?"
- txtScore.Text = score & scoreTotal
- Case "What port does SMTP operate on?", "Correct! Simple Mail Transfer Protocol operates on port 25"
- If rtbQuestion.Text = "Correct! Simple Mail Transfer Protocol operates on port 25" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does HTTPS operate over?"
- txtScore.Text = score & scoreTotal
- Case "What port does HTTPS operate over?", "Correct! HyperText Transfer Protocol Secure operates on port 443"
- If rtbQuestion.Text = "Correct! HyperText Transfer Protocol Secure operates on port 443" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does POP3 operate on?"
- txtScore.Text = score & scoreTotal
- Case "What port does POP3 operate on?", "Correct! POP3 operates on port 110"
- If rtbQuestion.Text = "Correct! POP3 operates on port 110" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does FTP operate on?"
- txtScore.Text = score & scoreTotal
- Case "What port does FTP operate on?", "Correct! File Transfer Protocol operates on port 21"
- If rtbQuestion.Text = "Correct! File Transfer Protocol operates on port 21" Then
- score -= 2
- Else
- score -= 1
- End If
- rtbQuestion.Text = "What port does HTTP operate over?"
- txtScore.Text = score & scoreTotal
- Case "Correct! HyperText Transfer Protocol operates on port 80"
- rtbQuestion.Text = "What port does HTTP operate over?"
- score -= 1
- txtScore.Text = score & scoreTotal
- End Select
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement