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

EAPI=8

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

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="f10fdbfeb149d9b5647b397e1ce7fa8ab0d39799"
SRC_URI="https://github.com/byt3bl33d3r/DeathStar/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz"

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

#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}]
	test? (
		dev-python/pytest[${PYTHON_USEDEP}]
		dev-python/pytest-httpx[${PYTHON_USEDEP}]
		dev-python/rich[${PYTHON_USEDEP}]
	)
"

distutils_enable_tests pytest

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

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"
}
