summaryrefslogtreecommitdiffstats
path: root/app-misc/sshsleeper
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
commitca9627e70852f6b2e835660df870fe3ab405882d (patch)
tree0a008b1d5b16fa0679a195ed7b5662c7891f591c /app-misc/sshsleeper
downloaddarklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.gz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.bz2
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.xz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.zip
Initial import
Diffstat (limited to 'app-misc/sshsleeper')
-rw-r--r--app-misc/sshsleeper/Manifest2
-rw-r--r--app-misc/sshsleeper/files/sshsleeper.c38
-rw-r--r--app-misc/sshsleeper/sshsleeper-0.1.ebuild37
3 files changed, 77 insertions, 0 deletions
diff --git a/app-misc/sshsleeper/Manifest b/app-misc/sshsleeper/Manifest
new file mode 100644
index 0000000..8e15f8c
--- /dev/null
+++ b/app-misc/sshsleeper/Manifest
@@ -0,0 +1,2 @@
+AUX sshsleeper.c 769 RMD160 9cf34c6e8254eeac90b27559180d760e90a838ee SHA1 3521f6b66862e48dd36cb41a93a4543715d514c6 SHA256 d2e3cd2c0576eb8b85b51de8e52b9025c0b4dbaf37fc5b84b99a01e19f66b816
+EBUILD sshsleeper-0.1.ebuild 814 RMD160 fc14687d26acbf33ee149ca51df5489f27b427e9 SHA1 817946110b886ad80e031595e1a713c7edc54b40 SHA256 5e3ff4f6544b42bdddd5c46afb245fe7b8a01f1f804c6679eee7bcb0c2aafb3e
diff --git a/app-misc/sshsleeper/files/sshsleeper.c b/app-misc/sshsleeper/files/sshsleeper.c
new file mode 100644
index 0000000..a88c4bc
--- /dev/null
+++ b/app-misc/sshsleeper/files/sshsleeper.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+#define BUFSIZE 128
+
+int main() {
+ int i;
+ unsigned int val;
+ int slpsec = 3600;
+
+ char buf[BUFSIZE+1];
+
+ FILE *f = fopen("/etc/sshsleeper.conf", "r");
+ if (f) {
+ while (fgets(buf, BUFSIZE, f)) {
+ // check if we are facing a long string
+ if (strlen(buf) >= BUFSIZE) {
+ while ((fgets(buf, BUFSIZE, f))&&(strlen(buf) >= BUFSIZE));
+ }
+
+ for (i = 0; buf[i] == ' '; i++);
+ if (strncmp(buf, "duration", 8)) continue;
+ for (i += 8; buf[i] == ' '; i++);
+ if (sscanf(buf + i, "%u", &val) != 1) continue;
+
+ if (val > 0) {
+ slpsec = val;
+ break;
+ }
+
+ }
+ fclose(f);
+ }
+
+ printf("Sleeping for %u seconds\n", slpsec);
+ sleep(slpsec);
+}
diff --git a/app-misc/sshsleeper/sshsleeper-0.1.ebuild b/app-misc/sshsleeper/sshsleeper-0.1.ebuild
new file mode 100644
index 0000000..ca464ab
--- /dev/null
+++ b/app-misc/sshsleeper/sshsleeper-0.1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header:
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="just a sleep app to be used for ssh backdoors"
+HOMEPAGE="http://dside.dyndns.org/"
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="x86 amd64"
+
+
+
+src_compile() {
+ gcc -o ${PN} "${FILESDIR}"/${PN}.c
+}
+
+src_install() {
+ dobin ${PN}
+
+ dodir /etc
+ echo "duration 14400" > "${D}"/etc/sshsleeper.conf
+
+ dodir /var/lib/sshsleeper
+ dodir /var/lib/sshsleeper/.ssh
+}
+
+pkg_postinst() {
+ enewuser sleep 601 /usr/bin/sshsleeper /var/lib/sshsleeper nogroup -K PASS_MAX_DAYS=31
+ fowners sleep.nogroup /var/lib/sshsleeper
+ fowners sleep.nogroup /var/lib/sshsleeper/.ssh
+
+ einfo ""
+ einfo "Please, add sshsleaper to /etc/shells"
+}