def testSkipEstablished(self): # self.naming.GetNetAddr.return_value = _IPSET self.naming.GetServiceByProto.return_value = ['123'] pol = windows.WindowsGenerator( policy.ParsePolicy(GOOD_HEADER + TCP_ESTABLISHED_TERM + GOOD_TERM, self.naming), EXP_INFO) self.assertEqual(len(pol.windows_policies[0][4]), 1) pol = windows.WindowsGenerator( policy.ParsePolicy(GOOD_HEADER + UDP_ESTABLISHED_TERM + GOOD_TERM, self.naming), EXP_INFO) self.assertEqual(len(pol.windows_policies[0][4]), 1)
def testBuildWarningTokens(self): pol1 = windows.WindowsGenerator( policy.ParsePolicy(GOOD_HEADER + GOOD_WARNING_TERM, self.naming), EXP_INFO) st, sst = pol1._BuildTokens() self.assertEqual(st, SUPPORTED_TOKENS) self.assertEqual(sst, SUPPORTED_SUB_TOKENS)
def testBuildTokens(self): pol1 = windows.WindowsGenerator( policy.ParsePolicy(GOOD_HEADER + MULTIPLE_PROTOCOLS_TERM, self.naming), EXP_INFO) st, sst = pol1._BuildTokens() self.assertEqual(st, SUPPORTED_TOKENS) self.assertEqual(sst, SUPPORTED_SUB_TOKENS)