I was able to build this snap a few days ago under classic confinement, but it didn’t work under other Linux distributions like Fedora and only worked in my KDE Neon desktop based on Ubuntu 22.04. Now, this snap builds and installs totally fine but some of the stage packages I’ve included in the snap does not work even if they’re installed from Ubuntu repos. The problem creating stage packages are whatweb and wkhtmltopdf which are giving errors. The errors can seen from the image below:-
These packages when installed in my KDE Neon desktop from Ubuntu repos work perfectly fine but they don’t work when included in the snap package. I think this is a bug in Snapcraft. Here is my snapcraft.yaml
snapcraft.yaml
name: autorecon
version: '0.0.3'
summary: my summary
base: core22
description: |
My description.
grade: devel
confinement: strict
plugs:
wordlists:
interface: system-files
read:
- /usr/share/seclists
apps:
autorecon:
command: bin/python $SNAP/bin/autorecon
environment:
RUBYLIB: '$SNAP/usr/lib/ruby/vendor_ruby:$SNAP/usr/lib/ruby/3.0.0:$SNAP/usr/lib/x86_64-linux-gnu/ruby/3.0.0:$RUBYLIB'
JAVA_HOME: "$SNAP/usr/lib/jvm/java-11-openjdk-amd64"
PATH: "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin"
GIT_EXEC_PATH: $SNAPCRAFT_PART_INSTALL/usr/lib/git-core
GIT_TEMPLATE_DIR: $SNAPCRAFT_PART_INSTALL/usr/share/git-core/templates
GIT_CONFIG_NOSYSTEM: "1"
plugs:
- network
- network-bind
- home
- wordlists
# Just another bug in snapcraft
#package-repositories:
# - type: apt
# suites: [kali-rolling]
# components: [main]
# key-id: 44C6513A8E4FB3D30875F758ED444FF07D8D0BF6
# url: https://http.kali.org/kali/
parts:
# I wanted the latest sslscan.
sslscan:
source: https://github.com/rbsec/sslscan.git
plugin: nil
build-packages:
- build-essential
- git
- zlib1g-dev
override-build: |
make static
mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/bin/"
cp ./sslscan "$SNAPCRAFT_PART_INSTALL/usr/bin/"
#####################################################
### START: PACKAGES NOT AVAILABLE IN UBUNTU REPOS ###
#####################################################
oscanner:
after: [sslscan]
source: .
plugin: nil
build-packages:
- git
stage-packages:
- default-jre
override-build: |
./oscanner.sh
tnscmd10g:
after: [oscanner]
plugin: nil
build-packages:
- wget
stage-packages:
- perl
override-build: |
wget "https://gitlab.com/kalilinux/packages/tnscmd10g/-/raw/kali/master/tnscmd10g" -O $SNAPCRAFT_PART_INSTALL/usr/bin/tnscmd10g
chmod +x $SNAPCRAFT_PART_INSTALL/usr/bin/tnscmd10g
enum4linux:
after: [tnscmd10g]
plugin: nil
stage-packages:
- samba
- smbclient
- polenum
- ldap-utils
override-build: |
git clone https://github.com/CiscoCXSecurity/enum4linux.git $SNAPCRAFT_PART_INSTALL/usr/share/enum4linux/
rm $SNAPCRAFT_PART_INSTALL/usr/share/enum4linux/C* $SNAPCRAFT_PART_INSTALL/usr/share/enum4linux/*.md
echo -e '#!/usr/bin/env sh \n\nset -e \n\ncd $SNAP/usr/share/enum4linux/ && exec ./enum4linux.pl "$@"' > $SNAPCRAFT_PART_INSTALL/usr/bin/enum4linux
chmod +x $SNAPCRAFT_PART_INSTALL/usr/bin/enum4linux
###################################################
### END: PACKAGES NOT AVAILABLE IN UBUNTU REPOS ###
###################################################
python:
after: [enum4linux]
plugin: autotools
source: https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
autotools-configure-parameters:
- --enable-optimizations
build-packages:
- build-essential
- gdb
- lcov
- pkg-config
- libbz2-dev
- libffi-dev
- libgdbm-dev
- libgdbm-compat-dev
- liblzma-dev
- libncurses5-dev
- libreadline6-dev
- libsqlite3-dev
- libssl-dev
- lzma
- lzma-dev
- tk-dev
- uuid-dev
- zlib1g-dev
override-stage: |
snapcraftctl stage
[ ! -d "${SNAPCRAFT_STAGE}/bin" ] && mkdir ${SNAPCRAFT_STAGE}/bin
ln -sf ../usr/local/bin/python3.10 "${SNAPCRAFT_STAGE}/bin/python3.10"
stage-packages:
- libtcl8.6
- libtk8.6
- libxft2
- libxss1
# Install sipvicious from source. For core20 snaps.
# sipvicious:
# after: [python]
# plugin: python
# source: https://github.com/enablesecurity/sipvicious.git
# build-environment:
# - SNAPCRAFT_PYTHON_INTERPRETER: python3.10
# override-build: |
# python3.10 setup.py install
autorecon:
after: [python]
plugin: python
stage-snaps: [feroxbuster/latest/stable]
stage-packages:
- dnsrecon
- redis-tools
- wkhtmltopdf
- python3-impacket
- curl
- gobuster
- nbtscan
- nikto
- nmap
- onesixtyone
- smbclient
- smbmap
- snmp
- whatweb
- hydra
- sipvicious # remove this if you choose to install from source
organize:
usr/lib/*-linux-gnu/blas/*: usr/lib/
source: https://github.com/Tib3rius/Autorecon.git
build-environment:
- SNAPCRAFT_PYTHON_INTERPRETER: python3.10
override-build: |
mkdir -p "$SNAPCRAFT_PART_INSTALL"/bin
python3.10 -m pip install --user dephell[full]
sed -i 's/from m2r/#from m2r/g' /root/.local/lib/python3.10/site-packages/dephell/controllers/_readme.py
PATH=$HOME/.local/bin:$PATH dephell deps convert --from-path pyproject.toml --from-format poetry --to-path setup.py --to-format setuppy
snapcraftctl build
It also builds fine for core20
but I still get the same errors. Note, to reproduce the errors run the snap with the following command:-
autorecon 127.0.0.1 -vvv
This will show errors if any when running the app and will provide you with a error file which lists the errors. You need to have a webserver/webapp running on localhost to reproduce those errors. You’ll probably also see hydra
failing with errors but that’s normal because you don’t have the necessary wordlist in the required path. Now, I didn’t have the chance to debug all the functionality of my snap because it requires testing of specific servers running specific software and I think I maybe able to produce a few more errors if I had the chance because there is a lot of functionality in my snap.
Also, I’ve been trying to fix those errors for the last day as I was able to fix a few others but finally decided to ask here because my time is important and I’ve a lot of other things to do besides fixing bugs created by other people. Also, I think reporting bugs likes these only improves snapcraft.
P.S:- Great work guys! I totally love Snapcraft. I think I can now build a snap app for just about any program in any programming language out there. Cheers!