Giter VIP home page Giter VIP logo

Passmarked

NPM Build Status

CLI/Module/Framework for the Passmarked API that can be used for easy integrations and general horse play. Intended to be usable as a simple tool for your development workflow but also usable on services like Jenkins with a API to integrate into your own code. Providing a framework the package also allows any system to run any of the open source Passmarked rules directly from your system.

Install

NPM

npm install -g passmarked

View the project at npmjs.com/package/passmarked.

From Source

To build from source:

git clone [email protected]:passmarked/passmarked.git passmarked/
cd passmarked/
npm install

Terminal Usage

# get general help and usage information
passmarked --help

# test a host
passmarked http://example.com

# test many hosts with json output (default delimiter is \n)
passmarked --format=json --output=outfile.json < mysites.txt

# comma-delimited string of addresses
passmarked google.com,example.com

# perform a recursive crawl on given hosts
passmarked -r google.com,example.com

Module

The module can also be used as a regular module that allows programs to integrate with the Passmarked system.

API

Quick start

Install

npm install --save passmarked

Test a single page

Run a single page and return all issues and information gathered from the page. See the wiki for details on the API and events for information on realtime events.

passmarked.create({
  url:     'http://example.com',
  token:   '<token>'
}).on('done', function(result) {
  // or use:
  // var result = this.getResult();
  console.log('done with a score of', result.getScore())
  console.dir(result.toJSON())
}).on('update', function(result) {
  // or use:
  // var result = this.getResult()
  console.log(result.countPendingTests() + '/' + result.countTests())
}).start(function(err) {
  if (err) {
    console.log('Something went wrong starting the report')
    console.error(err)
  } else {
    console.log('Report started')
  }
})

Run a recursive report over a entire domain

Example running a site wide report, requested websites must be registered on passmarked.com. See the wiki for details on the API and events for information on realtime events.

passmarked.create({
  url:         'http://example.com',
  token:       '<token>',
  recursive:   true,
  limit:       50,
  bail:        true,
  patterns:    []
}).on('done', function(result) {
  // or use:
  // var result = this.getResult()
  console.log(
    'done with a score of',
    result.getScore(),
    'after going through',
    result.countPages(),
    'pages'
  )
  console.dir(result.toJSON())
}).on('error', function(err) {
  console.log('Problem starting report', err)
}).on('page', function(page) {
  console.log(
    'Processed page',
    page.getURL(),
    'score',
    page.getScore()
  )
}).on('update', function(result) {
  // or use:
  // var result = this.getResult()
  console.log('pages', (
    result.countProcessedPages() + '/' + result.countPages())
  )
}).start(function(err, crawl) {
  if (err) {
    console.log('problem starting the recursive report', err)
  } else {
    console.log('crawl started')
  }
})

Download historical report for a page

The following shows how to download a single historical report from our archive.

passmarked.getReport('2016049a03452018', function(err, report) {
  console.error(err)
  console.dir(report.getURL())
  console.dir(report.toJSON())
})

Registered websites

Returns the list of websites that the given token has access to.

passmarked.getWebsites('<token>', function(err, websites) {
  console.error(err)
  for (var i = 0; i < websites.length; i++) {
    console.log('->', websites[i].getDomain())
  }
})

Run selected tests locally

Passmarked is built to be a framework that can be used by anyone, all our rules that passmarked.com checks are open and available for use.

List of provided tests that anyone can run:

Written your own? Open a PR on the Passmarked repo with your new worker added to the list.

The Passmarked module also provides a way to easily download and run the tests in your own apps, and even write your own:

Using promises:

passmarked.createRunner(
  require('@passmarked/network'),
  require('@passmarked/inspect')
).run({
  url: 'http://example.com'
}).then(function(rules) {
  for (var i = 0; i < rules.length; i++) {
    console.log('*', rules[i].getMessage())
  }
}).catch(function(err) {
  console.error(err)
})

Using callbacks:

passmarked.createRunner(
  require('@passmarked/network'),
  require('@passmarked/inspect')
).run({
  url: 'http://example.com'
}, function(err, rules) {
  for(var i = 0; i < rules.length; i++) {
    console.log('*', rules[i].getMessage())
  }
});

Contributing

  1. Fork the project
  2. Write a test that reproduces the bug
  3. Fix the bug without breaking any of the existing tests
  4. Submit a pull request

We're busy building the tests and refactoring code as we go. If you spot any area that could use help feel free to open a PR.

License

Copyright 2018 Passmarked Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Passmarked's Projects

browser icon browser

Remote management client for browsers supporting the Chrome DevTools Protocol, built to be easy to use and inspired by standard HTTP libraries for Node.

chrome icon chrome

Chrome extension allows users to view the Passmarked scores of websites as they are browsing with a one click button to test a page

crawlable icon crawlable

Fake server that produces the specified amount of pages in directories to test web crawlers

css icon css

Rules related to checking the compatibility of the CSS on the page ensuring the stylesheet works on older browsers too

dns icon dns

A set of rules to check whether your DNS is properly set up and secure

docs icon docs

Next iteration of the Passmarked content repository that aims to pull together all the resources from our library in a more digestible format and allow the community at large control of the public passmarked.com website

firefox icon firefox

Firefox extension allows users to view the Passmarked scores of websites as they are browsing with a one click button to test a page

html icon html

Rules related to checking the HTML compatibility of the page

http icon http

Rules related to checking the http headers/protocol details of the request and response from server

inspect icon inspect

Rules that check if any bandwidth can be saved on any page content

javascript icon javascript

Rules related to checking if the Javascript produced by the page does not throw any errors or show messages in the log

js icon js

Javascript client for Passmarked API that can be used from the browser

lighthouse icon lighthouse

Uses Lighthouse integrations to show and return PWA recommendations

links icon links

Rules related to the links/assets on the page

malware icon malware

Rules that check if the page or linked pages on the same domain (or external) contain any unwanted software,malware or reported phishing attacks

mobile icon mobile

Rules related to checking if the the page is optimised and compatible for mobile devices

network icon network

Rules that check if a page and it's requests are configured optimally for the smallest possible size and speedy performance over the network

passmarked icon passmarked

CLI based tool for the Passmarked API that can be used for easy integrations and general horse play

phishtank icon phishtank

Small utility that loads any downloaded JSON databases from www.phishtank.com into Redis cache for quick local queries

php icon php

PHP wrapper for the API

python icon python

Python library wrapper for the Passmarked API

seo icon seo

Rules related to checking for any SEO issues on the page given

slack icon slack

A bot for Slack integration

social icon social

Rules related to checking the social tags and conformance to standards that control how the page appears on social media websites

spellcheck icon spellcheck

Rules related to finding spelling mistakes on a page

ssl icon ssl

Rules that relate to checking the SSL configuration of each individual resolved server from the domain to ensure locked down config with the broadest compatibility

suite icon suite

Enhanced suite of audit rules for Lighthouse that can be used to support the Passmarked rule list like security/spellchecking and morer.

tcs icon tcs

Rules related to terms/privacy and data (GDPR) policies on the site.

vnu icon vnu

Service running a static build of w3c that we keep updated and tested against our code base

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.