Socket
Socket
Sign inDemoInstall

@contrast/crawler

Package Overview
Dependencies
402
Maintainers
9
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @contrast/crawler

The Contrast Crawler exercises web apps to support security analysis with a Contrast agent


Version published
Weekly downloads
4
decreased by-66.67%
Maintainers
9
Created
Weekly downloads
 

Readme

Source

Contrast Crawler Project

This project uses application route data retrieved from TeamServer to seed a web crawler implemented using Crawlee and Playwright .

To Run Contrast Crawler

Customize example.yaml with your TeamServer user credentials (not agent credentials), the TeamServer name of the application to test, and the base URL of the application to test.

Install the crawler globally:

$ npm i -g @contrast/crawler

The launch command:

$ npx @contrast/crawler /path/to/contrast.yaml

To Configure Custom Fake Input

In the faker.json file, each object corresponds to a method in the faker.js API

For, example

  {
    "module": "location",
    "name": "streetAddress"
  }

corresponds to: https://fakerjs.dev/api/location.html#streetaddress

This method will be called and used to generate a fake address when an input field named "address" is encountered by the crawler.

Some objects have a field called "predicates". These are used if your application has unique identifiers for input. For example, "surname" might be used to identify a field where a person's last name is expected. The faker.js method for generating last names is called lastName thus, a predicate is used to retrieve the correct method.

Predicates can be added or removed, according to the needs of your application. They can be stored as a string or an array of strings.

Some objects have a field called "input". These can be used if the faker method needs input to produce a specific kind of output. For example, if you need a zip code to be from New York that needs to be passed into the zipcode method as {state: 'New York'} which would have to be added as "input": "{state: 'New York'}" to the zipcode object in the JSON.

Some objects have a field called "fn". These are used for post-processing fake input. For example, the birthdate method outputs an instance of a Date object which could be invalid input for your application. Adding

    "fn": {
      "methods": [
        {
          "name": "toISOString"
        },
        {
          "name": "split",
          "input": "T"
        }
      ],
      "idx": 0
    }

to the birthdate object does the following: converts the Date object to an ISOString then splits the resulting string by "T" and returns the element at index 0 so that it preserves the year-month-day format wihtout including the timezone.

FAQs

Last updated on 19 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc