A new bug found in older versions of windows like 7, 8 & 8.1, will allow malicious websites to crash the visitors computer by just including a single html line in their website. Since Microsoft has officially ended support for these operating systems, it is hard to tell when/if a patch will be released. It is good practise to update/upgrade your PC to the latest software to avoid issues like this.
If you want to experience this bug, you can save the contents of the following gist to a html file and open it on a vulnerable system, please be aware that by doing so your system might crash and become unresponsive, during my verification i found the bug to have no impact on the PC after i restart, however I dont guarantee anything, if you are trying this, you are doing at your own risk.
Now to the code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The answer is to use Elastic IP Address, If your instance (the one you want to point your root level domain(naked domain) like example.com to) has existing Elastic IP address, just update your domain’s A record to point to this IP address, if not, then follow the AWS documentation on how to assign an Elastic IP address to your instance and assign an elastic IP to you instance.
What is Root level domain or Naked domain ?
Root level domain or a Naked domain is the domain name with out the www sub domain, that is example.com instead of http://www.example.com, this is usually helpful when a website administrator wants, to give the users flexibility to visit their website without typing the www.
There are many websites that does this, and it can be achieved in AWS, either by pointing the A record directly to the IP address to where the website is hosted, or to a placeholder IP and redirecting all the web request to the www url.
Drawbacks of pointing root level domains to a web application
Pointing your domain name to a web application is known to cause issues with SMTP servers and may impact mail delivery for that domain name.
Hard coding an IP address to your website address also might not be scalable.
This post is actually a question I asked on Stackoverflow,
The question is Which performs better if or if-else ?, this might seem to be a silly question for a few because of 2 reasons.
If block will have relatively less lines of code, if both the blocks are having the same code, it is apparently a matter of commonsense.
And if they are not having the same code then we should not compare them in the first place
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following T-SQL Query will retrieve anything that is after the @ symbol, the query can be very useful for retrieving the domain of an email address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Programmatically searching for domain name availability is easier than I expected, all we have to do is get the Whois information for the domain name that we are looking for, and look for a specific text inside the Whois response.
I have already written a post on how to write a C# class to get whois information, you can go over there if you want more information on Whois, but if you just want the class name you can find it below and you can also find the complete source code at the links that I have provided.
Domain Search Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is Whois ?
Whois is a protocol to fetch the registered users of a internet resource such as a domain name or an IP block, it is documented in RFC 3912.
Whois information can be used to know some basic information about a domian name like the person or the organization it is registered to, registration & expiry date etc.,
The protocol
The whois protocol is a pretty straight forward TCP based query response protocol, each TLD or top level domain(example .com, .net, .org, etc., ) will have a whois server that will listen on the port number 43 for the queries, Once a request is received the server will check its internal database for the domain name details and return the information in the response, the availability of a domain name in a particular TLD can be identified from the whois information returned, the structure of the whois might differ from server to server.
The protocol can be explained simply as follows
Connect to the service host
TCP: service port 43 decimal
Send a single "command", ending with a new line character(ASCII CR and then ASCII LF)
Receive information in response to the command line. The
server closes its connections as soon as the output is
finished.
Implementation In C#
To get the Whois information of any domain, we need 3 parameters
Domain name
Record type, which is “domain”
The whois server address for the TLD of the given domain name
A collection of Whois server list is maintained by nirsoft.net which we can use to determine the correct Whois server for a given domain name based on its TLD
Once we get this, all we have to do is connect to the server on port 43 using TCP and send the query as combination of the text “domain” and your domain name, seperated by a single space character ” “, your query should always end with a new line character.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can get the whois information by just calling the Whois.Lookup method with your domain name as parameter as shown in the code below.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note
Please note that this is implementation works only “.com” TLD domains, you have to change the server name to make it work for other TLD’s, you can find the implementation which works with different TLD’s in the github project I linked below
The following C#.net class can be used to update statuses, delete, retweet statuses, obtain information regarding a particular status and any body who retweeted a particular status using status id.
This class implements all the methods that are under the “Tweets Resources” section in Twitter API documentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Updates the authenticating user's status. A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.
/// Authentication is required and this call is not rate limited
/// </summary>
/// <param name="tweet_message">The text of your status update, up to 140 characters.</param>
/// <param name="reponse_format">The format in which you want twitter to respond</param>
/// <param name="optionalparameters">Any optional paramters you want to pass</param>
/// <returns>Response string from twitter in user selected format </returns>
public string UpdateStatus(ResponseFormat reponse_format, string tweet_message, string optionalparameters)
{
if (string.IsNullOrEmpty(tweet_message))
throw new ArgumentNullException(tweet_message, "The status message cannot be null");
To get started with twitter needs you to authenticate your application before you could use twitter API’s search feature, to authenticate an application needs to initialize a oAuthTwitter object so that it is accessible through out the class like
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now since we have obtained the authentication we can use this oAuth to search twitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now we have the 100 search results stored in a string result in JSON format, we will use JSON parser for extracting the values of each tweet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I was searching for some source code to create an OCR reader in C#.net and luckily found this amazing article on codeproject, I don’t want to even try rewriting the article as it was such superbly written, If you are looking for an easiest way to create a barcode generator in C#.net, goto http://www.codeproject.com/KB/cpp/wsbarcode.aspx
I found this piece of code on the internet, the author of this code is Tamer Oz.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters