One of the most popular web application security scanner "Acunetix" official website has been got hacked and defaced by hacker. On 4th…
Its not wrong if we call this week as a "Data Breached' week. Security is the very important factors for any organizations, but then also…
Facebook owned, leading messaging service Whatsapp have finally rolled out what its users expecting. After the End-to-End encryption on its servic…
T he Graduate Aptitude Test in Engineering (GATE) is an All-India Examination conducted by the five IITs and IISC, Bangalore, on behalf of the …
Before you settle down to developing your website you need to have a well thought out plan ahead of you. This will ensure the success of the websi…
Now everyone one turning to Open Source, as earlier Microsoft have announced that it is bringing Linux to Windows 10 by adding Bash Shell for port…
Its been seen that iOS device is much effective as compared to Android regarding security issue. But now iOS device is also in danger. Security …
World's most nitrous hackers group Team GhostShell - which are behind some major cyber attacks including attacks on the FBI, NASA and the Pen…
We all know that Google had surprised everyone with announcement of the latest version of its mobile operating system, Android N Developer Previ…
US Defense team know as Defense Digital Service (DDS), which was established last year to bring US technology experts into the military, initiate …
const config = {
safeID = 'safelink',
safeURL: ['/p/safelink.html'],
timer: 15,
redirect: true,
text: {
wait: 'The link will appear in 0 second',
direct: 'You’ll be redirected to the download link in 0 second',
shifted: 'Redirecting... [link] if you’re not redirected automatically.',
click: 'Click here',
btn: 'Direct to link.'
}
};
(() => {
const randomURL = url => url[Math.floor(Math.random() * url.length)];
const safeLink = () => config.safeURL.some(path => location.pathname.endsWith(path));
const safeMessage = (text, time) => {
const [start, end] = text.split('0');
return `${start} ${time} ${end}.
`;
};
const outboundLinks = () => {
const links = document.querySelectorAll('a.safeurl[href]');
if (!links.length) return;
links.forEach(anchor => {
const encoded = encodeURIComponent(btoa(anchor.href));
Object.assign(anchor, {
href: `${location.origin}${randomURL(config.safeURL)}?go=${encoded}`,
target: '_self',
rel: 'noopener'
})
})
};
const handleLink = () => {
const params = new URLSearchParams(location.search);
const encoded = params.get('go');
if (!encoded) return;
const link = atob(decodeURIComponent(encoded))
params.delete('go');
history.replaceState({}, '', location.pathname + (params.toString() ? '?' + params : ''));
let counter = config.timer;
const label = config.redirect ? config.text.direct : config.text.wait;
const box = document.getElementById(config.safeID);
if (!box) return;
box.removeAttribute('hidden');
box.innerHTML = safeMessage(label, counter);
const countdown = setInterval(() => {
counter--;
box.innerHTML = safeMessage(label, counter);
if (counter > 0) return;
clearInterval(countdown);
if (config.redirect) {
box.innerHTML = `${config.text.shifted.replace('[link]', `${config.text.click}`)}
`;
location.href = link;
} else {
box.innerHTML = '';
const btn = document.createElement('a');
//btn.className = 'btn';
btn.href = link;
btn.target = '_blank';
btn.rel = 'nofollow noopener noreferrer';
btn.innerHTML = `${config.text.btn}`;
box.appendChild(btn);
}
}, 1000)
};
safeLink() ? handleLink() : outboundLinks();
})();