Created
November 9, 2018 03:46
-
-
Save tbhaxor/e40ab4bc3aa78f13fdb9f0ac0b93b690 to your computer and use it in GitHub Desktop.
Tinyurl Clean and custom alias maker
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
<?php | |
/* | |
How to execute : php tiny.php | |
This will help you in generating readable custom alias with enumration (if already registered) | |
*/ | |
function getURL($url, $sh) | |
{ | |
$data = file_get_contents("https://tinyurl.com/create.php?source=indexpage&url=$url&submit=Make+TinyURL%21&alias=$sh"); | |
preg_match('/<b>https:\/\/tinyurl.com\/.*<\/b>/', $data, $matches); | |
$respShort = explode("</b>", explode("<b>", $matches[0])[1])[0]; | |
return $respShort; | |
} | |
echo("[?] Enter url to shorten : "); | |
$url = explode("\n", fgets(STDIN))[0]; | |
echo("[?] Enter custom short alias : "); | |
$short = explode("\n", fgets(STDIN))[0]; | |
echo("[~] Creating\n"); | |
$u = getURL($url, $short); | |
$exists = true; | |
$i = 1; | |
while ($exists) | |
{ | |
if("https://tinyurl.com/$short" === $u) | |
{ | |
echo("[!] Your Tiny URL : $u\n"); | |
break; | |
} | |
$d = preg_split("/-[0-9]+(-[0-9]+)*/", $short)[0]; | |
$short = "$d-$i"; | |
$u = getURL($url, $short); | |
$i++; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment