URI: 
       trick - haunted-hosts - Unnamed repository; edit this file 'description' to name the repository.
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
       trick (3128B)
       ---
            1 #!/bin/sh
            2 ip_file=/var/hauntedhosts/client_ips
            3 
            4 # Capture connection info
            5 server_ip=$(
            6         echo "$SSH_CONNECTION" |\
            7         awk '{ print $3 }'
            8 );
            9 server_port=$(
           10         echo "$SSH_CONNECTION" |\
           11         awk '{ print $4 }'
           12 );
           13 client_ip=$(
           14         echo "$SSH_CONNECTION" |\
           15         awk '{ print $1 }'
           16 );
           17 hashed_ip=$( printf "%s\n" "$client_ip" |\
           18         openssl dgst -sha256
           19 );
           20 printf "%s\n" "$hashed_ip" >> $ip_file
           21 
           22 # Lookup number of times client has reconnected
           23 client_recons=$(
           24         grep -co "$hashed_ip" $ip_file
           25 );
           26 
           27 err_authentication() {
           28         printf "Received disconnect from %s port %s: Too many satanic failures\n" $server_ip $server_port
           29         exit
           30 }
           31 
           32 err_authentication_again() {
           33         printf "Received disconnect from %s port %s: Really? You're trying again?\n" $server_ip $server_port
           34         exit
           35 }
           36 
           37 err_authentication_again_again() {
           38         printf "Go away...\n" 
           39         exit
           40 }
           41 
           42 function err_rm_root {
           43         printf "rm: /etc/pf.conf: Permission denied\n"
           44         printf "rm: /etc/ssh/sshd_config: Permission denied\n"
           45         printf "rm: /etc/ssl/cert.pem: Permission denied\n"
           46         printf "rm: /etc/passwd: Permission denied\n"
           47         exit
           48 }
           49 
           50 function err_login_fail {
           51         printf "
           52 Last login: %s from %s
           53 OpenBSD 666 (SATANIC) #-1: Thur Oct 31 21:00:00 CET 2024
           54 
           55 Welcome to OpenBSD: The proactively satanic Cult-like operating system.
           56         \n" "$( date )" "$client_ip"
           57         printf "Could not connect to X666, maybe you need to sin?\n"
           58 }
           59 function err_satanic_verse {
           60         timeout=5
           61         index=0
           62         while [ $index -le $timeout ]; do
           63                 printf "."
           64                 sleep 1
           65                 index=$(( $index + 1 ))
           66         done
           67         printf "\n"
           68         verse="
           69 What kind of idea are you? Are you the kind that compromises, |
           70 does deals, accomodates itself to society, aims to find a niche, |
           71 to survive; or are you the cussed, bloody-minded, ramrod-backed |
           72 type of damnfool notion that would rather break than sway with the |
           73 breeze? The kind that will almost certainly, ninety-nine times |
           74 out of hundred, be smashed to bits; but, the hundredth time, will |
           75 change the world?"
           76         for word in $verse; do
           77                 if [ "$word" = "|" ]; then
           78                         printf "\n"
           79                 else
           80                         printf "%s " "$word"
           81                         word_len=$(
           82                                 printf "%s\n" "$word" |\
           83                                 wc -c
           84                         );
           85                         sleep_len=$(
           86                                 echo "$word_len * 0.05" |\
           87                                 bc
           88                         );
           89                         sleep "$sleep_len"
           90                 fi
           91         done
           92         printf "\n"
           93         exit
           94 }
           95 
           96 function err_dd {
           97         printf "
           98 dd if=/dev/urandom of=/dev/sda0
           99 \n"
          100         count=1000
          101         index=0
          102         r_in=0
          103         r_out=0
          104         r_bytes=0
          105         r_secs=0
          106         while [ $index -le $count ]; do
          107                 printf "%s+0 records in\n%s+0 records out\n%s bytes transferred in %s secs (666 bytes/sec)\n" $r_in $r_out $r_bytes $r_secs
          108                 r_in=$(( $r_in + 13  ))
          109                 r_out=$(( $r_out + 21 ))
          110                 r_secs=$( echo "$r_secs + 0.1" | bc )
          111                 r_bytes=$(( $r_bytes + 666 ))
          112                 sleep 0.1
          113                 for i in $( seq 0 3 ); do
          114                         printf "\033[A"
          115                 done
          116         done
          117         exit
          118 }
          119 
          120 function err_secret {
          121         printf "Whoa, you actually got here.\n"
          122 }
          123 
          124 function end_happy_halloween {
          125         printf "... And have a Happy Hallowe'en! Thanks for connecting :)\n"
          126 }
          127 
          128 case $client_recons in
          129         1)
          130                 err_authentication
          131                 ;;
          132         2)
          133                 err_rm_root
          134                 ;;
          135         3)
          136                 err_login_fail
          137                 ;;
          138         4)
          139                 err_satanic_verse
          140                 ;;
          141         5)
          142                 err_authentication_again
          143                 ;;
          144         6)
          145                 err_authentication_again_again
          146                 ;;
          147         7)
          148                 end_happy_halloween
          149                 ;;
          150         666)
          151                 err_secret
          152                 ;;
          153         *)
          154                 exit
          155                 ;;
          156 esac