build-mac.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package main
  2. import (
  3. "fmt"
  4. "math/rand"
  5. "strings"
  6. )
  7. func main(){
  8. //watch,err := fsnotify.NewWatcher()
  9. //if err != nil {
  10. // log.Error("new watch failed ",err.Error())
  11. //}
  12. //defer watch.Close()
  13. //
  14. //err = watch.Add("/root/Public/ioc")
  15. //if err != nil {
  16. // log.Error("watch ioc file failed ",err.Error())
  17. //}
  18. //go func(){
  19. // select{
  20. // case event := <-watch.Events:
  21. // {
  22. // if event.Op&fsnotify.Create == fsnotify.Create {
  23. // log.Info("file is created")
  24. // }
  25. // if event.Op&fsnotify.Rename == fsnotify.Rename {
  26. // log.Info("重命名文件 : ")
  27. // }
  28. // if event.Op&fsnotify.Remove == fsnotify.Remove {
  29. // log.Info("rename")
  30. // }
  31. // }
  32. // case err := <-watch.Errors:
  33. // {
  34. // log.Error(err.Error())
  35. // }
  36. // }
  37. //
  38. //
  39. //}()
  40. //select {
  41. //
  42. //}
  43. //var connsMap = sync.Map{}
  44. //connsMap.LoadOrStore(1,"1")
  45. //var count =0
  46. //connsMap.Range(func(key interface{}, value interface{}) bool{
  47. // count++
  48. // return true
  49. //})
  50. //fmt.Println(count)
  51. //data := "1hxri0ehkQ/bQn2a89P3KZjhLsiiuM5RtzHDhEpKBIgHV8muUzuN2nGoTC86R5cHLfrH3Qh46p/Xhso5TMEAgtXNSIccumZDlJWeTkTsF2RUGnK+N+z3l/pQTvkjO8Z64tYDSnOEoxKPOwuihiqEZVyaYiOYjvCHTG8fAQildqdDq6ux2fXN/R5l8PiLNnMO"
  52. //decodeStr, err := decode.DecodeCBC(data, "aes_key_16_bytes")
  53. //fmt.Println(decodeStr,err)
  54. //uuid,_ := uuid.NewV4()
  55. //fmt.Println(uuid)
  56. //requestId := fmt.Sprintf("%.23s",uuid)
  57. //re := lacia.RemoveX(requestId, "-")
  58. //fmt.Println(re)
  59. buf := make([]byte, 6)
  60. // Set the local bit
  61. for i:=0; i<10; i++{
  62. _, err := rand.Read(buf)
  63. if err != nil {
  64. fmt.Println("error:", err)
  65. break
  66. }
  67. buf[0] |= 2
  68. mac:=fmt.Sprintf("%02x%02x%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5])
  69. fmt.Println(strings.ToUpper(mac))
  70. }
  71. //for i:=0;i<10;i++{
  72. // n:=rand.Intn(10)
  73. // fmt.Println(n)
  74. //}
  75. }