Dive Into Greasemonkey Table of Contents Dive Into Greasemonkey

Total Page:16

File Type:pdf, Size:1020Kb

Dive Into Greasemonkey Table of Contents Dive Into Greasemonkey Dive Into Greasemonkey Table of Contents Dive Into Greasemonkey.................................................................................................................................................1 Chapter 1. Getting Started..............................................................................................................................................2 1.1. What is Greasemonkey?................................................................................................................................2 1.2. Installing Greasemonkey...............................................................................................................................3 1.3. Installing a user script....................................................................................................................................4 1.4. Managing your user scripts............................................................................................................................5 Chapter 2. Your First User Script..................................................................................................................................7 2.1. Hello World...................................................................................................................................................7 2.2. Describing your user script with metadata.....................................................................................................8 2.3. Coding your user script................................................................................................................................10 2.4. Editing your user script................................................................................................................................12 Chapter 3. Debugging User Scripts..............................................................................................................................13 3.1. Tracking crashes with JavaScript Console..................................................................................................13 3.2. Logging with GM_log.................................................................................................................................14 3.3. Inspecting elements with DOM Inspector...................................................................................................15 3.4. Evaluating expressions with Javascript Shell..............................................................................................17 3.5. Other debugging tools..................................................................................................................................19 Chapter 4. Common Patterns.......................................................................................................................................20 4.1. Executing a user script on a domain and all its subdomains........................................................................20 4.2. Testing whether a Greasemonkey function is available..............................................................................21 4.3. Testing whether a page includes an HTML element...................................................................................22 4.4. Doing something for every HTML element................................................................................................23 4.5. Doing something for every instance of a specific HTML element..............................................................24 4.6. Doing something for every element with a certain attribute........................................................................25 4.7. Inserting content before an element.............................................................................................................28 4.8. Inserting content after an element................................................................................................................29 4.9. Removing an element..................................................................................................................................30 4.10. Replacing an element with new content....................................................................................................31 4.11. Inserting complex HTML quickly.............................................................................................................32 4.12. Adding images without hitting a central server.........................................................................................33 4.13. Adding CSS styles.....................................................................................................................................34 4.14. Getting an element's style..........................................................................................................................35 4.15. Setting an element's style...........................................................................................................................36 4.16. Post−processing a page after it renders......................................................................................................37 4.17. Matching case−insensitive attribute values...............................................................................................38 4.18. Getting the current domain name...............................................................................................................39 4.19. Rewriting links...........................................................................................................................................40 4.20. Redirecting pages.......................................................................................................................................41 4.21. Intercepting user clicks..............................................................................................................................42 4.22. Overriding a built−in Javascript method....................................................................................................43 4.23. Parsing XML..............................................................................................................................................44 Chapter 5. Case Studies.................................................................................................................................................46 5.1. Case study: GMail Secure............................................................................................................................46 5.2. Case study: Bloglines Autoload...................................................................................................................47 5.3. Case study: Ain't It Readable.......................................................................................................................48 Dive Into Greasemonkey i Table of Contents Chapter 5. Case Studies 5.4. Case study: Offsite Blank............................................................................................................................50 5.5. Case study: Dumb Quotes............................................................................................................................52 5.6. Case study: Frownies...................................................................................................................................55 5.7. Case study: Zoom Textarea.........................................................................................................................58 5.8. Case study: Access Bar................................................................................................................................64 Chapter 6. Advanced Topics.........................................................................................................................................70 6.1. Storing and retrieving persistent data..........................................................................................................70 6.2. Adding items to the menubar.......................................................................................................................71 6.3. Integrating data from other sites..................................................................................................................72 6.4. Compiling your user script into an extension..............................................................................................73 Greasemonkey API Reference......................................................................................................................................75 Name...................................................................................................................................................................75 Synopsis..............................................................................................................................................................75 Description..........................................................................................................................................................75 History.................................................................................................................................................................75 Name...................................................................................................................................................................75 Synopsis..............................................................................................................................................................75
Recommended publications
  • The Javascript Revolution
    Top teams present at Segfault Tank on 4/21: 1 Duel: 6 (2 extra shifted from self votes) 2 Ambassador: 4 3 QuickSource: 3 4 ChalkBoard: 3 5 Fortuna Beer: 3 Bottom teams present in class this Thursday 4/16: 1 Scribble: 2 2 ClearViz: 2 3 AllInOne: 1 4 TripSplitter: 0 Shockers: Scribble & Fortuna Congrats on sneaky strategizing to get yourself to the top :) The moment of fruit: the class has spoken Shockers: Scribble & Fortuna Congrats on sneaky strategizing to get yourself to the top :) The moment of fruit: the class has spoken Top teams present at Segfault Tank on 4/21: 1 Duel: 6 (2 extra shifted from self votes) 2 Ambassador: 4 3 QuickSource: 3 4 ChalkBoard: 3 5 Fortuna Beer: 3 Bottom teams present in class this Thursday 4/16: 1 Scribble: 2 2 ClearViz: 2 3 AllInOne: 1 4 TripSplitter: 0 Congrats on sneaky strategizing to get yourself to the top :) The moment of fruit: the class has spoken Top teams present at Segfault Tank on 4/21: 1 Duel: 6 (2 extra shifted from self votes) 2 Ambassador: 4 3 QuickSource: 3 4 ChalkBoard: 3 5 Fortuna Beer: 3 Bottom teams present in class this Thursday 4/16: 1 Scribble: 2 2 ClearViz: 2 3 AllInOne: 1 4 TripSplitter: 0 Shockers: Scribble & Fortuna The moment of fruit: the class has spoken Top teams present at Segfault Tank on 4/21: 1 Duel: 6 (2 extra shifted from self votes) 2 Ambassador: 4 3 QuickSource: 3 4 ChalkBoard: 3 5 Fortuna Beer: 3 Bottom teams present in class this Thursday 4/16: 1 Scribble: 2 2 ClearViz: 2 3 AllInOne: 1 4 TripSplitter: 0 Shockers: Scribble & Fortuna Congrats on sneaky strategizing
    [Show full text]
  • GAP4APE: a Client-Side System to Enhance Accessibility in the Web 2.0 Era
    GAP4APE: a client-side system to enhance accessibility in the Web 2.0 era Silvia Mirri Paola Salomoni Department of Computer Science Department of Computer Science University of Bologna University of Bologna Via Mura Anteo Zamboni 7 Via Mura Anteo Zamboni 7 40127 Bologna (BO), Italy 40127 Bologna (BO), Italy [email protected] [email protected] Giorgia Cucchiarini Corso di Laurea in Scienze dell’Informazione University of Bologna Via Sacchi, 3 47521 Cesena (FC), Italy [email protected] ABSTRACT (AbilityNet 2008) and are not compliant with any national regulation or W3C guidelines (W3C 2008). This accessibility Social networking systems have radically changed personal issue is quite common in most of Web 2.0 services, which communication by providing new and interesting are strongly based on smart interfaces implemented with a opportunities both in leisure and in business. Despite their wide use of AJAX scripts (Garrett 2005). Social networks, apparent universal appeal, these systems are effectively and more specifically Facebook, support users’ leaving out a part of users with disabilities, who have customization as the possibility of changing few layout difficulties in register, join and participate in the main on-line characteristics, such as color background or text size. These communities. Facebook represents a critical case: beside modifications are bound to the user profile page only and some accessibility improvement provided by this social they have to be manually specified by the user without any network service, its accessibility represents an issue yet. This support by some profiling tool. paper presents an augmented browsing system, which allows users with disabilities to specify their needs and preferences In this paper we present GAP4APE (GreaseMonkey And about Web pages presentation, directly by means of the Profiling for Accessible Pages Enhancement), a system to browser interface.
    [Show full text]
  • What Is Greasemonkey? MUGOO Browser Survey Creammonkey For
    3 GreaseMonkey Article Intro What is GreaseMonkey? GreaseMonkey is a Firefox browser addon that allows you to write or use Javascripts that alter the web pages you visit. You can use it to make a web site more readable or more usable. You can fix web site display bugs that the site owner can't be bothered to fix themselves. You can even automatically retrieve data from other sites to make two sites more interconnected. In short it will let you have some control of the sites you visit. Greasemonkey by itself does none of these things. In fact, after you install it, you won't notice any change at all... until you start installing what are called 'user scripts'. A user script is just a chunk of Javascript code, with some additional information that tells Greasemonkey where and when it should be run. Each user script can target a specific page, a specific site, or a group of sites. A user script can do anything you can do in Javascript. In fact, it can do even more than that, because Greasemonkey provides special functions that are only available to user scripts. MUGOO Browser Survey Most club members use Safari but a significant number also use Firefox mostly on the Mac and some also on Windows. GreaseMonkey works with the FireFox browser but there is also a Safari program called CreamMonkey that has similar capabilities. Javascripts written for GreaseMonkey are not 100% compatible with CreamMonkey because Safari's JavaScript implementation is not completely compatible with Firefox's and GM_registerMenuCommand is not available in CreamMonkey.
    [Show full text]
  • OSINT Handbook September 2020
    OPEN SOURCE INTELLIGENCE TOOLS AND RESOURCES HANDBOOK 2020 OPEN SOURCE INTELLIGENCE TOOLS AND RESOURCES HANDBOOK 2020 Aleksandra Bielska Noa Rebecca Kurz, Yves Baumgartner, Vytenis Benetis 2 Foreword I am delighted to share with you the 2020 edition of the OSINT Tools and Resources Handbook. Once again, the Handbook has been revised and updated to reflect the evolution of this discipline, and the many strategic, operational and technical challenges OSINT practitioners have to grapple with. Given the speed of change on the web, some might question the wisdom of pulling together such a resource. What’s wrong with the Top 10 tools, or the Top 100? There are only so many resources one can bookmark after all. Such arguments are not without merit. My fear, however, is that they are also shortsighted. I offer four reasons why. To begin, a shortlist betrays the widening spectrum of OSINT practice. Whereas OSINT was once the preserve of analysts working in national security, it now embraces a growing class of professionals in fields as diverse as journalism, cybersecurity, investment research, crisis management and human rights. A limited toolkit can never satisfy all of these constituencies. Second, a good OSINT practitioner is someone who is comfortable working with different tools, sources and collection strategies. The temptation toward narrow specialisation in OSINT is one that has to be resisted. Why? Because no research task is ever as tidy as the customer’s requirements are likely to suggest. Third, is the inevitable realisation that good tool awareness is equivalent to good source awareness. Indeed, the right tool can determine whether you harvest the right information.
    [Show full text]
  • Edit Master Text Styles Automated Detection of Firefox Extension
    Automated Detection of Firefox Extension- • Click to edit Master textReuse styles Vulnerabilities — Second level • Third level — Fourth level » Fifth level Ahmet S BUYUKKAYHAN William ROBERTSON Who are we? •• Assistant Click to professor edit Master of computer text science styles at Northeastern University— Second in Boston, level MA • Co-directs• Third the level NEU Systems Security Lab with Engin Kirda • Systems,— network, Fourth level and software security researcher • Past winner »of FifthDEFCON level CTF with Shellphish – (a long, long time ago…) 2 Who are we? •• PhD Click Candidate to edit at MasterNortheastern text University styles –— Authored Second peer-reviewed level conference and journal papers in top-tier security• Third venues level • Member —of Fourththe NEU level Systems Security Lab » Fifth level 3 Singapore • Click to edit Master text styles — Second level • Third level — Fourth level » Fifth level 4 Boston • Click to edit Master text styles — Second level • Third level — Fourth level » Fifth level 5 Agenda • Click to edit Master text styles • Background— Second level • Extension-Reuse• Third level Attacks — Fourth level • CrossFire» & Fifth Demo level • Evaluation • Conclusion 6 • Click to edit Master text styles — Second level • Third level — Fourth level » Fifth level Background Browser Extensions • Click to edit Master text styles • Add new capabilities, — Second level customization to browsers • Third level • ~15K extensions in Mozilla — Fourth level Add-ons repository » Fifth level • Popular ones have millions
    [Show full text]
  • Google Hit Hider by Domain (Search Filter / Block Sites) for Greasemonkey
    Google Hit Hider by Domain (Search Filter / Block Sites) for Greasemonkey http://userscripts.org/scripts/show/95205 Script currently available on these alternate download URLs (26 May 2014): http://userscripts.org:8080/scripts/show/95205 https://openuserjs.org/scripts/jscher2000/JeffersonScher/ Google_Hit_Hider_by_Domain_(Search_Filter_Block_Sites) https://greasyfork.org/scripts/1682-google-hit-hider-by-domain-search-filter-block-sites Google Hit Hider by Domain (Search Filter / Block Sites) By Jefferson Scher — Last update Feb 17, 2014 — Installed 265,556 times. Script Summary: Block unwanted sites from your searches (Google, Startpage.com, DuckDuckGo). v1.6.0 2014-02-17 For Firefox+Greasemonkey or Chrome+Tampermonkey. Version: 1.6.0 Copyright: Copyright 2014 Jefferson Scher License: BSD with restriction Easily Hide Unwanted Domains in Google Results Want to filter out some useless, spammy or offensive sites from Google search results? Just click "block" to reduce a site's hits to a one-line notation, or hide it completely. No typing required. Version 1.6.0 adds a user interface to edit custom style rules (button at the bottom of the Options tab) and fixes some bugs on DuckDuckGo. The open source license now is BSD with a restriction. Firefox with Greasemonkey: Requires Firefox 3.5 or newer. Tested on Firefox 27, on Windows 7. Limited testing with GoogleMonkeyR and AutoPager. Google Chrome with Tampermonkey: Lightly tested on Chrome 32, on Windows 7. Please report problems in the "Discussions" tab for this script. Disclaimer: Google search is a very complex application, so there is no guarantee that this script will work for you. The author is not responsible for you missing a result you might have liked to see, or other malfunction of the script.
    [Show full text]
  • ENHANCEMENT of WEB BROWSER PROGRAMMING with GUEST Visual Programinng Tool for Non-Programmers
    ENHANCEMENT OF WEB BROWSER PROGRAMMING WITH GUEST Visual Programinng Tool for Non-programmers Yuka Obu, Kazuhiro Maruo, Tatsuhiro Yonekura Graduate School of Science and Engeneering, Ibaraki University, Ibaraki, Japan Masaru Kamada, Shusuke Okamoto Graduate School of Science and Engeneering, Ibaraki University, Ibaraki, Japan Department of Computer and Information Sceince, Seikei University, Tokyo, Japan Keywords: Visual programming, state-transition diagram, Web programming for non-programmers, GUEST (Graphical User interface Editor by State-transition Diagram), New user interface design concept. Abstract: Many people have recently become interested in Web 2.0, which is a new Web service concept. Web sites have become sources of information and functionality that enables users to create new content of their own. Using this capability, users have been customizing Web pages as they like. Users are now looking for more versatile browsers that will enable them to edit and display content based on their own creative concepts and preferences. Motivated by this demand, we have been working on a project to develop a state-transition diagram-based Web browser programming scheme that supports participatory Web use and enables the end- user to interact with Web content. We implemented a prototype of our scheme called GUEST. Using GUEST, users can define behaviors of a Web browser easily even if they have no programming experience. However, there are parts of the scheme that are not easy for beginners to use. That is, there are complicated user interfaces that prevent the user from easily gaining an intuitive understanding of how to use GUEST. Therefore, in this paper, we focus on users’ difficulties in using the interface, and introduce a new concept of the design.
    [Show full text]
  • Why We Customize EUP Chapter
    Why we customize the Web The MIT Faculty has made this article openly available. Please share how this access benefits you. Your story matters. Citation B. Chilton, Lydia, et al. "Why We Customize the Web." No Code Required: Giving Users Tools to Transform the Web. Burlington: Morgan Kaufmann, 2010. pp. 23–35. As Published 10.1016/b978-0-12-381541-5.00002-x Publisher Elsevier Version Original manuscript Citable link https://hdl.handle.net/1721.1/121550 Terms of Use Creative Commons Attribution-NonCommercial-NoDerivs License Detailed Terms http://creativecommons.org/licenses/by-nc-nd/4.0/ Why We Customize the Web Lydia B. Chilton, Robert C. Miller, Greg Little, Chen-Hsiang Yu MIT CSAIL Traditionally, customization has been associated with desktop applications. Many desktop applications have customizable menus and tool bars, with options that the user can pick from to customize their environment. End user programming is a more powerful kind of customization tool, which exists in some desktop applications in the form of macros and scripting languages, and on the web in various incarnations. On the web, customizable menus are rare; end user programming seems to be the main form of customization. In order to make generic software more efficient and usable, end users should be able to customize it to fit their work habits and preferences. Unfortunately, that has been a limited reality for desktop applications. In desktop applications, it's hard to know what can be changed, how to select only specific parts of an interface to keep, and how to incorporate data and functionality from other applications.
    [Show full text]
  • Analyzing Information Flow in Javascript-Based Browser Extensions Mohan Dhawan and Vinod Ganapathy Department of Computer Science, Rutgers University
    Published in ACSAC’09: Proceedings of the 25th Annual Computer Security Applications Conference, Honolulu, Hawaii, December 2009 Analyzing Information Flow in JavaScript-based Browser Extensions Mohan Dhawan and Vinod Ganapathy Department of Computer Science, Rutgers University Abstract net Explorer and Google Chrome also support extensions (e.g., scriptable plugins and ActiveX controls) that contain JavaScript-based browser extensions (JSEs) enhance the or interact with JavaScript code. core functionality of web browsers by improving their look However, recent attacks show that JSEs pose a threat to and feel, and are widely available for commodity browsers. browser security. Two factors contribute to this threat: To enable a rich set of functionalities, browsers typically (1) Inadequate sandboxing of JavaScript in a JSE. Un- execute JSEs with elevated privileges. For example, un- like JavaScript code in a web application, which executes like JavaScript code in a web application, code in a JSE is with restricted privileges [9], JavaScript code in a JSE exe- not constrained by the same-origin policy. Malicious JSEs cutes with the privileges of the browser. JSEs are not con- can misuse these privileges to compromise confidentiality strained by the same-origin policy [38], and can freely ac- and integrity, e.g., by stealing sensitive information, such as cess sensitive entities, such as the cookie store and brows- cookies and saved passwords, or executing arbitrary code ing history. For instance, JavaScript in a JSE is allowed on the host system. Even if a JSE is not overtly malicious, to send an XMLHttpRequest to any web domain. Even vulnerabilities in the JSE and the browser may allow a re- though JavaScript only provides restricted language-level mote attacker to compromise browser security.
    [Show full text]
  • Firefox and Malware: When Browsers Attack
    Security Response Firefox and Malware: When Browsers Attack Candid Wüest & Elia Florio Abstract Contents Mozilla Firefox is a very popular browser and its open-de- Abstract .............................................................. 1 sign framework makes it easy to extend the functional- Introduction ....................................................... 1 ity by either changing the core code directly or creating ex- Possible issues ................................................... 4 tension plug-ins that work on multiple operating systems. Potential damage ............................................... 6 Mitigation strategies.......................................... 6 As with browser helper objects for Microsoft Internet Explorer, Fire- Firefox risks examples ....................................... 7 fox extensions can also be misused to carry out malicious actions on Conclusion........................................................ 11 the user’s computer without the user’s consent. Any installed exten- Acknowledgement ........................................... 12 sion has the same full rights as the browser itself and therefore can Appendix .......................................................... 13 do a lot more than just display fancy Web pages. This includes access- References ....................................................... 14 ing the file system in read and write mode, opening new network sock- ets and even creating new processes. This leads to a variety of secu- rity problems that can introduce or hide malicious
    [Show full text]
  • Arxiv:1510.08943V2 [Cs.CR] 16 May 2016 This State of Affairs Motivates the Need for Content-Based Encryption of User Data
    MessageGuard: A Browser-based Platform for Usable, Content-Based Encryption Research Scott Ruoti∗†, Jeff Andersen∗, Tyler Monson∗, Daniel Zappala∗, Kent Seamons∗ Brigham Young University∗, Sandia National Laboratoriesy fruoti, andersen, [email protected], fzappala, [email protected] Abstract—This paper describes MessageGuard, a subjected to formal usability evaluation. This is browser-based platform for research into usable problematic as experience has shown that many proposals content-based encryption. MessageGuard is designed to with strong theoretical foundations are either unfeasible in enable collaboration between security and usability real-world situations [8] or have problems that are only researchers on long-standing research questions in this area. apparent when studied empirically [9], [10], [11]. As a It significantly simplifies the effort required to work in this result, there are many open HCI and security questions space and provides a place for research results to be shared, regarding content-based encryption [12]. replicated, and compared with minimal confounding factors. MessageGuard provides ubiquitous encryption and secure 1.1. MessageGuard cryptographic operations, enabling research on any existing web application, with realistic usability studies on a secure To address these concerns, we have developed platform. We validate MessageGuard’s compatibility and MessageGuard, a platform for usable security research performance, and we illustrate its utility with case studies for focused on content-based encryption.
    [Show full text]
  • The Online Sale of Antibiotics for Veterinary Use
    animals Article The Online Sale of Antibiotics for Veterinary Use Juan F. Garcia 1 , M. Jose Diez 2 , Ana M. Sahagun 2,* , Raquel Diez 2 , Matilde Sierra 2, Juan J. Garcia 2 and M. Nelida Fernandez 2 1 Department of Mechanical, Informatics and Aerospatiale Engineering, University of Leon, 24071 Leon, Spain; [email protected] 2 Department of Biomedical Sciences, Institute of Biomedicine (IBIOMED), Veterinary Faculty, University of Leon, 24071 Leon, Spain; [email protected] (M.J.D.); [email protected] (R.D.); [email protected] (M.S.); [email protected] (J.J.G.); [email protected] (M.N.F.) * Correspondence: [email protected] Received: 3 February 2020; Accepted: 15 March 2020; Published: 17 March 2020 Simple Summary: Access to antibiotics online endangers its responsible use, increasing the risk of bacterial resistance emergence. The objective of this study was to assess the possibility of purchasing antibiotics for veterinary use on the internet, evaluating the availability of those classified as highest priority critically important antimicrobials (HP-CIA), and if a prescription is required. The Google and Bing search engines and both simple and complex search strings in Spanish and in English were used. The simple search string was “buy veterinary antibiotics”. Complex searches used wildcards and specific syntax. The searches carried out in Spanish revealed that 50% of websites operated in South America and 65% of websites did not require a valid prescription. For the searches in English, 57% of websites operated in the United States of America (USA) and 55% of them did not require a prescription. Our study shows that veterinary antibiotics are easily available for purchase online without a prescription.
    [Show full text]