All Projects → pier-cli → Pier

pier-cli / Pier

Licence: mit
A Linux script management CLI written in Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Pier

Block Options
EditorsKit — a toolkit for the Gutenberg block editor.
Stars: ✭ 208 (-11.86%)
Mutual labels:  tools
Adb Toolkit
ADB-Toolkit V2 for easy ADB tricks with many perks in all one. ENJOY!
Stars: ✭ 217 (-8.05%)
Mutual labels:  tools
Aws Adfs
Command line tool to ease aws cli authentication against ADFS (multi factor authentication with active directory)
Stars: ✭ 229 (-2.97%)
Mutual labels:  tools
Joymachine Public
All sorts of random publicly-available information, assets, scripts, and more as we (Joy Machine) work on our projects.
Stars: ✭ 210 (-11.02%)
Mutual labels:  tools
Agimagecontrols
cool tools for image edition
Stars: ✭ 217 (-8.05%)
Mutual labels:  tools
Dev Tools
The most popular software developer tools in one app
Stars: ✭ 221 (-6.36%)
Mutual labels:  tools
Ladon
大型内网渗透扫描器&Cobalt Strike,Ladon8.9内置120个模块,包含信息收集/存活主机/端口扫描/服务识别/密码爆破/漏洞检测/漏洞利用。漏洞检测含MS17010/SMBGhost/Weblogic/ActiveMQ/Tomcat/Struts2,密码口令爆破(Mysql/Oracle/MSSQL)/FTP/SSH(Linux)/VNC/Windows(IPC/WMI/SMB/Netbios/LDAP/SmbHash/WmiHash/Winrm),远程执行命令(smbexec/wmiexe/psexec/atexec/sshexec/webshell),降权提权Runas、GetSystem,Poc/Exploit,支持Cobalt Strike 3.X-4.0
Stars: ✭ 2,911 (+1133.47%)
Mutual labels:  tools
Wtsdk
开发项目积累的一些category、tools、自定义View,持续更新
Stars: ✭ 235 (-0.42%)
Mutual labels:  tools
Record Ios Simulator
A script to start and stop video recordings from the iOS Simulator as easily as taking a screenshot.
Stars: ✭ 218 (-7.63%)
Mutual labels:  tools
Bbo
bbo is a utility library of zero dependencies for javascript. 🍖🌭🍔
Stars: ✭ 227 (-3.81%)
Mutual labels:  tools
Systemjs Hot Reloader
reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
Stars: ✭ 215 (-8.9%)
Mutual labels:  tools
Django Livereload Server
Livereload functionality integrated with your Django development environment.
Stars: ✭ 213 (-9.75%)
Mutual labels:  tools
Hfish
安全、可靠、简单、免费的企业级蜜罐
Stars: ✭ 2,977 (+1161.44%)
Mutual labels:  tools
Quickstrom
High-confidence browser testing
Stars: ✭ 208 (-11.86%)
Mutual labels:  tools
Awesome Recruitment
List of my favourite recruitment things 💫
Stars: ✭ 226 (-4.24%)
Mutual labels:  tools
Goutil
💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more. Go 的一些工具函数,格式化,特殊处理,常用信息获取等等
Stars: ✭ 205 (-13.14%)
Mutual labels:  tools
Hekate
hekate - A GUI based Nintendo Switch Bootloader
Stars: ✭ 3,286 (+1292.37%)
Mutual labels:  tools
Smart Hierarchy
Better hierarchy for Unity.
Stars: ✭ 234 (-0.85%)
Mutual labels:  tools
Swiftscripting
A list of Swift scripting tools, frameworks & examples
Stars: ✭ 230 (-2.54%)
Mutual labels:  tools
Sudo Font
Sudo, a font for programmers and command line users.
Stars: ✭ 225 (-4.66%)
Mutual labels:  tools

pier ~ A Linux script management tool

Build Status crates.io

A central repository to manage all your one-liners, scripts, tools, and CLIs. Add, remove, list, and run scripts - storing metadata to easily find them later. No more digging through your bin folder...

Boat pier

Description

If you've spent any amount of time in the terminal you no doubt have built up a lovely collection of one-liners, scripts, useful tools, and CLIs. Whenever you want to use them you dig through your bin folder trying to remember what you called the script... Linux users love hard-to-remember naming conventions.

Scripts should be first-class citizens. In a GUI world we can find our programs using a menu of sorts. In the terminal scripts get lost.

The idea behind pier is to create a central repository for all your scripts, and provide a way to attach metadata about these scripts. Using pier you can add, remove, list, and run scripts. These can be managed by pier in a human-readable TOML config, or you can use it to catalog existing scripts that you may have lying around - you'd then simply add the metadata for the specific script, and attach it to the name in the PATH.

Installation

From Crates.io: cargo install pier

From GitHub release: simply download the release binary

Using Nix package manager:

  1. From GitHub release: make install or nix-env -if derivation.nix
  2. From source: update src in derivation to ./.

Recent Breaking Changes

Version 0.1.4:

The configuration variable default_interpreter has been removed:

default_interpreter = ["foorunner", "-c"]

So when upgrading from to 0.1.4 from an earlier version you will need to instead specify the variable in this format:

[default]
interpreter = ["foorunner", "-c"]

Operation

Use pier --help to display help on commandline or see src/cli.rs for a more detailed spec.

pier 0.1.4
Benjamin Scholtz, Isak Johansson
A simple script management CLI

USAGE:
    pier [FLAGS] [OPTIONS] <alias>
    pier [FLAGS] [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help       
            Prints help information

    -V, --version    
            Prints version information

    -v, --verbose    
            The level of verbosity


OPTIONS:
    -c, --config-file <path>    
            Sets a custom config file.
            
            DEFAULT PATH is otherwise determined in this order:
            
            - $PIER_CONFIG_PATH (environment variable if set)
            
            - pier.toml (in the current directory)
            
            - $XDG_CONFIG_HOME/pier/config.toml
            
            - $XDG_CONFIG_HOME/pier/config
            
            - $XDG_CONFIG_HOME/pier.toml
            
            - $HOME/.pier.toml
            
            - $HOME/.pier
            
             [env: PIER_CONFIG_PATH=]

ARGS:
    <alias>    
            The alias or name for the script.


SUBCOMMANDS:
    add       Add a new script to config.
    edit      Edit a script matching alias.
    help      Prints this message or the help of the given subcommand(s)
    list      alias: ls - List scripts
    remove    alias: rm - Remove a script matching alias.
    run       Run a script matching alias.
    show      Show a script matching alias.
  • pier list
  • pier add "ip link set wlp58s0 down && sleep 5 && ip link set wlp58s0 up" --alias refresh-wifi
  • pier refresh-wifi

Example pier TOML config

[scripts.refresh-wifi]
alias = "refresh-wifi"
command = "ip link set wlp58s0 down && sleep 5 && ip link set wlp58s0 up"

[scripts.twa-analyze]
alias = "twa-analyze"
command = "docker run --rm -t trailofbits/twa -vw"
tags = [ "infosec" ]

[scripts.enabled-services]
alias = "enabled-services"
command = "systemctl list-unit-files --state=enabled"

[scripts.flush-docker]
alias = "flush-docker"
command = "docker container stop $(docker container ls -a -q) && docker system prune -a -f --volumes"
description = "A script to clear out old Docker containers and images"
tags = [ "docker", "flush" ]

Example pier list output

▶ pier list           
 Alias             | Command 
-------------------+----------------------------------------------------------------------------------------------------------------
 fromscratch       | appimage-run ~/AppImage/FromScratch.1.4.3.AppImage 
 nspawn-bionic     | sudo systemd-nspawn --bind=/tmp/.X11-unix -D /var/lib/machines/bionic --bind /home/bscholtz:/home/bscholtz 
 bspwm-refresh     | .config/bspwm/bspwmrc 
 flush-docker      | docker container stop $(docker container ls -a -q) && docker system prune -a -f --volumes 
 zfs-compression   | sudo zfs get all | grep compressratio 
 mongo-docker      | docker run --name mongodb -d mongo:latest 
 forward-mongo     | kubectl port-forward mongo-molecule-set-0 27018:27017 
 refresh-wifi      | ip link set wlp58s0 down && sleep 5 && ip link set wlp58s0 up 
 lepton            | appimage-run ~/AppImage/Lepton-1.8.0-x86_64.AppImage 
 ledger            | appimage-run AppImage/ledger-live-desktop-1.6.0-linux-x86_64.AppImage 
 reload-urxvt      | xrdb ~/.Xresources 
 kill-docker       | rm -rf /var/lib/docker 
 reload-xresources | xrdb ~/.Xresources 
 graphiql          | appimage-run ~/AppImage/graphiql-app-0.7.2-x86_64.AppImage 
 enabled-services  | systemctl list-unit-files --state=enabled 
 ports             | netstat -tulpn 
 chmod-copy        | chmod --reference= 
 zfs-drop-caches   | sync; echo 2 | sudo tee /proc/sys/vm/drop_caches 
 update            | sudo nix-channel --update && sudo nixos-rebuild switch 
 flush-untagged    | docker images -q --filter dangling=true | xargs -r docker rmi 
 twa-analyze       | docker run --rm -t trailofbits/twa -vw 
 parity-ubuntu     | docker image pull yodascholtz/parity-ubuntu:latest && docker run -p 8545:8545 yodascholtz/parity-ubuntu:latest

Execute pier scripts in any interpreted languages

Scripts starting with a shebang #! will be run with the specified interpeter just like it would in a normal script. Pier does this by creating a temp file from your script, executing it and then finally cleaning the file up. This allows you to write your pier script in python, node.js etc. even compiled languages can be run if using something like scriptisto.

Shebang example config

[scripts.run_rust_script]
alias = "run_rust_script"
command = '''
#!/usr/bin/env scriptisto

// scriptisto-begin
// script_src: src/main.rs
// build_cmd: cargo build --release && strip ./target/release/script
// target_bin: ./target/release/script
// files:
//  - path: Cargo.toml
//    content: |
//     package = { name = "script", version = "0.1.0", edition = "2018"}
//     [dependencies]
// scriptisto-end


fn main() {
    println!("This is a rust script!");
}

'''

[scripts.run_python]
alias = "run_python"
command = '''
#!/usr/bin/env python3
import sys

print("Running python with version {}".format(sys.version))

'''

Setting the default shell / interpreter

By default if no shebang is specified pier will try to use your default shell to execute the script inline. This can be overwritten with the variable interpreter. It needs to be a list with the first item being the binary and the rest is any flags necessary.

Default interpreter example config

# Sets the default interpreter, the first item in the list should be the binary and the rest are the arguments for the interpreter cli option.
[default]
interpreter = ["node", "-e"]

# Runs as the fallback interpreter nodejs as it's lacking a shebang
[scripts.hello_world_nodejs]
alias = "hello_world_nodejs"
command = '''
console.log("Hello world!")

'''

# This will be run as a posix sh script as it has a shebang
[scripts.a_shell_script]
alias = "a_shell_script"
command = '''
#!/bin/sh

nohup st > /dev/null 2>&1&

'''

Origin

Originally intended as a way to manage Docker one-liners, the name pier continues along the same maritime theme. I realized Pier can manage a lot more than just Docker scripts.

Roadmap to v1.0.0

  • Fuzzy search + autocomplete e.g. prompts for alias
  • Complete base features: mv, tag
  • Rework testing
  • Update documentation e.g. contributor guidelines, templates
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].