diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0eb2354 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +#* +*~ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..0063b67 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Tumblr Evil Detector + +## Description + +This is a simple TamperMonkey script that does one thing: warn you if +you're about to reblog a post with a script in it. Malicious users will +often hide javascript tags in the caption of a photograph which detects +when you're actually looking at the page (through mouse or keyboard +actions) and redirects you a site full of malware, spam, or porn. This +script is intended to help prevent that, and make your follower's +reading experience more pleasant. + +## Installation + +You will need Tampermonkey installed in your browser, then install the +Javascript file found in this directory into Tampermonkey. + +## Behavior + +The URL filter currently only identifies pages on Tumblr that are POST +pages. If the user has a custom DNS, sadly we can't detect them, but +few if any spammers go to those lengths to snare people. It will put a +message in the UPPER LEFT corner of the page with the words "SCRIPT +DETECTED" if a malicious javascript file is detected in the post +message. + +That's all it does. It's very short. But it's also very effective. + +## LICENSE: + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +## AUTHOR: + +Me, Elf M. Sternberg diff --git a/tumblr-evil-detector.js b/tumblr-evil-detector.js new file mode 100644 index 0000000..9caace9 --- /dev/null +++ b/tumblr-evil-detector.js @@ -0,0 +1,21 @@ +// ==UserScript== +// @name TumblrEvilDetector +// @namespace http://elfsternberg.com +// @version 0.1 +// @description Detect if a Tumblr post has an embedded script in it +// @author Elf M. Sternberg +// @match http://*.tumblr.com/post/* +// @grant none +// ==/UserScript== +/* jshint -W097 */ +'use strict'; + +function tumblr_reblog_warning() { + var post = document.querySelectorAll('.post-wrapper script'); + if (post.length > 0) { + document.body.innerHTML += ('
' + + 'SCRIPT DETECTED
'); + } +} + +window.setTimeout(tumblr_reblog_warning, 500);