diff --git a/bin/ctf-tools-pip b/bin/ctf-tools-pip new file mode 100755 index 0000000..7e038ef --- /dev/null +++ b/bin/ctf-tools-pip @@ -0,0 +1,34 @@ +#!/bin/bash +set -e -o pipefail + +PY_VERSION=2 +if [[ "$0" =~ \.+pip3 ]]; then + PY_VERSION=3 +fi +if [[ "$0" =~ \.+pip2 ]]; then + PY_VERSION=2 +fi + +CTF_TOOLS_VE="ctftools" +if [[ "PY_VERSION" -eq 3 ]]; then + CTF_TOOLS_VE="${CTF_TOOLS_VE}3" +fi + +export WORKON_HOME=~/.virtualenvs +if [[ ! -d "$WORKON_HOME" ]]; then + mkdir -p "$WORKON_HOME" +fi +export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 + +source $(which virtualenvwrapper.sh) + +if ! workon "$CTF_TOOLS_VE" 2>&1 1>/dev/null; then + echo "#### Creating python#PY_VERSION virtualenv '$CTF_TOOLS_VE' ####" >&2 + # for some reason mkvirtualenv returns non-zero even if it + # succeeds? + mkvirtualenv -p $(which "python$PY_VERSION") "$CTF_TOOLS_VE" || true + echo "#### Switching to '$CTF_TOOLS_VE' virtualenv" >&2 + workon "$CTF_TOOLS_VE" || (deactivate && workon "$CTF_TOOLS_VE") +fi + +exec pip "$@" diff --git a/bin/ctf-tools-pip3 b/bin/ctf-tools-pip3 new file mode 120000 index 0000000..1f63be9 --- /dev/null +++ b/bin/ctf-tools-pip3 @@ -0,0 +1 @@ +ctf-tools-pip \ No newline at end of file diff --git a/binjitsu/install b/binjitsu/install new file mode 100755 index 0000000..3b52a09 --- /dev/null +++ b/binjitsu/install @@ -0,0 +1,3 @@ +#!/bin/bash -e + +ctf-tools-pip install --upgrade 'git+https://github.com/binjitsu/binjitsu.git' diff --git a/binjitsu/install-root b/binjitsu/install-root new file mode 100755 index 0000000..a6e5448 --- /dev/null +++ b/binjitsu/install-root @@ -0,0 +1,17 @@ +#!/bin/bash -e + +case "$DISTRI" in + "debian") + apt-add-repository -y ppa:pwntools/binutils + apt-get update + apt-get -y install binutils-.*-linux-gnu + ;; + "archlinux") + pacman -Syu --noconfirm binutils + ;; + *) + echo "Unknown distribution" + exit 1 + ;; +esac + diff --git a/binjitsu/uninstall b/binjitsu/uninstall new file mode 100755 index 0000000..f54f29d --- /dev/null +++ b/binjitsu/uninstall @@ -0,0 +1,3 @@ +#!/bin/bash -e + +ctf-tools-pip uninstall binjitsu diff --git a/pwntools/install b/pwntools/install index 4ca2f02..aa8ca1f 100755 --- a/pwntools/install +++ b/pwntools/install @@ -1,30 +1,4 @@ #!/bin/bash -e # pwnutils -git clone --depth 1 https://github.com/Gallopsled/pwntools.git -cd pwntools -pip install -r requirements.txt -cd .. - -# binutils -#curl https://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.gz | tar xz -#mkdir binutils-build -#cd binutils-build -#export AR=ar -#export AS=as -#../binutils-2.25/configure --prefix=$(dirname $PWD)/binutils-inst --enable-multilib -#make -j $(nproc) -#make install - -mkdir -p bin -cd bin -for i in $(yes n | pip uninstall pwntools | grep bin) -do - mv $i $(basename $i).real - cat < $(basename $i) -#!/bin/bash -PATH=/usr/bin:\$PATH $PWD/$(basename $i).real "\$@" -END - chmod 755 $(basename $i) -done -cd .. +ctf-tools-pip install --upgrade 'git+https://github.com/Gallopsled/pwntools.git' diff --git a/pwntools/install-root b/pwntools/install-root index fe5aa41..a6e5448 100755 --- a/pwntools/install-root +++ b/pwntools/install-root @@ -1,6 +1,17 @@ #!/bin/bash -e -apt-add-repository -y ppa:pwntools/binutils -apt-get update -apt-get -y install binutils-.*-linux-gnu +case "$DISTRI" in + "debian") + apt-add-repository -y ppa:pwntools/binutils + apt-get update + apt-get -y install binutils-.*-linux-gnu + ;; + "archlinux") + pacman -Syu --noconfirm binutils + ;; + *) + echo "Unknown distribution" + exit 1 + ;; +esac diff --git a/pwntools/uninstall b/pwntools/uninstall new file mode 100755 index 0000000..0bd6a4b --- /dev/null +++ b/pwntools/uninstall @@ -0,0 +1,3 @@ +#!/bin/bash -e + +ctf-tools-pip uninstall pwntools || true