Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/subgraph/macouflage

go 1.20

require (
github.com/subgraph/libmacouflage v0.0.1
github.com/urfave/cli v1.22.14
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
)
26 changes: 26 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subgraph/libmacouflage v0.0.1 h1:DTzVhFxtANTflvNPhMLGP9c8NxSZzdK2JHIwDEdzX/g=
github.com/subgraph/libmacouflage v0.0.1/go.mod h1:wTajnv9uXMczTL0k32UMV2oXzTsNDs0A5tfZT60J5oc=
github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk=
github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
74 changes: 38 additions & 36 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package main

import (
"os"
"fmt"
"log"
"github.com/codegangsta/cli"
"os"

"github.com/urfave/cli"
)

var AppHelpTemplate = `NAME:
{{.Name}} - {{.Usage}}
USAGE:
Expand All @@ -26,83 +28,83 @@ func main() {
cli.AppHelpTemplate = AppHelpTemplate
app := cli.NewApp()
app.Name = "macouflage"
app.Usage ="macouflage is a MAC address anonymization tool"
app.Usage = "macouflage is a MAC address anonymization tool"
app.Version = "0.1"
app.Author = "David McKinney"
app.Email = "mckinney@subgraph.com"
app.Flags = []cli.Flag {
cli.StringFlag{
Name: "i, interface",
Usage: "Target device (required)",
},
cli.BoolFlag{
Name: "b, bia",
Usage: "Pretend to be a burned-in-address",
},
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "i, interface",
Usage: "Target device (required)",
},
cli.BoolFlag{
Name: "b, bia",
Usage: "Pretend to be a burned-in-address",
},
}
app.Commands = []cli.Command {
app.Commands = []cli.Command{
{
Name: "show",
Usage: "Print the MAC address and exit",
Name: "show",
Usage: "Print the MAC address and exit",
Action: show,
},
{
Name: "ending",
Usage: "Don't change the vendor bytes (generate last three bytes: XX:XX:XX:??:??:??)",
Name: "ending",
Usage: "Don't change the vendor bytes (generate last three bytes: XX:XX:XX:??:??:??)",
Action: ending,
},
{
Name: "another",
Usage: "Set random vendor MAC of the same kind",
Name: "another",
Usage: "Set random vendor MAC of the same kind",
Action: another,
},
{
Name: "any",
Usage: "Set random vendor MAC of any kind",
Name: "any",
Usage: "Set random vendor MAC of any kind",
Action: any,
},
{
Name: "permanent",
Usage: "Reset to original, permanent hardware MAC",
Name: "permanent",
Usage: "Reset to original, permanent hardware MAC",
Action: permanent,
},
{
Name: "random",
Usage: "Set fully random MAC",
Name: "random",
Usage: "Set fully random MAC",
Action: random,
},
{
Name: "popular",
Usage: "Set a MAC from the popular vendors list",
Name: "popular",
Usage: "Set a MAC from the popular vendors list",
Action: popular,
},
{
Name: "list",
Usage: "Print known vendors",
Name: "list",
Usage: "Print known vendors",
Action: list,
Subcommands: []cli.Command{
{
Name: "popular",
Usage: "Print known popular vendors",
Name: "popular",
Usage: "Print known popular vendors",
Action: listPopular,
},
},
},
{
Name: "search",
Usage: "Search vendor names",
Name: "search",
Usage: "Search vendor names",
Action: search,
},
{
Name: "mac",
Usage: "Set the MAC XX:XX:XX:XX:XX:XX",
Name: "mac",
Usage: "Set the MAC XX:XX:XX:XX:XX:XX",
Action: mac,
},
}
app.Run(os.Args)
}

func show(c *cli.Context) {
func show(c *cli.Context) {
iface := c.GlobalString("i")
if iface != "" {
result, err := getCurrentMacInfo(iface)
Expand Down