Page 1 of 2 12>
Topic Options
#177423 - 2007-07-01 07:44 AM Sending Message via Network
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Good Morning All.

I have a domain with few subnets, all subnets connects through IPVPN to the center where i'm at. In every subnet there is one computer which runs one very important application.

There are two things i need to do:

1) To find out whether the application runs or not.
2) To send me a message to notify me about it.

Now, i have tried just to send a message to myself using the SendMessage function but it doesn't work. Is this function uses the Messenger Service which is disabled cause of security issues?

Any help will be appreciated.

Top
#177424 - 2007-07-01 07:49 AM Re: Sending Message via Network [Re: ddady]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
1. Checkout Enumprocess() and see if it will do what you want.
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=83681
2. Possibly use BLAT.exe to send yourself an email.

Top
#177426 - 2007-07-01 08:38 AM Re: Sending Message via Network [Re: Allen]
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Thanx Allen,

I'll try the BlAT thing.

BTW, i have searched the Kix Reference before i asked but from some reason the Enumprocess() doesn't exist there.

Top
#177428 - 2007-07-01 12:00 PM Re: Sending Message via Network [Re: ddady]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
enumprocess is a UDF:
http://www.kixtart.org/UDF/UDF_lister.php?what=post&code=83681

in the post allen linked to, you see the same stuff as in my link.
the code you need to include in your script bottom and the instructions how to use it.
_________________________
!

download KiXnet

Top
#177430 - 2007-07-01 02:13 PM Re: Sending Message via Network [Re: Lonkero]
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
mmmm.....OK.

Since i'm new to kix, can someone please explain in short how to use it?

Do i use the exact code?
Where it comes in my script?
How do i know if the process i need is working?

I'm sorry for all those questions, but as i said. i'm new to kix.

Thanx

Top
#177431 - 2007-07-01 04:01 PM Re: Sending Message via Network [Re: ddady]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There is an FAQ that answers most of those.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#177432 - 2007-07-01 06:41 PM Re: Sending Message via Network [Re: ddady]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
UDF are add-on function for kixtart. They are cerate by users and can be inserted in the script or called from the script. They will get loaded into memory when the script starts and if all goes well they can be used as any other function native to kix. UDF come as they are and should not have to be changed unless you want something extra from it. Enumproccess in this case does exactly what you want it to.

Here's an example that uses enumproccess to see if notepad is running and does something when notepad is not running You should change notepad.exe in the $pid= EnumProcess("notepad.exe") line to the app you want to monitor and you should add a line that actually uses Blat (or some other mail app) to send you a message that app x is no longer running.

 Code:
Break on

$pid= EnumProcess("notepad.exe")

If $pid = ""
	?"Notepad is NOT running."
	Sleep 5
EndIf


;Function EnumProcess($exe, optional $terminate, optional $Computer)
;
;To enumerate OR kill specific processes
;
;$exe: the process name OR numeric PID
;$terminate: null/notnull value to terminate the specified process(es)
;$Computer: the PC to Execute against. Null = local PC
;
;returns an array of PIDs (pipe seperated), If $exe is a process name
;
;To Return the pid of setup.exe
;$pid= EnumProcess("setup.exe")
;
;to terminate all running Internet Explorer windows
;$kill= EnumProcess("iexplore.exe",1)
;
;To terminate a specific exe by it's PID
;$pid=694
;$kill=EnumProcess($pid,1)
;
;Code: 
Function EnumProcess($exe, optional $terminate, optional $Computer)
	Dim $winmgmts, $ExecQuery, $Process, $id, $GetObject, $
	If NOT $computer	$computer=@wksta	EndIf
	$winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
	Select
		Case Val($exe)>0
			$ExecQuery="select * from Win32_Process where ProcessId='$exe'"
			$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
			For Each $Process in $GetObject
				If $terminate		$=$Process.Terminate	EndIf
				$EnumProcess = $Process.name
				Next
			$GetObject=''
		Case VarType($exe)=8
			$ExecQuery="select * from Win32_Process where Name='$exe'"
			$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
			For Each $Process in $GetObject
				If $terminate		$=$Process.Terminate	EndIf
				$id=$Process.ProcessId
				$EnumProcess = "$Id" + "|" + "$EnumProcess"
				Next
			$EnumProcess=Left($EnumProcess,Len($EnumProcess)-1)
			$GetObject=''
		Case 1
			Exit 1
		EndSelect
	EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#177433 - 2007-07-01 07:00 PM Re: Sending Message via Network [Re: ddady]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: ddady
Is this function uses the Messenger Service which is disabled cause of security issues?
Why not just start the messenger service and test it?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#177434 - 2007-07-02 01:25 AM Re: Sending Message via Network [Re: Les]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I never understood the security issue fuzz about that service...
_________________________
!

download KiXnet

Top
#177435 - 2007-07-02 04:07 AM Re: Sending Message via Network [Re: Lonkero]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Not per say a real security issue as I recall (been a while) more an annoyance.
Top
#177436 - 2007-07-02 04:58 AM Re: Sending Message via Network [Re: NTDOC]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
http://support.microsoft.com/kb/330904
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#177437 - 2007-07-02 08:25 AM Re: Sending Message via Network [Re: Lonkero]
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Thanx MART for the explanation and the example and to the rest of you guys who took the time to help.
Top
#177438 - 2007-07-02 08:37 AM Re: Sending Message via Network [Re: ddady]
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Thanx Les, That is the reason why this service is disabled. It's better to be safe than sorry, anyhow there is no use for me in the domain with that service so i see no reason to enable it.
Top
#177441 - 2007-07-02 10:03 AM Re: Sending Message via Network [Re: ddady]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
this spam-problem should never occur in firewalled network.
you guys who disabled it, not using firewalls???
_________________________
!

download KiXnet

Top
#177443 - 2007-07-02 10:32 AM Re: Sending Message via Network [Re: Lonkero]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
 Originally Posted By: Jooel
hmm...
this spam-problem should never occur in firewalled network.
you guys who disabled it, not using firewalls???


Apparantly, in all our networks we make sure it's enabled through gpo.
A Network firewall should disable all ports by default except the ones you actually use.

Top
#177445 - 2007-07-02 12:03 PM Re: Sending Message via Network [Re: Arend_]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well...
our gpo sets workstation firewall disabled when connected to domain, to ease administration.

anyways, I see no point in disabling the service.
you never know when you need it and if you have firewalls & AV in place there is no risk either.
disabling the service is imo same as disabling server service on servers cause someone might be able to access the sensible data.

just my 4BUSD
_________________________
!

download KiXnet

Top
#177457 - 2007-07-02 05:11 PM Re: Sending Message via Network [Re: Lonkero]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
I agree, we already disable windows xp firewalls in the ris image, and at gpo level as well.
Top
#177462 - 2007-07-03 12:57 AM Re: Sending Message via Network [Re: Arend_]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
we enable WXP SP2 firewall but configure it through GPO to ease administration. The messenger service is running on al the computers.
Top
#177470 - 2007-07-03 09:37 AM Re: Sending Message via Network [Re: Witto]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Well the firewalling should be done at the perimeter to keep outside systems from spamming your internal systems, not internal systems firewalled from each other.

If you can and want to manage internal firewalls that's cool - just think a lot of us Admins are too busy (lazy) to setup and test everything and make sure all applications and our remote admin tools work on all systems so we shut off the XP firewall.


Top
#177490 - 2007-07-03 11:35 AM Re: Sending Message via Network [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, that's really lazy.
just set the domain policy to be off and otherwise on...
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.071 seconds in which 0.028 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org