Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Looking up Whois Info the Right Way

You can find a nice Whois Server list on Github

Add Using statement:
Code
using System.Net;
using System.Net.Sockets;

Global Declarations:
Code
public string whois_server;
public int whois_port;
public TcpClient client;
public string dns_qry;

Form Load Event:
Code
whois_port = 43;
whois_server = textBox1.Text;
dns_qry = string.Empty;

Tetxbox 2 Keypress Event:
Code
switch ((Keys)e.KeyChar)
{
    case Keys.Enter:
        client = new TcpClient();
        textBox3.Text = "";

        client.Connect(whois_server, whois_port);
        dns_qry = textBox2.Text + "\r\n";
        byte[] qry_bytes = Encoding.ASCII.GetBytes(dns_qry.ToCharArray());
        Stream dns_strm = client.GetStream();
        dns_strm.Write(qry_bytes, 0, qry_bytes.Length);
        StreamReader rdr = new StreamReader(dns_strm, Encoding.ASCII);
        while (rdr.ReadLine() != null)
        {
            textBox3.Text += rdr.ReadLine() + Environment.NewLine;
        }

        rdr.Close();
        dns_strm.Close();
        client.Close();
        break;
}
And what do we enter in TextBox1?
(Oct 22, 2016 04:37 PM)Ninja Wrote:  And what do we enter in TextBox1?

the host i guess?
Quote: while (rdr.ReadLine() != null)
{
textBox3.Text += rdr.ReadLine() + Environment.NewLine;
}


I think you are skipping half of the lines.
Lotta blood to let, peace to make, give a fuk about a check


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Culperring722Jun 22, 2015 08:51 AM 7 208 Jun 22, 2015 08:51 AM
Last Post: Emoticon
[.NET] by SniperWarriorDec 30, 2014 09:29 AM 11 550 Dec 30, 2014 09:29 AM
Last Post: xVipX
[.NET] by shanMay 4, 2013 07:14 AM 8 547 May 4, 2013 07:14 AM
Last Post: Mohatu