Hack Forums
[.NET] [TuT] Get User Infomation (IP/ISP/PORT/PROXY/BROWSER ETC) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [TuT] Get User Infomation (IP/ISP/PORT/PROXY/BROWSER ETC) (/showthread.php?tid=368752)



[TuT] Get User Infomation (IP/ISP/PORT/PROXY/BROWSER ETC) - The-One - Apr 15, 2010

Again another share for me :)

Just define under 'Pulblic Class Form1' The Strings

So with:
Code
getuserinfo = nav.Select("//remote_port")
    While (getuserinfo.MoveNext())
    RemotePort = (getuserinfo.Current.Value)
    End While

You define
Code
Dim RemotePort As String

And e.g in Form1.Load
Code
YourIP()
Label1.text = RemotePort

Label1.text will show e.g = '55068'

Whole code:
Code
Imports System.Xml.XPath

Private Sub YourIP()
  Try
    Dim doc As XPathDocument
    doc = New XPathDocument("http://ip-address.domaintools.com/myip.xml")
    Dim nav As XPathNavigator
    nav = doc.CreateNavigator()
    Dim Data As XPathExpression = nav.Compile("//ip_address")
    Dim getuserinfo As XPathNodeIterator = nav.Select(Data)
    While (getuserinfo.MoveNext())
    Ip = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//connection")
    While (getuserinfo.MoveNext())
    Connection =  (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//remote_port")
    While (getuserinfo.MoveNext())
    RemotePort = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//proxy_type")
    While (getuserinfo.MoveNext())
    ProxyType = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//user_agent")
    While (getuserinfo.MoveNext())
    UserAgent = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//hostname")
    While (getuserinfo.MoveNext())
    Hostname = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//country")
    While (getuserinfo.MoveNext())
    Country = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//region")
    While (getuserinfo.MoveNext())
    Region = (getuserinfo.Current.Value)
    'End While

    getuserinfo = nav.Select("//isp")
    While (getuserinfo.MoveNext())
    ISP = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//city")
    While (getuserinfo.MoveNext())
    City = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//country_flag")
    While (getuserinfo.MoveNext())
    PictureBox1.ImageLocation = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//protocol")
    While (getuserinfo.MoveNext())
    Protocol = (getuserinfo.Current.Value)
    End While

  Catch ex As Exception

  End Try
    End Sub

Enjoy!


* - Leoopardss - Apr 15, 2010

Thanks Nicee Tuto nice share. :D


* - The-One - Apr 15, 2010

(Apr 15, 2010 12:09 PM)Leoopardss Wrote:  Thanks Nicee Tuto nice share. :D

No problem thanks for replying :)


* - .Nielz - May 2, 2010

Sorry not realy working , can i add you on MSN?
PM me plz ..


* - The-One - May 2, 2010

(May 2, 2010 06:51 AM)nielsje153 Wrote:  Sorry not realy working , can i add you on MSN?
PM me plz ..


Yes, but this is working lol.


* - rapidguide - May 8, 2010

thx for sharing
toshrt


* - The-One - May 8, 2010

(May 8, 2010 09:46 AM)rapidguide Wrote:  thx for sharing
toshrt

No problem mate :D


* - codepoet - May 8, 2010

thanks for this grate tutorial man...


* - Black Hound - Jul 19, 2010

Hm I got 13 non declared errors Please PM me.


* - PAGMAN - Jul 19, 2010

You should group every piece of code that gets info inside its own Try...Catch. That way, unlike your code above, all will not fail when one thing goes wrong.


* - no1me - Aug 24, 2010

Fixed
Code
Imports System.Xml.XPath
Public Class Form1
    Dim datetime, ip, Connection, RemotePort, ProxyType, UserAgent, Hostname, Country, Region, ISP, City, Protocol, language As String
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Try
    Dim doc As XPathDocument
    doc = New XPathDocument("http://ip-address.domaintools.com/myip.xml")
    Dim nav As XPathNavigator
    nav = doc.CreateNavigator()
    Dim Data As XPathExpression = nav.Compile("//ip_address")
    Dim getuserinfo As XPathNodeIterator = nav.Select(Data)
    While (getuserinfo.MoveNext())
    Ip = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//date")
    While (getuserinfo.MoveNext())
    Datetime = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//connection")
    While (getuserinfo.MoveNext())
    Connection = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//remote_port")
    While (getuserinfo.MoveNext())
    RemotePort = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//proxy_type")
    While (getuserinfo.MoveNext())
    ProxyType = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//user_agent")
    While (getuserinfo.MoveNext())
    UserAgent = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//hostname")
    While (getuserinfo.MoveNext())
    Hostname = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//country")
    While (getuserinfo.MoveNext())
    Country = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//region")
    While (getuserinfo.MoveNext())
    Region = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//isp")
    While (getuserinfo.MoveNext())
    ISP = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//city")
    While (getuserinfo.MoveNext())
    City = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//protocol")
    While (getuserinfo.MoveNext())
    Protocol = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//language")
    While (getuserinfo.MoveNext())
    Language = (getuserinfo.Current.Value)
    End While

    getuserinfo = nav.Select("//country_flag")
    While (getuserinfo.MoveNext())
    PictureBox1.ImageLocation = (getuserinfo.Current.Value)
    End While
    Label1.Text = "Ip : " + ip
    Label2.Text = "Connection : " + Connection
    Label3.Text = "RemotePort : " + RemotePort
    Label4.Text = "ProxyType : " + ProxyType
    Label5.Text = "UserAgent : " + UserAgent
    Label6.Text = "Hostname : " + Hostname
    Label7.Text = "Country : " + Country
    Label8.Text = "Region : " + Region
    Label9.Text = "ISP : " + ISP
    Label10.Text = "City : " + City
    Label11.Text = "Protocol : " + Protocol
    Label12.Text = "Datetime : " + datetime
    Label13.Text = "language : " + language
  Catch ex As Exception
  End Try
    End Sub
End Class