{"id":13508718,"url":"https://github.com/ephe-meral/mac","last_synced_at":"2026-02-19T08:02:18.872Z","repository":{"id":57519010,"uuid":"62314655","full_name":"ephe-meral/mac","owner":"ephe-meral","description":"MAC-to-vendor search for Elixir","archived":false,"fork":false,"pushed_at":"2016-08-10T11:16:26.000Z","size":1445,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T08:43:50.974Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ephe-meral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-30T13:55:35.000Z","updated_at":"2024-06-27T12:47:39.000Z","dependencies_parsed_at":"2022-09-26T18:00:42.885Z","dependency_job_id":null,"html_url":"https://github.com/ephe-meral/mac","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ephe-meral/mac","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fmac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fmac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fmac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fmac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ephe-meral","download_url":"https://codeload.github.com/ephe-meral/mac/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephe-meral%2Fmac/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:57.481Z","updated_at":"2026-02-19T08:02:18.855Z","avatar_url":"https://github.com/ephe-meral.png","language":"Elixir","funding_links":[],"categories":["Networking"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/ephe-meral/mac.svg?branch=master)](https://travis-ci.org/ephe-meral/mac)\n[![Hex.pm](https://img.shields.io/hexpm/l/mac.svg \"WTFPL Licensed\")](https://github.com/ephe-meral/mac/blob/master/LICENSE)\n[![Hex version](https://img.shields.io/hexpm/v/mac.svg \"Hex version\")](https://hex.pm/packages/mac)\n[![Documentation](https://img.shields.io/badge/docs-hexpm-blue.svg)](http://hexdocs.pm/mac/)\n\n# MAC\n\nParses a MAC-to-vendor database file and builds a search tree from that. This search tree is loaded into memory and can be used via the standard API.\n\n## MAC database\n\nUses the compiled version from the wireshark project:\n\nhttps://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=manuf;hb=HEAD\n\n## setup\n\nIn your `mix.exs` file:\n\n```elixir\ndef deps do\n  [{:mac, \"\u003e= 0.1.0\"}]\nend\n```\n\nNote that the initial compilation might take a few more seconds since it compiles the lookup table.\n\n## usage\n\n```elixir\n# standard usage:\nMAC.fetch_vendor(\"00:00:0F:00:00:00\")\n# =\u003e {:ok, \"NEXT, INC.\"}\n\nMAC.fetch_vendor(\"other stuff or non-existing\")\n# =\u003e :error\n\n# works with different formats by stripping away unexpected chars:\nMAC.fetch_vendor(\" 00+++00\\\\\\\\0F00----00   00  \")\n# =\u003e {:ok, \"NEXT, INC.\"}\n\n# the parser does also accept bit-masks, so you can also use\nMAC.Parser.to_bitstring(\"00:00:F0/20\")\n# =\u003e \u003c\u003c0, 0, 15::size(4)\u003e\u003e\n```\n\n## speed\n\nFor a very simple profiling experiment, I used fprof and 10000 lookups of the same MAC with sub-space matching, which took approx. 7600 milliseconds.\n\nIf you seem to have problems with the lookup speed, please let me know (create an issue here). I assume that this approach is still faster than calling an external API etc. for this purpose.\n\n## lookup-table structure and assumptions\n\nThe table is a max 2 level map with the following assumptions:\n\n- the outer map's keys are the first 3 byte of the MAC address\n- the outer map's values are either:\n  - a binary with the company name, or\n  - a tuple with `{key_bitsize, sub_match_map}`\n- a sub-match map key is the entire prefix of any MAC address space with a bitmask biggen than /24 - they are required to be all of the same length per sub-match map (the compiler will notify you if it drops keys b/c of a mismatch)\n- the sub-match map's values are the binary vendor names\n\n```elixir\n%{\u003c\u003c1, 2, 3\u003e\u003e =\u003e \"Some Company Inc.\",\n  \u003c\u003c4, 5, 6\u003e\u003e =\u003e {32, %{\n    \u003c\u003c4, 5, 6, 7\u003e\u003e =\u003e \"Another Comp LLC\",\n    \u003c\u003c4, 5, 6, 8\u003e\u003e =\u003e \"A 3rd Organisation\"}}}\n```\n\n## is it any good?\n\nbien sûr.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephe-meral%2Fmac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fephe-meral%2Fmac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephe-meral%2Fmac/lists"}