there's usually a list somewhere.... could be in the app itself, or in somekind of data file, or online. Before navigating to the page, it checks the destination address, and if it's in the list, re-routes the navigation and displays the access denied notice.
oh... so this isn't inside of some browser you built... but rather you're trying to hook into the user's browser, what ever they have.... no clue how exactly they do that. Probably scanning the tcp traffic somehow... and some how returns a false response from the server...
What you are trying to make is a 'basic' Firewall, and it is not a trivial task... I recommend you find a pre-made one (perhaps on PlanetSourceCode), and try to find out how it works.
There are no real firewalls written in VB on pscode.com. They do not block connections, but they disconnect already established connections to your computer.
The way they do it is by continuously looping through the TCP table with the GetTcpTable API and a timer. But it might not be fast enough, because you need to convert each hostname (mscracks.com) to an IP address in order to disconnect it and that takes time, especially when you have a huge list of websites.
Here's a small tool I wrote years ago to disconnect certain IP addresses you might want to play around with.
In the picture i placed above Eset detected the website as soon as i pressed go, that is very ok. because scanning tcp port is not a good idea. most antivirus don't like this.
Programming is all about good logic. Spend more time here
What you are trying to make is a 'basic' Firewall, and it is not a trivial task... I recommend you find a pre-made one (perhaps on PlanetSourceCode), and try to find out how it works.
what are your suggestions?
Programming is all about good logic. Spend more time here
Search for a pre-made firewall project written in VB, and run the ones that seem good to see whether they seem to be capable of doing this (despite what Chris001 posted, I have seen VB projects that are real firewalls).
If you find one that seems about right, try to make changes so that it does what you want.
What Chris001 linked to could also be a good place to start, but I haven't looked at it.
As I said before this kind of thing is not a trivial task, even if you manage to find a pre-made project it will still be far more complex than walking a treeview... so it may be best if you don't try to implement something like this (and instead use a pre-made program).
If you've seen VB6 projects that are real firewalls, then I would like to see one. Real firewalls do low level packet filtering (probably requires a driver) and check a packet before it's allowed to go through.
I've looked at this, this, this, this, this, this and this 'firewall' from pscode.com and all of them simply check the TCP Table after the connection has already been fully made. Then they set the State to 12 (MIB_TCP_STATE_DELETE_TCB) and disconnect with the SetTcpEntry API and that's too late.
I have seen at least one that does it properly, but it was a few years ago so unfortunately I can't remember where I found it (and I didn't keep a copy, as I wasn't that interested).
I can't remember details of it either, but I wouldn't be surprised if it had a C based DLL to act as a driver.
So you are saying that it involves packet filtering,
I think start from there.
but please don't forget to post back if you find it.
Si
Am not planing on building a full fledge firewall, just a simple program to prevent browsing the site i specify. plus the fact that it wont look nice if i add third party to my program except its a dll or activex.
Can you suggest a premadeone that is free anyways
Thanks
Last edited by coolcurrent4u; Feb 9th, 2010 at 11:58 AM.
Programming is all about good logic. Spend more time here
you can search 'local webserver' source code.
and you can set your default page to local file with that.
and you can edit file 'hosts' (without extension) in system32\driver directory.
and direct it into 127.0.0.1
yes this is true. but how do i intercept the connection request and redirect it
first each unwanted link will be in a file. what exactly i want to do is as soon as the user presses enter in the browser, if its is a bad site, i immediately redirect it.
thanks
Programming is all about good logic. Spend more time here
I would go with mozzart way it the simplest way to go and guarantee to work each time.
Originally Posted by coolcurrent4u
yes this is true. but how do i intercept the connection request and redirect it
first each unwanted link will be in a file. what exactly i want to do is as soon as the user presses enter in the browser, if its is a bad site, i immediately redirect it.
i know, i know, but how? Any code sample would be ok. the examples posted that refers to PSC is not exactly what i want, but am presently working on seeing how to make it work. untill then, any suggestion and code samples would be appreciated
Programming is all about good logic. Spend more time here