Skip to content

Web extension boilerplate files for web application testers.

Notifications You must be signed in to change notification settings

doyensec/webext_boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

webext_boilerplate

Web extension boilerplate files for web application testers.

This is a near minimum code base for creating your own web extension.

Temporarily Load

This code is unsigned, so you can't load it like a normal web extension. Unless you are using a development version of a browser, you have to install it temporarily. Restarting the browser will require you to re-load the plugin.

How it works

The src/manifest.json file registers a content script src/script.js. The content script will run in every frame, at page load. The content script gets it's own scope but shares the DOM with the web page. So it adds JavaScript to the DOM of the web page. The added JavaScript shares the scope of the web page and will execute first.

As a proof of concept, the script augments the functionality of document.write with a console.log of arguments.

	// example code to dump all arguments to document.write
	document.write = new Proxy(document.write, {
		apply: function(_func, _doc, args) {
			console.group(`[**] document.write.apply arguments`);
				for (const arg of args) {
					console.dir(arg);
				}
			console.groupEnd();
			return Reflect.apply(...arguments);
		}
	});

Replace that code with what ever you want and it will run first in all frames.

About

Web extension boilerplate files for web application testers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published