Go wrapper around Device Console Windows tool.

go-devcon

Go Reference

Go wrapper around the Windows Device Console (devcon.exe).

go install github.com/mikerourke/go-devcon

Introduction

Here's a brief overview of DevCon taken from the Windows Hardware Developer documentation site:

DevCon (Devcon.exe), the Device Console, is a command-line tool that displays detailed information about devices on computers running Windows. You can use DevCon to enable, disable, install, configure, and remove devices.

DevCon runs on Microsoft Windows 2000 and later versions of Windows.

This package provides a handy mechanism for querying devices and performing various operations on said devices. It provides methods that map directly to the devcon.exe commands.

Prerequisites

You'll need the devcon.exe executable. It's not included in the package because Redistribution of Microsoft software without consent is usually a violation of Microsoft's End User License Agreements.

For information regarding how to get your hands on devcon.exe, check out the Microsoft documentation page.

There are other ways to get it, but you didn't hear it from me.

Usage

There is extensive documentation and examples available on the docs site, but here's a quick example of how to log all the devices on the computer:

package main

import (
	"fmt"
	
	"github.com/mikerourke/go-devcon"
)

func main() {
	dc := devcon.New(`\path\to\devcon.exe`)
	
	devs, err := dc.FindAll("=net")
	if err != nil {
		panic(err)
    }
	
	for _, dev := range devs {
		fmt.Printf("ID: %s, Name: %s\n", dev.ID, dev.Name)
    }
}

FAQ

Aren't you supposed to use the PnPUtil now?

Yes, but PnPUtil is only supported on Windows Vista and later. You can't use it on older operating systems.

Isn't this a little niche?

Yes, but one of my other projects requires me to check for the existence of a device and install a driver on Windows XP. I wrote a bunch of parsing code to get the output, so I figured why not open source it?

Will this work on Windows XP?

Yes, I'm using only using Go APIs available in version 1.10.7 (or earlier?), since executables built with that version of Go still run on Windows XP. It's possible that earlier versions may work, but I used 1.10.7 during development, so I'd advise sticking with that version. To target Windows XP 32-bit, build your project like so:

GOOS=windows GOARCH=386 go1.10.7 build -o myproject.exe myproject.go  
Owner
Mike Rourke
Wolf of all trades, master of none.
Mike Rourke
Similar Resources

Command-line tool and library for Windows remote command execution in Go

WinRM for Go Note: if you're looking for the winrm command-line tool, this has been splitted from this project and is available at winrm-cli This is a

Nov 29, 2022

A simple abstraction around ssh and sftp libraries in Go(Golang).

sshx A simple abstraction around ssh and sftp libraries in Go(Golang). Resources Installation Installation Install sshx as you normally would for any

Dec 14, 2022

A snapshot of Mess With DNS's backend code from around when it was released

Mess With DNS This is a snapshot of Mess With DNS's backend code from around whe

Nov 9, 2022

Orion - a small lightweight framework written around grpc/protobuf with the aim to shorten time to build microservices at Carousell.

Orion Orion is a small lightweight framework written around grpc/protobuf with the aim to shorten time to build microservices at Carousell. It is deri

Nov 16, 2022

A Windows named pipe implementation written in pure Go.

npipe Package npipe provides a pure Go wrapper around Windows named pipes. Windows named pipe documentation: http://msdn.microsoft.com/en-us/library/w

Jan 1, 2023

Automatically spawn a reverse shell fully interactive for Linux or Windows victim

Automatically spawn a reverse shell fully interactive for Linux or Windows victim

Girsh (Golang Interactive Reverse SHell) Who didn't get bored of manually typing the few lines to upgrade a reverse shell to a full interactive revers

Dec 14, 2022

tidal discord rich presence for windows

tidal discord rich presence for windows

discordtidal Remember when Discord added a Spotify integration and all of your friends started having fun with it, but then being the weirdo you are,

Jan 2, 2023

EDR-Recon scans Windows services, drivers, processes, registry for installed EDRs.

EDR-Recon scans Windows services, drivers, processes, registry for installed EDRs.

EDR-Recon EDR-Recon scans Windows services, drivers, processes, registry for installed EDRs. Install Binary Download the latest release from the relea

Dec 29, 2022

🦄️ 🎃 👻 Clash Premium 规则集(RULE-SET),兼容 ClashX Pro、Clash for Windows 客户端。

简介 本项目生成适用于 Clash Premium 内核的规则集(RULE-SET),同时适用于所有使用 Clash Premium 内核的 Clash 图形用户界面(GUI)客户端。使用 GitHub Actions 北京时间每天早上 6:30 自动构建,保证规则最新。 说明 本项目规则集(RUL

Jan 3, 2023
Optimize Windows's network/NIC driver settings for NewTek's NDI(Network-Device-Interface).

windows-ndi-optimizer[WIP] Optimize Windows's network/NIC driver settings for NewTek's NDI(Network-Device-Interface). How it works This is batchfile d

Apr 15, 2022
A simple wrapper around libpcap for the Go programming language

PCAP This is a simple wrapper around libpcap for Go. Originally written by Andreas Krennmair [email protected] and only minorly touched up by Mark Smith

Dec 5, 2022
Wrapper around bufcli to make it do cross-repo compiles for private repos and use full paths.
Wrapper around bufcli to make it do cross-repo compiles for private repos and use full paths.

Bufme A tool for compiling protos with full directory paths and cross repo compiles. Introduction Protocol buffers rock, but protoc should die in a fi

Feb 5, 2022
An unofficial GUI wrapper around the Tailscale CLI client.
An unofficial GUI wrapper around the Tailscale CLI client.

Trayscale Trayscale is an unofficial GUI wrapper around the Tailscale CLI client, particularly for use on Linux, as no official Linux GUI client exist

Dec 26, 2022
This is a tool that allows you to check minecraft names availability, this tool can do around 3000~ names a minute or more!

Checker This is a tool that allows you to check minecraft names availability, this tool can do around 3000~ names a minute or more! Tutorial To instal

Feb 13, 2022
Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed.

raw Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed. For more information about using ra

Dec 28, 2022
Deskreen turns any device with a web browser into a secondary screen for your computer
Deskreen turns any device with a web browser into a secondary screen for your computer

Deskreen Website: https://deskreen.com ▶️ Deskreen Youtube channel (video tutorials, demos, use cases for Deskreen day to day usage) Deskreen turns an

Jan 7, 2023
IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port
IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

Nov 10, 2021
An implementation of the FIDO Device Onboard (FDO) spec written in Rust.

fido-device-onboard-rs An implementation of the FIDO Device Onboard Specification written in rust. The current implementation targets specification ve

Dec 17, 2022
Nomad plugin for reserving device mappings used by ebs devices.

Nomad Skeleton Device Plugin Skeleton project for Nomad device plugins. This project is intended for bootstrapping development of a new device plugin.

Jan 5, 2022