summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-09-28 22:48:17 +0200
committertv <tv@krebsco.de>2021-09-28 22:48:17 +0200
commited2c6bd9792afbc433ae4eb23f40e17b90420f99 (patch)
tree289de32dd7f58f46accf7ad25ed184db5aa45198 /lass/5pkgs
parent20e358043546482acfa8c6134f095c1a64ef144d (diff)
parente151cfd3298120ec541987d4beb155e18335a0d8 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'lass/5pkgs')
-rw-r--r--lass/5pkgs/proxychains-ng/default.nix16
-rw-r--r--lass/5pkgs/sshify/default.nix38
2 files changed, 54 insertions, 0 deletions
diff --git a/lass/5pkgs/proxychains-ng/default.nix b/lass/5pkgs/proxychains-ng/default.nix
new file mode 100644
index 000000000..488293f7c
--- /dev/null
+++ b/lass/5pkgs/proxychains-ng/default.nix
@@ -0,0 +1,16 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+ pname = "proxychains-ng";
+ version = "4.15";
+
+ src = fetchFromGitHub {
+ owner = "rofl0r";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "128d502y8pn7q2ls6glx9bvibwzfh321sah5r5li6b6iywh2zqlc";
+ };
+}
diff --git a/lass/5pkgs/sshify/default.nix b/lass/5pkgs/sshify/default.nix
new file mode 100644
index 000000000..aba0ab6bb
--- /dev/null
+++ b/lass/5pkgs/sshify/default.nix
@@ -0,0 +1,38 @@
+{ pkgs }:
+pkgs.writers.writeBashBin "sshify" ''
+ set -efu
+
+ TMPDIR=$(mktemp -d)
+
+ SSH_ARGS=()
+
+ while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ --)
+ shift
+ break
+ ;;
+ *)
+ SSH_ARGS+=($1)
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "$#" -le 0 ]]; then
+ echo no command specified
+ exit 1
+ fi
+
+ RANDOM_HIGH_PORT=$(shuf -i 20000-65000 -n 1)
+
+ cat << EOF >$TMPDIR/proxychains.conf
+ [ProxyList]
+ socks4 127.0.0.1 $RANDOM_HIGH_PORT
+ EOF
+
+ ssh -fNM -S "$TMPDIR/socket" -D "$RANDOM_HIGH_PORT" "''${SSH_ARGS[@]}"
+ trap "ssh -S $TMPDIR/socket -O exit bla 2>/dev/null; rm -rf $TMPDIR >&2" EXIT
+
+ ${pkgs.proxychains-ng}/bin/proxychains4 -q -f "$TMPDIR/proxychains.conf" "$@"
+''