Question vBulletin Authorization System Problem - HTTP request

leptoon

Member
Joined
Aug 20, 2008
Messages
7
Programming Experience
Beginner
I have a VB.Net auth form that users will put their username and password in and then it verifies that they are a member of my vBulletin forum and launches the main form.

In debug every time I put in my username and password and click login, it says "NullRefrenceException was unhandled" and highlights the following line in the wrapper.

ReqHeaders = "POST " + strFile + " HTTP/1.1" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Host: " + Host + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Language: en-us,en;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Encoding: gzip, deflate" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Keep-Alive: 300" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: keep-alive" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Referer: " + Referer + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Cookie: " + strCookies + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Type: application/x-www-form-urlencoded" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Length: " + strPost.Length.ToString + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: close" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + strPost
Thats all one long line, but its chopped up on here.

PM me if you want more of the source.
 
Last edited:
It doesn't do anything because this line:
VB.NET:
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
is missing the Handles clause. This means that at one point you deleted the OK_Button on the form and later on must've added it back.

To fix this simply add:
VB.NET:
 Handles OK_Button.Click
now run the code
 
It doesn't do anything because this line:
VB.NET:
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
is missing the Handles clause. This means that at one point you deleted the OK_Button on the form and later on must've added it back.

To fix this simply add:
VB.NET:
 Handles OK_Button.Click
now run the code

I figured that out like an hour before you posted lmao. Thanks for the info! Now I have another problem. I've updated the thread.
 
I have a VB.Net auth form that users will put their username and password in and then it verifies that they are a member of my vBulletin forum and launches the main form.

In debug every time I put in my username and password and click login, it says "NullRefrenceException was unhandled" and highlights the following line in the wrapper.

Thats all one long line, but its chopped up on here.

PM me if you want more of the source.
As the error message tells you "NullRefrenceException was unhandled" that means one of your variables in there isn't set, you should put a break on the line right before that one and when the program breaks on that line you can hold the mouse over each variable and a yellow tool tip will tell you the contents of that variable.
 
Here is the auth form named frmTerms and the Wrapper.
 

Attachments

  • frmTerms.zip
    39.3 KB · Views: 53
  • Wrapper.zip
    4.3 KB · Views: 56
Last edited:
I think I've found/fixed the error:
VB.NET:
'In the wrapper class paste this:
        Dim ReqHeaders As String
        If Method = "GET" OrElse Method = "PIC" Then
            ReqHeaders = "GET" + " " + strFile + " HTTP/1.1" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Host: " + Host + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Language: en-us,en;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Encoding: gzip, deflate" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Keep-Alive: 300" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: keep-alive" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Referer: " + Referer + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Cookie: " + strCookies + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & ""
        Else
            ReqHeaders = "POST" + " " + strFile + " HTTP/1.1" & Microsoft.VisualBasic.Chr(13) & Microsoft.VisualBasic.Chr(10) & "" + "Host: " + Host + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Language: en-us,en;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Encoding: gzip, deflate" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Keep-Alive: 300" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: keep-alive" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Referer: " + Referer + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Cookie: " + strCookies + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Type: application/x-www-form-urlencoded" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Length: 0" & Microsoft.VisualBasic.Chr(13) & Microsoft.VisualBasic.Chr(10) & "" + "Connection: close" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + strPost
        End If
VB.NET:
'Here's all of the frmTerms code:
Imports System.Windows.Forms
Public Class frmTerms
    Private strHTML As String

    Private Sub loginBut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loginBut.Click
        If txtuser.Text.Trim = String.Empty OrElse txtpass.Text.Trim = String.Empty Then
            MsgBox("You left the password and/or username field blank", vbCritical)
        Else
            loginBut.Enabled = False
            txtuser.Enabled = False
            txtpass.Enabled = False
            Dim myWrapper As New Wrapper()
            strHTML = myWrapper.Request("POST", "http://www.ab3r.com/forums/login.php", "vb_login_md5password=&s=&do=login&vb_login_username=" & txtuser.Text & "&cookieuser=1&vb_login_password=" & txtpass.Text)
            If strHTML.Contains("Thank you for logging in, ") Then
                strHTML = myWrapper.Request("GET", "http://www.ab3r.com/forum/", "http://www.ab3r.com/forum/")
            ElseIf strHTML.Contains("You have entered an invalid") Then
                MsgBox("Invalid Username or Password")
                loginBut.Enabled = True
                txtuser.Enabled = True
                txtpass.Enabled = True
                If strHTML.Contains("Thank you for") Then
                    Me.Hide()
                    frmMain.Show()
                End If
            Else
                MsgBox("Login failed.")
                loginBut.Enabled = True
                txtuser.Enabled = True
                txtpass.Enabled = True
            End If
        End If
    End Sub
    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
        End
    End Sub
End Class
 
URL for loging into vBulletin?

What is the 1 string URL to log in to vBulletin with?

Example:
VB.NET:
www.mysite.com/forums/login.php?login=do&username+md5pass&password
 
It's not working for me, I have it linked to my forums (vBulletin).. and I just get Login Failure.

Is the login string correct?

VB.NET:
vb_login_md5password=&s=&do=login&vb_login_username=" & txtuser.Text & "&cookieuser=1&vb_login_password="
 
Re:

its not working here i got vbulletin 4.0.3 and it is not working


the script

Dim ReqHeaders As String
If Method = "GET" OrElse Method = "PIC" Then
ReqHeaders = "GET" + " " + strFile + " HTTP/1.1" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Host: " + Host + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Language: en-us,en;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Encoding: gzip, deflate" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Keep-Alive: 300" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: keep-alive" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Referer: " + Referer + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Cookie: " + strCookies + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & ""
Else
ReqHeaders = "POST" + " " + strFile + " HTTP/1.1" & Microsoft.VisualBasic.Chr(13) & Microsoft.VisualBasic.Chr(10) & "" + "Host: " + Host + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Language: en-us,en;q=0.5" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Encoding: gzip, deflate" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Keep-Alive: 300" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Connection: keep-alive" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Referer: " + Referer + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Cookie: " + strCookies + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Type: application/x-www-form-urlencoded" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "Content-Length: 0" & Microsoft.VisualBasic.Chr(13) & Microsoft.VisualBasic.Chr(10) & "" + "Connection: close" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + "" & Microsoft.VisualBasic.Chr(13) & "" & Microsoft.VisualBasic.Chr(10) & "" + strPost
End If


whare to pase it to and it not works?¿:confused:
 
Back
Top