# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DISTUTILS_USE_PEP517=poetry
PYTHON_COMPAT=( python3_{10..12} )

inherit distutils-r1

DESCRIPTION="A tool to gain Domain Admin rights with a push of a button"
HOMEPAGE="https://github.com/byt3bl33d3r/DeathStar"

HASH_COMMIT="1ced058fcbd73e89f13967cbadc1d375dc48f1d1"
SRC_URI="https://github.com/byt3bl33d3r/DeathStar/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz"

KEYWORDS="~amd64 ~x86"
LICENSE="GPL-3"
SLOT="0"

#requirements.txt
RDEPEND="${PYTHON_DEPS}
	app-exploits/empire
	dev-python/certifi[${PYTHON_USEDEP}]
	dev-python/colorama[${PYTHON_USEDEP}]
	dev-python/commonmark[${PYTHON_USEDEP}]
	dev-python/h11[${PYTHON_USEDEP}]
	dev-python/httpcore[${PYTHON_USEDEP}]
	dev-python/httpx[${PYTHON_USEDEP}]
	dev-python/idna[${PYTHON_USEDEP}]
	dev-python/pygments[${PYTHON_USEDEP}]
	dev-python/rfc3986[${PYTHON_USEDEP}]
	dev-python/rich[${PYTHON_USEDEP}]
	dev-python/sniffio[${PYTHON_USEDEP}]
	dev-python/typing-extensions[${PYTHON_USEDEP}]
"

S="${WORKDIR}/DeathStar-${HASH_COMMIT}"

src_prepare() {
	default
	# exclude is not supported by pyproject2setuppy
	sed -i '/^exclude/,/^\]/d' pyproject.toml || die
}

#src_prepare() {
#	sed -i \
#		-e "s/__version__ = '\(.*\)'/__version__ = '${PV}'/" \
#		DeathStar.py || die
#	default
#}

#src_install() {
#	python_foreach_impl python_newscript DeathStar.py $PN
#	dodoc README.md
#}

pkg_postinst() {
	einfo "\nSee the following URL:"
	einfo " * https://byt3bl33d3r.github.io/automating-the-empire-with-the-death-star-getting-domain-admin-with-a-push-of-a-button.html\n"
}