Skip to content

Commit

Permalink
Merge pull request #531 from ReFirmLabs/530-fix-sasquatch-in-binwalk-…
Browse files Browse the repository at this point in the history
…docker-container

530 fix sasquatch in binwalk docker container
  • Loading branch information
eacmen authored Mar 25, 2021
2 parents 80a519b + c84bec1 commit 772f271
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
.coverage
*.extracted
*.pyc
**/*.egg-info
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ addons:
apt:
update: true
install:
- export PYTHON=$(which python3)
- ./deps.sh --yes
- pip install coverage
- ./setup.py install
script: ./setup.py test
cache: pip
- sudo -E $PYTHON -mpip install coverage
- sudo -E $PYTHON ./setup.py install
script:
- export PYTHON=$(which python3)
- sudo -E $PYTHON ./setup.py test
jobs:
include:
- stage: test
Expand Down
37 changes: 14 additions & 23 deletions deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ else
YES=0
fi

set -eu
set -o nounset
set -x

if ! which lsb_release > /dev/null
then
Expand Down Expand Up @@ -60,35 +62,36 @@ fi
PYTHON3_APT_CANDIDATES=""
PYTHON3_YUM_CANDIDATES=""
YUM_CANDIDATES="git gcc gcc-c++ make openssl-devel qtwebkit-devel qt-devel gzip bzip2 tar arj p7zip p7zip-plugins cabextract squashfs-tools zlib zlib-devel lzo lzo-devel xz xz-compat-libs xz-libs xz-devel xz-lzma-compat python-backports-lzma lzip pyliblzma perl-Compress-Raw-Lzma lzop srecord"
PIP_COMMANDS="pip3"
PYTHON="$(which python3)"

# Check for root privileges
if [ $UID -eq 0 ]
then
echo "UID is 0, sudo not required"
SUDO=""
else
SUDO="sudo"
SUDO="sudo -E"
REQUIRED_UTILS="sudo $REQUIRED_UTILS"
fi

function install_yaffshiv
{
git clone https://github.com/devttys0/yaffshiv
(cd yaffshiv && $SUDO python3 setup.py install)
git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/yaffshiv
(cd yaffshiv && $SUDO $PYTHON setup.py install)
$SUDO rm -rf yaffshiv
}

function install_sasquatch
{
git clone https://github.com/devttys0/sasquatch
git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch
(cd sasquatch && $SUDO ./build.sh)
$SUDO rm -rf sasquatch
}

function install_jefferson
{
git clone https://github.com/sviehb/jefferson
(cd jefferson && $SUDO pip3 install -r requirements.txt && $SUDO python3 setup.py install)
git clone --quiet --depth 1 --branch "master" https://github.com/sviehb/jefferson
(cd jefferson && $SUDO $PYTHON -mpip install -r requirements.txt && $SUDO $PYTHON setup.py install)
$SUDO rm -rf jefferson
}

Expand All @@ -110,7 +113,7 @@ function install_cramfstools
INSTALL_LOCATION=/usr/local/bin

# https://github.com/torvalds/linux/blob/master/fs/cramfs/README#L106
git clone https://github.com/npitre/cramfs-tools
git clone --quiet --depth 1 --branch "master" https://github.com/npitre/cramfs-tools
# There is no "make install"
(cd cramfs-tools \
&& make \
Expand All @@ -123,19 +126,15 @@ function install_cramfstools

function install_ubireader
{
git clone https://github.com/jrspruitt/ubi_reader
(cd ubi_reader && $SUDO python3 setup.py install)
git clone --quiet --depth 1 --branch "master" https://github.com/jrspruitt/ubi_reader
(cd ubi_reader && $SUDO $PYTHON setup.py install)
$SUDO rm -rf ubi_reader
}

function install_pip_package
{
PACKAGE="$1"

for PIP_COMMAND in $PIP_COMMANDS
do
$SUDO $PIP_COMMAND install $PACKAGE
done
$SUDO $PYTHON -mpip install $PACKAGE
}

function find_path
Expand Down Expand Up @@ -240,14 +239,6 @@ then
exit 1
fi

# Check to see if we should install modules for python3 as well
find_path python3
if [ $? -eq 0 ]
then
PKG_CANDIDATES="$PKG_CANDIDATES $PKG_PYTHON3_CANDIDATES"
PIP_COMMANDS="pip3 $PIP_COMMANDS"
fi

# Do the install(s)
cd /tmp
$SUDO $PKGCMD $PKGCMD_OPTS $PKG_CANDIDATES
Expand Down

0 comments on commit 772f271

Please sign in to comment.