MCPcopy Index your code
hub / github.com/Print3M/ByteCaster / ipv4

Method ipv4

encoding/encoding.go:53–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51}
52
53func (e *encoder) ipv4() {
54 /*
55 IPv4-fuscation:
56 "252.72.131.228\0" + "252.72.131.228\0" + "252.72.131.228\0"
57 */
58 NUM_OF_BYTES := 4
59
60 var result []byte
61 rest := len(e.input) % NUM_OF_BYTES
62
63 for i := 0; i < len(e.input)-rest; i += NUM_OF_BYTES {
64 ip := net.IP(e.input[i : i+NUM_OF_BYTES]).String()
65 bytes := append([]byte(ip), 0x00)
66 e.output = append(e.output, bytes...)
67 }
68
69 if rest == 0 {
70 e.output = result
71 return
72 }
73
74 length := len(e.input)
75 lastBytes := e.input[length-(NUM_OF_BYTES-rest):]
76
77 for range rest {
78 lastBytes = append(lastBytes, 255)
79 }
80
81 lastIp := net.IP(lastBytes).String()
82 bytes := append([]byte(lastIp), 0x00)
83
84 e.output = append(e.output, bytes...)
85}
86
87func (e *encoder) mac() {
88 /*

Callers 1

EncodeDataFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected