Author Topic: How we can steal the usb ports control from OS's hand!  (Read 15206 times)

mr_asadi

  • Member
  • ***
  • Posts: 11
How we can steal the usb ports control from OS's hand!
« 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?
« Last Edit: September 22, 2012, 10:31:02 am by mr_asadi »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: How we can steal the usb ports control from OS's hand!
« Reply #1 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.


mr_asadi

  • Member
  • ***
  • Posts: 11
Re: How we can steal the usb ports control from OS's hand!
« Reply #2 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)
« Last Edit: September 23, 2012, 01:45:26 am by mr_asadi »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: How we can steal the usb ports control from OS's hand!
« Reply #3 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?

mr_asadi

  • Member
  • ***
  • Posts: 11
Re: How we can steal the usb ports control from OS's hand!
« Reply #4 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.
« Last Edit: September 23, 2012, 01:54:28 pm by mr_asadi »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: How we can steal the usb ports control from OS's hand!
« Reply #5 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?

mr_asadi

  • Member
  • ***
  • Posts: 11
Re: How we can steal the usb ports control from OS's hand!
« Reply #6 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 :)
« Last Edit: September 23, 2012, 05:13:13 pm by mr_asadi »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research

mr_asadi

  • Member
  • ***
  • Posts: 11
Re: How we can steal the usb ports control from OS's hand!
« Reply #8 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.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research

mr_asadi

  • Member
  • ***
  • Posts: 11
Re: How we can steal the usb ports control from OS's hand!
« Reply #10 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
« Last Edit: September 25, 2012, 06:41:12 am by mr_asadi »