thorin1270
01-29-2008, 07:12 AM
Hello all,
I wish to create my own server WHOIS. :D
how to make ?
I can do it on a server of the linux type, but does there exist package to create WHOIS server with mysql base (or other sql database) ?
The server will have to allow the incorporation of domain names with their details (registrant, adress, phone,…) and will have to allow to be questioned like any server WHOIS.
thank you by advance for your assistance.
thorin
I don't think so... But, you can work with the "whois" command in the linux shell/terminal and look in the source of that program (not sure if it's opensource) hench, a php script that contacts the whois program should be very easy. From there it's a piece of cake to store it in a db.
The whois protocol is quite simple. Basically you just need to have a program that listens to port 43. Every command that comes comes terminated by a new line and you answer with your output.
The WHOIS protocol is documented here:
http://www.ietf.org/rfc/rfc3912.txt
It's basically
=> CLIENT CONNECTS TO SERVER PORT 43
C: domain.com\r\n
S: (c)Registrar\r\n
S: This domain is registererd\r\n
S: ...\r\n
=> SERVER CLOSES CONNECTION
PM me if you need help.
emsjs1
01-30-2010, 01:29 PM
The WHOIS protocol is documented here:
http://www.ietf.org/rfc/rfc3912.txt
It's basically
=> CLIENT CONNECTS TO SERVER PORT 43
C: domain.com\r\n
S: (c)Registrar\r\n
S: This domain is registererd\r\n
S: ...\r\n
=> SERVER CLOSES CONNECTION
PM me if you need help.
Do you know where I can get a script to set up my own whois? well actually what i need is a whois for subdomains, like check if they "Resolve" and if they don't, the whois will return the subdomain as "available" for registration.
adaniels
02-04-2010, 12:54 PM
If you can make a PHP script that outputs the information you want, you're almost there.
#!/usr/bin/php
#
# -- /usr/local/bin/mywhois --
#
<?php
$search = fgets(STDIN);
$db = new mysqli('localhost', 'myuser', 'mypwd', 'somedb');
$result = $db->query('SELECT * FROM domain WHERE name="' . mysqli::real_escape_string($search) . '"');
if ($result->num_rows == 0) {
echo "Not found";
exit();
}
$domain = $result->fetch_assoc();
echo "Name: ", $domain['name'], "\n";
echo "Owner: ", $domain['owner'], "\n";
echo "Exp date: ", $domain['end_date'], "\n";
Make sure the script is executable.
Next use xinetd (or another inetd) to listen on port 43 and call the script.
# -- /etc/xinetd.d/whois --
#
# description: An xinetd service which outputs whois info.
service whois
{
disable = no
socket_type = stream
protocol = tcp
user = root
server = /usr/local/bin/mywhois
wait = no
}
That's it :)