Fork me on GitHub

Armyknife

Armyknife

Download the latest version

Install on Windows

Armyknife can be installed using Chocolatey, a package manager for Windows.

PS C:\Users\Duco\Desktop> choco install armyknife -y

Install on Ubuntu

There is an install script for Ubuntu. You can call it directly from a Bash terminal like this (make sure you are super user):

wget -qO- https://raw.githubusercontent.com/dukeofharen/armyknife/master/scripts/install.sh | bash

Armyknife is a nice little tool which contains many handy little command line tools. It contains tools like base64 encoder / decoder, URL shortener, SHA512 hasher and more.

Example

Chapters

Help

Use this program like this:
- armyknife <toolname> <arguments>

Use this command to show the help page of a specific tool:
- armyknife help <toolname>

For debugging purposes, add the "--debug" flag:
- armyknife help <toolname> --debug

Recipes

Windows

Make use of "piping"

PS C:\Users\Duco\Desktop> Get-Content .\test.txt | armyknife base64encode
VGhpcyBpcyBhIHRlc3QgZmlsZSENCg==

Pass clipboard data to Armyknife through piping

PS C:\Users\Duco\Desktop> Get-Clipboard | armyknife sha1
69776a1e2e0bfa8505342952cc6978d56342cc14

Tools

Encoding tools

base64decode

Decodes a piece of Base64 encoded text.

Usage:
- base64decode ZGVjb2RlIHRoaXM=
- base64decode --input ZGVjb2RlIHRoaXM=

base64encode

Encodes a piece of text or a file to a Base64 string.

Usage:
- base64encode encode this
- base64encode --input encode this

htmldecode

A simple to to HTML decode a given string.

Usage:
- htmldecode &lt;html&gt;&lt;/html&gt;

htmlencode

A simple to to HTML encode a given string.

Usage:
You can't use characters like '<' or '>' as input, so you need to provide the input via piping.

urldecode

A simple tool to URL decode a given string.

Usage:
- urldecode https%3a%2f%2fgoogle.com

urlencode

A simple tool to URL encode a given string.

Usage:
- urlencode https://www.google.com

File tools

filext

Lets you fill in a file extension and looks up the corresponding information of that file extension.

Usage:
- filext xlsx

frommime

Checks a given MIME type and finds all corresponding file extensions.

Usage:
- frommime text/plain

tomime

Converts a given file extension or file name to the corresponding MIME type.

Usage:
- tomime txt
- tomime filename.txt

Date / time tools

fromunixtimestamp

A handy tool to convert UNIX timestamps to readable date-time strings. Supportx UNIX timestamps in seconds and milliseconds.

Usage:
- fromunixtimestamp 1513889220332
- fromunixtimestamp 1513889220

tounixtimestamp

A handy tool to convert an ISO 8601 date time string to a UNIX timestamp. The result is a UNIX timestamp including milliseconds. If you want to use it as a regular timestamp, remove the last 3 numbers.

Usage:
- tounixtimestamp
- tounixtimestamp 2017-08-20T15:00:00+02:00

weeknumber

A tool which shows the current week number.

Usage:
- weeknumber

Web tools

jsonprettify

A handy tool to prettify a JSON string.

Usage:
- jsonprettify {"key": "value"}
- jsonprettify --input {"key": "value"} --character space --tabsize 3

Optional parameters:
- character: whether the indentation character should be either "tab" or "space" (default space)
- tabsize: the indentation size (default 3)

jsonuglify

This handy tool allows you to format a multiline JSON string to a single line.

Usage:
You can't provide multiline strings directly from the command line, but you can, for example, pipe the contents of a file or the clipboard to Armyknife.

longurl

A handy tool to lengthen URLs from several (not all) URL shortening services.

Usage:
- longurl http://tinyurl.com/123

Works with (at least):
- bit.ly
- goo.gl
- is.gd
- tinyurl.com
- t.co
- fb.me

tinyurl

A handy tool to generate shortened URLs at tinyurl.com.

Usage:
- tinyurl https://google.com

Text tools

lipsum

Generates a number of Lorem Ipsum paragraphs.

Usage:
- lipsum
- lipsum --paragraphs 20

Optional properties:
- paragraphs: the number of Lorem Ipsum paragrahps (5 default).

removenewline

A tool to remove newlines from pieces of text.

Usage:
- removenewline this\r\ntext\ncontains newlines

stringlength

A handy tool to calculate the number of characters of a string.

Usage:
- stringlength calculate length of this string

stringreverse

This tool lets you reverse a string.

Usage:
- stringreverse Reverse this string my man.

stringtolower

Handy tool to convert a string to lower case.

Usage:
- stringtolower TO LOWERCASE

stringtotitlecase

Handy tool to convert a string to title case.

Usage:
- stringtotitlecase convert this to title case

stringtoupper

Handy tool to convert a string to upper case.

Usage:
- stringtoupper convert this to upper case

wordcount

A handy tool to count the number of words in a string.

Usage:
- wordcount count the number of words

Hashing tools

md5

Encodes a piece of text to an MD5 hash.

Usage:
- md5 hash this
- md5 --input hash thi
- md5 --input hash this --hmac secret-key

Optional properties:
- hmac: the signature key for the MD5 hash
- outputType: how the string should be generated (should be 'hex' or 'base64')

securepwd

A handy tool to generate secure passwords.

Usage:
- securepwd
- securepwd --length 20 --capitals false

Optional properties:
- length: the length of the password (default 20)
- capitals: if capital letters should be included (default true)
- lowercase: if lowercase letters should be included (default true)
- numbers: if numbers should be included (default true)
- specialchars: if special characters should be included (default true)

sha1

Encodes a piece of text to a SHA1 hash.

Usage:
- sha1 hash this
- sha1 --input hash this
- sha1 --input hash this --hmac secret-key

Optional properties:
- hmac: the signature key for the MD5 hash
- outputType: how the string should be generated (should be 'hex' or 'base64')

sha256

Encodes a piece of text to a SHA256 hash.

Usage:
- sha256 hash this
- sha256 --input hash this
- sha256 --input hash this --hmac secret-key

Optional properties:
- hmac: the signature key for the SHA256 hash
- outputType: how the string should be generated (should be 'hex' or 'base64')

sha384

Encodes a piece of text to a SHA384 hash.

Usage:
- sha384 hash this
- sha384 --input hash this
- sha384 --input hash this --hmac secret-key

Optional properties:
- hmac: the signature key for the SHA384 hash
- outputType: how the string should be generated (should be 'hex' or 'base64')

sha512

Encodes a piece of text to a SHA512 hash.

Usage:
- sha512 hash this
- sha512 --input hash this
- sha512 --input hash this --hmac secret-key

Optional properties:
- hmac: the signature key for the SHA512 hash
- outputType: how the string should be generated (should be 'hex' or 'base64')

Number tools

uuid

A handy tool to generate a (or many) UUIDs.

Usage:
- uuid
- uuid --brackets true --uppercase true --hyphens true --howmany 1

Optional properties:
- brackets: whether the GUIDs should be surrounded by brackets (true or false, default false)
- uppercase: whether the GUIDs should be uppercase (true or false, default false)
- hyphens: whether the GUID parts should be separated by hyphens (true or false, default true)
- howmany: how many GUIDs should be generated (default 1)

Imaging tools

writeqr

A handy tool to generate QR codes.

Usage:
- writeqr --input this is the QR content --outputFile C:\temp\qr.png --width 250 --height 250
- writeqr --input this is the QR content --extension png

The output type is determined by the file extension of "outputType" (or "extension"). Supported file types: png, svg.

"extension" or "outputType" should be set. They can't be set both. If "extension" is set, the file contents are Base64 encoded when written to the console window.

Optional properties:
- width: the PNG file width in pixels (default 250)
- height: the PNG height in pixels (default 250)
- openFile: whether the file should be opened after saving (true or false, default false)