Post: Shortened Link Reversal
02-01-2017, 05:19 AM #1
Kryptus
Former Staff Manager
(adsbygoogle = window.adsbygoogle || []).push({}); Retards in my chat kept posting logout links and whatnot using shortened links so I threw this together to reverse it. Got some help off old Stack Overflow posts.
Some parts might be messy. Figured it'd be useful for some people.

Aside from the Google, YouTube, etc issue noted in comments of it, the other issue is it doesn't prevent in-page framing of a page that are sometimes substitute to an actual redirect, but these aren't used much.

It works perfectly fine with common shit like goo.gl, bit.ly, etc.

    <?
$words = explode(" ", $message);
foreach ($words as $key => $word)
{
if (filter_var($word, FILTER_VALIDATE_URL) !== false) // Is valid url
{
if (stripos($word, "google") === false && stripos($word, "youtu") === false) // Google & YouTube sometimes redirect so we don't want it looking for them
{
$headers = get_headers($word, true);
$url = "";
while (array_key_exists('Location', $headers)) // While loop in case they're using shortened links within shortened links. Should work for inf layers of them.
{
if (filter_var($headers['Location'], FILTER_VALIDATE_URL) !== false) // If redirect is valid
{
$url = htmlspecialchars($headers['Location']);
$words[$key] = "[Link Shorten Attempt]: {$url}";
}
else if (is_array($headers['Location'])) // If redirect is an array of multiple locations just grab the first
{
$url = htmlspecialchars($headers['Location'][0]);
$words[$key] = "[Link Shorten Attempt]: {$url}";
}
else
{
$words[$key] = "FAULTY SHORTENED LINK REMOVED";
continue;
}
$headers = get_headers($url, true);
}
}
}
}
$message = implode(" ", $words);
?>

The following 3 users say thank you to Kryptus for this useful post:

Father Luckeyy, Specter, SQUID-EYE
02-02-2017, 11:43 PM #2
Passion
League Champion
bypassed this already #urafuckingNOOB
02-07-2017, 11:22 PM #3
Kryptus
Former Staff Manager
Originally posted by Passion View Post
bypassed this already #urafuckingNOOB
But your average skid not familiar with the chat just looking to spread malicious shit wouldn't know any better. They'd think shit like goo.gl would work no problem.

The following user thanked Kryptus for this useful post:

aaron25th
02-07-2017, 11:59 PM #4
Passion
League Champion
Originally posted by Kryptus View Post
But your average skid not familiar with the chat just looking to spread malicious shit wouldn't know any better. They'd think shit like goo.gl would work no problem.


ill teach them for BTC $

unban Felipe first though!

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo