Skip to content

Instantly share code, notes, and snippets.

@ShiponKarmakar
Forked from AminulBD/README.MD
Created December 17, 2018 16:51
Show Gist options
  • Save ShiponKarmakar/efebc05c03ce0f5d8a3330a56c4b8652 to your computer and use it in GitHub Desktop.
Save ShiponKarmakar/efebc05c03ce0f5d8a3330a56c4b8652 to your computer and use it in GitHub Desktop.
BD Domain ability checker with php.

(DOT) .BD DOMAIN ABILITY CHECKER

You can use this as WHMCS or other domain checker to check ability of .bd domains. This is a concept for how to create your own whois server.

WARNING: WHEN YOU USE THIS SCRIPT, YOU KNOW WHAT YOU ARE DOING. I'M NOT RESPONSIVE FOR ANY PROBLEM

First login to your server (Any distro) and install the following dependencies.

For ubuntu user:

apt-get install xinetd dnsutils php-cli

For Centos/Redhat user:

yum install xinetd bind-utils php-cli

Add new user with not root access. (I know you are expert for this)

Above this two files edit as your needs and then place "bdwhois" file in the /etc/xinetd.d/bdwhois and "bdwhois.php" file in the /home/USER/bdwhoois.php

Now, edit the /etc/services file and place the code below at the end of line.

# Local services
bdwhois 		43/tcp 					# BD Whois checker

Now You are enter the restart the xinetd to finish.

Now open your terminal and test telnet YOUR_IP_OR_HOST 43 then enter your domain.

WHMCS .BD Domain checker setup process.

First go to the your WHMCS installation directory, then find "/resources/domains/dist.whois.json" and open it on the code editor.

Now place the blow code end of the array. Example: http://d.aminul.net/iKIg/4X9gSqDj

{
    "extensions": ".com.bd,.net.bd,.org.bd,.edu.bd,.co.bd,.mil.bd,.gov.bd,.ac.bd,.info.bd,.tv.bd,.sw.bd",
    "uri": "socket://YOUR_IP_OR_YOUR_DOMAIN",
    "available": "NXDOMAIN"
}

Now you are setup. Just go the domain pricing and add the new domain to check .bd domain in your WHMCS installation. Note: THIS IS NOT WHOIS SERVICE SERVER. This is a just nslookup command for every domain (Not only .bd :D ) Some registered domains which do not have nameserver setup can be shows as available.

# default: on
# description: BD Domain checker
service bdwhois
{
socket_type = stream
protocol = tcp
wait = no
user = USERNAME
server = /usr/bin/php
server_args = /home/USERNAME/bdwhois.php
log_on_success += DURATION
nice = 10
disable = no
}
<?php
$name = fgets(STDIN);
$name = trim( $name );
if( substr( strtolower( $name ), 0, 7 ) == "http://" )
$name = substr( $name, 7 );
if( substr( strtolower( $name ), 0, 4 ) == "www." )
$name = substr( $name, 4 );
$result = shell_exec( 'nslookup ' . $name );
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment