From 20a8db806c34d33e47cc83aea158c9ea5fa5acb8 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Tue, 13 Mar 2018 11:26:25 -0700 Subject: [PATCH 1/3] Make HISTFILE zprezto compatible. --- dotfiles/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dotfiles/zshrc b/dotfiles/zshrc index f575497..76bb467 100755 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -1,7 +1,7 @@ # For interactive shells -HISTFILE=~/.histfile -HISTSIZE=1000 -SAVEHIST=1000 +HISTFILE=~/.zhistory +HISTSIZE=10000 +SAVEHIST=10000 setopt appendhistory autocd autopushd extendedglob nohup nomatch histignorespace histlexwords histverify cbases unsetopt beep histbeep listbeep flowcontrol bindkey -e From 61b4dbe96372ce59097ee40a51e132e41c671544 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Wed, 14 Mar 2018 13:44:40 -0700 Subject: [PATCH 2/3] Do cyberchef install_tool style. --- bin/cyberchef | 10 +- bin/cyberchef.html | 382 --------------------------------------------- bin/install_tool | 12 ++ 3 files changed, 21 insertions(+), 383 deletions(-) delete mode 100644 bin/cyberchef.html diff --git a/bin/cyberchef b/bin/cyberchef index 6e8d6aa..d05ac72 100755 --- a/bin/cyberchef +++ b/bin/cyberchef @@ -1,3 +1,11 @@ #!/bin/bash -exec xdg-open $(dirname $0)/cyberchef.html +set -u + +CHEF_FILE=${HOME}/tools/cyberchef/cyberchef.html + +if [ ! -f ${CHEF_FILE} ] ; then + ${HOME}/bin/install_tool cyberchef +fi + +exec xdg-open ${CHEF_FILE} diff --git a/bin/cyberchef.html b/bin/cyberchef.html deleted file mode 100644 index 25d6f4d..0000000 --- a/bin/cyberchef.html +++ /dev/null @@ -1,382 +0,0 @@ - -CyberChef Edit
Operations
    Recipe
      Input
      Output
      \ No newline at end of file diff --git a/bin/install_tool b/bin/install_tool index c523640..ed5301d 100755 --- a/bin/install_tool +++ b/bin/install_tool @@ -31,10 +31,16 @@ if [ $# -ne 1 ] ; then fi TOOL=${1} +function die { + echo $* >/dev/stderr + return 1 +} + function install_pkgs { if [ ${PACKAGES} -eq 0 ] ; then return 0 fi + # TODO: check if packages are already installed if [ `id -u` -ne "0" ] ; then sudo apt-get -y install $* || ( echo -n "Unable to install packages, please ensure these " >/dev/stderr @@ -50,6 +56,7 @@ function download { SRC=${1} DST=${2} echo -n "Downloading ${SRC} to ${DST}..." >&2 + # TODO: consider curl instead? wget --no-server-response -q -O ${DST} --content-disposition ${SRC} echo " done." >&2 } @@ -176,6 +183,11 @@ case ${TOOL} in /etc/udev/rules.d/77-mm-usb-device-blacklist.rules && udevadm control --reload-rules" ;; + cyberchef) + mkdir -p ${DESTDIR} + src=$(python -c 'import urllib2; import json; print(filter(lambda x: x["name"]=="cyberchef.htm", json.load(urllib2.urlopen("https://api.github.com/repos/gchq/CyberChef/releases/latest"))["assets"])[0]["browser_download_url"])') + download ${src} ${DESTDIR}/cyberchef.html + ;; *) echo "Unknown tool: ${TOOL}" >/dev/stderr exit 1 From c9c65e10d74bfffb35931d02b5babeb92d4b7070 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Wed, 14 Mar 2018 22:15:52 -0700 Subject: [PATCH 3/3] Install latest mitmproxy. --- bin/install_tool | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/install_tool b/bin/install_tool index ed5301d..a7ea69a 100755 --- a/bin/install_tool +++ b/bin/install_tool @@ -144,8 +144,7 @@ case ${TOOL} in fi ;; mitmproxy) - # Find a better way to get the latest - src="https://github.com/mitmproxy/mitmproxy/releases/download/v2.0.1/mitmproxy-2.0.1-linux.tar.gz" + src=$(python -c 'import urllib2; import json; print(filter(lambda x: x["name"].endswith("-linux.tar.gz"), json.load(urllib2.urlopen("https://api.github.com/repos/mitmproxy/mitmproxy/releases/latest"))["assets"])[0]["browser_download_url"])') download ${src} /tmp/mitmproxy.tar.gz mkdir -p ${DESTDIR} tar zx -C ${DESTDIR} -f /tmp/mitmproxy.tar.gz