Skip to content

Commit

Permalink
Documentation and license
Browse files Browse the repository at this point in the history
  • Loading branch information
joohoi committed Jun 28, 2020
1 parent ef42bce commit fd11533
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Joona Hoikkala

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# pencode - complex payload encoder

Pencode is a tool that helps you to create payload encoding chains. It has been designed to be used in automation whereever
it is required to apply multiple encodings to a payload (and possibly inserting the payload to a template in between).

`pencoder` can be used as a standalone command line tool or as a library for other Go programs.


## Installation
```
go get -u github.com/ffuf/pencode/cmd/pencode
```

### Usage

```
pencode - complex payload encoder v0.1
Usage: pencode ENCODER1 ENCODER2 ENCODER3...
pencode reads input from stdin, which is typically piped from another process.
Available encoders:
b64decode - Base64 decoder
b64encode - Base64 encoder
hexdecode - Hex string decoder
hexencode - Hex string encoder
unicodedecode - Unicode escape string decode
unicodeencodeall - Unicode escape string encode (all characters)
urldecode - URL decode
urlencode - URL encode reserved characters
urlencodeall - URL encode all characters
utf16 - UTF-16 encoder (Little Endian)
utf16be - UTF-16 encoder (Little Endian)
```

To urlencode, base64encode and hex encode a string:

```
$ echo 'what%ever'|pencode urlencode b64encode hexencode
64326868644355794e5756325a58493d
```

### Available encoders

- Base64 encoder
- Base64 decoder
- Hex string encoder
- Hex string decoder
- Unicode escape string encoder
- Unicode escape string decoder
- URL encoder (reserved characters)
- URL encoder (all characters)
- URL decoder
- UTF16 encoder (Little Endian)
- UTF16 encoder (Big Endian)

### Upcoming

- Templating

### Usage as a library

```go
package main

import (
"fmt"

"github.com/ffuf/pencode/pkg/pencode"
)

func main() {
inputdata := "Whatever you wish to run through the chain"
# A slice of encoders in the preferred encoding chain execution order
encoders := []string{
"utf16",
"b64encode",
}
chain := pencode.NewChain()
err := chain.Initialize(encoders)
if err != nil {
panic(err)
}
output, err := chain.Encode([]byte(inputdata))
if err != nil {
panic(err)
}
fmt.Print(string(output))
}
```

## License

`pencode` is released under MIT license. See [LICENSE](https://github.com/ffuf/pencoder/blob/master/LICENSE).

0 comments on commit fd11533

Please sign in to comment.