diff --git a/app-forensics/spiderfoot/Manifest b/app-forensics/spiderfoot/Manifest new file mode 100644 index 000000000..96b777642 --- /dev/null +++ b/app-forensics/spiderfoot/Manifest @@ -0,0 +1 @@ +DIST spiderfoot-2.12.0.tar.gz 3974759 BLAKE2B 5d65f760ff165c826e68b6d11205f802c0e917a9ebcdde70e88cf8f1ce2716d7d2fdca1eeacde3b7e30966a6795248b5f7885bc816dddb8eb9bcc48c22bd0ae9 SHA512 5657eecdf68078019dbae490f35ba868483dd92993718b86bdbe819d5fc0c01e226bfadf7e6f0dc900d7f017351bd66e1855ebfb4e6964b5f3b39bd5de34c0dd diff --git a/app-forensics/spiderfoot/files/spiderfoot-2.12.0_add_support_user_homedir.patch b/app-forensics/spiderfoot/files/spiderfoot-2.12.0_add_support_user_homedir.patch new file mode 100644 index 000000000..4a9716764 --- /dev/null +++ b/app-forensics/spiderfoot/files/spiderfoot-2.12.0_add_support_user_homedir.patch @@ -0,0 +1,39 @@ +diff -ur a/sfdb.py b/sfdb.py +--- a/sfdb.py 2018-03-02 20:31:37.000000000 +0300 ++++ b/sfdb.py 2019-04-21 12:02:21.092534120 +0300 +@@ -13,6 +13,7 @@ + import sqlite3 + import re + import time ++import os + from sflib import SpiderFoot + + # SQLite doesn't support regex queries, so we create +@@ -218,10 +219,14 @@ + def __init__(self, opts): + self.sf = SpiderFoot(opts) + ++ DBPATH = str(os.path.expanduser('~') + '/.spiderfoot') ++ if not os.path.exists(DBPATH): ++ os.makedirs(os.path.join(DBPATH)) ++ + # connect() will create the database file if it doesn't exist, but + # at least we can use this opportunity to ensure we have permissions to + # read and write to such a file. +- dbh = sqlite3.connect(self.sf.myPath() + "/" + opts['__database'], timeout=10) ++ dbh = sqlite3.connect(DBPATH + "/" + opts['__database'], timeout=10) + if dbh is None: + self.sf.fatal("Could not connect to internal database, and couldn't create " + opts['__database']) + dbh.text_factory = str +diff -ur a/sflib.py b/sflib.py +--- a/sflib.py 2018-03-02 20:31:37.000000000 +0300 ++++ b/sflib.py 2019-04-21 12:02:50.957411169 +0300 +@@ -382,7 +382,7 @@ + + # Return the cache path + def cachePath(self): +- path = self.myPath() + '/cache' ++ path = str(os.path.expanduser('~') + '/.spiderfoot' + '/cache') + if not os.path.isdir(path): + os.mkdir(path) + return path diff --git a/app-forensics/spiderfoot/files/spiderfoot-daemon.confd b/app-forensics/spiderfoot/files/spiderfoot-daemon.confd new file mode 100644 index 000000000..1de7cedee --- /dev/null +++ b/app-forensics/spiderfoot/files/spiderfoot-daemon.confd @@ -0,0 +1,10 @@ +# /etc/conf.d/spiderfoot-daemon: config file for /etc/init.d/spiderfoot-daemon + +# Address and port service will listen on +# Default: 127.0.0.1 +#SF_HOST="127.0.0.1" +# Default: 5001 +#SF_PORT="5001" + +# Path to log file (needs to be absolute path) +#SF_LOGFILE="" diff --git a/app-forensics/spiderfoot/files/spiderfoot-daemon.initd b/app-forensics/spiderfoot/files/spiderfoot-daemon.initd new file mode 100644 index 000000000..1856348ac --- /dev/null +++ b/app-forensics/spiderfoot/files/spiderfoot-daemon.initd @@ -0,0 +1,37 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +SF_LOGFILE="${SF_LOGFILE:-/var/log/${RC_SVCNAME}.log}" + +USER="spiderfoot" +GROUP="spiderfoot" + +description="The most complete OSINT collection and reconnaissance tool" +command="/usr/bin/sf" +command_background=true +command_user="${USER}:${GROUP}" +command_args="${SF_HOST:-127.0.0.1}:${SF_PORT:-5001}" +pidfile="/run/${RC_SVCNAME}.pid" +start_stop_daemon_args="--quiet -1 ${SF_LOGFILE}" +retry="${SF_TERMTIMEOUT:-"TERM/25/KILL/5"}" +extra_commands="checkconfig" + +depend() { + after net +} + +checkconfig() { + if ! [ -f "${SF_LOGFILE}" ]; then + touch "${SF_LOGFILE}" \ + && chmod 0660 "${SF_LOGFILE}" \ + && chown ${USER}:${GROUP} "${SF_LOGFILE}" > /dev/null 2>&1 \ + || eerror "Failed to create: ${SF_LOGFILE}" + fi +} + +start_pre() { + checkconfig || return 1 +} + +# vim: set ft=gentoo-init-d ts=4 : diff --git a/app-forensics/spiderfoot/metadata.xml b/app-forensics/spiderfoot/metadata.xml new file mode 100644 index 000000000..c4511c144 --- /dev/null +++ b/app-forensics/spiderfoot/metadata.xml @@ -0,0 +1,8 @@ + + + + + email@linxon.ru + Yury Martynov + + diff --git a/app-forensics/spiderfoot/spiderfoot-2.12.0.ebuild b/app-forensics/spiderfoot/spiderfoot-2.12.0.ebuild new file mode 100644 index 000000000..c4ee6908f --- /dev/null +++ b/app-forensics/spiderfoot/spiderfoot-2.12.0.ebuild @@ -0,0 +1,99 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python2_7 ) +PYTHON_REQ_USE="sqlite,ssl,readline" + +inherit eutils python-single-r1 user + +DESCRIPTION="The most complete OSINT collection and reconnaissance tool" +HOMEPAGE="https://www.spiderfoot.net" + +if [[ ${PV} == *9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/smicallef/spiderfoot" +else + SRC_URI="https://github.com/smicallef/spiderfoot/archive/v${PV}-final.tar.gz -> ${P}.tar.gz" + # >=cherrypy-17.4.1 — is not support "x86" (ebuild) + KEYWORDS="~amd64 ~arm64" + S="${WORKDIR}/${P}-final" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +DEPEND="${PYTHON_DEPS}" +RDEPEND="${DEPEND} + >=dev-python/cherrypy-17.4.1[${PYTHON_USEDEP}] + dev-python/m2crypto[${PYTHON_USEDEP}] + dev-python/mako[${PYTHON_USEDEP}] + dev-python/beautifulsoup:4[${PYTHON_USEDEP}] + dev-python/lxml[${PYTHON_USEDEP}] + >=dev-python/netaddr-0.7.18[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] + >=dev-python/ipaddr-2.2.0[${PYTHON_USEDEP}] + dev-python/future[${PYTHON_USEDEP}] + dev-python/phonenumbers[${PYTHON_USEDEP}] + dev-python/pygexf[${PYTHON_USEDEP}] + dev-python/PyPDF2[${PYTHON_USEDEP}] + net-libs/stem[${PYTHON_USEDEP}]" + +pkg_setup() { + python-single-r1_pkg_setup + + enewgroup ${PN} + enewuser ${PN} -1 -1 /var/lib/${PN} ${PN} +} + +src_prepare() { + python_fix_shebang "${S}" + + # run it without fucking root + eapply "${FILESDIR}"/${P}_add_support_user_homedir.patch + eapply_user +} + +src_install() { + # you need check distro files and update this array before bump it + local dist_files=( + "dyn" + "ext" + "modules" + "static" + *.py + ) + + insinto /usr/share/${PN} + for x in ${dist_files[@]}; do + doins -r ${x} + done + + for x in sf sfcli; do + make_wrapper "${x}" \ + "python2 /usr/share/${PN}/${x}.py" \ + "/usr/share/${PN}/" + done + + dosym ./sf /usr/bin/${PN} + dosym ./sfcli /usr/bin/${PN}-cli + + keepdir /var/lib/${PN} + fowners ${PN}:${PN} /var/lib/${PN} + + newinitd "${FILESDIR}"/spiderfoot-daemon.initd spiderfoot-daemon + newconfd "${FILESDIR}"/spiderfoot-daemon.confd spiderfoot-daemon + + dodoc README.md Dockerfile + + python_optimize "${D}"/usr/share/${PN} +} + +pkg_postinst() { + elog "\nJust run:" + elog " ~# rc-service spiderfoot-daemon start" + elog "and open in browser http://127.0.0.1:5001\n" + + elog "See documentation: https://www.spiderfoot.net/documentation/\n" +}