On the client machine I need to be able to somehow detect which sites the current user are looking at right now.
I know the base URL of the sharepoint app, say sharepoint.thecompany.net but how the hack do I get the last requested url from the server?
I have hit a dead stop when trying to iterate the current processes and the casting the iexplorer process to something I can work with, I just don't know which kind of object to cast the process to :-(
I hope to implement this logic in a C# assembly what should run on the client box.
Any other approach that might work?
Thanks in advance
WatiN will allow you to attach to IE instances and get the current url from them. It will also allow you to do the same with Firefox instances.
It might be more efficient however to try to get requested urls at the network level using a wireshark type concept where you are just listening to http traffic on the computer and keeping track of the urls but a solution like that is a bit over my head.
EDIT: I came across this while looking for a solution: http://www.codeproject.com/KB/IP/networkmonitor.aspx
From what I can see I would think you could adapt the monitoring code to monitor and look for http request packets and parse the headers for the url information you need.
Related
I've been trying very hard to write a code in C# that lets me know what web address is accessed from my computer no matter which browser I am using or which software is accessing that web address.
This is very important because there might be softwares on my computers opening up web pages in the background that I am not aware of.
I need the code to have a list of the web addresses, even if the recording begins when ever you run the program its fine...
It sounds like what you might want is a proxy server.
Check out Squid.
Use Fiddler, you can get it here...
http://www.fiddler2.com/fiddler2/
How would I go about creating an application that can somehow see URLs I am viewing in most popular browsers?
Can it be done out of process?
In what ways can this be done?
Can it be done without browser plugins?
The simplest answer is use a proxy server.. prevent html access out except from the proxy server so they have to use it, then all url requests go to the proxy server, even if you choose to make it yourself, then you can collect the URLS either from logs or something and off you go.
You will have to install something in your network infrastructure and then collect data from it.
That could be a proxy server (eg Fiddler) or you can look at tools like WireShark (pcap).
How do I detect when a new computer has logged into my website?
The public IP address can be the same since you can share more than 1 computer via 1 internet connection.
I could use cookies but this will only detect a new browser not a new computer! 1 computer can have IE, firefox, chrome! Etc.
I expect (and hope) that this is impossible. If my browser is transmitting information that identifies my machine, then I want a new browser. Likewise, you should probably not be expecting to be able to receive such information.
Update
Seems like I have to update my expectations: https://panopticlick.eff.org/
You can use browser finger printing to do a pretty darn good job of distinguishing between computers that visit your site. It won't be 100% perfect but not far short.
There is no unique way to identify visitors to your website. All types of cookies get deleted at some point. You might be tempted to use flash cookies, since they don't depend on the browser but I strongly recommend against it since there is a huge legal debate on them.
Your only solution is to use a heuristic based on all the information you can gather on your visitor. This is called browser fingerprinting. Check out http://panopticlick.eff.org/ for the latest research on this topic.
You can check for the HTTP_X_FORWARDED_FOR header which should contain the machines Class C address (eg: 192.168.0.10) provided it was forwarded by a proxy.
you can set a cookie on client and check it in session_start ,its not 100% solution but can be a solution
I want to check which web sites is open in browsers ( IE, Firefox, Chrome ) to write a program in C# which can block web site which is in list of forbidden web site. Is there some API of browsers?
The better solution can be to write a TCP/IP filter, like most firewalls do.
UPD: this topic can be relevant: How do I hook the TCP stack in Windows to sniff and modify packets?
There is no generic "browser API" that allows access to this kind of information across all browsers.
I'm pretty sure the idea of doing this by accessing the browsers is doomed from the start. It is going to be almost impossible to implement, require frequent updates, and always extremely easy to circumvent (there are dozens and dozens of browsers that your program will not know.).
The only reliable way is to filter traffic on network level. I would recommend looking into using an existing proxy server or TCP filtering program. There are several Open Source ones that I'm sure you can use as a basis to rewrite or hook into.
The easier solution is to write an http listener that logs the requests.
Fiddler2 is one of these, you can check it out. it logs all incomming and outcomming http content.
The program has a black list, it contains a list of sites. When the user opens the site in IE (Firefox, Opera, Chrome) he should get an error. (For example 404).
How can I do? It is advisable not writing to the file HOSTS.
Language C#.
What you are describing is a Proxy server:
http://www.squid-cache.org/
The concept behind what you're trying to do is monitoring port 80 outgoing traffic and block any requests addressed to sites/ips contained in the black list.
It's kind of complex posting for you the whole code here.
Regardless, this kind of operation is best suited to a network firewall filter than to a custom C# app that runs on the client.