├── LICENSE ├── README.md ├── content_script.js ├── icon └── 128x128.png └── manifest.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Enguerran Gillier 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # postMessage-logger 2 | Simple "postMessage logger" Chrome extension 3 | 4 | Simple logger for Messages received by a webpage (https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) 5 | Open the console (F12) to view the message logs 6 | 7 | Source code of the extension available at https://github.com/opnsec/postMessage-logger -------------------------------------------------------------------------------- /content_script.js: -------------------------------------------------------------------------------- 1 | function logMessage(event) { 2 | try { 3 | console.log("Message received by: " + document.location.href, "\norigin: " + event.origin + " source: ", event.source, "\ndata:", event.data) 4 | } catch (error) { 5 | // If the source window is cross-origin, you can't log it here 6 | console.log("Message received by: " + document.location.href, "\norigin: " + event.origin + " source is cross-origin", "\ndata:", event.data) 7 | } 8 | } 9 | addEventListener("message", logMessage) -------------------------------------------------------------------------------- /icon/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opnsec/postMessage-logger/09ee3bcc0bdba1efc6f0ab03d6ff75b7482c0259/icon/128x128.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postMessage logger", 3 | "description": "Simple postMessage logger", 4 | "version": "1.0", 5 | "content_scripts": [ 6 | { 7 | "matches": [ 8 | "" 9 | ], 10 | "run_at": "document_start", 11 | "all_frames": true, 12 | "js": [ 13 | "content_script.js" 14 | ] 15 | } 16 | ], 17 | "icons": { 18 | "128": "icon/128x128.png" 19 | }, 20 | "manifest_version": 2 21 | } --------------------------------------------------------------------------------