summaryrefslogtreecommitdiffstats
path: root/lib/network
diff options
context:
space:
mode:
Diffstat (limited to 'lib/network')
-rw-r--r--lib/network49
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/network b/lib/network
deleted file mode 100644
index 9d7ea197..00000000
--- a/lib/network
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-#include core
-
-anytelnet(){
- # find Telnet or similar and executes it at the end
- # requires exist
- # if env TELNET is set, will be trying to run this
- # Tries the following things:
- # telnet
- # nc
- # netcat
- # busybox telnet
- if [ -e "${TELNET:-does_not_exist}" ]; then
- info"Will be using $TELNET as Telnet Client"
- elif exists telnet ;then
- TELNET="$(command -v telnet)"
- elif exists nc ;then
- TELNET="$(command -v nc)"
- elif exists netcat;then
- TELNET="$(command -v netcat)"
- elif exists busybox;then
- TELNET="$(command -v busybox) telnet"
- else
- error "Cannot find telnet binary, please install either telnet-client or busybox or netcat or provided TELNET environment.\nbailing out!"
- return 1
- fi
- $TELNET $@
-}
-
-send_irc(){
- ## reads from stdin, writes to IRC
- ##
- ## requires func: exists() anytelnet()
- if [ -z "${HOSTN:-}" ]; then
- HOSTN="$(get_hostname)"
- info "no HOSTN given, using $HOSTN instead"
- fi
- IRCCHANNEL=${IRCCHANNEL:-"#krebs_incoming"}
- IRCSERVER=${IRCSERVER:-"irc.freenode.net"}
- IRCPORT=${IRCPORT:-6667}
- NICK="${HOSTN}_$(head /dev/urandom | tr -dc "0123456789" | head -c3)"
- info "starting irc connect as $NICK"
- ( echo "NICK $NICK";
- echo "USER $NICK $IRCSERVER bla : $NICK";
- echo "JOIN $IRCCHANNEL";
- sleep 23;
- while read line; do echo "PRIVMSG $IRCCHANNEL :$line";sleep 1;done
- sleep 5; ) | anytelnet $IRCSERVER $IRCPORT 2>/dev/null | line_to_dot
-}