Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

Excel Logic

Use Case: Complicated SIEM LOGS

You might have a list of logs and need to see if both/or conditions are true. Here are two examples:

This AND That

More than 1 condition needs to be true:

=AND(B1 = "192.168.1.1", C1 = "Unauthorized Access")
RowIP AddressEvent TypeResult
1192.168.1.1Unauthorized Access=AND(B2 = “192.168.1.1”, C2 = “Unauthorized Access”)
2192.168.1.1Authorized Access=AND(B3 = “192.168.1.1”, C3 = “Unauthorized Access”)
310.0.0.5Unauthorized Access=AND(B4 = “10.0.0.5”, C4 = “Unauthorized Access”)
4172.16.0.1Unauthorized Access=AND(B5 = “172.16.0.1”, C5 = “Unauthorized Access”)

would render:

RowIP AddressEvent TypeResult
1192.168.1.1Unauthorized AccessTRUE
2192.168.1.1Authorized AccessFALSE
310.0.0.5Unauthorized AccessFALSE
4172.16.0.1Unauthorized AccessFALSE

This OR That

Only 1 condition needs to be true:

=OR(B1 = "192.168.1.1", B1 = "10.0.0.5")

Match List

If you had a sheet called “IOC” and that sheet had a list in column A of known IP addresses to look for, you could search your log entries in another tab like this:

=IF(ISNUMBER(MATCH(B1, IOC!A:A, 0)), "Match", "No Match")
TimestampIP AddressMatch Status
12:00192.168.1.1=IF(ISNUMBER(MATCH(B2, IOC!A:A, 0)), “Match”, “No Match”)
12:0110.0.0.5=IF(ISNUMBER(MATCH(B3, IOC!A:A, 0)), “Match”, “No Match”)
12:02172.16.0.1=IF(ISNUMBER(MATCH(B4, IOC!A:A, 0)), “Match”, “No Match”)

Match List AND

To check an entire list and other conditions, we can use the IOC list in Column A on the IOC sheet to look at many log entries:

=IF(AND(ISNUMBER(MATCH(B2, IOC!A:A, 0)), C2 = "Unauthorized Access"), "Match", "No Match")
RowIP AddressEvent TypeResult
1192.168.1.1Unauthorized Access=IF(AND(ISNUMBER(MATCH(B2, IOC!A:A, 0)), C2 = “Unauthorized Access”), “Match”, “No Match”)
2192.168.1.1Authorized Access=IF(AND(ISNUMBER(MATCH(B3, IOC!A:A, 0)), C3 = “Unauthorized Access”), “Match”, “No Match”)
310.0.0.5Unauthorized Access=IF(AND(ISNUMBER(MATCH(B4, IOC!A:A, 0)), C4 = “Unauthorized Access”), “Match”, “No Match”)
4172.16.0.1Unauthorized Access=IF(AND(ISNUMBER(MATCH(B5, IOC!A:A, 0)), C5 = “Unauthorized Access”), “Match”, “No Match”)

Other Options

  • Power Query/Get & Transform (Data > Filter > Event Type > Keyword)
  • Conditional Formatting: =AND(ISNUMBER(MATCH($B2, IOC!$A$1:$A$100, 0)), $C2 = "Unauthorized Access")

The formulas are a bit cumbersome, but will work regardless of the data type and are easy to customize.