So, the two main things you want:
- Determine if it is tinyurl
- Determine if the URL is malicious.
The answer to part 1 is simple. Just check if the URL of the tinyurl.com domain belongs. It should just be to check the source string of the URL or part of the host returned by the getHost () method of the java.net.URL object.
Part 2 is harder to code from scratch ...
First you need your code to find out where tinyurl is redirected to.
The next bit really depends on how you want to define "malicious". Finding spoofed URLs will require some work (for example, finding the difference between something like www.stackoverflow.com and www.stack0verf10w.com) or comparing the destination URL with a malicious list of URLs (where they are published). Multiple redirects are also checked there, pop-ups and a list of criteria can go on and on.
source share