Snoop is like grep or ack, but for the browser.
You can search any query across various parts of a web page, including the DOM, cookies, localStorage, sessionStorage, and more.
- Copy snoop.js into the browser console
snoop
is now available in the global scope- snoop('query') will search for the query
- Search across multiple areas of a web page:
- DOM elements and their attributes
- Script contents
- Meta tags
- Body text
- Image attributes (src, alt, title)
- Cookies
- localStorage and sessionStorage
- Window properties
- Comments
- Styles (both inline and in stylesheets)
- URLs (current page and links)
- Case-sensitive or case-insensitive search
- Configurable search depth for object traversal
- Easy to use directly in the browser console
- Clone this repository or download the source code.
- Build the project using TypeScript:
bun run build
This will generate a snoop.js
file in the dist
directory.
- Copy the contents of
dist/snoop.js
into your browser's console. - The
snoop
function is now available in the global scope. - Use it to search for any query:
snoop('your-search-query');
Searches the page for the given query.
query
: The string to search for.options
: An optional object to customize the search behavior.
An object with the following properties (all boolean):
scripts
: Search in script tagsmeta
: Search in meta tagsbody
: Search in body contentimages
: Search in image attributescookies
: Search in cookieslocalStorage
: Search in localStoragesessionStorage
: Search in sessionStoragewindowProperties
: Search in window propertiesattributes
: Search in element attributescomments
: Search in commentsstyles
: Search in stylesurls
: Search in URLscaseSensitive
: Perform a case-sensitive searchmaxDepth
: Maximum depth for object traversal
- Node.js
- Bun (for running tests)
- Clone the repository:
git clone https://github.com/your-username/snoop.git
cd snoop
- Install dependencies:
bun install
Tests are written using Bun's test runner. To run the tests:
bun test
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.