473,396 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Url Block

I need to write a program to block certain URLs when web browsing, but I
have not been able to really find anything to help. I was hoping to have a
service running in the back that can check browser windows and compare the
URLs then post a message and shut down the web page if it matches....Any one
have a good starting point for me.

TIA
Dave
Nov 21 '05 #1
10 2698
On 2005-02-09, Lespaul36 <le*******@none.net> wrote:
I need to write a program to block certain URLs when web browsing, but I
have not been able to really find anything to help. I was hoping to have a
service running in the back that can check browser windows and compare the
URLs then post a message and shut down the web page if it matches....Any one
have a good starting point for me.

TIA
Dave


That sounds like the job of a proxy server or a firewall...

The problem with using browser windows is that, how are you going to
know the window for every possible browser... So, you hook IE, but what
if the user decides to fire up Firefox (my fav!) or Mozilla or Opera or
.... No, the only way to do this (unless you know that you will always
be dealing with only one browser) is really to intercept outbound traffic
in the form of a proxy as stated above, or on the low level like a
firewall. The low level would involve the use of raw sockets to sniff
all outbound traffic, and you would probably have an easier time doing
that in C# the VB.NET...

If you know it's always going to be one browser, then you would probably
need to do a system wide hook to recieve all messages related to the
creating of top level windows... Probably WH_SHELL would be the best
choice, since it would only send you notifications for top level
windows, and not for every dialog, button, and menu in the system. But,
that would mean that you would have to step outside of .NET for the
actual hook since this kind of hook must reside in a standard non-com
dll.

Is there some reason that you can't use one of the many available
solutions to this?

--
Tom Shelton [MVP]
Nov 21 '05 #2
Tom,

I am glad you write about this in this way, the last time I was scared to
answer this kind of messages because of the lot of messages I had seen about
ports and was in doubt if there was not found a method for this.

You know that I answer this always in context wise exact same way as you did
now.

Cor
Nov 21 '05 #3
It is for my nephew...he has been getting in a bit of trouble and is
restricted on his computer use. In the past I have tried a few of the
parenting products out there, but they over did it and then I couldn't seem
to remove them, was a real pain in the but.

He uses IE and he can't install software. I thought there was a way to
block sites using Security Policies, but haven't been able to find much out
about it. I was thinking there might even be a way to do it with IE itself,
but no luck.

I was interested in finding out how a program like that would work also to
further my knowledge. As far as being easier in C#, don't all .net
languages have the same access to the CLR. I do know c#, but I am more
comfortable with vb.
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message
news:uD*************@TK2MSFTNGP14.phx.gbl...
On 2005-02-09, Lespaul36 <le*******@none.net> wrote:
I need to write a program to block certain URLs when web browsing, but I
have not been able to really find anything to help. I was hoping to have
a
service running in the back that can check browser windows and compare
the
URLs then post a message and shut down the web page if it matches....Any
one
have a good starting point for me.

TIA
Dave


That sounds like the job of a proxy server or a firewall...

The problem with using browser windows is that, how are you going to
know the window for every possible browser... So, you hook IE, but what
if the user decides to fire up Firefox (my fav!) or Mozilla or Opera or
... No, the only way to do this (unless you know that you will always
be dealing with only one browser) is really to intercept outbound traffic
in the form of a proxy as stated above, or on the low level like a
firewall. The low level would involve the use of raw sockets to sniff
all outbound traffic, and you would probably have an easier time doing
that in C# the VB.NET...

If you know it's always going to be one browser, then you would probably
need to do a system wide hook to recieve all messages related to the
creating of top level windows... Probably WH_SHELL would be the best
choice, since it would only send you notifications for top level
windows, and not for every dialog, button, and menu in the system. But,
that would mean that you would have to step outside of .NET for the
actual hook since this kind of hook must reside in a standard non-com
dll.

Is there some reason that you can't use one of the many available
solutions to this?

--
Tom Shelton [MVP]

Nov 21 '05 #4
In article <uD**************@TK2MSFTNGP14.phx.gbl>, Lespaul36 wrote:
It is for my nephew...he has been getting in a bit of trouble and is
restricted on his computer use. In the past I have tried a few of the
parenting products out there, but they over did it and then I couldn't seem
to remove them, was a real pain in the but.

He uses IE and he can't install software. I thought there was a way to
block sites using Security Policies, but haven't been able to find much out
about it. I was thinking there might even be a way to do it with IE itself,
but no luck.

I was interested in finding out how a program like that would work also to
further my knowledge. As far as being easier in C#, don't all .net
languages have the same access to the CLR. I do know c#, but I am more
comfortable with vb.


The main reason that working with raw sockets may be a little easier in
C# is it's ability to use direct memory access (aka, real pointers) via
the unsafe keyword. It's not impossible in VB.NET - but it would be
slower and not as clean.

I would avoid raw sockets. You can write a proxy server - but you'll want
to get familiar with the RFC's related to http. Really, the easiest and
most practicle way is to setup a firewall and filter from there. If you
can't find a reasonably priced hardware firewall that has this ability -
you can always use something like FreeBSD. The nice thing is that you
don't need much of a machine to run it. I'm running FreeBSD 4.11 as a
firewall on a Pentium 200 box with 128MB of RAM and 4GB harddrive.

--
Tom Shelton [MVP]
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 2 Build 2600
System Up Time: 0 Days, 0 Hours, 1 Minutes, 11 Seconds
Nov 21 '05 #5
Lespaul.

The sites that you want to block for your little nephew can't mostly not be
blocked even not with the most expensive hardware/software.

They change there IP adresses they change their dns names they use
redirectors from homepage style url's or whatever to prevent that.

(When you dont want to block any access)

Just my thought,

Cor
Nov 21 '05 #6
Tom Shelton <to*@YOUKNOWTHEDRILLmtogden.com> wrote in
news:eK**************@TK2MSFTNGP10.phx.gbl:
I would avoid raw sockets. You can write a proxy server - but you'll
want to get familiar with the RFC's related to http. Really, the
easiest and most practicle way is to setup a firewall and filter from


Indy already has proxy components and can be used from VB. Its free with
source too:
http://www.indyproject.org/
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 21 '05 #7
In article <e2**************@TK2MSFTNGP14.phx.gbl>, Cor Ligthert wrote:
Lespaul.

The sites that you want to block for your little nephew can't mostly not be
blocked even not with the most expensive hardware/software.

They change there IP adresses they change their dns names they use
redirectors from homepage style url's or whatever to prevent that.

(When you dont want to block any access)

Just my thought,

Cor


That's true - there are sites that are hard to block without constant
attention.

--
Tom Shelton [MVP]
Nov 21 '05 #8
I am going to take a look the proxy idea. However, knowing that he is only
using IE, I am checking out BHOs(Browser Heloper Objects), but I think I may
put that on the back burner for a bit and just do some research until I get
more time.
"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
In article <uD**************@TK2MSFTNGP14.phx.gbl>, Lespaul36 wrote:
It is for my nephew...he has been getting in a bit of trouble and is
restricted on his computer use. In the past I have tried a few of the
parenting products out there, but they over did it and then I couldn't
seem
to remove them, was a real pain in the but.

He uses IE and he can't install software. I thought there was a way to
block sites using Security Policies, but haven't been able to find much
out
about it. I was thinking there might even be a way to do it with IE
itself,
but no luck.

I was interested in finding out how a program like that would work also
to
further my knowledge. As far as being easier in C#, don't all .net
languages have the same access to the CLR. I do know c#, but I am more
comfortable with vb.


The main reason that working with raw sockets may be a little easier in
C# is it's ability to use direct memory access (aka, real pointers) via
the unsafe keyword. It's not impossible in VB.NET - but it would be
slower and not as clean.

I would avoid raw sockets. You can write a proxy server - but you'll want
to get familiar with the RFC's related to http. Really, the easiest and
most practicle way is to setup a firewall and filter from there. If you
can't find a reasonably priced hardware firewall that has this ability -
you can always use something like FreeBSD. The nice thing is that you
don't need much of a machine to run it. I'm running FreeBSD 4.11 as a
firewall on a Pentium 200 box with 128MB of RAM and 4GB harddrive.

--
Tom Shelton [MVP]
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 2 Build 2600
System Up Time: 0 Days, 0 Hours, 1 Minutes, 11 Seconds

Nov 21 '05 #9
I don't mean this to sound sarcastic (although I think it will come across
that way), but have your nephew's parents considered spending time with him
while he is on the computer and being involved in what he does to ensure
that he doesn't do things that can get him in trouble?

Perhaps it would be worthwhile moving his computer away from the solitude
and privacy of his room into a more open environment like the lounge, or
dining room so that he is always aware that people are around and can see
his screen?

On a technology level, install terminal services or VNC or anything that
lets someone else log in and see what he is up to, then point out to the
young man that he will be subject to random checks of his machine using this
tool.

Alternatively, if you really want to write a software solution write some
code that will screenshot the entire screen onto a network share so long as
DirectX Exclusive mode is not in use (which would mean he's in a game). Then
set the software to screenshot at a configurable interval in minutes. This
could be achieved with off the shelf screenshotting software like Snagit,
but there is an obvious risk there that he will simply terminate the program
when he finds it .

My personal view is that attempting to restrict what the kid can do won't
work. However, making him responsible for his actions and aware that his
actions will be monitored and followed up may help more.
--
Pete Wright
Author of ADO.NET Novice to Pro for Apress
www.petewright.org

"Lespaul36" <le*******@none.net> wrote in message
news:uD**************@TK2MSFTNGP14.phx.gbl...
It is for my nephew...he has been getting in a bit of trouble and is
restricted on his computer use. In the past I have tried a few of the
parenting products out there, but they over did it and then I couldn't
seem to remove them, was a real pain in the but.

He uses IE and he can't install software. I thought there was a way to
block sites using Security Policies, but haven't been able to find much
out about it. I was thinking there might even be a way to do it with IE
itself, but no luck.

I was interested in finding out how a program like that would work also to
further my knowledge. As far as being easier in C#, don't all .net
languages have the same access to the CLR. I do know c#, but I am more
comfortable with vb.
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message
news:uD*************@TK2MSFTNGP14.phx.gbl...
On 2005-02-09, Lespaul36 <le*******@none.net> wrote:
I need to write a program to block certain URLs when web browsing, but I
have not been able to really find anything to help. I was hoping to
have a
service running in the back that can check browser windows and compare
the
URLs then post a message and shut down the web page if it matches....Any
one
have a good starting point for me.

TIA
Dave


That sounds like the job of a proxy server or a firewall...

The problem with using browser windows is that, how are you going to
know the window for every possible browser... So, you hook IE, but what
if the user decides to fire up Firefox (my fav!) or Mozilla or Opera or
... No, the only way to do this (unless you know that you will always
be dealing with only one browser) is really to intercept outbound traffic
in the form of a proxy as stated above, or on the low level like a
firewall. The low level would involve the use of raw sockets to sniff
all outbound traffic, and you would probably have an easier time doing
that in C# the VB.NET...

If you know it's always going to be one browser, then you would probably
need to do a system wide hook to recieve all messages related to the
creating of top level windows... Probably WH_SHELL would be the best
choice, since it would only send you notifications for top level
windows, and not for every dialog, button, and menu in the system. But,
that would mean that you would have to step outside of .NET for the
actual hook since this kind of hook must reside in a standard non-com
dll.

Is there some reason that you can't use one of the many available
solutions to this?

--
Tom Shelton [MVP]


Nov 21 '05 #10
Pete,

I completly agree, however not alone for kids.

This is as well for workers in a company.

Cor
Nov 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
4
by: Christopher | last post by:
This should be a quick one. URL: http://cfa-www.harvard.edu/~cpilman/Stuff/flush.html Code: ============================= <!DOCTYPE HTML Public "-//W3C//DTD HTML 4.01//EN">...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
7
by: seamoon | last post by:
Hi, I'm doing a simple compiler with C as a target language. My language uses the possibility to declare variables anywhere in a block with scope to the end of the block. As I remembered it this...
2
by: morrell | last post by:
I have a request to find out is there an easy way to solve this little poblem. ___________________ | Block 1 | | | | | | |...
6
by: foolmelon | last post by:
If a childThread is in the middle of a catch block and handling an exception caught, the main thread calls childThread.Abort(). At that time a ThreadAbortException is thrown in the childThread. ...
8
by: Alvin | last post by:
I'm making a very simple game in SDL, and I'm not asking for SDL help I hope - this looks like something C++ related, so I'll ask here. I have a class for a simple block, or tile, in the game,...
6
by: dave8421 | last post by:
Hi, I'm a bit confused about the definition about "Prinicpal Block Boxes" in CSS 2.1 draft specification. ( http://www.w3.org/TR/2006/WD-CSS21-20061106 ) <pre> 9.2.1 Block-level elements and...
2
by: Bob Greschke | last post by:
This is the idea Block = pack("240s", "") Block = pack(">H", W) Block = pack(">H", X) Block = pack(">B", Y) Block = pack(">H", Z)) but, of course, Block, a str, can't be sliced. The real...
15
by: cssExp | last post by:
hello, Rather than going on a wild explanation on what's the the problem, it'll be much quicker and easier if i let you look at it yourself, so I'll post my page source (actual contents taken out,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.