Whois server time out - whois

I would like to ask why every time I try to request to these whois servers I always get a time out error:
whois.nic.website
whois.nic.tech
whois.nic.name
whois.nic.xyz
whois.nic.store
whois.nic.site
whois.nic.online
whois.nic.design
whois.nic.fun
whois.nic.ink
whois.nic.host
whois.nic.art
whois.nic.name
whois.nic.coop
whois.nic.wiki
whois.nic.love
whois.nic.press
whois.nic.fans
whois.nic.realty
whois.nic.dhl
whois.nic.storage
whois.nic.kred
whois.nic.basketball
whois.nic.rent
whois.nic.tickets
whois.nic.gent
whois.nic.observer
These whois servers are all based on IANA and ICANN when I try to search for the whois servers for those TLDs.
Here is a screenshot when I try to get the whois data of a .tech link
All the other whois servers return the same time out error.
Thanks for your answers

Per ICANN requirements all of these gTLDs need to have a port 43 whois server.
However:
they are all rate-limited, as they are all abused
even if they reply nowadays due do GDPR and ICANN temporary solutions the output may be significantly redacted, specially for the contacts part (the output format is also a requirement coming from ICANN, so registries have little place there to deviate)
as observed in comments, these whois servers also need to be available under IPv6 from ICANN requirements if I remember correctly, but IPv6 connectivity (both on your end and the server end) may be vastly different from the IPv4 one.
The rate limiting is the most probable case and is easy to detect, if you try from another IP address and even better from another IP block.
I just tried a few right now and they work, so either your access is rate limited/blocked for any reason (like previous too high volume of requests) or you just hit a period where they were not available for some reason (less probable as you hit different registries, even if most of your list are handled by CentralNic, there are some by Neustar or others).
Since your question is not really a programming question at this stage, maybe by explaining more why you need to query, in an high volume it seems, all of these whois servers, one would be able to give you better advices.
Also about
Is this also the cause whenever I try to telnet the servers, it always fails?
whois is a very simple protocol and basically just an exchange over TCP/43 so using a whois client or doing telnet on port 43 is exactly the same thing, and will get the same results based on whatever rate limiting or blocked access you are hitting at that moment.

Try:
$whoisserver = 'whois.verisign-grs.com';
$domain = 'name.com';
$port = 43;
$timeout = 10;
$fp = #fsockopen($whoisserver, $port, $errno, $errstr, $timeout) or die("Socket Error " . $errno . " - " . $errstr);
fputs($fp, $domain . "\r\n");
while(!feof($fp)){
$out .= fgets($fp);
}
fclose($fp);
The service URL: http://akan.online/name.com

Related

Can I find out the status of the port using the Lua "socket" library?

Help me track the status of a specific port: "LISTENING", "CLOSE_WAIT", "ESTABLISHED".
I have an analog solution with the netstat command:
local command = 'netstat -anp tcp | find ":1926 " '
local h = io.popen(command,"rb")
local result = h:read("*a")
h:close()
print(result)
if result:find("ESTABLISHED") then
print("Ok")
end
But I need to do the same with the Lua socket library.
Is it possible?
Like #Peter said, netstat uses the proc file system to gather network information, particularly port bindings. LuaSockets has it's own library to retrieve connection information. For example,
Listening
you can use master:listen(backlog) which specifies the socket is willing to receive connections, transforming the object into a server object. Server objects support the accept, getsockname, setoption, settimeout, and close methods. The parameter backlog specifies the number of client connections that can be queued waiting for service. If the queue is full and another client attempts connection, the connection is refused. In case of success, the method returns 1. In case of error, the method returns nil followed by an error message.
The following methods will return a string with the local IP address and a number with the port. In case of error, the method returns nil.
master:getsockname()
client:getsockname()
server:getsockname()
There also exists this method:
client:getpeername() That will return a string with the IP address of the peer, followed by the port number that peer is using for the connection. In case of error, the method returns nil.
For "CLOSE_WAIT", "ESTABLISHED", or other connection information you want to retrieve, please read the Official Documentation. It has everything you need with concise explanations of methods.
You can't query the status of a socket owned by another process using the sockets API, which is what LuaSocket uses under the covers.
In order to access information about another process, you need to query the OS instead. Assuming you are on Linux, this usually means looking at the proc filesystem.
I'm not hugely familiar with Lua, but a quick Google gives me this project: https://github.com/Wiladams/lj2procfs. I think this is probably what you need, assuming they have written a decoder for the relevant /proc/net files you need.
As for which file? If it's just the status, I think you want the tcp file as covered in http://www.onlamp.com/pub/a/linux/2000/11/16/LinuxAdmin.html

Website and email google apps redirects

I've set up MX records as such:
5 # ALT1.ASPMX.L.GOOGLE.COM
5 # ALT2.ASPMX.L.GOOGLE.COM
10 # ALT3.ASPMX.L.GOOGLE.COM
10 # ALT4.ASPMX.L.GOOGLE.COM
1 # ASPMX.L.GOOGLE.COM
CNAME as such:
www xxxx.rhcloud.com
The problem is that xxxx.com does not resolve to www.xxxx.com in a web browser.
The second problem is that emails sent to xxxx.com return with "DNS Error: Address resolution of xxxx.ca. failed: DNS server returned answer with no data". And before, "The recipient server did not accept our requests to connect.".
Another thing was this. Not sure what that is.
I've seen some hints on the internet to set up an A record to route # to the IP of the server, but rhcloud dosen't have one IP, I don't think.
I'm completely out of my depth here. I just want my google apps emails to work, and website to direct trafic to my rhcloud server.
You can't set your root domain as CNAME, only subdomain can be CNAME.
Root domain must have A-record if you want correct redirect to www.yoursite.com in web browser.
I've seen some hints on the internet to set up an A record to route # to the IP of the server, but rhcloud dosen't have one IP, I don't think.
Symbol "#" in DNS zone means "root domain without subdomains, so this two record are equal:
NAME TYPE VALUE
--------------------------------------------------
someexample.com. A 55.33.11.22
# A 55.33.11.22
I don't know how openshift works, but looks like you can have only subdomain directed to your xxx.openshift.com application.
Issues with MX records in is unrelated to first question and I can't say what actually wrong.
Will be better if you show your real domain name so I can look on real zone configuration.

malformed url versus broken link in perl

I'm looking to distinguish between typos in urls and actual broken links. For example:
typo:
www.google/com
broken link:
www.thislinkpointstonothing.org
I would like my application to recognize the first URL as misformed and to indicate the second URL to returns a 404 not found when queried. Is there a perl module or a regex I can use in order to make this distinction?
I'm trying to distinguish between bad links due to typos or - if the link follows the RFC - if the bad link is simply due to the page no longer existing.
You are talking about two different types of "queries": DNS lookups and HTTP requests. HTTP requests make use of DNS lookups - but not always. for example a server can be located on a local network and you can request pages from it using IP address and name information from an /etc/hosts file. Link names may not always contain a host name portion since they can be relative (this is often a good practice for making a website easily able to be moved behind a reverse proxy or if the host name changes.
Taking account of that distinction the gist of your question - whether you can check a link for correctness of the URI versus a truly missing a a page (404) is sound - but a DNS query for google/com should snot succeed. Is your application being redirected by a proxy to a search page?
A rough approximate answer follows - this probably won't be much use as it is but you'll get the idea. For more useful approaches in perl, you might want to check if some of the more featureful perl frameworks (Catalyst Mojo) have methods for doing this. Also, if you are doing this for your front end UI (i.e. javascript on a web page) there may be well established approaches that are quicker or simpler. The following steps seem like what you want to do with each link:
1 Check if the link/URI is "normal"; if not print an error; if it is then :
2 Do a DNS lookup on the host part of the link/URI; if not print an error; if it succeeds then:
3 Try to fetch the web page and print any errors or if it succeeds say so
Measuring "success" is hard to automate though: should it be defined strictly as status "200 OK"? Perhaps you or another member can add that part and find an elegant way to read in the "links" (broken or otherwise).
This script makes sloppy use of our to stash things and won't run with use strict. Please somebody make it look nicer and use only CORE:: modules :-)
use Regexp::Common qw/URI/;
use Net::DNS;
use 5.10.0;
use LWP::UserAgent;
my $url = "http://www.google.com/adsfdsa" ;
my $lookup = Net::DNS::Resolver->new;
my $ua = LWP::UserAgent->new;
### Step 0. regexp the URI ##
if ($url =~ /$RE{URI}{HTTP}{-keep}/){
say "$url is a URI ";
our $hostpart = $3; # stash the host part as per man page
our $filepart = $5; # stash the path
}
### Step 1. do a DNS look up and if it succeeds then or else ... etc. ###
if ($lookup->query($hostpart)) { say "$hostpart is a valid host" }
else { say " but $hostpart is an invalid host" }
### Step 2. fetch the page and check the return code ###
my $request = HTTP::Request->new(GET => $url);
my $response = $ua->request($request);
if ($response->is_success || $response->is_redirect ) {
print $request->content;
}
else {
say "but $filepart is an invalid path";
}
Output:
http://www.google.com/adsfdsa is a URI
www.google.com is a valid host
but /adsfdsa is an invalid path
You could make something like the above (but shorter, more elegant and more efficient!) read from your input and return the appropriate message to your users i.e. from wherever the error happens: i.e. at step 0., 1, or 2.). Note taht there are likely faster and simpler ways to do this, but modules like Regexp::Common and LWP are well exercised and tessted.

How to redirect to a default hostname

I want something like:
"http://www.anyhostname.com" ==> "http://192.168.0.1"
i.e. I want to redirect any request other than "192.168.0.1" to "http://192.168.0.1"
I am using Lighttpd as my webserver and dnsmasq as my DNS server.
I have to wonder if you're doing transparent proxying -- if so, there may be better mechanisms to accomplish what you want to do than literally doing what you outlined as your goal.
But if you want to keep going this route, I think you can use lighttpd's mod_evhost facility to easily use a default site configuration:
General Example:
server.document-root = "/home/user/sites/default/site"
evhost.path-pattern = "/home/user/sites/%0/site/"
If example.org is requested, and
/home/user/sites/example.org/site/ is
found, that path becomes the docroot.
If example.net is requested but no
directory named
/home/user/sites/example.net/site/
exists, then the docroot remains
/home/user/sites/default/site
If you have specific hostnames that you want to handle, you can add them to /etc/hosts and your dnsmasq will serve them. This would work if you had a few hundred hosts/domains that you wanted to handle, but if you wanted to handle everything, then dnsmasq may not be the right tool.
I know that PowerDNS's PipeBackend can be used to easily give the same answer regardless of DNS question; this way, you could easily intercept requests and handle some or all requests specially. This way, you could answer 192.168.0.1 for every request, for some requests, or anything you can program.
Okay, I solved the problem. Posting the solution here back with hope that it helps somebody in the future...
I solved this by modifying the lighttpd.conf file. I added the following inside my lighttpd.conf file:
$HTTP["host"] !~ "mydesiredhostname\.com" {
url.redirect = (
"" => "http://192.168.0.1/"
)
}
Thank you everybody for your time. Cheers!

How do i get a free socket port? C++

I am writing a UDP test client/server and i want to get it through firewall. Supposedly all i need to do is have both sides send to the correct IP and server. Getting an IP is not a problem but how do i have the client pick a random free port and report it to the user? I eventually would want it to connect to a matchmaker server but right now i need a simple working prototype and i would like to cout the port number so my friend/tester can send me the # via IM so we can test.
How do i get the port number?
sorry for the long desc. I notice people tell me not to do what i am asking when i dont give a desc :(
To use the highly technical term, this is actually a pretty icky problem or even a pair of icky problems. Depending on the configuration of the firewall, it will usually allow responses from another endpoint on the IP endpoint as the request came from. So... if you friend receives the UDP datagram using something like the recvfrom() system call, the address parameter will receive the IP endpoint information to respond to. So the other end should be able to respond with a sendto() using the same addressing information. Something like:
/* initiator */
struct sockaddr_in hisaddr;
memset(&hisaddr, 0, sizeof(hisaddr));
hisaddr.sin_addr.s_addr = htonl(target_ip);
hisaddr.sin_port = htons(target_port);
sendto(sd, msg_ptr, msg_sz, 0, (struct sockaddr*)&hisaddr, sizeof(hisaddr));
/* receiver */
struct sockaddr_in peeraddr;
socklen_t peer_sz = sizeof(peeraddr);
recvfrom(sd, buf_ptr, buf_sz, 0, (struct sockaddr*)&peeraddr, &peer_sz);
/* build response */
sendto(sd, msg_ptr, msg_sz, 0, (struct sockaddr*)&peeraddr, peer_sz);
The peeraddr on the other side will be your external address or, more correctly, the IP address of your firewall and the port number that it chose to use. The port number that you specify in your code may be completely different than the port that your friend would have to send data to. Ultimately, it might not matter what port you choose to use since the firewall might be sending and receiving on an entirely different port - this is what Network Address Translation is all about. I would recommend reading RFC3235 for some tips on how to overcome that hurdle.
The best approach IMHO is to:
Let the OS choose a port by either calling bind() with a zero port number or skipping the bind altogether
Having the client receive the address information from the socket layer (e.g., the fifth and sixth arguments to recvfrom())
The client sends response to the endpoint retrieved in the previous step
Tweak the firewall configurations until the previous steps work
Of course, all of the magic is in the last step. If you can disable NAT or ensure that the firewall is never going to switch ports, then nailing down a port number and bind-ing to it will work as well. You might want to take a look at %WINDIR%\system32\drivers\etc\services (or /etc/services depending on your OS inclination) to get an idea of what port numbers are reserved or generally in use.
bind() the socket before you send your data. Specify port 0 to bind(), and the OS will pick an unused port for you. You can then use getsockname() to find out what port wsa chosen.
Generally speaking - you - as the developer - choose the port. You can set your application to read the port from a config file or user input - but no magic firewall is going to tell you what port to use...
If I'm understanding your question correctly, I'm not sure there's a way to do what you want programatically (and even if there is, I don't think it's the right approach). I think you need to find a port that isn't in use on the server machine (and perhaps a different or the same port on the client machine, if communication is bi-directional) AND that port must be able to pass through your firewall. I assume since you say "getting an IP is not a problem", you've already configured your firewall to forward some or all ports to a specific computer inside the firewall? If so, the port you seek is one of the ones you forwarded. You can just pick an arbitrary one, as long as no other service is running on that port. Ports below 1024 are reserved, so you probably want to pick a higher number than that. You can use a simple portscanning tool such as nmap to see which services are running on your computer on which ports and pick a different one. Note that nmap can be fooled by firewalls and various bind rules when sockets are created.
I think you're better off picking a fixed port rather than relying on the random port number chosen by the O/S.
If you use a random port you'd have to change your firewall settings each and every time you run the program.
If you're using WINSOCK check this link:
http://msdn.microsoft.com/en-us/library/aa280717(VS.60).aspx
Basically you have 2 choices set the port to 0 and let the system assign you one or chose a random one try to open the socket if it doesn't work try another (be sure to steer clear of reserved ports)