{"id":17554168,"url":"https://github.com/phlegx/macker","last_synced_at":"2025-03-19T21:30:32.046Z","repository":{"id":56882464,"uuid":"96125603","full_name":"phlegx/macker","owner":"phlegx","description":"Real MAC addresses generator and vendor lookup with MAC address handling.","archived":false,"fork":false,"pushed_at":"2022-10-21T17:52:05.000Z","size":1059,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T23:12:19.919Z","etag":null,"topics":["address","gem","generator","lookup","mac","mac-address","oui","ouilookup","random","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phlegx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-03T15:31:14.000Z","updated_at":"2024-08-17T20:25:27.000Z","dependencies_parsed_at":"2022-08-20T12:20:08.097Z","dependency_job_id":null,"html_url":"https://github.com/phlegx/macker","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phlegx%2Fmacker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phlegx%2Fmacker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phlegx%2Fmacker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phlegx%2Fmacker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phlegx","download_url":"https://codeload.github.com/phlegx/macker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056329,"owners_count":20390719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["address","gem","generator","lookup","mac","mac-address","oui","ouilookup","random","ruby"],"created_at":"2024-10-21T06:53:33.415Z","updated_at":"2025-03-19T21:30:31.522Z","avatar_url":"https://github.com/phlegx.png","language":"Ruby","readme":"# Macker (The Mac Maker)\n\n[![Gem Version](https://badge.fury.io/rb/macker.svg)](https://rubygems.org/gems/macker)\n[![Gem](https://img.shields.io/gem/dt/macker.svg)](https://rubygems.org/gems/macker)\n[![Build Status](https://secure.travis-ci.org/phlegx/macker.svg?branch=master)](https://travis-ci.org/phlegx/macker)\n[![Code Climate](https://codeclimate.com/github/phlegx/macker.svg)](https://codeclimate.com/github/phlegx/macker)\n[![Inline Docs](http://inch-ci.org/github/phlegx/macker.svg?branch=master)](http://inch-ci.org/github/phlegx/macker)\n[![License](https://img.shields.io/github/license/phlegx/macker.svg)](http://opensource.org/licenses/MIT)\n\nReal MAC address generator and vendor lookup.\n\n## Features\n\n* Generate random mac addresses\n* Generate random mac addresses by vendor\n* Lookup vendor by mac address\n* Fetch OUI list and use cache system\n* High configurable\n* See the [documentation](http://www.rubydoc.info/gems/macker)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'macker'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install macker\n\n## Usage\n\n### Configuration\n\nThe following configuration is the default configuration of Macker. Store the configration code and load it at the beginning of Macker use.\nRails users can create a file `macker.rb` in `config/initializers` to load the own Macker configuration.\n\n```ruby\nMacker.configure do |config|\n  config.oui_full_url    = 'http://linuxnet.ca/ieee/oui.txt'                                       # Full URL of OUI text file\n  config.user_agent      = 'Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0'  # A common user agent\n  config.ttl_in_seconds  = 86_400                                                                  # Will expire the vendors in one day\n  config.cache           = File.expand_path(File.dirname(__FILE__) + '/../../data/oui_*.txt')      # Can be a string, pathname or proc\n  config.auto_expire     = true                                                                    # Expiration can be checked manually\n  config.auto_stale      = true                                                                    # Stale can be checked manually\nend\n```\n\n### Generat MAC address\n\n```ruby\nmac = Macker.generate\n# =\u003e #\u003cMacker::Address:0x000000047e5cd0 @val=257034854932948, @name=nil, @address=nil, @iso_code=nil\u003e\nmac.to_s\n# =\u003e \"E9:C5:97:39:21:D4\"\n\nmac = Macker.generate(vendor: true)\n# =\u003e #\u003cMacker::Address:0x0000000477ed50 @val=272999927425737, @name=\"Huawei Technologies Co.,ltd\", @address=[\"D1, Huawei Industrial...\"], @iso_code=\"CN\"\u003e\nmac.to_s('-')\n# =\u003e \"F8-4A-BF-B2-AA-C9\"\nmac.to_i\n# =\u003e 272999927425737\nmac.prefix\n# =\u003e \"F84ABF\"\nmac.name\n# =\u003e \"Huawei Technologies Co.,ltd\"\nmac.address\n# =\u003e [\"D1, Huawei Industrial Base, Bantian, Longgang, Shenzhen\", \"Shenzhen Guangdong 518129\", \"Cn\"]\nmac.full_address\n# =\u003e \"D1, Huawei Industrial Base, Bantian, Longgang, Shenzhen, Shenzhen Guangdong 518129, Cn\"\nmac.iso_code\n# =\u003e \"CN\"\n\nmac = Macker.generate(vendor: 'Apple, Inc.')\n# =\u003e #\u003cMacker::Address:0x000000046e6910 @val=61638330009701, @name=\"Apple, Inc.\", @address=[\"1 Infinite Loop\", \"Cupertino Ca 95014\", \"Us\"], @iso_code=\"US\"\u003e\nmac.to_s\n# =\u003e \"64:E6:82:E5:CC:58\"\n\nmac = Macker.generate(iso_code: 'US')\n# =\u003e #\u003cMacker::Address:0x000000046b86f0 @val=161304050786, @name=\"The Weather Channel\", @address=[\"Mail Stop 500\", \"Atlanta Ga 30339\", \"Us\"], @iso_code=\"US\"\u003e\n\n# Raise an exception\nMacker.generate!(iso_code: 'HELLO')\n```\n\n### Lookup MAC address\n\n```ruby\nMacker.lookup('64:E6:82:E5:CC:58')\n# =\u003e #\u003cMacker::Address:0x00000004699520 @val=110941201353816, @name=\"Apple, Inc.\", @address=[\"1 Infinite Loop\", \"Cupertino Ca 95014\", \"Us\"], @iso_code=\"US\"\u003e\n\nMacker.lookup(mac)\n# =\u003e #\u003cMacker::Address:0x000000046886d0 @val=161304050786, @name=\"The Weather Channel\", @address=[\"Mail Stop 500\", \"Atlanta Ga 30339\", \"Us\"], @iso_code=\"US\"\u003e\n\n# More examples\nMacker.lookup('64-E6-82-E5-CC-58')\nMacker.lookup('64E682E5CC58')\nMacker.lookup(110941201353816)\nMacker.lookup!(110941201353816)\n```\n\n### MAC address\n```ruby\nmymac = Macker.lookup('64-E6-82-E5-CC-58')\nmymac.class\n# =\u003e Macker::Address\n\n# Some methods of the address class\nmymac.name\nmymac.address\nmymac.iso_code\n\nmymac.to_i\nmymac.to_s\n\nmymac.oui?\nmymac.valid?\nmymac.broadcast?\nmymac.unicast?\nmymac.multicast?\nmymac.global_uniq?\nmymac.local_admin?\n\nmymac.next\nmymac.succ\nmymac.prefix\nmymac.full_address\n```\n\n### Cache control\n\n```ruby\n# Update OUI from cache (careful)\nMacker.update\n# =\u003e 2017-07-03 13:03:00 +0200\n\n# Update OUI from remote (straight)\nMacker.update(true)\n# =\u003e 2017-07-03 13:04:00 +0200\n\n# Vendor table with all base16 MAC prefixes as keys\nMacker.prefix_table\n# =\u003e \"F8DA0C\"=\u003e{:name=\u003e\"Hon Hai...\"},  ...\n\n# Vendor table with all country iso codes as keys\nMacker.iso_code_table\n# =\u003e \"CN\"=\u003e[{:name=\u003e\"Hon Hai...\"} ... ]\n\n# Vendor table with all country vendor names as keys\nMacker.vendor_table\n# =\u003e \"Apple, Inc.\"=\u003e[{:prefix=\u003e...} ... ]\n\nMacker.lapsed!\n# =\u003e false\n\nMacker.expire!\n# =\u003e false\n\nMacker.stale!\n# =\u003e false\n\nMacker.expired?\n# =\u003e false\n\nMacker.stale?\n# =\u003e false\n\nMacker.vendors_expiration\n# =\u003e 2017-07-04 13:04:00 +0200\n\n# Get configuration of Macker\nMacker.config\n# =\u003e #\u003cMacker::Config:0x0000000124ff30 @config=#...\u003e\u003e\n```\n\n## Contributors\n\n* Inspired by MacVendor [github.com/uceem/mac_vendor](https://github.com/uceem/mac_vendor).\n* Inspired by MacAddressEui48 [github.com/cunchem/mac_address_eui48](https://github.com/cunchem/mac_address_eui48).\n\n## Contributing\n\n1. Fork it ( https://github.com/[your-username]/macker/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## License\n\nThe MIT License\n\nCopyright (c) 2022 Phlegx Systems Technologies GmbH\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphlegx%2Fmacker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphlegx%2Fmacker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphlegx%2Fmacker/lists"}