• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pillage filesystems for sensitive information with Go ๐Ÿ”

Pillager

Go Reference Latest Release Go Report Card Tests

Pillage filesystems for sensitive information with Go.

Table of Contents

  1. Summary
  2. Installation
  3. Usage
  4. Documentation

Summary

Pillager is designed to provide a simple means of leveraging Go's strong concurrency model to recursively search directories for sensitive information in files. Pillager does this by standing on the shoulders of a few giants. Once pillager finds files that match the specified pattern, the file is scanned using a series of concurrent workers that each take a line of the file from the job queue and hunt for sensitive pattern matches. The available pattern filters can be defined in a rules.toml file or you can use the default ruleset.

Installation

Go

If you have Go setup on your system, you can install Pillager with go get

go get github.com/brittonhayes/pillager

Scoop (Windows)

scoop bucket add pillager https://github.com/brittonhayes/pillager-scoop.git
scoop install pillager

Homebrew (OSX/Linux)

brew tap brittonhayes/homebrew-pillager
brew install pillager

Docker Image

docker run --rm -it ghcr.io/brittonhayes/pillager:latest hunt .

If you're looking for a binary, check the latest releases for the executable that matches your system

Usage

To see all the commands available with pillager

# To see instructions for the entire application
pillager

# From any subcommand
pillager [cmd] --help

User Interface

Pillager provides a terminal user interface built with bubbletea if you'd like to scan for secrets interactively.

asciicast

Configuration

Gitleaks Rules

Pillager provides full support for Gitleaks1 rules. This can either be passed in with a rules.toml2 file, or you can use the default ruleset by leaving the rules flag blank.

# rules.toml
title = "pillager rules"

[[rules]]
id = "gitlab-pat"
description = "GitLab Personal Access Token"
regex = '''glpat-[0-9a-zA-Z\-\_]{20}'''

[[rules]]
id = "aws-access-token"
description = "AWS"
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''

# Cryptographic keys
[[rules]]
id = "PKCS8-PK"
description = "PKCS8 private key"
regex = '''-----BEGIN PRIVATE KEY-----'''

Built-in Output Formats

Pillager has a series of built-in output formats available. Pick your flavor!

Basic

pillager hunt .

JSON

pillager hunt ./example -f json | jq

JSON output is designed to work seamlessly with the amazing jq utility for easy parsing.

Click to view more output formats

YAML

pillager hunt . -f yaml

TOML

pillager hunt . -f toml

HTML

pillager hunt . -f html > results.html

HTML Table

pillager hunt . -f html-table > results.html

Markdown

pillager hunt . -f markdown > results.md

Markdown Table

pillager hunt . -f table > results.md

Custom Go Template

pillager hunt . --template "{{ range .}}Secret: {{.Secret}}{{end}}"

Custom Go Template from File

pillager hunt . -t "$(cat pkg/templates/simple.tmpl)"

Custom Templates

Pillager allows you to use powerful go text/template to customize the output format. Here are a few template examples.

Basic

{{ range . -}}
    File: {{ .File }}
    Secret: {{ .Secret}}
    Description: {{ quote .Description }}
{{ end -}}

Markdown Styling

# Results

{{ range . -}}
    ## {{ .File }}
    - Location: {{.StartLine}}
{{end}}

More template examples can be found in the templates directory.

Documentation

๐Ÿ“š View the docs

GoDoc documentation is available on pkg.go.dev for pillager but it is also available for all packages in the repository in markdown format. Just open the folder of any package, and you'll see the GoDocs rendered in beautiful Github-flavored markdown thanks to the awesome gomarkdoc tool.

Development

To get involved developing features and fixes for Pillager, get started with the following:


Shoulders of Giants โญ

spf13's Cobra

What is Cobra?

Cobra is a library providing a simple interface to create powerful modern CLI interfaces similar to git & go tools. Cobra is also an application that will generate your application scaffolding to rapidly develop a Cobra-based application.

If you've seen a CLI written in Go before, there's a pretty high chance it was built with Cobra. I can't recommend this library enough. It empowers developers to make consistent, dynamic, and self-documenting command line tools with ease. Some examples include kubectl, hugo, and Github's gh CLI.

Gitleaks

What is Gitleaks?

Gitleaks1 is a SAST tool for detecting hardcoded secrets like passwords, api keys, and tokens in git repos.

Gitleaks is an amazing tool for secret leak prevention. If you haven't implemented Gitleaks as a pre-commit checker, it's worth your time to check it out.

Why is Gitleaks relevant to Pillager?

Pillager implements the powerful rules functionality of Gitleaks while taking a different approach to presenting and handling the secrets found. While I have provided a baseline set of default rules, Pillager becomes much more powerful if you allow users to create rules for their own use-cases.

Check out the included rules2 for a baseline ruleset.


This goes without saying but I'm going to say it anyways: I am not responsible for any repercussions caused by your use of pillager. This tool is intended for defensive use, educational use, and security researcher use with the consent of all involved parties. Malicious behavior with pillager is in no way condoned, nor encouraged. Please use this tool responsibly and ensure you have permission to scan for secrets on any systems before doing so.

At it's core, Pillager is designed to assist you in determining if a system is affected by common sources of credential leakage as documented by the MITRE ATT&CK3 framework.

MITRE ATT&CK Technique - T1552,003 - Unsecured Credentials: Bash History

MITRE ATT&CK Technique - T1552,001 - Unsecured Credentials: Credentials In Files

Footnotes

  1. Gitleaks โ†ฉ โ†ฉ2

  2. Gitleaks Rules Reference โ†ฉ โ†ฉ2

  3. MITRE ATT&CK Website โ†ฉ

More Repositories

1

pod

Productivity application for audio professionals ๐ŸŒฑ
Vue
27
star
2

hikeshi

Hikeshi is a security incident response application that keeps documenting incidents simple, so you can focus on fighting fires.
Go
20
star
3

glitter

UI components + themes for lipgloss, glamour, and bubbletea
Go
13
star
4

dnd

Go Client for the D&D 5e REST API โš”๏ธ๐Ÿ”ฎ
Go
13
star
5

roll

A simple Go package and CLI for dice rolling ๐ŸŽฒ
Go
9
star
6

devops-lab

A Kubernetes DevOps homelab. Running on Intel Nuc + Raspberry Pi โ˜ธ๐Ÿ“ฆ
8
star
7

fbi

Go client for the FBI's Most Wanted REST API ๐Ÿš”
Go
7
star
8

validate-yaml

GitHub action for validating YAML against a schema
TypeScript
7
star
9

warhammer-aos

A REST API for Warhammer Age of Sigmar minis.
Go
6
star
10

notion-stix

Integrate Threat Intelligence into your Notion workspace with notion-stix ๐Ÿ›ก๏ธ
Go
6
star
11

citadel

A family of Security Operations micro services built with go-kit
Go
5
star
12

inventory-go

Go
4
star
13

homeassistant-ts

A typescript REST API client for the Home Assistant API. Interact with your Home Assistant instance from TS/JS services..
TypeScript
4
star
14

dotfiles.archive

My personal configurations and recipes that I just can't get enough of.
Lua
4
star
15

doomguy

Doom Guy is a yaml-configurable discord bot
Go
3
star
16

brittonhayes

My personal Github profile
3
star
17

dnd-deploy

Infrastructure for dnd5eapi.co deployment to AWS. Built on Elastic Container Sevice + Cloudfront๐ŸŽฒ
TypeScript
3
star
18

staffing

This is an example of a staffing service for a fictional consulting company. It is an implementation of Domain Driven Design and Clean Architecture.
Go
3
star
19

aos

AoS API (Unofficial) built with Go and Sqlite. Including OpenTelemetry, Grafana, and Jaeger for logs, metrics, and traces.
Go
3
star
20

defangle

๐Ÿง› Defangle is the gleam link defanger. Make URLs, IPs, and Emails safe to share.
Gleam
3
star
21

homie

A telegram bot and CLI to help hunt for houses ๐Ÿก ๐Ÿ”
Go
2
star
22

zero

Find zero-days related to your code, deployments, and projects. ๐Ÿ” ๐Ÿž
Go
2
star
23

warhammer-aos-docs

REST API Documentation for the Warhammer Age of Sigmar API
JavaScript
2
star
24

pkg

A set of common utilities and helpers for Golang projects ๐Ÿ“ฆ
Go
2
star
25

learn-go-with-tests

Learning Go with test-driven development
Go
2
star
26

go-minecraft

An RCON client for minecraft built in Go โœจ๐Ÿ“ฆ๐Ÿ—ก๏ธ
Go
2
star
27

notion-homeassistant

A Notion integration that allows your Home Assistant smart home to connect with your Notion instance.
TypeScript
2
star
28

warhammer-proto

A gRPC API for Warhammer Age of Sigmar
Go
2
star
29

dotfiles

My personal configurations and recipes that I just can't get enough of.
Shell
2
star
30

godb

A simple implementation of the Golang Scribble tiny JSON database. This repo gets you setup with a basic example project to make CRUD operations with JSON.
Go
2
star
31

hikeshi-tap

Homebrew tap for the hikeshi web application
Ruby
1
star
32

minikv

A mini key value store built with Go + Gorilla Mux + BoltDB ๐Ÿน
Go
1
star
33

homebrew-pillager

The homebrew tap repository for pillager
Ruby
1
star
34

nico_rpg

A rough idea for Nico's rpg game
1
star
35

pillager-scoop

Scoop App Manifest for the pillager tool
1
star
36

leetcode

An anthology of my struggle to understand how on earth people practically implement these algorithms.
Go
1
star
37

armactl

armactl is a cross-platform CLI tool for managing ARMA 3 servers and ARMA Reforger servers. Supports Windows, Linux, and MacOS.
Go
1
star
38

hikeshi-docs

The home of all gitbook documentation for hikeshi.
1
star
39

Smooth-Scroll

A project to explore smooth scrolling and navigation in RWD with jQuery.
HTML
1
star
40

rpg

A text-based role-playing game engine written in Go ๐Ÿนโš”๏ธ
Go
1
star
41

Loan-Calculator

CSS
1
star
42

Nico-Game

HTML
1
star
43

micro-cargofmt

A plugin for the micro text editor to run cargo format on your Rust projects ๐Ÿฆ€
Lua
1
star
44

hellknight

Go
1
star
45

terraform-honeypot

A honeypot built on AWS and deployed via terraform
HCL
1
star
46

ChatApp

Learning how to use Socket.IO and Node
CSS
1
star
47

TaskList

A javascript project with an editable to-do list. Includes element creation, deletion, and persistent local storage.
JavaScript
1
star
48

security-sandbox

My personal security sandbox environment. For use in CTF events, studying, or security research ๐Ÿง…โ˜ ๏ธ๐Ÿ–๏ธ
Shell
1
star
49

Lottie-Like

HTML
1
star
50

arma-reforger-helm

๐Ÿ™Helm chart repository for the ARMA Reforger dedicated server using LinuxGSM.
Smarty
1
star
51

secops.mov

secops[.]mov is a site created purely with the intention to state that the .mov TLD is a bad idea that will be a huge pain for lots of security engineers. This site is a joke, buttt it's also a real problem.
HTML
1
star
52

notes

a collection of my notes about things
TypeScript
1
star
53

notionmd

๐Ÿช„ Convert Markdown into Notion Blocks
Go
1
star
54

krusty

Dig around for krusty old files taking up space with Rust ๐Ÿฆ€
Rust
1
star
55

psych

๐Ÿ‘ฉโ€โš•๏ธ Psych - Find a mental health professional
Go
1
star
56

githooks

A repository of simple pre-commit hooks to ensure your code is nice and clean before commit.
Shell
1
star