this is for sending linux terminal messages to logged on members using two commands

View previous topic View next topic Go down

this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 25th March 2011, 22:22



1st
you will need notify installed on both machines and also ssh server access on the recipient side, if you have ssh access you can install notify remotely which is good!

if you need open ssh-srver

community.linuxmint.com/software/view/openssh-server

man.openbsd.org/ssh_config

Enable port 22 in you're firewall!

Code:
sudo apt install -y notify-osd libnotify-bin

Code:
Code:
#!/bin/bash
# (c) J~Net 2017
#
# chmod +x *.sh
#
# Non Kali Install
# sudo apt install -y notify-osd libnotify-bin
#
apt install -y notify-osd libnotify-bin
clear
echo "Hi & Welcome To J~Net Messenger (c) 2017 ~ To Quit ctrl z"
echo "Input Remote Username (ssh)"
read user
echo "Input IP Or Hostname"
read ip
echo "Input You're Name"
read from
echo "Input Message"
read msg
echo "Message Sent, App Will Now Exit, Thanks For Using J~Net Messenger."
ssh $user@$ip 'export DISPLAY=:0; notify-send "From '$from'" "'$msg'"'
# on remote pc u may need to install
# sudo apt install -y notify-osd libnotify-bin

Script sent from Kali Linux 2.0 2017.1 to Linux Mint 18 (Both 64 bit)



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Other Methods:


linux.byexamples.com/archives/233/write-a-message-to-login-users-through-terminal/


inside terminal type


Code:
who



and this will display all logged on users


and now type


Code:
wall



this will send message to members example

wall

press enter

type messgae


press enter

ctrl d when finished


Last edited by jamied_uk on 6th May 2017, 17:16; edited 3 times in total
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 14:56

More info @
computerhope.com/unix/wall.htm
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 14:57

Code:
wall [-n] [-t TIMEOUT] [file]



Code:
sudo wall message.txt
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 14:59

Also you can use talk

Code:
talk user@hostname
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 14:59

More on talk and examples


talk syntax

Code:
talk person [ttyname]


Options

personIf you want to talk to someone on your machine, then person is just the person's login name. If you want to talk to a user on another host, then person is of the form 'user@host'.
ttynameIf you want to talk to a user who is logged in more than once, the ttyname argument may be used to indicate the appropriate terminal name, where ttyname is of the form 'ttyXX' or 'pts/X'.

talk examples

Code:
talk hope

More info @
computerhope.com/unix/talk.htm
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 15:02

Now lets look at Write 


write examples

Code:
write hope

Write a message to the user hope. After entering this command, you will be placed on a blank line, where everything you type will be sent to the other user (line by line). Typing the interrupt character (Ctrl-C, by default) will return you to the command prompt and end the write session.
Code:
write hope tty7

userThe user to write to.
ttyThe specific terminal to write to, if the user is logged in to more than one session.

More info @
computerhope.com/unix/write.htm
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 15:04

Now for Notify

Code:
sudo apt install -y notify-osd libnotify-bin


notify-send Test "Hello World"

send message to screen of another system:

Code:
ssh <user name>@<ip address>



and then when you're logged in, type:

Code:
export DISPLAY=:0



Code:
notify-send "Title of message" "message text"



Code:
notify-send --help



Some examples:

1. Basic message with an icon in front of the Title showing 5000 milliseconds
Code:
Code:
notify-send "Message Title" "The message body is shown here" -i /usr/share/pixmaps/idle.xpm -t 5000

2. Show contents of a file:
Code:
Code:
notify-send test "`tail /var/log/syslog`"

3. Follow log file:
Code:
Code:
tail -n0 -f /var/log/messages | while read line; do notify-send "System Message" "$line"; done

4. Format message with HTML:
Code:
Code:
notify-send Test "<font size=16 color=blue><b><i>Hello World</b></i></font>"


Last edited by jamied_uk on 6th May 2017, 15:50; edited 1 time in total
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 15:39

Using Netcat (aka nc)


On PC 1, type:
Code:
nc -l 55555
On PC 2, type:
Code:
nc $IP 55555
, where
Code:
$IP
equals the local IP address of PC 1 [e.x.
Code:
192.168.2.50
]
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by jamied_uk on 6th May 2017, 15:41

Ytalk

Code:
apt install -y ytalk


Code:
ytalk [-x] [-s] [-Y] [-i] [-h hostname_or_ip] username...
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: this is for sending linux terminal messages to logged on members using two commands

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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