Page 1 of 1

Visual Basic Whitelist Assistance.

Posted: 02 Aug 2016, 21:58
by MASTALOL
This is a program I am writing for close friends, and I don't want anyone other than my friends to get access to it, I have in the past use a GUID but my old code broke, so I resorted to using IP's.

What I am requesting:
A. Assitance re-creating the GUID or HWID method
OR
B. Assitance making this method work...

Currently it works most of the time, but if you continue to open, close, open, close it somtimes allows you to access the program.


here is the code:

Code: Select all

Dim IPRRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://api.ipify.org/")
        Dim IPRResponse As System.Net.HttpWebResponse = IPRRequest.GetResponse()
        Dim IPRSR As System.IO.StreamReader = New System.IO.StreamReader(IPRResponse.GetResponseStream)
        Dim IPRAdded As String = IPRSR.ReadToEnd
        IP.Text = IPRAdded
        Dim IPRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://CENSORED.com/whitelist.txt")
        Dim IPResponse As System.Net.HttpWebResponse = IPRequest.GetResponse()
        Dim IPSR As System.IO.StreamReader = New System.IO.StreamReader(IPResponse.GetResponseStream)
        Dim IPAdded As String = IPSR.ReadToEnd
        Dim ThisIP As String = IP.Text
        If ThisIP = "Error" Then
            MessageBox.Show("Error Retrieving IP!" & vbNewLine & "Please try again!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Application.Exit()
            Exit Sub
        End If
        If IPAdded.Contains(ThisIP) = False Then
            MessageBox.Show("You Are Not Whitelisted!" & vbNewLine & "Please Contact An Admin For Access!" & vbNewLine & "Your IP: " + IP.Text, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Application.Exit()
            Exit Sub
        End If