From 8e20db292de93d59c22c2920aff114df646f7051 Mon Sep 17 00:00:00 2001 From: rhatto Date: Wed, 24 Jun 2009 15:33:12 +0000 Subject: kismet: adding kismet git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2212 370017ae-e619-0410-ac65-c121f96126d4 --- net/wireless/kismet/Manifest | 23 +++ net/wireless/kismet/kismet.SlackBuild | 315 ++++++++++++++++++++++++++++++++++ 2 files changed, 338 insertions(+) create mode 100644 net/wireless/kismet/Manifest create mode 100644 net/wireless/kismet/kismet.SlackBuild (limited to 'net/wireless/kismet') diff --git a/net/wireless/kismet/Manifest b/net/wireless/kismet/Manifest new file mode 100644 index 00000000..52fa2bca --- /dev/null +++ b/net/wireless/kismet/Manifest @@ -0,0 +1,23 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +DIST kismet-2009-05-RC2.tar.gz 840862 MD5 a1898ed387a0484b0ee84fb412c3ba82 RMD160 ab6f536393ee4ce735fce64cb20b4af1a97438ae SHA1 d65f6c2f3a2fd4502a982f8bbbca948539ed9e0c SHA256 d6e2cb1c14364dc2d8db363d72a311d54353f6491970d5cdc0b808d333642d4b SHA512 636a4e1d1fae9c7a366dbe0709dd97b5db892e942578810a70ac57eae9e827d862cf08b1e879c13113638394f41dd1bea8c5437147454d97cadf8feb55a9e8e3 +MKBUILD kismet.mkbuild 5234 MD5 05e84ed8bbb490c57b95239d4d9aa003 RMD160 ca880b88a2689f4bdc97be8121356da624787ac9 SHA1 f6f43f3602a59ece93b8532bcf57ae54ca1abce1 SHA256 30ac0a721896720e63ae1f287405e8d9a702e317634e6835a343e7dcd0a2ea8a SHA512 025c703c7589a67a0546189898eff2f0c9264f99677911f37d8e8bf9566f97a5c6276516c0e9ed48e60e7ce399486a55db910663b9541b0b6aa8d72773d2eabc +SLACKBUILD kismet.SlackBuild 9622 MD5 aa70b8bbd02bfe48b605961781e831b8 RMD160 db124451dca92c5c3630bbab989b52ab32e68ce6 SHA1 c62bf0309f309903a4d2236002cf53dd83a8ddff SHA256 215fb8288c5a235152c6373c402ab4fb2780bcecc3b37e08010a3847cd8254ba SHA512 3c6991fdee383b67cc9dac651976615501939bc80ec00aede93f237d1fc10aad2aa0f487cadb9579700b47bcef9bfa000a7d3e8b2ed17d4052617c5710a71b31 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iQIcBAEBCAAGBQJKQkLaAAoJEEHL93ESzgei3A0P/2YOkECiMt4F0xDbbNPVLGRn +BaCcTLdnnNP0KXbr5nK5LhQ2UY2Cm1fHcUokZDe1NZDpWS/E6m3vfIgjRZ4jdVgJ +sYyibUfLIhc+kkNuyDNko4HFlYiPsIVjMJNU38KCBoNuC/Xr0jjPCjn794uJEb9l +6jR0z18ExeqBLUn/t6jjO34onylR9nMLk+n2Wk1hVXh5z43+U/WS5rXBAE9uk9vu +SbMMoMrOCdY8iJ6dNGM0G3bVggnoP9Pksu1chhgZoNRDIgFrQTkcdIYB5daHJoTj +x4/aI6gUhKjvev4qBNik60v/TzOMcZZibtBc4bQ2WLPtKuAOH9o59aLsCRR5+0Eh +HF22WR/FpoHw6oU8x+AOC2bM4/Wn22HKEvM/3Ze2ZW+pge6THjVKDqfWAyuo+/Gg +kFBg87WlV1SDWHen8FVI/JBKVG2Q92SPcbTxcSqHpC5ewPdJUl7T81gOOjXuXwow +jKhFOcBH7Vf0TS/qqEHkNMimCD8pdC5Xqrz67OQvwRdIR9ledB5JIk8kIvP5nPMW +MvCcDsVrToyrOPmlriJPBWleX6ZDxFgVzJ8CPEWgz/sLLYiKSzgnaQwRxkP/Ed1/ +4mlWkuY1K9w7ixoGL9LILlpEwvutmCAzPDgeFiRQFdjikE7NY12eFwfd8GOaL56G +wWStI/Q+I+ihmWoWxKM/ +=gAVN +-----END PGP SIGNATURE----- diff --git a/net/wireless/kismet/kismet.SlackBuild b/net/wireless/kismet/kismet.SlackBuild new file mode 100644 index 00000000..a044ea1e --- /dev/null +++ b/net/wireless/kismet/kismet.SlackBuild @@ -0,0 +1,315 @@ +#!/bin/bash +# +# kismet.SlackBuild is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the License, +# or any later version. +# +# kismet.SlackBuild is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# +# slackbuild for kismet, by Silvio Rhatto +# requires: +# tested: kismet-2009-05-RC2 +# model: generic.mkSlackBuild $Rev: 805 $ +# + +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + +# Set variables +CWD="$(pwd)" +SRC_NAME="kismet" +PKG_NAME="kismet" +ARCH=${ARCH:=i486} +SRC_VERSION=${VERSION:=2009-05-RC2} +PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" +BUILD=${BUILD:=1rha} +SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME +TMP=${TMP:=/tmp} +PKG=${PKG:=$TMP/package-$PKG_NAME} +REPOS=${REPOS:=$TMP} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="net/wireless/kismet"} +PREFIX=${PREFIX:=/usr} +PKG_WORK="$TMP/$SRC_NAME" +CONF_OPTIONS=${CONF_OPTIONS:="--sysconfdir=/etc"} +NUMJOBS=${NUMJOBS:=""} + +# Set system libraries' path and optmization flags based on $ARCH +LIBDIR="$PREFIX/lib" + +if [ "$ARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mtune=i686" +elif [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIR="$PREFIX/lib64" + LDFLAGS="-L/lib64 -L/usr/lib64" +fi + +# Set error codes (used by createpkg) +ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 +ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 +ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 +ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 +ERROR_MANIFEST=43; + +# Clean up any leftovers of previous builds +rm -rf "$PKG_WORK" 2> /dev/null +rm -rf "$PKG" 2> /dev/null + +# Create directories if necessary +mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR +mkdir -p "$PKG" || exit $ERROR_MKDIR +mkdir -p "$REPOS" || exit $ERROR_MKDIR +mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR + +# Dowload source if necessary +SRC="$SRC_NAME-$VERSION.tar.gz" +URL="http://www.kismetwireless.net/code/$SRC" + +if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET +fi + +# Import minimized signing key from +if echo [[SIGNING KEY URL]] | grep -q -v "SIGNING KEY URL"; then + lynx -dump [[SIGNING KEY URL]] | gpg --import || exit $ERROR_GPG +elif echo 738BBDB1 | grep -q -v "SIGNING KEY ID"; then + gpg --recv-keys 738BBDB1 || exit $ERROR_GPG +else + gpg --import << EOKEY || exit $ERROR_GPG +[[SIGNING KEY]] +EOKEY +fi + +# Download source's signature if necessary and check it +if echo [[SIGNING URL]] | grep -q -v "SIGNING URL"; then + SIGNATURE="`basename [[SIGNING URL]]`" + if [ ! -s "$SRC_DIR/$SIGNATURE" ]; then + wget "[[SIGNING URL]]" -O "$SRC_DIR/$SIGNATURE" || exit $ERROR_WGET + fi +else + if [ -s "$SRC_DIR/$SRC.sig" ]; then + SIGNATURE="$SRC.sig" + elif [ -s "$SRC_DIR/$SRC.asc" ]; then + SIGNATURE="$SRC.asc" + else + echo Trying to get signature file from $URL.sig... + if wget "$URL.sig" -O "$SRC_DIR/$SRC.sig"; then + SIGNATURE="$SRC.sig" + else + rm $SRC_DIR/$SRC.sig + echo Trying to get signature file from $URL.asc... + if wget "$URL.asc" -O "$SRC_DIR/$SRC.asc"; then + SIGNATURE="$SRC.asc" + else + rm $SRC_DIR/$SRC.asc + echo "Error getting source's signature file" + exit $ERROR_GPG + fi + fi + fi +fi + +echo Checking $SRC_DIR/$SRC with gpg using $SRC_DIR/$SIGNATURE... +gpg --verify "$SRC_DIR/$SIGNATURE" "$SRC_DIR/$SRC" || exit $ERROR_GPG +echo Success. + +# Check Manifest file +if [ -e "$CWD/Manifest" ]; then + + # Manifest signature checking + if grep -q -- "-----BEGIN PGP SIGNED MESSAGE-----" $CWD/Manifest; then + echo "Checking Manifest signature..." + gpg --verify $CWD/Manifest + if [ "$?" != "0" ]; then + exit $ERROR_MANIFEST + fi + fi + + MANIFEST_LINES="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | wc -l`" + + for ((MANIFEST_COUNT=1; MANIFEST_COUNT <= $MANIFEST_LINES; MANIFEST_COUNT++)); do + + MANIFEST_LINE="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | head -n $MANIFEST_COUNT | tail -n 1`" + MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`" + MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`" + + if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then + MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE" + else + MANIFEST_FILE="`find $CWD -name $MANIFEST_FILE`" + fi + + if [ ! -e "$MANIFEST_FILE" ] || [ -d "$MANIFEST_FILE" ]; then + continue + fi + + echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..." + + SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`" + SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`" + + # Check source code size + if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then + echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC" + exit $ERROR_MANIFEST + else + echo "Size match." + fi + + # Check source code integrity + for ALGO in md5 rmd160 sha1 sha256 sha512; do + if [ $ALGO = "rmd160" ]; then + ALGO_SRC="`openssl rmd160 $MANIFEST_FILE | awk '{ print $2 }'`" + else + ALGO_SRC="`"$ALGO"sum $MANIFEST_FILE | awk '{ print $1 }'`" + fi + ALGO="`echo $ALGO | tr '[:lower:]' '[:upper:]'`" + ALGO_MANIFEST=$(echo $MANIFEST_LINE | sed "s/.* $ALGO //" | awk '{ print $1 }') + if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then + echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC" + exit $ERROR_MANIFEST + else + echo "$ALGO match." + fi + done + + done + +else + exit $ERROR_MANIFEST +fi + +# Untar +cd "$PKG_WORK" +tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR +PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`" +cd "$PKG_SRC" + +# Configure +CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix="$PREFIX" --libdir="$LIBDIR" $CONF_OPTIONS || exit $ERROR_CONF + +# Compile +make $NUMJOBS || exit $ERROR_MAKE + +# Install +make install DESTDIR="$PKG" || exit $ERROR_INSTALL + +# Strip binaries +( cd "$PKG" + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +# Install documentation +DOCS="CHANGELOG GPL README" +mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR +for doc in $DOCS; do + if [ -f "$doc" ]; then + cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + fi +done + +# Add package description (slack-desc) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EODESC > "$PKG/install/slack-desc" +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler-------------------------------------------------------| +kismet: kismet +kismet: +kismet: Kismet is an 802.11 layer2 wireless network detector, +kismet: sniffer, and intrusion detection system. Kismet will +kismet: work with any wireless card which supports raw +kismet: monitoring (rfmon) mode, and can sniff 802.11b, +kismet: 802.11a, and 802.11g traffic. +kismet: +kismet: +kismet: +kismet: +EODESC + +# Move config files to .new to avoid overwriting any system config +for config_file in etc/kismet.conf etc/kismet_drone.conf etc/kismet_ui.conf; do + mv $PKG/$config_file $PKG/$config_file.new +done + +# Add a post-installation script (doinst.sh) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EOSCRIPT > "$PKG/install/doinst.sh" +config() { + NEW="\$1" + OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" + OLD="\$(dirname \$NEW)/\$(basename \$OLD .sample)" + OLD="\$(dirname \$NEW)/\$(basename \$OLD .dist)" + + # If there's no config file by that name, mv it over: + if [ ! -r \$OLD ]; then + mv \$NEW \$OLD + elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then + # toss the redundant copy + rm \$NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +mkgroup() { + GROUP="\$1" + if ! grep -qe "^\$GROUP:" etc/group; then + echo Creating group \$GROUP... + chroot . /usr/sbin/groupadd \$GROUP + fi +} + +mkuser() { + USER="\$1" + if [ ! -z "\$2" ]; then + GROUP="\$2" + else + GROUP="\$USER" + fi + if ! grep -qe "^\$USER:" etc/passwd; then + echo Creating user \$USER... + chroot . /usr/sbin/useradd \$USER -g \$GROUP + fi +} + +config etc/kismet.conf.new ; config etc/kismet_drone.conf.new; config etc/kismet_ui.conf.new +EOSCRIPT + +# Build the package +cd "$PKG" +mkdir -p $REPOS/$SLACKBUILD_PATH +makepkg -l y -c n "$REPOS/$SLACKBUILD_PATH/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG + +# Delete source and build directories if requested +if [ "$CLEANUP" == "yes" ] || [ "$1" = "--cleanup" ]; then + rm -rf "$PKG_WORK" "$PKG" +fi -- cgit v1.2.3