Showing posts with label user console manipulation. Show all posts
Showing posts with label user console manipulation. Show all posts

write matrix chars to another user console for manipulation

watch the video for action :-).

#!/bin/bash -       
#title           :matrix_to_user_console.sh
#description     :This script will write matrix characters to another user console :-) .
#author          :Mehmet DEMİR
#date            :20140302
#version         :0.1    
#usage           :bash matrix_to_user_console.sh
#notes           :Will be fun!
#==============================================================================

#remove comment if target user at remote
#ssh root@10.6.181.111 

target_user="mehmet"
the_message="\n
\n
################################################\n
################################################\n
################## THE MATRIX ##################\n
################################################\n
# Your computer got involved in matrix network.#\n
# Don't touch this machine! ####################\n
################################################\n
################################################\n
\n
\n"
message_duration=10 # as second
target_tty="/dev/"`who|grep $target_user|tail -1|awk {'print $2'}`


echo -e $the_message > $target_tty
sleep $message_duration

# from https://github.com/devsnd/matrix-curses/blob/master/matrix-curses.py
MATRIX_CODE_CHARS=(ɀ Ɂ ɂ ŧ Ϣ ϣ Ϥ ϥ Ϧ ϧ Ϩ ϫ Ϭ ϭ Ϯ ϯ ϰ ϱ Ϣ ϣ Ϥ ϥ Ϧ ϧ Ϩ ϩ Ϫ ϫ Ϭ ϭ Ϯ ϯ ϰ ߃  ߄ ༣ ༤ ༥ ༦ ༧ ༩ ༪ ༫ ༬ ༭ ༮ ༯ ༰ ༱ ༲ ༳ ༶)

count=${#MATRIX_CODE_CHARS[*]}

maxcol=15

while (true);  do  

    noshow=$((RANDOM % $count))
    noshowchar[$noshow]=$noshow;

    for (( i=0; i<=$maxcol; i++ ))
    do
            if [ "${noshowchar[$i]}" == "$i" ]; then
                printf '\t%s' ' ' > $target_tty
            else
                index=$((RANDOM % $count))
                printf '\t%s' ${MATRIX_CODE_CHARS[$index]} > $target_tty          
            fi  
    done
     
     printf '\n' > $target_tty
     sleep 0.05

     noshowchar[$((RANDOM % $count))]=100;
     noshowchar[$((RANDOM % $count))]=100;
     noshowchar[$((RANDOM % $count))]=100;
     noshowchar[$((RANDOM % $count))]=100;
     noshowchar[$((RANDOM % $count))]=100;

done

exit 0