PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Sending messages through pts tty on linux

Go down

Sending messages through pts tty on linux Empty Sending messages through pts tty on linux

Post by jamied_uk 22nd July 2021, 22:55



sudo command required in most cases!


Blast.sh


Code:
#!/bin/bash
# Message Blaster (c) Jnet 2021
# jnet.sytes.net
#
# https://jnet.forumotion.com/t1754-sending-messages-through-pts-tty-on-linux#2715
#
# ./blast "Message"
#
# echo $message > /dev/pts/$f
spec="-en "
echo -en "\e[92mWelcome To PTS / TTY Blaster (c) J~Net 2021"
defaultmessage="Get Off Now!!!"
echo ""
if [ "$#" -eq  "0" ]
  then
    read -p "Enter message [$defaultmessage]: " message
else
    message=$1
fi
# Cleanup
rm -f out.txt
# Display users with w
w
#
MSG="Get Off Now!!!"
for f in /dev/pts/* ; # Puts /dev/pts/1 into item list so remember that!
do
    echo "$f \n" >> out.txt # /dev/pts/$f
    echo $spec $message > $f
done



SpamBlast.sh

Code:
#!/bin/bash
# Message Blaster (c) Jnet 2021
# jnet.sytes.net
#
# https://jnet.forumotion.com/t1754-sending-messages-through-pts-tty-on-linux#2715
#
# ./spamblast "Message"
#
# echo $message > /dev/pts/$f
spec="-en "
while true;
do
echo -en "\e[92mWelcome To PTS / TTY Blaster (c) J~Net 2021"
defaultmessage="Get Off Now!!!"
echo ""
if [ "$#" -eq  "0" ]
  then
    read -p "Enter message [$defaultmessage]: " message
else
    message=$1
fi

# Cleanup
rm -f out.txt
# Display users with w
w
#
#message="Get Off Now!!!"
for f in /dev/pts/* ; # Puts /dev/pts/1 into item list so remember that!
do
    echo "$f \n" >> out.txt # /dev/pts/$f
    echo $spec $message > $f
    cat $message | sudo $f
done
done


Last edited by jamied_uk on 22nd July 2021, 23:16; edited 1 time in total
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Sending messages through pts tty on linux Empty Re: Sending messages through pts tty on linux

Post by jamied_uk 22nd July 2021, 23:08

Running is simple sudo file.sh

or make executable


Code:
sudo chmod +x *.sh

./file.sh

sudo is required in  most cases!

Code:
./blast.sh "message here!"

./spamblast.sh "bla bla bla "
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum