PORTS Forum

Ports and Interfaces => USB => Topic started by: mr_asadi on September 22, 2012, 10:20:22 am

Title: How we can steal the usb ports control from OS's hand!
Post by: mr_asadi on September 22, 2012, 10:20:22 am
Hi Jan
Maybe the subject of this post is clear to you and you can discover my purpose,but I ask my questions anyway!
I have  some general questions!
Can I enumerate the usb ports by a server programmatically?(the clients  connected to a server in a local area network)in other words,can I execute the enumeration process programmatically?
And the main question is how the local computer will not enable enumerate any usb device?
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: Jan Axelson on September 22, 2012, 04:20:29 pm
The USBView utility in the Windows Driver Kit (WDK) shows how to list the devices attached to local USB ports. I don't know how to do it, or if it's possible, for remote computers in a local network.

The devcon utility in the WDK shows how to disable a port.

Title: Re: How we can steal the usb ports control from OS's hand!
Post by: mr_asadi on September 23, 2012, 01:28:57 am
Thanks Jan,
Can you describe the enumeration process for me simply?What files and resources of windows have to be manipulate in this process?
In your view can I arrive to my purpose from this way?(Arrive to this goal is important to me that we have a local copmuter without access to usb ports)
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: Jan Axelson on September 23, 2012, 11:51:06 am
A description of USB enumeration is here:

http://www.lvr.com/usbcenum.htm

If by enumeration you instead mean how can an application find and list attached devices, the source code for USBView is the best resource I know of.

Again, if you want to disable USB ports, see the devcon utility.

If it's just drives you're concerned about, see:

http://windowsdevcenter.com/pub/a/windows/2005/11/15/disabling-usb-storage-with-group-policy.html

If you disable all USB ports on a PC, how will users gain access to a keyboard?
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: mr_asadi on September 23, 2012, 01:50:32 pm
Thanks a lot Jan
I have found some examples about how to lock and unlock Usb devices on a Windows machine using HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor registry key and usin devcon tools.
All the examples I have been able to find are for a manager-like executable in which you disable or enable usb access by changing registry key before you do something.
But what I intend to do is writing a program wit C# like a windows service that locks usb access completely at start-up and spots if a usb device is plugged then ask for a password and if the password is correct allow access. But here is my problem;
When you disable usb devices by changing registry key and using devcon tools, all the plugged usb devices are still disabled and invisible to windows and vice-versa; if you disable usb access, all previously plugged devices are still accessable.both of working with devcon tools and change the registry key are require the restart and I dont want this act be happened.
This issue my "plug, enter password, use" concept impossible.
Can anyone point me at the right direction where I can(if I can) make windows re-scan plugged usb devices for all usb ports or for a specified port so that it wont be necessary to unplug&replug usb devices after entering password or a way to disable a specified usb port/hub, not all of them programmatically? Any other suggestions are also greatly appreciated.
Thank you.
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: Jan Axelson on September 23, 2012, 03:30:32 pm
Do you want to disable a specific port, a specific device, or a specific device type?

If it's device or device type, what device or device type is it? Drives?
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: mr_asadi on September 23, 2012, 05:08:58 pm
Mass storage devices that I think that means the 'drives'.(Devices look like: external hards,flash memories,memory card Readers,mobile phones and etc.
Anyway thank you dear Jan Axelson.Your reply is cause of my assurance :)
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: Jan Axelson on September 23, 2012, 09:48:28 pm
Maybe bitlocker can do what you're looking for:

http://www.techrepublic.com/blog/window-on-windows/secure-your-usb-drives-with-bitlocker-to-go-for-windows-7/1176
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: mr_asadi on September 24, 2012, 01:26:15 am
Thanks Jan
No bitlocker isn't appropiate for me.My problem is enumeration of MSD's! I want to write a filter program with C# between usb ports and OS and when the MSD's have been plug/unplug ,my program will begin its work.I want limit access of usb ports by blocking them sometimes that I need.
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: Jan Axelson on September 24, 2012, 11:05:20 am
See

http://www.osronline.com/showthread.cfm?link=178106
Title: Re: How we can steal the usb ports control from OS's hand!
Post by: mr_asadi on September 25, 2012, 03:54:21 am
Any way thanks a lot Jan.I'll try to research more about this context and I'll come back soon  ;)
God be with you