@@ -10,6 +10,7 @@ import (
10
10
"github.com/ipchama/dhammer/socketeer"
11
11
"github.com/spf13/cobra"
12
12
"github.com/vishvananda/netlink"
13
+ "golang.org/x/sys/unix"
13
14
"net"
14
15
"sync"
15
16
"time"
@@ -246,13 +247,45 @@ func init() {
246
247
options .StatsRate = 5
247
248
}
248
249
250
+ filter := [28 ]unix.SockFilter {{0x28 , 0 , 0 , 0x0000000c }, // "arp or (port 67 or port 68)"
251
+ {0x15 , 24 , 0 , 0x00000806 },
252
+ {0x15 , 0 , 9 , 0x000086dd },
253
+ {0x30 , 0 , 0 , 0x00000014 },
254
+ {0x15 , 2 , 0 , 0x00000084 },
255
+ {0x15 , 1 , 0 , 0x00000006 },
256
+ {0x15 , 0 , 20 , 0x00000011 },
257
+ {0x28 , 0 , 0 , 0x00000036 },
258
+ {0x15 , 17 , 0 , 0x00000043 },
259
+ {0x15 , 16 , 0 , 0x00000044 },
260
+ {0x28 , 0 , 0 , 0x00000038 },
261
+ {0x15 , 14 , 13 , 0x00000043 },
262
+ {0x15 , 0 , 14 , 0x00000800 },
263
+ {0x30 , 0 , 0 , 0x00000017 },
264
+ {0x15 , 2 , 0 , 0x00000084 },
265
+ {0x15 , 1 , 0 , 0x00000006 },
266
+ {0x15 , 0 , 10 , 0x00000011 },
267
+ {0x28 , 0 , 0 , 0x00000014 },
268
+ {0x45 , 8 , 0 , 0x00001fff },
269
+ {0xb1 , 0 , 0 , 0x0000000e },
270
+ {0x48 , 0 , 0 , 0x0000000e },
271
+ {0x15 , 4 , 0 , 0x00000043 },
272
+ {0x15 , 3 , 0 , 0x00000044 },
273
+ {0x48 , 0 , 0 , 0x00000010 },
274
+ {0x15 , 1 , 0 , 0x00000043 },
275
+ {0x15 , 0 , 1 , 0x00000044 },
276
+ {0x6 , 0 , 0 , 0x00040000 },
277
+ {0x6 , 0 , 0 , 0x00000000 }}
278
+
279
+ socketeerOptions .EbpfFilter = & unix.SockFprog {28 , & filter [0 ]}
280
+
249
281
gHammer = hammer .New (socketeerOptions , options )
250
282
251
283
err = gHammer .Init (ApiAddress , ApiPort )
252
284
253
285
if err != nil {
254
286
panic (err )
255
287
}
288
+
256
289
err = gHammer .Run ()
257
290
258
291
if err != nil {
0 commit comments