├── .gitignore ├── .npmrc ├── .gitattributes ├── eslint.config.ts ├── vitest.config.ts ├── tsconfig.json ├── .editorconfig ├── tsdown.config.ts ├── .github └── workflows │ └── ci.yaml ├── index.test.ts ├── snapshots ├── index.test.ts.snap └── oui.test.js.snap ├── README.md ├── package.json ├── index.ts └── Makefile /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | /dist 3 | /node_modules 4 | /npm-debug.log* 5 | /yarn-error.log 6 | /yarn.lock 7 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | audit=false 2 | fund=false 3 | package-lock=true 4 | save-exact=true 5 | update-notifier=false 6 | ignore-scripts=true 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.snap linguist-language=JavaScript linguist-generated 3 | fixtures/** linguist-generated 4 | vendor/** linguist-vendored 5 | -------------------------------------------------------------------------------- /eslint.config.ts: -------------------------------------------------------------------------------- 1 | import silverwind from "eslint-config-silverwind"; 2 | import {defineConfig} from "eslint/config"; 3 | 4 | export default defineConfig(...silverwind); 5 | -------------------------------------------------------------------------------- /vitest.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "vitest/config"; 2 | import {backend} from "vitest-config-silverwind"; 3 | 4 | export default defineConfig(backend({ 5 | url: import.meta.url, 6 | })); 7 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "typescript-config-silverwind", 3 | "compilerOptions": { 4 | "types": [ 5 | "jest-extended", 6 | "vite/client", 7 | "vitest/globals", 8 | ], 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | tab_width = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [Makefile] 13 | indent_style = tab 14 | -------------------------------------------------------------------------------- /tsdown.config.ts: -------------------------------------------------------------------------------- 1 | import {nodeCli} from "tsdown-config-silverwind"; 2 | import {defineConfig} from "tsdown"; 3 | 4 | export default defineConfig(nodeCli({ 5 | url: import.meta.url, 6 | minify: true, 7 | sourcemap: false, 8 | shims: false, 9 | })); 10 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: ci 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | test: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v5 9 | - uses: actions/setup-node@v5 10 | with: 11 | node-version: latest 12 | - run: make deps 13 | - run: make test 14 | 15 | -------------------------------------------------------------------------------- /index.test.ts: -------------------------------------------------------------------------------- 1 | import spawn from "nano-spawn"; 2 | 3 | test("cli", async () => { 4 | let stdout; 5 | 6 | ({stdout} = await spawn("node", ["./dist/index.js", "20:37:06:12:34:56"])); 7 | expect(stdout).toMatchSnapshot(); 8 | ({stdout} = await spawn("node", ["./dist/index.js", "20_37_06"])); 9 | expect(stdout).toMatchSnapshot(); 10 | ({stdout} = await spawn("node", ["./dist/index.js", "203706"])); 11 | expect(stdout).toMatchSnapshot(); 12 | }); 13 | -------------------------------------------------------------------------------- /snapshots/index.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`cli 1`] = ` 4 | "Cisco Systems, Inc 5 | 80 West Tasman Drive 6 | San Jose CA 94568 7 | United States" 8 | `; 9 | 10 | exports[`cli 2`] = ` 11 | "Cisco Systems, Inc 12 | 80 West Tasman Drive 13 | San Jose CA 94568 14 | United States" 15 | `; 16 | 17 | exports[`cli 3`] = ` 18 | "Cisco Systems, Inc 19 | 80 West Tasman Drive 20 | San Jose CA 94568 21 | United States" 22 | `; 23 | -------------------------------------------------------------------------------- /snapshots/oui.test.js.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`cli 1`] = ` 4 | "Cisco Systems, Inc 5 | 80 West Tasman Drive 6 | San Jose CA 94568 7 | United States" 8 | `; 9 | 10 | exports[`cli 2`] = ` 11 | "Cisco Systems, Inc 12 | 80 West Tasman Drive 13 | San Jose CA 94568 14 | United States" 15 | `; 16 | 17 | exports[`cli 3`] = ` 18 | "Cisco Systems, Inc 19 | 80 West Tasman Drive 20 | San Jose CA 94568 21 | United States" 22 | `; 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # oui 2 | [![](https://img.shields.io/npm/v/oui.svg?style=flat)](https://www.npmjs.org/package/oui) [![](https://img.shields.io/npm/dm/oui.svg)](https://www.npmjs.org/package/oui) [![](https://packagephobia.com/badge?p=oui)](https://packagephobia.com/result?p=oui) 3 | > CLI to look up MAC addresses for their vendor in the IEEE OUI database 4 | 5 | *Note: This module is CLI-only since v13. The data has moved to module [oui-data](https://github.com/silverwind/oui-data).* 6 | 7 | ## Usage 8 | ```console 9 | $ npm i -g oui 10 | $ oui 20:37:06:12:34:56 11 | Cisco Systems, Inc 12 | 80 West Tasman Drive 13 | San Jose CA 94568 14 | United States 15 | ``` 16 | 17 | © [silverwind](https://github.com/silverwind), distributed under BSD licence 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oui", 3 | "version": "13.1.1", 4 | "author": "silverwind ", 5 | "description": "CLI to look up MAC addresses for their vendor in the IEEE OUI database", 6 | "repository": "silverwind/oui", 7 | "license": "BSD-2-Clause", 8 | "type": "module", 9 | "bin": "./dist/index.js", 10 | "files": [ 11 | "dist" 12 | ], 13 | "dependencies": { 14 | "oui-data": "^1.1.472" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "24.10.1", 18 | "eslint": "9.39.1", 19 | "eslint-config-silverwind": "111.0.8", 20 | "nano-spawn": "2.0.0", 21 | "tsdown": "0.16.5", 22 | "tsdown-config-silverwind": "1.5.2", 23 | "typescript": "5.9.3", 24 | "typescript-config-silverwind": "13.0.2", 25 | "updates": "16.9.1", 26 | "versions": "14.0.2", 27 | "vitest": "4.0.10", 28 | "vitest-config-silverwind": "10.4.2" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import {exit, argv, stdout} from "node:process"; 3 | import {createRequire} from "node:module"; 4 | import pkg from "./package.json" with {type: "json"}; 5 | 6 | const args = argv.slice(2); 7 | 8 | if (!args.length || ["help", "--help"].includes(args[0])) { 9 | stdout.write(`${[ 10 | "Usage: oui [mac]", 11 | "", 12 | "Commands:", 13 | " [mac] look up a MAC address in the database", 14 | " version print the version", 15 | "", 16 | "Examples:", 17 | " oui 20:37:06:12:34:56", 18 | " oui 20_37_06", 19 | " oui 203706", 20 | ].join("\n")}\n`); 21 | } else if (["version", "--version", "-v", "-V"].includes(args[0])) { 22 | stdout.write(`${pkg.version || "0.0.0"}\n`); 23 | } else { 24 | const ouiData = createRequire(import.meta.url)("oui-data"); 25 | const result = ouiData[args[0].replace(/[^0-9a-f]/gi, "").toUpperCase().substring(0, 6)]; 26 | if (result) { 27 | stdout.write(`${result}\n`); 28 | } else { 29 | stdout.write(`${args[0]} not found in database\n`); 30 | } 31 | } 32 | 33 | exit(0); 34 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SOURCE_FILES := index.ts 2 | DIST_FILES := dist/index.js 3 | 4 | node_modules: package-lock.json 5 | npm install --no-save 6 | @touch node_modules 7 | 8 | .PHONY: deps 9 | deps: node_modules 10 | 11 | .PHONY: lint 12 | lint: node_modules 13 | npx eslint --color . 14 | npx tsc 15 | 16 | .PHONY: lint-fix 17 | lint-fix: node_modules 18 | npx eslint --color . --fix 19 | npx tsc 20 | 21 | .PHONY: test 22 | test: node_modules build 23 | npx vitest 24 | 25 | .PHONY: test-update 26 | test-update: node_modules build 27 | npx vitest -u 28 | 29 | .PHONY: build 30 | build: node_modules $(DIST_FILES) 31 | 32 | $(DIST_FILES): $(SOURCE_FILES) package-lock.json package.json tsdown.config.ts 33 | npx tsdown 34 | chmod +x $(DIST_FILES) 35 | 36 | .PHONY: publish 37 | publish: node_modules 38 | git push -u --tags origin master 39 | npm publish 40 | 41 | .PHONY: update 42 | update: node_modules 43 | npx updates -cu 44 | rm -rf node_modules package-lock.json 45 | npm install 46 | @touch node_modules 47 | 48 | .PHONY: path 49 | patch: node_modules lint test 50 | npx versions patch package.json package-lock.json 51 | @$(MAKE) --no-print-directory build publish 52 | 53 | .PHONY: minor 54 | minor: node_modules lint test 55 | npx versions minor package.json package-lock.json 56 | @$(MAKE) --no-print-directory build publish 57 | 58 | .PHONY: major 59 | major: node_modules lint test 60 | npx versions major package.json package-lock.json 61 | @$(MAKE) --no-print-directory build publish 62 | --------------------------------------------------------------------------------