hostapd-mana: add live 9999 and patches for some components

This commit is contained in:
Yury Martynov 2019-09-22 14:01:59 +03:00
parent 54b9d3be2d
commit 78622a5f93
No known key found for this signature in database
GPG key ID: EBE62DD0CCEAE19E
5 changed files with 183 additions and 87 deletions

View file

@ -0,0 +1,41 @@
# SensePost PythonTemplate
#
# Copyright (C) 2012 SensePost <ian@sensepost.com>
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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, see <http://www.gnu.org/licenses/>.
# This file contains configuration options for the script.
# Configuration options should be valid python variable declarations
# Control verboseness
VERBOSE=1
# Thread Count - this will control how many threads are spawned.
THREADS=10
# Thread Control - this file will be created when crackapd is run.
# Removing this file will cause crackapd to exit.
RUNFILE="/tmp/crackapd.run"
# HostAPD - This is where the hostapd configuration file is
HOSTAPD="/etc/hostapd-mana/hostapd-karma-eap.conf"
# The EAP User file (to add cracked credentials to.
EAPUSER="/etc/hostapd-mana/hostapd.eap_user"
# The script used to crack the hashes
CRACKEX="/usr/sbin/asleap"
# The wordlist to use for cracking
WORDLST="/usr/share/wordlists/rockyou.txt"

View file

@ -0,0 +1,34 @@
diff -ur a/crackapd/crackapd.py b/crackapd/crackapd.py
--- a/crackapd/crackapd.py 2019-01-10 16:26:23.000000000 +0300
+++ b/crackapd/crackapd.py 2019-09-22 08:11:09.714715885 +0300
@@ -50,7 +50,7 @@
f = open(s_file, 'a')
f.write(str(s_string) + "\n")
f.close()
- s = str("pkill -SIGHUP hostapd")
+ s = str("pkill -SIGHUP hostapd-mana")
p = os.popen(s, "r")
while 1:
line = p.readline()
@@ -102,16 +102,16 @@
# We start off getting the path of the file being executed, and replace python script name with nada
# The will give us a base directory we can work from
- THEPATH=str(os.path.realpath(__file__)).replace("crackapd.py", "")
+ THEPATH=str("/etc/hostapd-mana/")
# Global Variables. These get overwritten in config file...
VERBOSE=1
THREADS=10
RUNFILE="/tmp/crackapd.run"
- HOSTAPD="/etc/mana-toolkit/hostapd-karma-eap.conf"
- EAPUSER="/etc/mana-toolkit/hostapd.eap_user"
- ENNODES="/var/lib/mana-toolkit/ennode.node"
- CRACKEX="/usr/bin/asleap"
+ HOSTAPD="/etc/hostapd-mana/hostapd-karma-eap.conf"
+ EAPUSER="/etc/hostapd-mana/hostapd.eap_user"
+ ENNODES="/var/lib/hostapd-mana/ennode.node"
+ CRACKEX="/usr/sbin/asleap"
WORDLST="/usr/share/wordlists/rockyou.txt"
# Global Variables. These are calculated... :P

View file

@ -0,0 +1,21 @@
diff -ur a/hostapd/hostapd.conf b/hostapd/hostapd.conf
--- a/hostapd/hostapd.conf 2019-01-10 16:26:23.000000000 +0300
+++ b/hostapd/hostapd.conf 2019-09-22 10:01:40.958822235 +0300
@@ -65,7 +65,7 @@
# Enabled Sycophant
# Allows relaying of inner EAP authentication methods with a modified wpa_supplicant
# wpa_sycophant is available at https://github.com/sensepost/wpa_sycophant
-#enable_sycophant=1
+enable_sycophant=1
# Sycophant state file directory
# Sycophant communicates with wpa_sycophant through several files
@@ -138,7 +138,7 @@
# than one interface is used.
# /var/run/hostapd is the recommended directory for sockets and by default,
# hostapd_cli will use it when trying to connect with hostapd.
-ctrl_interface=/var/run/hostapd
+ctrl_interface=/var/run/hostapd-mana
# Access control for the control interface can be configured by setting the
# directory to allow only members of a group to use sockets. This way, it is

View file

@ -1,87 +0,0 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python2_7 )
inherit python-r1 toolchain-funcs systemd savedconfig
DESCRIPTION="SensePost's modified hostapd for wifi attacks"
HOMEPAGE="https://w1f1.net https://github.com/sensepost/hostapd-mana"
if [[ $PV == *9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/sensepost/hostapd-mana.git"
else
SRC_URI="https://github.com/sensepost/hostapd-mana/archive/${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~x86"
fi
LICENSE="BSD"
SLOT="0"
IUSE="+crackapd"
DEPEND="
crackapd? ( ${PYTHON_DEPS} )
dev-libs/openssl:0=[-bindist]
dev-libs/libnl:3"
RDEPEND="${DEPEND}"
MY_PN="${PN%-mana}"
S="${S}/${MY_PN}"
src_prepare() {
#sed -e "s:/etc/hostapd:/etc/${PN}:g" \
# -i "${S}/hostapd.conf" || die
if use crackapd; then
sed -e "s/THEPATH + str('crackapd.conf')/str('\/etc\/mana-toolkit\/crackapd.conf')/" \
-i ../crackapd/crackapd.py || die
fi
# Allow users to apply patches to src/drivers for example,
# i.e. anything outside ${S}/${MY_PN}
pushd ../ >/dev/null || die
default
popd >/dev/null || die
}
src_configure() {
restore_config .config
default_src_configure
}
src_compile() {
emake V=1
}
src_install() {
#insinto "/etc/${PN}"
#doins ${MY_PN}.{conf,accept,deny,eap_user,radius_clients,sim_db,wpa_psk}
newsbin ${MY_PN} hostapd-mana
newbin ${MY_PN}_cli hostapd-mana_cli
if use crackapd; then
insinto "/etc/${PN}"
pushd ../crackapd >/dev/null || die
doins crackapd.conf
python_foreach_impl python_newscript crackapd.py crackapd
popd >/dev/null || die
fi
fperms -R 600 "/etc/${PN}"
doman ${MY_PN}{.8,_cli.1}
dodoc ChangeLog README
docinto examples
dodoc wired.conf
save_config .config
}

View file

@ -0,0 +1 @@
./hostapd-mana-9999.ebuild

View file

@ -0,0 +1,86 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python2_7 )
inherit python-r1 toolchain-funcs savedconfig
DESCRIPTION="SensePost's modified hostapd for wifi attacks"
HOMEPAGE="https://w1f1.net https://github.com/sensepost/hostapd-mana"
if [[ $PV == *9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/sensepost/hostapd-mana.git"
else
SRC_URI="https://github.com/sensepost/hostapd-mana/archive/${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~x86"
fi
LICENSE="BSD"
SLOT="0"
IUSE="+crackapd"
DEPEND="
crackapd? (
${PYTHON_DEPS}
app-crypt/asleap
)
dev-libs/openssl:0=[-bindist]
dev-libs/libnl:3
net-libs/libnfnetlink"
RDEPEND="${DEPEND}"
MY_PN="${PN%-mana}"
S="${S}/${MY_PN}"
src_prepare() {
sed -e "s:/etc/hostapd:/etc/${PN}:g" \
-i "${S}/hostapd.conf" || die
# Allow users to apply patches to src/drivers for example,
# i.e. anything outside ${S}/${MY_PN}
pushd ../ >/dev/null || die
eapply "${FILESDIR}"/crackapd_pentoo.patch
eapply "${FILESDIR}"/update_hostapd.conf.patch
default
popd >/dev/null || die
}
src_configure() {
restore_config .config
default_src_configure
}
src_compile() {
emake V=1
}
src_install() {
insinto "/etc/${PN}"
doins ${MY_PN}.{conf,accept,deny,eap_user,radius_clients,sim_db,wpa_psk}
newsbin ${MY_PN} hostapd-mana
newbin ${MY_PN}_cli hostapd-mana_cli
if use crackapd; then
insinto "/etc/${PN}"
pushd ../crackapd >/dev/null || die
doins "${FILESDIR}"/crackapd.conf
python_foreach_impl python_newscript crackapd.py crackapd
popd >/dev/null || die
fi
fperms -R 600 "/etc/${PN}"
dodoc ChangeLog README
save_config .config
}