Linux to XP, "net send" messenger possible?

This is a discussion on Linux to XP, "net send" messenger possible? within the Linux Networking forums, part of the Linux Forums category; Hello everyone. Thank you all for the help with iptables to block a LAN computer access to the Internet. The ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-24-2006
Ohmster
 
Posts: n/a
Default Linux to XP, "net send" messenger possible?

Hello everyone. Thank you all for the help with iptables to block a LAN
computer access to the Internet. The CLI command worked very well and
cron does such a great job with running it on schedule, both to block
Internet and then to restore the Internet. Now I would like to "pretty it
up a bit" by sending a windows messenger service message to the LAN
computer that Internet access will end in 5 minutes, to give the
individual a chance to finish up, prior to losing the Internet
connection.

I can send a message to any MS computer on the LAN with the net commands,
run in a command prompt window as such:
net send 192.168.0.2 Hello there, nice to see you.
or
net send paula Hello there, nice to see you.

Either of these commands, run in the command window "cmd.exe" will send
the message "Hello there, nice to see you." to the same computer, in a
very intrusive popup box, where you can read the message and then press
the OK button to dismiss the window. I have the NAT address as well as
the computer name in my windows hosts file. Here is a list of the net
commands and what they do:
http://tinyurl.com/s5862

Is it possible to send net commands from a linux computer to a windows
computer on the same network and if so, how is this done? I would really
like to do this as a CLI command as I would like to incorporate this into
a shell script that would first run the net message command to inform the
user that Internet connectivity will stop in 5 minutes, and then when the
5 minutes has passed, stop the connection with the iptables command that
I was given here. Currently, I run the iptables stop Internet command via
cron and then cron will restore Internet connectivity at the designated
time. This works very, very well, thank you Klazmon and everyone that
helped. The commands that I use are:

iptables -I FORWARD 1 -s x.x.x.x -j DROP
(To stop Internet connectivity on the machine.)

iptables -D FORWARD -s x.x.x.x -j DROP
(To restore the connection later.)

So is it possible to send popup messages to another MS computer or all MS
computers on the LAN with Windows Messenger Service? How can this be
done, is there some sort of program or utility for this? I am using
Fedora Core 3 on the linux server/firewall/gateway currently, will
upgrade to Fedora Core 5 as soon as I am able to get another 200Gb or
better hard disk.

Thank you all for your help and genuine concern, this is a very good
Usenet newsgroup.

Cheers,
--
~Ohmster
"Read Ohmster" in subject, bypass spam filter.
ohmster /a/t/ newsguy dot com
Reply With Quote
  #2 (permalink)  
Old 06-24-2006
Ohmster
 
Posts: n/a
Default Re: Linux to XP, "net send" messenger possible?

Ohmster <notareal@emailaddress.com> wrote in
news:Xns97EBD65E7B5E1MyBigKitty@216.77.188.18:

> So is it possible to send popup messages to another MS computer or all
> MS computers on the LAN with Windows Messenger Service? How can this
> be done, is there some sort of program or utility for this? I am using
> Fedora Core 3 on the linux server/firewall/gateway currently, will
> upgrade to Fedora Core 5 as soon as I am able to get another 200Gb or
> better hard disk.


Apparently, there are net commands available in the linux CLI. Now I have
to figure out how to show the list of computers in my samba workgroup to
edit the list or add computers. The /etc/hosts file does not seem to affect
the samba net workgroup. Can someone show me how to list my samba workgroup
computers in the linux CLI to edit and add computers please? I am really
trying to do this with searching and google but there is much to weed
through and I cannot seem to find out how to list my samba workgroup. :(

--
~Ohmster
"Read Ohmster" in subject, bypass spam filter.
ohmster /a/t/ newsguy dot com
Reply With Quote
  #3 (permalink)  
Old 06-24-2006
Ohmster
 
Posts: n/a
Default Re: Linux to XP, "net send" messenger possible?

Ohmster <notareal@emailaddress.com> wrote in
news:Xns97EC15FD66A8MyBigKitty@216.77.188.18:

> Apparently, there are net commands available in the linux CLI. Now I
> have to figure out how to show the list of computers in my samba
> workgroup to edit the list or add computers. The /etc/hosts file does
> not seem to affect the samba net workgroup. Can someone show me how to
> list my samba workgroup computers in the linux CLI to edit and add
> computers please? I am really trying to do this with searching and
> google but there is much to weed through and I cannot seem to find out
> how to list my samba workgroup. :(


Okay, I figured it out and it works real well. Instructions are here:
http://tinyurl.com/lvq6t

Easy enough to tailor that to suit my needs, tested it from the CLI, and
then added it to cron twice. One 5 minutes before killing the Internet to
cat a 5 minute warning to computer from a text file, and another 1 minute
as a "last chance" to finish up. Too bad that cron cannot do stuff like in
30 second increments. I will have to add all of this to a shell script and
then try to just call the shell script from cron. That would be so much
better and this is how I learn. Find a real world need for something, then
learn all about it.

Cheers people and goodnight.
--
~Ohmster
"Read Ohmster" in subject, bypass spam filter.
ohmster /a/t/ newsguy dot com
Reply With Quote
  #4 (permalink)  
Old 06-24-2006
GL
 
Posts: n/a
Default Re: Linux to XP, "net send" messenger possible?


"Ohmster" <notareal@emailaddress.com> wrote in message
news:Xns97ECB85DF502MyBigKitty@216.77.188.18...
> Ohmster <notareal@emailaddress.com> wrote in
> news:Xns97EC15FD66A8MyBigKitty@216.77.188.18:



> Easy enough to tailor that to suit my needs, tested it from the CLI, and
> then added it to cron twice. One 5 minutes before killing the Internet to
> cat a 5 minute warning to computer from a text file, and another 1 minute
> as a "last chance" to finish up. Too bad that cron cannot do stuff like in
> 30 second increments. I will have to add all of this to a shell script and
> then try to just call the shell script from cron. That would be so much
> better and this is how I learn. Find a real world need for something, then
> learn all about it.
>

maybe use the sleep command (inside a script) ? I.e. run a script where you
echo a warning to all users, then sleep say 5 minutes, then echo next
warning, sleep 30 seconds then do whatever :)

I have not tried it, and only assume it will work ...

/gml


Reply With Quote
  #5 (permalink)  
Old 06-24-2006
Ohmster
 
Posts: n/a
Default Re: Linux to XP, "net send" messenger possible?

"GL" <someone@invalid.com> wrote in news:bbfng.89002$IK3.23103@pd7tw1no:

> maybe use the sleep command (inside a script) ? I.e. run a script
> where you echo a warning to all users, then sleep say 5 minutes, then
> echo next warning, sleep 30 seconds then do whatever :)
>
> I have not tried it, and only assume it will work ...


That sounds about right. I am going to try it, thanks for the tip.

--
~Ohmster
"Read Ohmster" in subject, bypass spam filter.
ohmster /a/t/ newsguy dot com
Reply With Quote
  #6 (permalink)  
Old 06-25-2006
Ohmster
 
Posts: n/a
Default Re: Linux to XP, "net send" messenger possible?

"GL" <someone@invalid.com> wrote in news:bbfng.89002$IK3.23103@pd7tw1no:

> maybe use the sleep command (inside a script) ? I.e. run a script
> where you echo a warning to all users, then sleep say 5 minutes, then
> echo next warning, sleep 30 seconds then do whatever :)
>
> I have not tried it, and only assume it will work ...


It worked, I made the shell script and tested it. Thanks for the
suggestion. This script is called by cron at 12:55 AM:

---------------------------------------------------------------------
[root@ohmster scripts]# cat closeinet
#!/bin/bash

#This script will close a LAN computer's internet access and give
warnings prior to shutting it down.

# Give the client computer a 5 minute warning by sending a warning text
to the machine.
cat /root/scripts/netdown.txt | smbclient -M leesh

# Sleep for 5 minutes and then give a final 30 second warning with
another text message.
sleep 5m; cat /root/scripts/30secwarn.txt | smbclient -M leesh

# Sleep for 30 seconds and then close the internet connection down.
sleep 30s; /sbin/iptables -I FORWARD 1 -s 192.168.0.5 -j DROP
---------------------------------------------------------------------

leesh is the name of the LAN machine as per the /etc/samba/lmhosts file.
netdown.txt is just a warning text file that is sent to the leesh
machine.

[root@ohmster scripts]# cat netdown.txt
The internet connection will be going off in 5 minutes. Please finish up
what you are doing.

30secwarn.txt is another text file that is sent to the leesh machine:

[root@ohmster scripts]# cat 30secwarn.txt
Internet connection going off in 30 seconds! This is your last notice.

And finally, after 30 seconds, the internet connection is dropped. cron
will restore the connection at 4:00 PM later on that day.

Man these shell scripts rock, is there anything you cannot do with a
shell script? :)

--
~Ohmster
"Read Ohmster" in subject, bypass spam filter.
ohmster /a/t/ newsguy dot com
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:03 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0