MCPcopy Create free account
hub / github.com/activecm/rita / TestNetworkID

Function TestNetworkID

integration/networkid_test.go:22–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20type NetworkIDSuite ValidDatasetTestSuite
21
22func TestNetworkID(t *testing.T) {
23 networkIDSuite := new(NetworkIDSuite)
24
25 // set up file system interface
26 afs := afero.NewOsFs()
27
28 cfg, err := config.ReadFileConfig(afs, ConfigPath)
29 require.NoError(t, err)
30
31 cfg.Filtering.FilterExternalToInternal = false
32
33 cfg.Env.DBConnection = dockerInfo.clickhouseConnection
34 require.NoError(t, err, "updating config should not return an error")
35
36 // // import data
37 results, err := cmd.RunImportCmd(time.Now(), cfg, afs, "../test_data/dnscat2-ja3-strobe-agent", "dnscat2_ja3_strobe_agent", false, false)
38 require.NoError(t, err)
39 networkIDSuite.importResults = results
40
41 // connect to database
42 db, err := database.ConnectToDB(context.Background(), "dnscat2_ja3_strobe_agent", cfg, nil)
43 require.NoError(t, err)
44
45 // determine which max timestamp to use for relative time calculations
46 minTimestamp, maxTimestamp, _, err := db.GetBeaconMinMaxTimestamps()
47 require.NoError(t, err)
48
49 networkIDSuite.maxTimestamp = maxTimestamp
50 networkIDSuite.minTimestamp = minTimestamp
51
52 // networkIDSuite.useCurrentTime = useCurrentTime
53 networkIDSuite.db = db
54 networkIDSuite.cfg = cfg
55 suite.Run(t, networkIDSuite)
56}
57
58func (it *NetworkIDSuite) TestNetworkIDSeparation() {
59 t := it.T()

Callers

nothing calls this directly

Calls 4

ReadFileConfigFunction · 0.92
RunImportCmdFunction · 0.92
ConnectToDBFunction · 0.92

Tested by

no test coverage detected