[C#][Help] MPGH Login

Posts 115 of 20 · Page 1 of 2
[C#][Help] MPGH Login
Hello,
How would I be able to login to MPGH via C# or even VB.Net. As I am trying to make a browser purely based on MPGH and feature towards it, but at the moment to no avail can I get the login to work. I have located the code for everything else, but it's all useless since it can't do a remote login (eg. through the program and not navigating to the webpage)

I have tried so many methods of coding, from injecting a cookie to filling in the forms manually, but it doesn't help. Could I please get some help on this matter?

Thanks in advanced.
Quote Originally Posted by Rakuuza View Post
Hello,
How would I be able to login to MPGH via C# or even VB.Net. As I am trying to make a browser purely based on MPGH and feature towards it, but at the moment to no avail can I get the login to work. I have located the code for everything else, but it's all useless since it can't do a remote login (eg. through the program and not navigating to the webpage)

I have tried so many methods of coding, from injecting a cookie to filling in the forms manually, but it doesn't help. Could I please get some help on this matter?

Thanks in advanced.
I suggest you to look on this:
HttpWebRequest Class (System.Net)

Code I found: (No credit to me, just found)
Code:
using System; 
    using System.Web;
    using System.Net; 
    using System****;
    using System.Web.UI;
    using System.Web.UI.WebControls; 

namespace Foo
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("Site"); 
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)"; 
            req.Method = "POST";
            req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            req.Headers.Add("Accept-Language: en-us,en;q=0.5");
            req.Headers.Add("Accept-Encoding: gzip,deflate");
            req.Headers.Add("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            req.KeepAlive = true;
            req.Headers.Add("Keep-A****** 300");
            req.Referer ="Site";

            req.ContentType = "application/x-www-form-urlencoded"; 

            String Username = "username";
            String PassWord = "Password";

            StreamWriter sw = new StreamWriter(req.GetRequestStream());
            sw.Write("application=portal&url=" + Username + "&password=" + password + "");
            sw.Close();

            HttpWebResponse response = (HttpWebResponse)req.GetResponse();


            StreamReader reader = new StreamReader(response.GetResponseStream());
            string tmp = reader.ReadToEnd();

            foreach (Cookie cook in response.Cookies)
            {
                tmp += "\n" + cook.Name + ": " + cook.Value;
            }


            Response.Write(tmp);
            Response.End();

        }
    }
}
You need to write it yourself tho
Quote Originally Posted by Jorndel View Post
I suggest you to look on this:
HttpWebRequest Class (System.Net)

Code I found: (No credit to me, just found)
Code:
using System; 
    using System.Web;
    using System.Net; 
    using System****;
    using System.Web.UI;
    using System.Web.UI.WebControls; 

namespace Foo
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("Site"); 
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)"; 
            req.Method = "POST";
            req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            req.Headers.Add("Accept-Language: en-us,en;q=0.5");
            req.Headers.Add("Accept-Encoding: gzip,deflate");
            req.Headers.Add("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            req.KeepAlive = true;
            req.Headers.Add("Keep-A****** 300");
            req.Referer ="Site";

            req.ContentType = "application/x-www-form-urlencoded"; 

            String Username = "username";
            String PassWord = "Password";

            StreamWriter sw = new StreamWriter(req.GetRequestStream());
            sw.Write("application=portal&url=" + Username + "&password=" + password + "");
            sw.Close();

            HttpWebResponse response = (HttpWebResponse)req.GetResponse();


            StreamReader reader = new StreamReader(response.GetResponseStream());
            string tmp = reader.ReadToEnd();

            foreach (Cookie cook in response.Cookies)
            {
                tmp += "\n" + cook.Name + ": " + cook.Value;
            }


            Response.Write(tmp);
            Response.End();

        }
    }
}
You need to write it yourself tho
Have done similar methods but to no avail did they work. I'll try that one though. Thanks
Quote Originally Posted by Rakuuza View Post
Have done similar methods but to no avail did they work. I'll try that one though. Thanks
I am not sure but as I understand.
You don't want to use the webbrowser to type the username & password for you.

Code found: (No credit to me, I just found )
Code:
private void btnLogin_Click(object sender, EventArgs e)
{
    HtmlElement ele = webBrowser1.Document.GetElementById("username");
    if (ele != null)
        ele.InnerText = "Set Username";

    ele = webBrowser1.Document.GetElementById("password");
    if (ele != null)
        ele.InnerText = "Set Password";

    ele = webBrowser1.Document.GetElementById("Login Click");
    if (ele != null)
        ele.InvokeMember("click");
}
Quote Originally Posted by Jorndel View Post
I am not sure but as I understand.
You don't want to use the webbrowser to type the username & password for you.

Code found: (No credit to me, I just found )
Code:
private void btnLogin_Click(object sender, EventArgs e)
{
    HtmlElement ele = webBrowser1.Document.GetElementById("username");
    if (ele != null)
        ele.InnerText = "Set Username";

    ele = webBrowser1.Document.GetElementById("password");
    if (ele != null)
        ele.InnerText = "Set Password";

    ele = webBrowser1.Document.GetElementById("Login Click");
    if (ele != null)
        ele.InvokeMember("click");
}
Thank you as I am home I shall test both methods, I know the second method works but that uses the web browser idea. if the first method doesn't work I'll use a suppressed web browser idea.

Thank you or the great help!!
You could access the users Database....Oh wait...
Quote Originally Posted by user590177 View Post
You could access the users Database....Oh wait...
Yeah, that would make things simple but Dave wouldn't allow it lol. So I have to try inject the user and pass to the php script
Quote Originally Posted by Rakuuza View Post
Yeah, that would make things simple but Dave wouldn't allow it lol. So I have to try inject the user and pass to the php script
Yes and what then? You won't have access to any kind of information....Well you will but it would be so fucking complicated. (and probably will take time)
Quote Originally Posted by user590177 View Post
Yes and what then? You won't have access to any kind of information....Well you will but it would be so fucking complicated. (and probably will take time)
I understand that but if I only make a basic / intermediate one then maybe Dave might give me access. If not I'll try the complicated method
Quote Originally Posted by Rakuuza View Post
I understand that but if I only make a basic / intermediate one then maybe Dave might give me access. If not I'll try the complicated method
I don't think that Dave will allow that. Since having access to the database consists in a high risk for MPGH. Let's be honest nobody knows how things will go, maybe some kind of hacker will decompile your code and have access to the databases delete users, get the head admin password, or whatever else.
Quote Originally Posted by user590177 View Post
I don't think that Dave will allow that. Since having access to the database consists in a high risk for MPGH. Let's be honest nobody knows how things will go, maybe some kind of hacker will decompile your code and have access to the databases delete users, get the head admin password, or whatever else.
That's 100% true that's why my current method is the hard way, that way I didn't rely on any type of access only php post methods which this forum runs on. And being vbbulletin it isn't as hard as a custom build forum as you can find resources on all functions.

Secondly I wouldn't be stupid enough to put database details in the program . Secondly vbbulletin only allows access from a white list
Quote Originally Posted by Rakuuza View Post
That's 100% true that's why my current method is the hard way, that way I didn't rely on any type of access only php post methods which this forum runs on. And being vbbulletin it isn't as hard as a custom build forum as you can find resources on all functions.

Secondly I wouldn't be stupid enough to put database details in the program . Secondly vbbulletin only allows access from a white list
Didn't know about that white list thingy. Anyways if you want to connect to a database you must put the database info somewhere...
Quote Originally Posted by user590177 View Post
Didn't know about that white list thingy. Anyways if you want to connect to a database you must put the database info somewhere...
Correct, I would connect to a php script for database, most secure method. As it is the same way 99% of the forums do.
You guys do realize that you can "restrict" users database access and such right? .___. Such as write/read on a table, etc..

So, you could actually have a user whom can only do queries to a table on a DB. (Which i dont see any risk about knowing the credentials by getting hacked or something)
Just not sure of how much freedom you have on a VBulletin forum/dbs/etc...
Quote Originally Posted by 'Bruno View Post
You guys do realize that you can "restrict" users database access and such right? .___. Such as write/read on a table, etc..

So, you could actually have a user whom can only do queries to a table on a DB. (Which i dont see any risk about knowing the credentials by getting hacked or something)
Just not sure of how much freedom you have on a VBulletin forum/dbs/etc...
Really probably is easier using a web scraping method!!
Posts 115 of 20 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?