topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 11:06 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: IDEA: Block/Unblock all network traffic button (one-click)  (Read 45642 times)

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,859
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #25 on: February 01, 2011, 06:41 PM »
^Yep. That's the tricky part of the equation. You'd need to get that information somehow. If not through devcon, then some other way. I'd guess polling the registry would be how a pro would get it.

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,859
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #26 on: February 01, 2011, 07:01 PM »
No worries! Just 2 bottles of Samuel Adams Double Bock  :-* (yummy!) twice a day, combined with very little exercise, and you'll soon have one too! Just ask my nephew. (Who is reading this and is not amused.) :P
 (see attachment in previous post)
If the gods of brewing make anything better, they're keeping it for themselves AFAICT. :up:

Is that a real bock? If it is... Jeez... You don't need 2 a day to get fat! :) Bocks are the heaviest things out there. I usually split a bottle with someone if there's anyone willing.

Me too. A half pint at a time is plenty when it comes to a quality bock. Especially this one.

Ages well, so don't be afraid to stock up if you have a dark cool place to cellar it. Haven't enjoyed something this complex since O'Hanlon's stopped brewing its legendary Thomas Hardy Ale. :-*

This is the grande vin burgundy of dark beers IMO. I'm normally an ale fan who has scant interest in lagers. I make an exception for this one.

Here's what Sam Adams has to say about it:


Intense and warming, a meal in a bottle.

One cannot help but appreciate Samuel AdamsĀ® Double Bock's huge malt character.  We use an enormous amount of malt, half a pound per bottle, to brew this intensely rich lager.  Its deep brown-ruby color is all made in the kettle, no black malt is used, resulting in a rich sweetness that is free of the rough taste of burnt malt.  All that remains is the velvet smooth flavor and mouth feel of the two-row malt. Samuel Adams Double Bock's intense malt character is balanced with a subtle piney, citrus hop note from the Noble hops.

Awesome stuff.  :Thmbsup:

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #27 on: February 01, 2011, 07:09 PM »
Given permissions being set that disallow normal users from disabling the adapters, how is using devcon, (which I've used for other things), going to help?

Guess I'll have to fire up XP Pro and have a play in the Group Policy editor.

Scratch that, looks like server OS only.

Time to put the thinking cap on.

^ You are correct. There is a 32 and a 64bit version. Completely forgot about that.

The 64bit version included is for Intel Itaniums, (ia64), won't work on x64 installations.

i don't think you're a cracker failure.

I wasn't suggesting I'm a cracker failure, perish the thought, I was suggesting my next program would be a cracker failure....as in format your drive type  ;D

^Yep. That's the tricky part of the equation. You'd need to get that information somehow. If not through devcon, then some other way. I'd guess polling the registry would be how a pro would get it.

devcon listclass net >list.txt

Then string match the first 3 characters of each line to USB, PCI or BTH - should pick up almost any network hardware, giving you hardware ID, (for devcon), and adapter name, (for GUI).
« Last Edit: February 01, 2011, 08:39 PM by 4wd »

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #28 on: February 01, 2011, 08:36 PM »
Man, this adapter ID thing is totally the reason why there are no good third party network software for windows.  I've always wondered why there were no cool little software out there to improve on little annoyances like this related to networks.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #29 on: February 01, 2011, 08:44 PM »
Man, this adapter ID thing is totally the reason why there are no good third party network software for windows.  I've always wondered why there were no cool little software out there to improve on little annoyances like this related to networks.

It would be nice to know whether devcon worked in your situation before proceeding along this path.

Any chance you can download DEVCON, do the following in a CLI and paste the results in list.txt here?

devcon listclass net >list.txt

Then we could give you a devcon command to try and disable the adapter, if it doesn't work then there doesn't seem to be an easy way around the permissions.

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,859
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #30 on: February 01, 2011, 08:50 PM »

^ You are correct. There is a 32 and a 64bit version. Completely forgot about that.

The 64bit version included is for Intel Itaniums, (ia64), won't work on x64 installations.

No wonder I forgot about it!  ;D

Has anybody here ever even seen an Itanium-based machine, let alone worked with one?

There are supposedly a couple of hundred thousand deployed systems that use this chip. I've been around for a while as well as been in a few places. I've seen RISC, supercomputers, prototype advanced graphics workstations, SPARC boxes, SGI Indigos, a Cray-3, and even a working Connection Machine.

But so far I haven't seen one IA-64 system out in the wild.  :huh:

Where are they?  :o




Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #31 on: February 02, 2011, 01:56 AM »
Has anybody here ever even seen an Itanium-based machine, let alone worked with one?

I have, both seen and worked with, but it wasn't running Windows but HP-UX. It's rock-steady, and performs quite good, for the tasks it was designed for. Not particularly good in any Windows environment though.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #32 on: February 02, 2011, 08:12 PM »
Just for interests sake, a x64 version of devcon can be found here.

They might even go so far as providing the link to the file for you.  but the best way would be to have the program's installer offer to download the file and install it for you in case it's not installed yet.

I'm going for something a bit easier, AutoIt allows incorporating binaries as a resource into the compiled program - so it will just extract the x86/x64 version out of the compiled program as required.

Probably not exactly kosher regarding distribution license but I'm feeling too old and lazy to be bothered by the more complicated method of grabbing it from MS or the location of the x64 version, (what happens if they change the address?), and installing it.

Also, I have no idea how to write an installer and I *hate* programs that cannot be unzipped and run unless there is a very good reason.

I can't see any reason why this won't run from a flash drive when I've finished, (fingers and toes crossed).

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #33 on: February 02, 2011, 10:24 PM »
sweet!

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #34 on: February 02, 2011, 11:42 PM »
OK, give this a try - it uses devcon to get the status and (dis|en)able the network adapter.

I don't see how it's going to work if you're blocked from (dis|en)abling via the Network Connections Control Panel but who knows, stranger things have happened.

If it doesn't work, then the only option left is to either modify the program to elevate to SYSTEM user or try and run the devcon command elevated and see what happens.

NOTES: You no longer have a choice of toggling ALL connections.

Actual fact it probably works better than NetToggle because the status is more consistantly reported but it does have a LOT less error checking ;)

REMOVED - See following posts.
« Last Edit: February 12, 2011, 08:24 PM by 4wd »

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #35 on: February 12, 2011, 05:59 PM »
OK, give this a try - it uses devcon to get the status and (dis|en)able the network adapter.

I don't see how it's going to work if you're blocked from (dis|en)abling via the Network Connections Control Panel but who knows, stranger things have happened.

If it doesn't work, then the only option left is to either modify the program to elevate to SYSTEM user or try and run the devcon command elevated and see what happens.

NOTES: You no longer have a choice of toggling ALL connections.

Actual fact it probably works better than NetToggle because the status is more consistantly reported but it does have a LOT less error checking ;)
4wd, you've almost got it!  Please don't stop!
i just tried the file listed above, and it works functionally, but it gives the following error dialog when toggling it on or off:
Screenshot - 2_12_2011 , 3_55_42 PM.png

So I get that error when toggling the button on and off, and sometimes the save nic dialog pops up again.  So the program is working, it's just a little buggy.  Cmon, we can do this.  er...you can...

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #36 on: February 12, 2011, 06:08 PM »
Oh shit!  Look what I found:
http://www.murgee.co.../network-controller/

This does the job pretty well.  When you run the program, it opens up a window with the network connections, you click the one you want, press disable/enable, and it works.

Now, I have faith that 4wd can do better.  What's better?  Well, in 4wd's program, it's a more efficient method of toggling.  basically, you just click on the system tray icon vs. opening a window, selecting, clicking.  So one click vs. three clicks.  Both solutions are nice, but if 4wd's worked without errors, I'd prefer that one.  Plus the tray icons he used looks really cool.

But, if we can't figure it out here, I'll be forced to pay $10 to murgee.  I'd rather support the authors here.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #37 on: February 12, 2011, 08:23 PM »
i just tried the file listed above, and it works functionally, but it gives the following error dialog when toggling it on or off: (see attachment in previous post)
So I get that error when toggling the button on and off,

OK, that's a result of me not getting the syntax of DevCon correct - it's (en|dis)abling all matching interfaces instead of just the selected one.  I don't have a machine with two NICs with the same ID but different instances.  Plus not closing the STDIO handle after running DevCon.

The attached should fix that.

and sometimes the save nic dialog pops up again.

Are you sure you're not hitting the RMB, (that will bring up the interface selection window), on the icon instead of the LMB ?

LMB - Toggle
RMB - Config

There's only three ways to call the NIC Selector routine:
1) First run of the program will call it when it doesn't find NICToggle.ini in the same directory as the executable.
2) If you run the program and the previously saved NIC hardware ID instance, (has to match exactly), doesn't exist it will open the selector to pick another one, (eg. you're running it from a flash drive and plugged it into a new machine).
3) You click the right mouse button on the icon.

Next time it happens can you try and recreate and/or note the steps taken, state of NIC before/after, etc?

NOTES: There's an arbitrary limit of 10 physical NICs, (PCI or USB), I'm sure there's a reason to have more, I just couldn't think of it.

v0.2
  • Fixed - DevCon parameters NQR, was acting on all matching ID strings.
  • Fixed - Forgot to close STDIO after each DevCon execution.  :wallbash:
  • Added - Rescans available NICs when the config is called, (in case a USB NIC is plugged in).
To do:
  • Add back 'All interfaces' option, (should easy - FLW).
  • Add comments to source, (CYM).
UPDATED: See here.
« Last Edit: March 30, 2011, 08:21 PM by 4wd »

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #38 on: February 17, 2011, 11:26 PM »
OK I just tried it.  First, I don't get an error anymore.  It seems to work fine, but it's a little unstable.  My computer has to local area connections.  I chose the first one and it was the one I wasn't using.  I clicked on the icon, and it turned red.  I clicked again, and nothing happened.  i right clicked, and it seemed to just be frozen.  i had to kill it.  Then I ran it again, I right clicked, changed to the other connection.  I clicked, it turned red, and my connection was off.  Great!  I clicked again and it was back on.  Great!  Then...I didn't know how to exit.  It needs an exit.  If I were you, I'd make the right click bring up a menu, that says:
Change Connection
Exit

That's about it.  There's some crashing, but it works overall...and add an exit.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #39 on: February 17, 2011, 11:38 PM »
OK I just tried it.  First, I don't get an error anymore.  It seems to work fine, but it's a little unstable.  My computer has to local area connections.  I chose the first one and it was the one I wasn't using.  I clicked on the icon, and it turned red.  I clicked again, and nothing happened.  i right clicked, and it seemed to just be frozen.  i had to kill it.  Then I ran it again, I right clicked, changed to the other connection.  I clicked, it turned red, and my connection was off.  Great!  I clicked again and it was back on.  Great!  Then...I didn't know how to exit.  It needs an exit.  If I were you, I'd make the right click bring up a menu, that says:
Change Connection
Exit

That's about it.  There's some crashing, but it works overall...and add an exit.

To exit: Right-click to bring up the select connection window, then just close it, (not Save).

But I'll change it to a Config menu just to be a conformist  :(   ;)

With the two connections:
Is the one that caused the lockup connected to a network, (ie. it has a cable and choose between networks to connect to) ?
Or, is it just an unused network port ?

I'll have to plug another NIC into my machine and have a play.
« Last Edit: February 17, 2011, 11:49 PM by 4wd »

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #40 on: February 18, 2011, 12:03 AM »
It's unused.  It's not disabled, but there's no wire connected.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #41 on: February 18, 2011, 12:14 AM »
Strange, I can't replicate the problem here.

Can you try it again on the unused port and before you have to kill it can you see if devcon.exe appears in Task Manager or just NICToggle.exe.

Also, have Network Connections open and see if you can see the connection toggling between Enabled and Disabled.

Oh, and the contents of the ini file thanks.
« Last Edit: February 18, 2011, 12:58 AM by 4wd »

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #42 on: February 18, 2011, 02:21 PM »
it's not doing it anymore.  It only did it the very first time i ran it.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #43 on: February 18, 2011, 05:17 PM »
Ah, I had it do it that once but could never get it to repeat it so wrote it off as some weird conflux of tongue position and astrological star positions.

EDIT: I think I found it - seems to happen if you initiate events too close together.  I've put a 5 second pause between event polling and it seems to have stopped it.

I'll try and get the RMB menu version up today, (that's my today, not yours), hopefully.
« Last Edit: February 19, 2011, 05:08 PM by 4wd »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #44 on: February 19, 2011, 05:22 PM »
Since no one had downloaded v0.21....

v0.25
Added - All Interfaces added, icon status has slightly different meaning: Green = Network connection, Red = No network connection
Added - RMB menu.
Fixed -  Occasional non-response, (hopefully).  Possibly due to not checking a variable for a specific value, (was checking for True/False).

REMOVED: Due to major screw up :)
« Last Edit: February 28, 2011, 11:25 PM by 4wd »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #45 on: February 28, 2011, 12:20 AM »
I'm assuming that because nobody has said it's wiped all their gmail accounts that it generally works?

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #46 on: February 28, 2011, 08:41 AM »
darn it!  I missed the update.
I'll have to check this out again when I go home.  Thanks 4wd!

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #47 on: February 28, 2011, 11:00 PM »
Well, it seems to be working.  But it's a little funny.  The first time I ran the new version and clicked it, it made my computer really active for about 30 seconds.  Then the light flashed red, and immediately back to green.  So i clicked it again, and it flashed like that again...also with a lot of computer activity.  The third time, it stayed red, and worked.  So it's a little unstable, and it's doing a whole lot of pretty intense stuff when you click on it (I can hear my hard drive making noises, and all the open programs kind of pause a little, but for 20-30 seconds).

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #48 on: February 28, 2011, 11:23 PM »
You're right, strange it didn't do it when I initially had it going.  Oh well, back to the drawing board, looks like I broke something when I added the All Interfaces.

Did v0.21 work OK, (removes the All Interfaces selection)?  DOH! No one had downloaded it.

Rephrase: Does v0.21 work OK?
« Last Edit: March 30, 2011, 08:13 PM by 4wd »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Block/Unblock all network traffic button (one-click)
« Reply #49 on: March 01, 2011, 09:50 AM »
4wd: just to make sure that people find their answer quickly in this thread, maybe you could edit your first post and add the file to it instead?