Solved

Checking for NETWORK activity

Posted on 2000-04-17
20
196 Views
Last Modified: 2010-04-04
I want to make a little program, that checks wether the computer is attached to the network or is working as a standalone. If not attached, the computer has to take action, if attached, and during operation disconnected, again, action is neccessary. I do not want to transmit any signal, so i was thinking of a programm which reads the NIC signal activity. It would be nice to check as soon as the computer boots, but during operation, it has to pol too.


REASON :

In the company i work for, computers run with Win 95. It is determind in the policy  that network valdidation is active. Some 'smart' users decide to disconnect the computer, gain access, install (illegal) software and re-attach the computer. Result : Unknown software on client pc's, virusses (record is 97 at one pc !) etc. And nobody knows who did what. Disconnecting Drive's did not help since some 'real smart #sses' have parrallel zip drives.... aaarrghh (i am work as a system administrator at a school...)
0
Comment
Question by:WMPeters
  • 8
  • 5
  • 2
  • +5
20 Comments
 
LVL 6

Expert Comment

by:Jaymol
Comment Utility
It's pretty simple really, as long as you have a drive that is mapped on all network connections.

Simply try to access the drive like this....

Try
  Do something on Drive X: (for example)
Except
  Oh, it's not connected!
End

It's not very technical and doesn't give you any network details, but it does tell you whether or not the PC is connected to the network.

John.
0
 
LVL 6

Expert Comment

by:Jaymol
Comment Utility
Or alternatively, get it to try and find the server.  If it can't, then it's not connected.
0
 

Author Comment

by:WMPeters
Comment Utility
Okay Jaymol,

It is supposed to work, i thought about it too, but...
The only drive a computer is always connected too, even when no login as yet been realized, is the login drive (mostly F: but not always), and there are no writing accesses to this drive, only reading. Those kids here are smart enough to set there portable zipdrives up as a drive with the letter....F:, which was copied from the original. And they can write protect that disk too, so for the system is seems like a network drive.

Thereby;
Not all users have home dir's or writing privileges on the network. Ex. temporary employees, etc. They may only use the phonebook or something like that. (yes, i know, i could check for the existance of that drive too, or for the existance of a combination of drives, but remember the good old SUBST command out of the DOS ages...?)

Thereby, Win 95 is sometimes pretty lame in refreshing...
0
 
LVL 6

Expert Comment

by:Jaymol
Comment Utility
You don't need to have write privileges.  You only need read privs.  (Check a file exists.)  These kids that get on there illegaly won't know what file it checks for and where it should be!  That's up to you!  Simply place a file in a specific location and make your software look for it.  They can't fake that unless they can reverse engineer your software.  If they can do that, then there's nothing you can do!

John.
0
 

Author Comment

by:WMPeters
Comment Utility
Yes, but that is wat i was meaning with having a copy of the login drive on a zip disk. The only way then is to make a new file every day, reset the filedate to the old, and just hope that they will not use a compare command between multiple copies of multiple files. I know, it seems like a easy solution to a not such difficult problem, but with reading files (and refreshing them every day or so) the network becomes to dependend of me as a administrator (illness, holiday etc) and it still generate traffic. Not much, but with about 500 client pc's seeking for the existing of a special file...aiaiai...can here the complains about the network beings slow allready...and don't forget, the client as to seek about every 2 minutes...
0
 

Author Comment

by:WMPeters
Comment Utility
Yes, but that is wat i was meaning with having a copy of the login drive on a zip disk. The only way then is to make a new file every day, reset the filedate to the old, and just hope that they will not use a compare command between multiple copies of multiple files. I know, it seems like a easy solution to a not such difficult problem, but with reading files (and refreshing them every day or so) the network becomes to dependend of me as a administrator (illness, holiday etc) and it still generate traffic. Not much, but with about 500 client pc's seeking for the existing of a special file...aiaiai...can here the complains about the network beings slow allready...and don't forget, the client as to seek about every 2 minutes...
0
 

Author Comment

by:WMPeters
Comment Utility
Yes, but that is wat i was meaning with having a copy of the login drive on a zip disk. The only way then is to make a new file every day, reset the filedate to the old, and just hope that they will not use a compare command between multiple copies of multiple files. I know, it seems like a easy solution to a not such difficult problem, but with reading files (and refreshing them every day or so) the network becomes to dependend of me as a administrator (illness, holiday etc) and it still generate traffic. Not much, but with about 500 client pc's seeking for the existing of a special file...aiaiai...can here the complains about the network beings slow allready...and don't forget, the client as to seek about every 2 minutes...
0
 
LVL 6

Expert Comment

by:Jaymol
Comment Utility
If the people that use the network are as good as you say, then there's nothing you can do to stop them.
0
 

Author Comment

by:WMPeters
Comment Utility
Well, I used to be one of those...:)))
Now i work here, stupid me...

Don't worry, if no better answer comes, you might as well have the points. I'm not going to be difficult about that, i was just hoping that somebody knew how to read out the NIC, and then i do not mean the mac adress, as you know by now.

Whe have a multiserver environment, and since a short time all buildings (70 of them) are linked together... So when the sh*t really hits the fan, i duck...and then it is aproblem off my boss, and pro's can solve it then.

Thanks for youre time and solutions anyway
0
 
LVL 6

Accepted Solution

by:
Jaymol earned 100 total points
Comment Utility
I can give you code for getting the NIC address, but, to be honest, I don't see why you want it.......here you go...

function GetNicAddr:AnsiString;
var
  T:AnsiString;
  I:Integer;
begin
  Result:='';
  SetLength(T,16);
  if CoCreateGUID(@T[1])=S_OK then begin
    for I:=11 to 15 do Result:=Result+IntToStr(Ord(T[I]))+'.';
    Result:=Result+IntToStr(Ord(T[16]));
  end;
end;

John.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Expert Comment

by:craig_capel
Comment Utility
Get a program out to restrict access on every pc.....

What os are you working on, and what software are u using to admin the computers... win98 / Novell / NT.... what are we dealing with?...
0
 
LVL 1

Expert Comment

by:wmckie
Comment Utility
If you're using TCP/IP you could periodicaly ping a known address or group of addresses and if there are a number of consecutive fails then that could indicate a network disconnection. If the packets are small and with a suitable time between pings this shouldn't create too much extra traffic.

A suitable ping component is available in the WinShoes suite or F Piette's ICS suite.

Cheers - Walter McKie
0
 

Expert Comment

by:snoopy_Spy
Comment Utility
Hi WMPeters

You can check the type of your Login Drive (F:\)
With GetDriveType(PChar('F:')); you get the Typ of the Drive which is one of the following Value :
0      The drive type cannot be determined.
1      The root directory does not exist.
DRIVE_REMOVABLE      The drive can be removed from the drive.
DRIVE_FIXED      The disk cannot be removed from the drive.
DRIVE_REMOTE      The drive is a remote (network) drive.
DRIVE_CDROM      The drive is a CD-ROM drive.
DRIVE_RAMDISK      The drive is a RAM disk.
0
 
LVL 3

Expert Comment

by:bryan7
Comment Utility
interesting.. listenning
0
 

Author Comment

by:WMPeters
Comment Utility
Hello Graiq capel;

The network env. is Novell 4.11, operating with W95 clients. 99% off the network traffic is in IPX
0
 
LVL 1

Expert Comment

by:l8knight
Comment Utility
Have a look at LanManager.zip from Project Jedi. I'm sure you will find something in the API that will check for network activity without sending any data onto the network.

Hope this helps

regards

l8knight

btw: I know how you feel I used to work at a school. One of the first in Australia with a Laptop programme. Can you imagine 300 laptops in the hands of 300 teenage boys. aaarrrgggghhhh!!!!
0
 

Author Comment

by:WMPeters
Comment Utility
Hello I8knight,

Can you also tell me how to get LanManager.zip ?

Can I download it somewhere, or can i find it at my delphi-cd ? (did not find it yet)

300 teenage with 300 laptops....welcome in the system-administrators hell....;))


By the way, i'm closing this question within a few days (closing, not redrawing / taking back).

Greetz, WMP
0
 
LVL 1

Expert Comment

by:l8knight
Comment Utility
G'day WMP,

Sorry, I thought everybody (delphi programmers that is) had heard of Project Jedi, here is the link http://www.delphi-jedi.org/Jedi:APILIBRARY:460582381

regards

l8knight
0
 

Author Comment

by:WMPeters
Comment Utility
Okay, i'm closing the question. Since Jaymol put much effort in answering, and provided some code for the NIC, i feel like its only fair to give him the points. Thanks everbody for taking the time to solve this question. When i make a mixture of all solutions, some real solution is bound to come up.
0
 

Expert Comment

by:silvamv
Comment Utility
What´s the Unit that I need to use  CreateGuid function ?

Thank´s.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now