Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good Day All

I would just like to find out if it is possible to track the IP address of a remote pc accessing(coping,creating,deleting,renaming) a file on a server.

Just a quick scenario:
I have a server with files on it, limited amount of people have access to the shared files. I would like to track who is accessing(as above) the files in the shared folder.

I already got to the part of which files are being accessed and how they are being accessed using FileSystemWatcher. This works great for what I need. Now I just need to know who is accessing the files.

If anyone has a code snippet or a link to where I can figure this out It would be greatly appreciated.

Please keep in mind that this is not for a web based application. I am writing it in a console application.

Thank you in advance
Posted

1 solution

There really isn't any code to write for this. This is just a matter of turning on auditing on the server and everything shows up in the Security event log. Read this[^].
 
Share this answer
 
Comments
BulletVictim 17-Feb-15 2:04am    
Shouldn't there be some way? Doesn't windows check for those details in the packet transfers for authentication? If not for the IP Address, at the very least for windows username and access rights to the shared file?
Dave Kreskowiak 17-Feb-15 12:50pm    
Sure, you just have to write a packet capture software with a packet sniffer that can decode SMB session traffic and figure out how to decrypt a kerberos session in mid-flight. No, you don't get the username of the person doing the operation in clear text. You get a security token, which does not contain anything useful for your specified requirements.

Good luck with that!
BulletVictim 23-Feb-15 2:28am    
I went ahead and included a packet sniffer to extract the IP address of the remote computer in the IP header of the Packet and this does display. Now I just need to get it a bit more precise by determining what packet is being used for the file being modified, So I need to compare the packet data to the file...Since I already have the file name that is being altered, It should not be too long of a compare to run on the packets being transferred at the time of the file being edited. Any Ideas or links that could point me in the right direction?
Dave Kreskowiak 23-Feb-15 8:48am    
Nope. You're in uncharted territory. Nobody does this.

Instead of a compare of the file contents against what is in the network traffic, you should just assume that what is being written to the file is a change.
Kats2512 17-Feb-15 2:13am    
you could try this:
http://abundantcode.com/how-to-get-the-ip-address-in-winformsconsole-application-using-c/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900