Skip to content

Commit

Permalink
Merge pull request #5 from GovTechSG/update-readme-file-perm
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
YangKaiting authored Aug 31, 2020
2 parents dd98144 + 5098bde commit 31f42dd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 30 deletions.
74 changes: 46 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,68 @@ purple-hats is a customisable, automated accessibility testing tool that allows
## Installations
purple-hats includes installer scripts which automates the installation of the required components used by purple-hats. Currently, it is supported on macOS and Linux (Red Hat, Centos, Ubuntu, OpenSuse/Suse).

> **NOTE: Please run the scripts with admin privileges.**
<details>
<summary>Instructions for changing file permissions</summary>

#### Commands to modify file permissions
In the event you cannot access the files due to running the installer scripts with elevated privileges previously, you can modify the file permissions to the appropriate owner and group.

```shell
# Linux/Unix: The user id (uid) and group id (gid) by default should be the same
# MacOS: The uid and gid may differ, if the user group doesn't exist, set the group as staff

# You can check the current user's uid and gid with the following command
id

# Update permissions for files
# Can provide the name or numerical id
sudo chown <user:group> <filename>

# Update permissions for directories
sudo chown -R <user:group> <filename>
```
</details>


### MacOS
As MacOS does not have a builtin package manager. Node Version Manager (NVM) will be used to install NodeJS. Please run the installer script *mac-installer.sh*

```console
```shell
# Navigate into the directory, if not done so
cd purple-hats/installers

# Run the installer script for MacOS with admin privileges
sudo sh mac-installer.sh
````
bash mac-installer.sh
```

```console
```shell
# If you cannot run the script due to insufficient permission, assign execute permission to the file
chmod +x mac-installer.sh

# Run the script again
sudo sh mac-isntaller.sh
bash mac-isntaller.sh
```

### Linux
Depending on the Linux Distro, the builtin package manager (YUM, APT or Zypper) will be used for the respective Linux Distro to install NodeJS. Please run the installer script *linux-installer.sh*

```console
# Navigate into the directory, if not done so
cd purple-hats/installers

# Run the installer script for MacOS with admin privileges
sudo sh linux-installer.sh
````

```console
```shell
# If you cannot run the script due to insufficient permission, assign execute permission to the file
chmod +x linux-installer.sh

# Run the script again
sudo sh linux-installer.sh
bash linux-installer.sh
```


## Features (stand-alone)
## Features
purple-hats can perform the following functions to crawl the target URI. Results will be generated in JSON format before being compiled into a HTML file. To start using purple-hats, run the following command(s)

```console
```shell
# Navigate into the directory, if not done so
cd purple-hats

# Execute run.sh with admin privileges to start using purple-hats
sudo sh run.sh
bash run.sh
```

> NOTE: An online test-site by Web Scraper is used to demonstrate purple-hats' features.
Expand All @@ -71,21 +83,26 @@ sudo sh run.sh
The crawler will then generate the results based on the links found **within the provided URL**.

**Required inputs**
- A public URL where sitemap.xml file is hosted
- URL linking to the sitemap file
- Examples of valid sitemap format
- XML (Recommended): https://www.sitemaps.org/sitemap.xml
- RSS: https://itunes.apple.com/gb/rss/customerreviews/id=317212648/xml
- Text: https://www.xml-sitemaps.com/urllist.txt
- For more information on sitemap: https://www.sitemaps.org/protocol.html

**Sample Output**

```console
user@user-MacBook-Pro Desktop % cd purple-hats
user@user-MacBook-Pro purple-hats % sudo sh run.sh
user@user-MacBook-Pro purple-hats % bash run.sh
Welcome to HAT's Accessibility Testing Tool!
We recommend using Chrome browser for the best experience.

What would you like to scan today?
1) sitemap.xml file containing links
2) public domain URL
#? 1
Please enter file link: https://www.google.com/sitemap.xml
Please enter file link: https://webscraper.io/test-sites/e-commerce/allinone
Scanning website...

#The crawler will then start scraping from the file link provided above.
Expand All @@ -100,14 +117,14 @@ The crawler will recursively visit the links to generate the results from **all
Under this feature, it will also take into consideration of the presence of a login page.


#### 2. Crawling of PublicDomain
#### 2. Crawling of PublicDomain w/o Login Page
**Required inputs**
- A public domain URL
- A website URL

**Sample Output**
**Sample Output - Public Domain without Login Page**
```console
user@user-MacBook-Pro Desktop % cd purple-hats
user@user-MacBook-Pro purple-hats % sudo sh run.sh
user@user-MacBook-Pro purple-hats % bash run.sh
Welcome to HAT's Accessibility Testing Tool!
We recommend using Chrome browser for the best experience.

Expand All @@ -116,10 +133,11 @@ What would you like to scan today?
2) public domain URL
#? 2
Please enter domain URL: https://webscraper.io/test-sites/e-commerce/allinone
Do you need to login to your domain? Y/N: N
Scanning website...

#The crawler will then start scraping from the file link provided above.
#Console results

user@user-MacBook-Pro purple-hats %
```
```
2 changes: 1 addition & 1 deletion installers/linux-installer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

#Linux in general

Expand Down
2 changes: 1 addition & 1 deletion installers/mac-installer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin.sh
#!/bin/bash

# Removing previous installation of /.nvm directory, node_modules and python pkgs
if [ -d "node_modules" ]; then
Expand Down

0 comments on commit 31f42dd

Please sign in to comment.