1 00:00:00,000 --> 00:00:10,140 All right, I'm Raphael. I work for a company called ArcSight, and for a living, I do enterprise security management or log analysis and correlation. 2 00:00:11,540 --> 00:00:18,880 And somehow over time, what happened to me was that I got kind of bored of the textual log files and parsing and everything, 3 00:00:19,080 --> 00:00:25,500 so I somehow developed a passion for visualization, and that's what I want to talk about today. 4 00:00:27,020 --> 00:00:31,120 So the rough outline is going to be that I want to introduce the problem very quickly. 5 00:00:31,420 --> 00:00:37,440 I'm going to show you what graphing really is and what I mean by that, and then I'm going to show you a tool that I developed over time, 6 00:00:37,840 --> 00:00:42,740 and some of you might have seen my talk last year where I introduced Afterglow a little bit. 7 00:00:43,560 --> 00:00:50,300 Over the last year, I have made quite some improvements on the tool and there are new features in there which are quite interesting, 8 00:00:50,460 --> 00:00:54,220 and I've gotten some really good feedback from you guys on what I should change 9 00:00:54,220 --> 00:00:55,480 and how you utilize the tool and how you use it. 10 00:00:55,500 --> 00:00:57,780 I'm going to show you how you can use this tool to actually visualize your own data. 11 00:00:58,620 --> 00:01:03,260 And what I want to do in the end, which is kind of the main part, is I want to go through a firewall log file 12 00:01:03,260 --> 00:01:06,700 and show you some of the things you can do with it and how you can visualize it. 13 00:01:11,660 --> 00:01:17,780 Just to send that up front, and you might have heard that from me already, but I need to do it because of legal issues. 14 00:01:18,240 --> 00:01:22,780 IP addresses and host names showing up in event graphs and descriptions are obfuscated or changed. 15 00:01:23,080 --> 00:01:24,600 The addresses are completely random. 16 00:01:24,600 --> 00:01:28,600 And any resemblance with well-known addresses or host names are purely coincidental. 17 00:01:28,900 --> 00:01:32,740 So don't try to play with these IP addresses and think it's me's. 18 00:01:32,860 --> 00:01:34,140 You're screwing someone else. 19 00:01:37,000 --> 00:01:37,720 All right. 20 00:01:37,900 --> 00:01:42,920 Well, the motivation for doing visualization or looking at graphs is really the question here. 21 00:01:43,140 --> 00:01:44,360 What would you rather look at? 22 00:01:44,760 --> 00:01:48,200 Do you want to look at the left-hand side or the right-hand side? 23 00:01:48,660 --> 00:01:52,780 I prefer the right-hand side because I can't even read the font on the left-hand side. 24 00:01:55,120 --> 00:02:00,980 And I guess this is something probably everyone has heard by now, but a picture is really worth 1,000 log entries. 25 00:02:01,180 --> 00:02:06,200 And I hope to be able to prove that in the next 50 minutes if I'm not going over time. 26 00:02:07,760 --> 00:02:08,380 All right. 27 00:02:08,440 --> 00:02:11,980 So how does graphing work or what do I mean by that? 28 00:02:12,200 --> 00:02:16,380 There are basically two steps if you simplify it a little bit. 29 00:02:16,680 --> 00:02:20,700 You have a device that generates a log file or maybe events. 30 00:02:20,840 --> 00:02:21,820 You record them. 31 00:02:22,340 --> 00:02:24,580 And you want to make a visual on the right side. 32 00:02:24,600 --> 00:02:29,400 Some kind of representation, a bar chart or a link graph or a tree map or something. 33 00:02:30,000 --> 00:02:34,440 What you have to do is you take that log file on the left side and you need to parse that thing. 34 00:02:34,600 --> 00:02:39,540 You need to figure out where are my source addresses in there, where are the destination addresses, where are the ports. 35 00:02:39,840 --> 00:02:42,500 So you need to parse it out and figure out all those things. 36 00:02:43,080 --> 00:02:47,420 And then you throw it into an event visualizer, whatever that is. 37 00:02:47,580 --> 00:02:49,760 You can use Afterglow, which I will show in a second. 38 00:02:50,080 --> 00:02:51,260 And you generate a graph. 39 00:02:54,600 --> 00:02:59,780 What I'm going to look at for graphs today is I don't want to cover all the different types of graphs that are out there or visuals. 40 00:03:00,040 --> 00:03:03,520 There's bar charts and pie charts and linear line charts and so on. 41 00:03:03,700 --> 00:03:05,800 What I want to cover is just these two types. 42 00:03:06,200 --> 00:03:08,440 There are link graphs and tree maps. 43 00:03:08,960 --> 00:03:16,000 Link graphs are basically you have a couple of nodes or three nodes and they're connected to each other and they show you a certain relationship. 44 00:03:16,720 --> 00:03:20,400 Tree maps, they look a little complicated when you look at them the first time. 45 00:03:20,500 --> 00:03:21,920 You might not quite understand what they are. 46 00:03:21,920 --> 00:03:26,180 But I want to introduce them to you and show exactly what they are in a second. 47 00:03:27,040 --> 00:03:33,380 Now if you take link graphs, a lot of times you will see graphs that show you communications between different IP addresses. 48 00:03:33,600 --> 00:03:36,860 You see that this machine talked to all these other machines. 49 00:03:37,600 --> 00:03:42,920 But the interesting thing is that you can actually reconfigure these graphs to also show you other things in a log file. 50 00:03:43,400 --> 00:03:45,020 So what I have here is a snort event. 51 00:03:45,300 --> 00:03:46,500 You don't have to be able to read this. 52 00:03:46,680 --> 00:03:51,080 But I basically take five fields out of this snort event. 53 00:03:51,920 --> 00:03:53,940 The event name, the IP addresses, and the ports. 54 00:03:54,540 --> 00:03:57,080 And there are different ways to configure a graph now. 55 00:03:57,600 --> 00:04:04,120 The regular way would be that you take the source address, then the event name, and then the destination address. 56 00:04:04,480 --> 00:04:09,480 So you will see things that what has this IP address done to other machines. 57 00:04:10,460 --> 00:04:19,320 However, if you configure this graph a little differently, if you say, well, let's visualize it the way that I have a source address, a destination address, and then the destination ports, 58 00:04:20,000 --> 00:04:21,760 you will suddenly see port scans. 59 00:04:21,920 --> 00:04:25,600 Because you see source machine going to some other machine on all kinds of ports. 60 00:04:26,280 --> 00:04:32,360 So that you wouldn't see that in the first configuration where you see a source IP, a name, and then a destination IP. 61 00:04:32,560 --> 00:04:34,400 Because you're not showing the destination ports. 62 00:04:34,980 --> 00:04:38,800 So the point of this slide is really you can configure these graphs all kinds of ways. 63 00:04:39,420 --> 00:04:42,540 And depending on the configuration, you will see different things. 64 00:04:44,900 --> 00:04:46,640 Now, let's have a look at tree maps. 65 00:04:46,920 --> 00:04:49,360 And I'm not sure how many people are familiar with those. 66 00:04:49,360 --> 00:04:53,240 But they're really useful for a lot of cases. 67 00:04:53,620 --> 00:04:58,920 So let's assume this rectangle that I have here is all your network traffic. 68 00:04:59,080 --> 00:05:00,880 Everything you see on the wire. 69 00:05:01,560 --> 00:05:07,440 Now, what I want to do, I want to see how many percent are UDP or TCP. 70 00:05:07,620 --> 00:05:09,240 Basically, I want to see the transport protocol here. 71 00:05:09,600 --> 00:05:15,300 And what I do is I just configure the tree map to use the transport protocol as a parameter. 72 00:05:15,980 --> 00:05:19,340 So what happens, I have 20% UDP, 80% TCP. 73 00:05:19,340 --> 00:05:21,420 And it just partitions it that way. 74 00:05:21,560 --> 00:05:24,660 So 20% in the rectangle is UDP here. 75 00:05:25,180 --> 00:05:29,600 Now, if I change the configuration, do not just be the protocol, the transport protocol. 76 00:05:29,860 --> 00:05:31,460 But I also want to see the service. 77 00:05:34,740 --> 00:05:38,580 So what happens then is basically this space is subdivided now. 78 00:05:38,860 --> 00:05:40,520 And the protocols are shown inside. 79 00:05:40,960 --> 00:05:44,480 So for UDP, you might see things like DNS or SNMP. 80 00:05:44,740 --> 00:05:47,120 And this is probably like a ratio of 90 to 10. 81 00:05:47,720 --> 00:05:49,320 And then on the other side, the TCP. 82 00:05:49,340 --> 00:05:53,560 You see the partitioning to all the TCP protocols you have. 83 00:05:54,060 --> 00:05:55,400 So you can set up a hierarchy. 84 00:05:55,820 --> 00:05:59,740 And the hierarchy is going to be displayed inside of this tree map. 85 00:05:59,880 --> 00:06:00,580 And you could go deeper. 86 00:06:00,760 --> 00:06:04,400 I could say now that I want to see the target port or the source IP address. 87 00:06:04,700 --> 00:06:09,440 And it will just be subdivided inside of these little rectangles. 88 00:06:09,480 --> 00:06:10,900 And it will show the percentage again. 89 00:06:12,580 --> 00:06:15,880 And you will see a real example later on what you can really do with this. 90 00:06:18,400 --> 00:06:19,320 Now, let's switch this. 91 00:06:19,340 --> 00:06:24,420 Switch over to Afterglow, which you will find either on the CD or on SourceForge. 92 00:06:25,220 --> 00:06:26,820 There are two versions right now. 93 00:06:27,340 --> 00:06:28,320 It's a little confusing. 94 00:06:28,520 --> 00:06:29,720 I apologize for that. 95 00:06:30,100 --> 00:06:31,840 There's basically a version 1.x. 96 00:06:32,440 --> 00:06:34,100 Currently, the one on CD is 1.56. 97 00:06:35,220 --> 00:06:39,160 And it's basically a Perl script that generates your link graphs. 98 00:06:40,200 --> 00:06:44,640 And then in the version 2.0, I started coding in Java and I used the library. 99 00:06:44,840 --> 00:06:49,300 And I thought I would be able to get all the capability or functionality from 1.x. 100 00:06:49,340 --> 00:06:50,480 into that new Java framework. 101 00:06:51,160 --> 00:06:53,620 But it turns out the library I'm using is a little buggy. 102 00:06:53,780 --> 00:06:56,440 And the author was not really responsive. 103 00:06:56,580 --> 00:06:57,880 I traded a few emails. 104 00:06:58,060 --> 00:07:02,020 And so far, I haven't gotten any patches for the bugs that I found. 105 00:07:02,160 --> 00:07:03,780 So for now, there are two versions. 106 00:07:03,940 --> 00:07:04,220 I'm sorry. 107 00:07:04,380 --> 00:07:06,900 Hopefully, at some point, there's a 3.0 which combines everything. 108 00:07:09,080 --> 00:07:14,300 So what you will also find in Afterglow is when I started playing with the log files, 109 00:07:14,440 --> 00:07:16,100 I needed to write parsers because otherwise, 110 00:07:16,100 --> 00:07:19,860 I couldn't really visualize my log files. 111 00:07:20,040 --> 00:07:23,560 So what I decided to do is the parsers I'm writing, 112 00:07:23,680 --> 00:07:25,680 I just put under the Afterglow distro as well. 113 00:07:26,640 --> 00:07:27,940 There are three parsers. 114 00:07:28,040 --> 00:07:29,900 One for the BSD packet filter. 115 00:07:30,420 --> 00:07:31,720 One for tcpdump. 116 00:07:31,900 --> 00:07:34,220 And I updated that to 3.9 recently. 117 00:07:34,960 --> 00:07:37,740 So if you're using an earlier version of tcpdump, 118 00:07:37,840 --> 00:07:40,240 it might not quite parse it out anymore. 119 00:07:41,080 --> 00:07:42,540 And then one for sendmail. 120 00:07:43,820 --> 00:07:45,460 If you look at the parsers quickly, 121 00:07:46,100 --> 00:07:48,600 it might actually be quite useful even if you don't want to do visualization. 122 00:07:50,460 --> 00:07:53,280 Here's an example of how to use tcpdump to CSV. 123 00:07:53,760 --> 00:07:56,860 So what it basically does is you pipe tcpdump into it. 124 00:07:57,380 --> 00:07:59,280 That's just a long comment line on top. 125 00:07:59,880 --> 00:08:03,440 And then you tell it what fields you want to extract 126 00:08:04,320 --> 00:08:06,400 from the original tcpdump output. 127 00:08:06,680 --> 00:08:11,080 And here, what I said is basically I want to see the source IP, 128 00:08:11,340 --> 00:08:13,800 the destination IP, and the source port. 129 00:08:16,100 --> 00:08:19,680 And if you want to know the names or the fields that are available, 130 00:08:19,760 --> 00:08:20,520 look at the source code. 131 00:08:20,600 --> 00:08:21,580 There's a list of all of them. 132 00:08:22,760 --> 00:08:24,660 So what this thing also does for you, 133 00:08:24,780 --> 00:08:26,080 it takes care of connections. 134 00:08:27,180 --> 00:08:30,620 If you look at a connection or if you look at a tcpdump 135 00:08:30,620 --> 00:08:32,900 and you see a client connecting to a server, 136 00:08:33,160 --> 00:08:36,220 you will see a request going over the wire. 137 00:08:36,340 --> 00:08:37,700 And the source address is the client. 138 00:08:37,880 --> 00:08:39,520 The destination address is the server. 139 00:08:40,200 --> 00:08:41,880 But then immediately followed by that, 140 00:08:41,920 --> 00:08:42,660 you will see a response. 141 00:08:43,120 --> 00:08:45,760 And now the source address seems to be coming from the server. 142 00:08:46,220 --> 00:08:47,140 Going to the client. 143 00:08:47,920 --> 00:08:49,220 If you visualize that, 144 00:08:49,400 --> 00:08:53,640 you will suddenly see that there was a bidirectional communication. 145 00:08:54,040 --> 00:08:56,900 So you're thinking that the server actually connected back to the client, 146 00:08:57,480 --> 00:08:59,780 which a lot of times you don't really want to do. 147 00:08:59,900 --> 00:09:01,120 You want to see the real connections. 148 00:09:01,320 --> 00:09:04,160 Who was connecting to whom and not the bidirectional thing. 149 00:09:04,900 --> 00:09:07,640 So the parser takes care of that for you. 150 00:09:07,720 --> 00:09:12,300 It will keep state and remember what initial setups it saw. 151 00:09:12,460 --> 00:09:13,360 It uses some heuristics. 152 00:09:13,480 --> 00:09:14,660 If it sees a by itself, 153 00:09:14,660 --> 00:09:16,640 then it's probably the session setup. 154 00:09:16,740 --> 00:09:18,200 If there's a that's the response. 155 00:09:18,600 --> 00:09:20,640 So it keeps a hash of all those connections 156 00:09:20,640 --> 00:09:24,440 and inverts the output if necessary. 157 00:09:25,900 --> 00:09:27,440 Then the sendmail parser. 158 00:09:27,600 --> 00:09:28,200 Sendmail is, 159 00:09:29,040 --> 00:09:32,020 they have certainly not designed this thing with logging in mind. 160 00:09:32,640 --> 00:09:35,180 What they do is for every email, 161 00:09:35,380 --> 00:09:36,920 they generate two log entries. 162 00:09:37,400 --> 00:09:40,640 One entry tells you this email came from someone. 163 00:09:41,140 --> 00:09:44,540 And then the other entry tells you it went to these people. 164 00:09:45,220 --> 00:09:47,300 And the way you connect them is the message ID, 165 00:09:47,900 --> 00:09:48,900 which is in bold here. 166 00:09:49,360 --> 00:09:51,740 So what I did is I just wrote a Perl script 167 00:09:51,740 --> 00:09:54,560 that basically remembers all those message IDs. 168 00:09:55,040 --> 00:09:58,720 And whenever it finds the combo of two went froms, 169 00:09:58,720 --> 00:10:02,220 it will output one entry showing you the two went froms in one line. 170 00:10:02,300 --> 00:10:04,080 So you can actually visualize connections now. 171 00:10:05,000 --> 00:10:07,980 And then the third one is the packet filter to CSV. 172 00:10:08,220 --> 00:10:09,620 And I'm going to use that in a little bit 173 00:10:09,620 --> 00:10:11,600 so I won't waste any time on it right now. 174 00:10:14,900 --> 00:10:15,940 Now, Afterglow, 175 00:10:15,980 --> 00:10:18,120 and we saw a similar diagram already 176 00:10:18,120 --> 00:10:20,180 on how do you graph something. 177 00:10:20,760 --> 00:10:23,640 So basically you have a device outputting some log file. 178 00:10:23,980 --> 00:10:25,280 You have a parser. 179 00:10:25,480 --> 00:10:27,280 Either you use one of the three that I provide 180 00:10:27,280 --> 00:10:29,440 or you use awk or something, 181 00:10:29,740 --> 00:10:33,580 or Perl to parse the logs into a CSV file. 182 00:10:33,940 --> 00:10:36,420 And that file you pump into Afterglow. 183 00:10:36,640 --> 00:10:39,520 And Afterglow outputs not a graph directly, 184 00:10:40,180 --> 00:10:41,400 but a graph description. 185 00:10:41,820 --> 00:10:45,000 So it basically uses the dot description 186 00:10:45,660 --> 00:10:47,020 from the GraphVis library. 187 00:10:47,420 --> 00:10:49,400 And it just says, okay, there are these nodes, 188 00:10:49,680 --> 00:10:52,420 A, B, C, D, E, and they're connected that way. 189 00:10:52,520 --> 00:10:55,580 So you have a node from A to B, one from B to C, and so on. 190 00:10:55,720 --> 00:10:57,280 So it just gives the description. 191 00:10:57,880 --> 00:10:59,640 And then you use some kind of a grapher. 192 00:10:59,840 --> 00:11:03,320 And I usually use GraphVis to generate the graphs 193 00:11:03,320 --> 00:11:06,220 because what that does, it does all the layouting. 194 00:11:06,240 --> 00:11:08,360 So it figures out where to place all the nodes 195 00:11:08,800 --> 00:11:11,580 so the overlaps of the edges 196 00:11:11,600 --> 00:11:12,540 and the edges are not too high. 197 00:11:12,720 --> 00:11:15,720 And you can kind of identify groups and so on. 198 00:11:15,840 --> 00:11:17,340 And I didn't want to tackle that problem 199 00:11:17,340 --> 00:11:19,580 because other people have done that. 200 00:11:21,480 --> 00:11:24,380 So what are some of the features of Afterglow? 201 00:11:24,520 --> 00:11:26,220 Well, it generates link graphs. 202 00:11:28,380 --> 00:11:30,380 Then what you can do is you can filter nodes. 203 00:11:30,780 --> 00:11:32,820 Well, you can say, well, I can do that with grep-v. 204 00:11:33,000 --> 00:11:33,700 Yes, you can. 205 00:11:34,300 --> 00:11:36,620 But it's a little nicer to actually configure it 206 00:11:36,620 --> 00:11:37,540 in Afterglow. 207 00:11:38,460 --> 00:11:40,780 And what you can do is you can either do it on a name. 208 00:11:40,780 --> 00:11:43,500 So I can say, I don't want to see any node 209 00:11:43,500 --> 00:11:47,020 that contains Windows, let's say. 210 00:11:48,320 --> 00:11:51,900 Or you can say, based on the number of times 211 00:11:51,900 --> 00:11:54,420 that node was seen, I only want to see nodes 212 00:11:54,420 --> 00:11:56,620 that have been seen more than 10 times 213 00:11:56,620 --> 00:11:57,940 or more than 100 times or something. 214 00:11:58,220 --> 00:11:59,840 So you can kind of filter noise out. 215 00:12:02,340 --> 00:12:04,120 Then you can do fan-out filtering. 216 00:12:04,420 --> 00:12:07,180 A fan-out of a node on the right side there, 217 00:12:07,280 --> 00:12:10,140 that blinking node, has a fan-out of three. 218 00:12:10,780 --> 00:12:12,840 So there are three connections going to other nodes. 219 00:12:13,420 --> 00:12:15,620 So you can specify when you draw a graph 220 00:12:15,620 --> 00:12:19,860 that you only want to see things that have a fan-out of x. 221 00:12:20,060 --> 00:12:23,280 So let's say only everything that has more than five 222 00:12:23,880 --> 00:12:25,680 connections going out you want to visualize. 223 00:12:26,460 --> 00:12:29,660 And you might already have in your mind 224 00:12:29,660 --> 00:12:30,440 what you want to do with this. 225 00:12:30,580 --> 00:12:32,660 And it's basically detecting port scans very, very quickly 226 00:12:32,660 --> 00:12:33,580 and filtering the noise. 227 00:12:35,460 --> 00:12:36,780 And then you can color everything. 228 00:12:37,040 --> 00:12:38,400 You can color the edges and the nodes. 229 00:12:39,820 --> 00:12:41,440 And finally, you can do clustering, 230 00:12:41,600 --> 00:12:42,760 which is very useful as well, 231 00:12:42,880 --> 00:12:46,580 because especially if you start visualizing firewall log files, 232 00:12:46,800 --> 00:12:48,800 you have these hundreds of machines 233 00:12:48,800 --> 00:12:50,900 or thousands of machines connected to your network. 234 00:12:51,100 --> 00:12:53,100 You're not interested in every single one 235 00:12:53,100 --> 00:12:55,480 because that graph is just going to be cluttered. 236 00:12:55,700 --> 00:12:57,400 So you want to cluster all those together. 237 00:12:57,660 --> 00:12:59,260 And I will show you what I did with that. 238 00:13:01,480 --> 00:13:05,520 If you start Afterglow, you can use "-h." 239 00:13:05,520 --> 00:13:08,240 And I think the usage is actually up-to-date. 240 00:13:08,240 --> 00:13:08,620 I hope. 241 00:13:09,980 --> 00:13:11,960 These are not all the parameters that are there, 242 00:13:12,140 --> 00:13:13,480 but the most important ones. 243 00:13:13,900 --> 00:13:16,000 The most important one in here is "-c," 244 00:13:16,000 --> 00:13:17,900 where you provide a configuration file. 245 00:13:18,140 --> 00:13:20,000 And I will show you a few of those files in a second. 246 00:13:20,980 --> 00:13:22,540 Then you can use "-d," 247 00:13:22,540 --> 00:13:25,040 and that basically adds the count 248 00:13:25,520 --> 00:13:28,620 of how many times a node showed up into the node itself. 249 00:13:29,120 --> 00:13:32,720 So you can kind of figure out what was more severe 250 00:13:32,720 --> 00:13:34,280 than other things because you might have seen them 251 00:13:34,280 --> 00:13:34,920 a lot of times. 252 00:13:36,220 --> 00:13:37,980 Then there's an easy way to change 253 00:13:38,240 --> 00:13:38,680 the edge length. 254 00:13:39,060 --> 00:13:40,880 You just say "-e," and then give a number. 255 00:13:41,240 --> 00:13:42,900 That's basically the default edge length 256 00:13:42,900 --> 00:13:46,780 that it uses to have the nodes separated. 257 00:13:47,900 --> 00:13:49,380 Then you can also use "-n," 258 00:13:49,380 --> 00:13:51,180 if you're not interested in node labels at all. 259 00:13:51,320 --> 00:13:52,840 You just get rid of them. 260 00:13:53,160 --> 00:13:54,480 And sometimes that's really useful 261 00:13:54,480 --> 00:13:55,980 to just see kind of patterns in there 262 00:13:55,980 --> 00:13:58,180 if you're not interested in seeing all the labels 263 00:13:58,180 --> 00:13:59,820 and knowing exactly what it is, 264 00:13:59,900 --> 00:14:02,420 but just kind of figure out what does this look like. 265 00:14:03,340 --> 00:14:06,260 And then you have "-o." 266 00:14:06,260 --> 00:14:07,960 It's a horrible way. 267 00:14:08,240 --> 00:14:09,580 I even named it here, omit threshold. 268 00:14:09,760 --> 00:14:13,480 It's basically how many times does a node have to show up 269 00:14:13,480 --> 00:14:14,780 to actually be in the graph. 270 00:14:15,000 --> 00:14:16,320 That's what I kind of described before, 271 00:14:16,800 --> 00:14:17,820 number of occurrences. 272 00:14:18,480 --> 00:14:20,700 And then you have a "-f," and a "-g," 273 00:14:21,220 --> 00:14:23,900 which is used for the fan-out filtering. 274 00:14:24,120 --> 00:14:26,360 And you can specify two different fan-out filters, 275 00:14:26,500 --> 00:14:27,460 one for the source nodes, 276 00:14:28,000 --> 00:14:31,220 how many connections does that guy need to have, 277 00:14:31,380 --> 00:14:34,000 and one for the event node, so the middle node, 278 00:14:34,220 --> 00:14:37,300 how many connections does that guy have to have to show up. 279 00:14:38,240 --> 00:14:41,600 And "-f is for the source, and "-g is for the event node. 280 00:14:43,240 --> 00:14:44,820 Now we're getting into the property file, 281 00:14:44,920 --> 00:14:46,800 and this is really where you configure everything 282 00:14:46,800 --> 00:14:47,580 for Afterglow. 283 00:14:49,280 --> 00:14:50,400 Let's start out with coloring. 284 00:14:51,360 --> 00:14:53,260 What you do is, in the file, 285 00:14:53,320 --> 00:14:54,660 you basically see color, dot, 286 00:14:54,780 --> 00:14:57,080 and then either source, event, target, or edge. 287 00:14:58,060 --> 00:14:59,500 And then you give a Perl expression. 288 00:15:00,940 --> 00:15:02,260 This gets really evil here. 289 00:15:03,320 --> 00:15:05,380 The easiest Perl expression is just a string. 290 00:15:05,580 --> 00:15:07,100 You just say, red. 291 00:15:08,240 --> 00:15:10,440 And the source, for example, 292 00:15:10,440 --> 00:15:11,580 is going to be red all the time. 293 00:15:13,380 --> 00:15:15,640 Then, if you want to get a little more sophisticated, 294 00:15:16,000 --> 00:15:17,020 use the next line, 295 00:15:17,140 --> 00:15:19,220 color.event equals red if, 296 00:15:20,100 --> 00:15:22,820 and then I provide some kind of an expression there. 297 00:15:24,240 --> 00:15:27,720 And Afterglow keeps track of the current log entry 298 00:15:28,240 --> 00:15:29,840 in the at fields array. 299 00:15:31,180 --> 00:15:34,500 So if I do this here, $fields 1, 300 00:15:34,740 --> 00:15:37,660 that means that the second column starts at zero, 301 00:15:38,240 --> 00:15:41,580 the second column has to be matching this regex, 302 00:15:41,720 --> 00:15:44,200 basically starting with 192 dot something. 303 00:15:44,680 --> 00:15:48,000 In that case, I would make the node red. 304 00:15:48,940 --> 00:15:50,640 And you can do all kinds of things here. 305 00:15:50,760 --> 00:15:53,900 It's really just doing an eval on this Perl expression, 306 00:15:54,140 --> 00:15:56,080 so whatever you want to do, 307 00:15:56,160 --> 00:15:57,840 you can read from files and all kinds of things. 308 00:15:58,940 --> 00:16:00,420 Then if you want to filter the nodes, 309 00:16:00,600 --> 00:16:01,540 you just use the color invisible. 310 00:16:02,640 --> 00:16:04,220 Same idea, you say invisible, 311 00:16:04,440 --> 00:16:07,400 then if the first column equals isAction, 312 00:16:08,240 --> 00:16:08,660 it won't be shown. 313 00:16:12,740 --> 00:16:14,720 Then the clustering works very similar. 314 00:16:15,040 --> 00:16:16,560 You just say cluster dot source, 315 00:16:16,820 --> 00:16:18,580 and then again you give a Perl expression. 316 00:16:19,200 --> 00:16:22,480 What this does now is it evaluates that for every node 317 00:16:23,110 --> 00:16:26,520 and basically returns or changes the node name. 318 00:16:27,080 --> 00:16:31,660 So if I have a whole bunch of 192, 168 addresses, 319 00:16:32,280 --> 00:16:35,320 and I want to cluster them together into one node, 320 00:16:35,540 --> 00:16:38,040 I can basically say that the cluster dot source 321 00:16:38,240 --> 00:16:41,240 equals, and then I just give some kind of a string. 322 00:16:41,460 --> 00:16:44,640 I can say 192, 168 dot x dot x 323 00:16:45,900 --> 00:16:49,960 if the field matches my regular expression, 324 00:16:50,120 --> 00:16:52,600 192 dot 168 dot star. 325 00:16:53,640 --> 00:16:56,180 And that would be the node that is assigned now 326 00:16:56,180 --> 00:16:57,180 instead of all the others. 327 00:16:57,260 --> 00:16:59,140 So that's evaluated every time a node is drawn. 328 00:17:00,580 --> 00:17:02,020 We'll see an example of that in a second. 329 00:17:02,220 --> 00:17:04,120 So this is kind of my hello world example. 330 00:17:04,900 --> 00:17:07,120 My input data is on the upper left. 331 00:17:07,120 --> 00:17:08,820 There are four entries in my log file, 332 00:17:09,000 --> 00:17:11,320 A, B, A, C, B, C, and D, E. 333 00:17:11,920 --> 00:17:13,340 If you would just visualize that, 334 00:17:13,480 --> 00:17:15,620 you would get something on the lower left. 335 00:17:16,460 --> 00:17:17,520 The nodes are connected. 336 00:17:18,380 --> 00:17:21,820 The command to run Afterglow is on top, 337 00:17:22,060 --> 00:17:25,000 and I think there is a pipe missing in your slides 338 00:17:25,500 --> 00:17:28,000 on the top right, but you will realize that yourself. 339 00:17:28,520 --> 00:17:31,440 You cat the file, you pipe it into Afterglow, 340 00:17:31,500 --> 00:17:33,660 you give it a property file, and you use minus T. 341 00:17:34,800 --> 00:17:37,100 By default, Afterglow expects afterglow 342 00:17:37,100 --> 00:17:38,020 as a three-column input, 343 00:17:38,600 --> 00:17:40,860 basically the first column being the source, 344 00:17:41,140 --> 00:17:42,680 the second column being the event node, 345 00:17:42,860 --> 00:17:44,780 and the third column being the destination node. 346 00:17:45,780 --> 00:17:48,360 So it's always a three-tier thing here. 347 00:17:48,540 --> 00:17:52,020 But if you use minus T, you just give it a two-column input, 348 00:17:52,220 --> 00:17:53,060 and that's what I have here. 349 00:17:53,760 --> 00:17:55,420 So now to color these nodes, 350 00:17:56,060 --> 00:17:57,820 you can guess how that works, 351 00:17:58,380 --> 00:18:00,640 you just say color dot target is blue. 352 00:18:00,880 --> 00:18:03,020 And by the way, that's all my PowerPoint skills. 353 00:18:03,160 --> 00:18:03,920 I can't go any further. 354 00:18:05,680 --> 00:18:07,020 So target is blue. 355 00:18:07,100 --> 00:18:10,260 It's blue if the second column is not an E. 356 00:18:11,640 --> 00:18:13,340 So you look at all the target nodes, 357 00:18:13,460 --> 00:18:15,380 the ones that get an arrow pointing to them, 358 00:18:15,680 --> 00:18:16,380 they're blue. 359 00:18:16,840 --> 00:18:19,280 The E there is not blue because it's not E. 360 00:18:20,500 --> 00:18:22,900 Or it is E. Sorry, it's early. 361 00:18:24,420 --> 00:18:30,080 Then the source, I want to make green if it's not D. 362 00:18:30,400 --> 00:18:32,160 So that's that one guy there. 363 00:18:32,700 --> 00:18:35,700 And by the way, it's first match, and then it's done. 364 00:18:35,700 --> 00:18:37,520 So it doesn't go and devaluate the rest. 365 00:18:38,340 --> 00:18:40,820 And then everything and all the other sources 366 00:18:41,420 --> 00:18:42,300 are going to be red. 367 00:18:43,480 --> 00:18:46,640 And then whatever is left, I just say color is green. 368 00:18:46,840 --> 00:18:50,280 So I don't have to say color dot target now or anything. 369 00:18:50,420 --> 00:18:52,700 I just say color, and that applies to all the nodes. 370 00:18:54,860 --> 00:18:56,660 All right, so that's the easy example, 371 00:18:56,740 --> 00:18:57,820 and it's getting harder from here. 372 00:18:57,900 --> 00:18:59,460 I hope you're all still following. 373 00:19:00,000 --> 00:19:00,800 Okay? Good. 374 00:19:01,560 --> 00:19:05,480 All right, but let's quickly talk about Afterglow 2.0. 375 00:19:05,700 --> 00:19:08,860 So in case you want to play with it, it's a little simpler. 376 00:19:09,460 --> 00:19:11,400 You have two common line parameters. 377 00:19:12,740 --> 00:19:14,160 One is for the property file, 378 00:19:14,660 --> 00:19:16,760 and the other one optional is for the data file. 379 00:19:17,220 --> 00:19:20,740 You can also provide the data file inside of the property file 380 00:19:21,200 --> 00:19:22,260 if you choose to do so. 381 00:19:23,320 --> 00:19:24,860 It's taking CSV input again. 382 00:19:25,240 --> 00:19:26,180 That's kind of my mantra. 383 00:19:26,360 --> 00:19:29,200 I want to use CSV files because then you can use your own parsers. 384 00:19:29,260 --> 00:19:31,580 I don't have to care about your data set at all. 385 00:19:31,800 --> 00:19:35,020 You just give me the CSV file, and I try to draw you a graph. 386 00:19:36,100 --> 00:19:39,700 And the interesting thing about Afterglow 2.0 387 00:19:39,700 --> 00:19:44,940 is that you have the tool generate the graph itself. 388 00:19:45,240 --> 00:19:47,540 So it doesn't just generate a description, 389 00:19:47,680 --> 00:19:49,220 and then you have to use some kind of grapher 390 00:19:49,220 --> 00:19:50,860 to actually visualize it. 391 00:19:51,120 --> 00:19:55,040 But it's a Java itself that generates the tree map right away. 392 00:19:55,360 --> 00:19:58,460 And what I can do with that is you have a little bit of interactivity. 393 00:19:58,640 --> 00:20:03,520 You can basically zoom in into different parts of this tree map 394 00:20:03,520 --> 00:20:05,680 if you want to look at close-ups. 395 00:20:05,700 --> 00:20:09,220 And you can change on what level of the hierarchy 396 00:20:09,220 --> 00:20:10,420 you want to use the color. 397 00:20:11,440 --> 00:20:13,700 So before, if you remember the example, 398 00:20:14,420 --> 00:20:16,960 my top-level hierarchy was the transport protocol. 399 00:20:17,340 --> 00:20:20,560 So you can say, I want to color this graph by the transport protocol. 400 00:20:20,820 --> 00:20:24,160 So you will just have basically two different colors in your graph. 401 00:20:24,640 --> 00:20:27,060 Or you can choose to color on the service, 402 00:20:27,300 --> 00:20:30,180 and then you will have all kinds of different colors just as in my example. 403 00:20:30,340 --> 00:20:33,860 So you can kind of play with where you want to use the color from, 404 00:20:33,920 --> 00:20:35,460 what depth in the hierarchy. 405 00:20:36,700 --> 00:20:39,060 And a simple output looks like this. 406 00:20:42,920 --> 00:20:44,860 All right, so let's get a little more practical. 407 00:20:45,080 --> 00:20:49,440 And let's see how we can visualize a firewall log file. 408 00:20:50,380 --> 00:20:54,420 And you've got to stop me if I'm going too fast here. 409 00:20:55,920 --> 00:20:58,180 So if I'm analyzing a firewall log file, 410 00:20:58,300 --> 00:20:59,720 there are a few steps I want to take. 411 00:20:59,860 --> 00:21:01,540 The first step is certainly I need to parse it. 412 00:21:02,900 --> 00:21:03,960 The second step, 413 00:21:03,960 --> 00:21:07,760 I probably want to look at what is coming into my network, 414 00:21:07,980 --> 00:21:10,340 what is allowed through the firewall. 415 00:21:10,660 --> 00:21:12,180 So I kind of know what is hitting me. 416 00:21:12,240 --> 00:21:14,120 So I can probably verify the ACL 417 00:21:14,120 --> 00:21:17,180 and figure out whether there are any gap or any holes 418 00:21:17,180 --> 00:21:19,460 of things that are coming into my network which shouldn't. 419 00:21:20,600 --> 00:21:23,380 Second, I probably want to look what is leaving my network. 420 00:21:23,680 --> 00:21:26,140 Everything is allowed to go out. 421 00:21:28,580 --> 00:21:30,280 And I'm actually quite surprised 422 00:21:30,760 --> 00:21:33,000 to see very big corporations in the U.S. 423 00:21:33,000 --> 00:21:36,800 still having no outbound ACLs and just letting everything out, 424 00:21:36,960 --> 00:21:40,240 which is, I don't know, great security. 425 00:21:42,620 --> 00:21:48,140 Then I usually look at outgoing blocked traffic. 426 00:21:48,340 --> 00:21:51,200 And that tells me that either I have misconfigured machines, 427 00:21:51,580 --> 00:21:54,960 which are not configured according to my policy 428 00:21:54,960 --> 00:21:57,600 because they should not be trying to connect outbound 429 00:21:57,600 --> 00:21:59,020 if they're not allowed to. 430 00:21:59,380 --> 00:22:02,980 Or maybe my firewall rule set is misconfigured 431 00:22:03,000 --> 00:22:05,340 and there's really a need for the service to communicate out. 432 00:22:05,600 --> 00:22:08,380 So if you have ever set up a firewall yourself 433 00:22:09,120 --> 00:22:10,800 and nothing worked anymore, 434 00:22:11,100 --> 00:22:15,160 you might have realized that you might have blocked ICMP 435 00:22:15,160 --> 00:22:18,900 and it doesn't do path empty discovery anymore 436 00:22:18,900 --> 00:22:19,780 or something like that. 437 00:22:19,900 --> 00:22:23,540 So communication is gone, especially in the older DSL worlds. 438 00:22:24,800 --> 00:22:26,600 And then if you're brave, 439 00:22:26,800 --> 00:22:31,140 you can also try to visualize or analyze the traffic 440 00:22:31,140 --> 00:22:32,840 that is blocked from coming in. 441 00:22:33,000 --> 00:22:34,940 And you will see all kinds of things in there. 442 00:22:37,180 --> 00:22:38,800 So the parsing part. 443 00:22:39,520 --> 00:22:44,340 I have a PF output here, a log file, just two lines. 444 00:22:45,400 --> 00:22:47,680 Then what you do is you cat that file 445 00:22:48,640 --> 00:22:51,420 and you use PF to CSV to parse it. 446 00:22:51,780 --> 00:22:53,700 And in this case, again, I want to use source IP, 447 00:22:53,760 --> 00:22:55,240 destination IP, destination port. 448 00:22:55,660 --> 00:22:57,300 And the output is just going to be 449 00:22:57,300 --> 00:22:59,900 those three fields delimited by a comma. 450 00:23:03,000 --> 00:23:06,280 Now this CSV output is the input for Afterglow. 451 00:23:07,440 --> 00:23:09,160 Well, putting it all together, 452 00:23:10,040 --> 00:23:13,340 you basically cat the log file, PF to CSV, 453 00:23:13,600 --> 00:23:16,820 give the fields you want, 454 00:23:17,040 --> 00:23:19,380 pipe that into Afterglow with a property file, 455 00:23:19,540 --> 00:23:21,520 and then pipe it into GraphVis. 456 00:23:21,720 --> 00:23:26,740 And there are basically four tools that GraphVis provides 457 00:23:26,740 --> 00:23:28,800 that use different layout algorithms. 458 00:23:29,240 --> 00:23:32,380 One is DOT, which uses hierarchical layout. 459 00:23:33,000 --> 00:23:33,780 And you will see that in a second 460 00:23:33,780 --> 00:23:34,880 in the first example I have. 461 00:23:35,720 --> 00:23:39,280 Then there is NITO, which does a organic layouting. 462 00:23:39,360 --> 00:23:41,600 So it tries to place the nodes optimal 463 00:23:41,600 --> 00:23:43,340 so there are not too many overlaps 464 00:23:43,340 --> 00:23:44,980 and similar things fall together. 465 00:23:46,460 --> 00:23:49,100 Sometimes, in a few cases, that doesn't work out too well. 466 00:23:49,320 --> 00:23:50,200 And there are two others. 467 00:23:50,400 --> 00:23:53,700 There's CIRCO, which uses a circular approach. 468 00:23:53,900 --> 00:23:57,380 It basically starts by putting all the nodes into the middle. 469 00:23:57,800 --> 00:24:00,260 And then there is apparently too much overlap there. 470 00:24:00,400 --> 00:24:02,260 So it starts to just move some of the nodes out 471 00:24:03,000 --> 00:24:03,240 and out. 472 00:24:03,320 --> 00:24:06,580 So it does concentric circles until it finds a layout 473 00:24:06,580 --> 00:24:10,580 where the nodes are placed in a decent distance to each other. 474 00:24:11,160 --> 00:24:12,920 And then there is 2PI, 475 00:24:13,180 --> 00:24:17,100 which uses some other weird algorithm to place things. 476 00:24:17,240 --> 00:24:18,580 So if you get stuck with the others, 477 00:24:18,620 --> 00:24:20,920 you can try 2PI and see what comes out of there. 478 00:24:23,380 --> 00:24:23,980 All right. 479 00:24:24,080 --> 00:24:28,440 So let's take the first use case we want to go after here. 480 00:24:28,840 --> 00:24:31,180 I want to look at all the traffic that got passed 481 00:24:31,180 --> 00:24:32,240 coming into my network. 482 00:24:33,000 --> 00:24:36,860 So what I do is I somehow grab all the passes in my log file. 483 00:24:37,100 --> 00:24:38,860 And don't do this literally. 484 00:24:39,060 --> 00:24:41,240 I just use this placeholder pass in. 485 00:24:41,380 --> 00:24:44,380 It really depends on how you filter for that in your log file. 486 00:24:44,520 --> 00:24:47,260 What I did in my log file is I grabbed everything 487 00:24:47,260 --> 00:24:50,100 that is coming in on my outer interface, 488 00:24:50,360 --> 00:24:51,740 which I think was XL1 or something. 489 00:24:53,220 --> 00:24:55,260 Then you pipe it into PFCSV. 490 00:24:55,420 --> 00:24:58,320 I get my source IP, destination IP, and destination port. 491 00:24:59,180 --> 00:25:02,360 And then I go into Afterglow, give it a properties file. 492 00:25:03,000 --> 00:25:06,160 I use minus D because I want to see the counts on the nodes. 493 00:25:06,260 --> 00:25:07,820 How many times did these things show up? 494 00:25:08,040 --> 00:25:09,400 If something showed up just once, 495 00:25:09,660 --> 00:25:13,220 I might just close my eyes and not think about it. 496 00:25:14,040 --> 00:25:15,580 And then I pipe it into dot. 497 00:25:15,820 --> 00:25:17,320 That's the hierarchical layouting. 498 00:25:17,680 --> 00:25:19,700 And that basically looks like this. 499 00:25:22,220 --> 00:25:24,220 So you have a node on top called external, 500 00:25:25,100 --> 00:25:26,320 which is already kind of strange 501 00:25:26,320 --> 00:25:30,180 because there is no external IP address or an IP address 502 00:25:30,180 --> 00:25:31,840 that's called external in my log file. 503 00:25:31,840 --> 00:25:33,260 So we'll figure out how we do that. 504 00:25:33,620 --> 00:25:36,240 And then you see all the machines in my network 505 00:25:36,240 --> 00:25:36,780 that were accessed. 506 00:25:37,300 --> 00:25:41,180 And then the bottom circles are the target ports 507 00:25:41,180 --> 00:25:43,560 or destination ports that you connected to. 508 00:25:44,340 --> 00:25:46,460 So how do we get the colors and the clustering? 509 00:25:46,780 --> 00:25:50,900 Well, use a few features to make this not too complicated. 510 00:25:51,400 --> 00:25:53,820 So the first thing we want to do is the clustering. 511 00:25:54,700 --> 00:25:56,780 So what I do is say the cluster.source, 512 00:25:57,000 --> 00:25:58,340 so all my source addresses, 513 00:25:58,500 --> 00:26:00,560 because I'm assuming the sources are in the Internet. 514 00:26:00,560 --> 00:26:01,940 That's what I'm looking for, 515 00:26:01,980 --> 00:26:03,120 everything that comes into my network. 516 00:26:03,500 --> 00:26:05,680 So the source is external. 517 00:26:06,260 --> 00:26:08,020 That's the cluster name that I want to give it. 518 00:26:08,900 --> 00:26:11,820 If it doesn't match my internal IP range. 519 00:26:12,800 --> 00:26:15,820 And match is a function that Afterglow provides you. 520 00:26:15,960 --> 00:26:18,040 And it basically, I told you before 521 00:26:18,040 --> 00:26:19,840 that there's this add fields array 522 00:26:20,560 --> 00:26:24,320 that it basically keeps track of the entries in the log file 523 00:26:24,320 --> 00:26:25,600 for the current entry that it looks at. 524 00:26:25,800 --> 00:26:28,400 The match just looks at all three of them 525 00:26:28,400 --> 00:26:29,880 and makes sure that, 526 00:26:30,700 --> 00:26:31,660 none of them matches. 527 00:26:31,980 --> 00:26:33,140 And if I mean source, 528 00:26:33,420 --> 00:26:34,680 it only looks at the first one. 529 00:26:35,280 --> 00:26:36,520 If I just said cluster, 530 00:26:36,780 --> 00:26:38,160 it would look at all three of them. 531 00:26:39,580 --> 00:26:40,880 So it always uses the one 532 00:26:40,880 --> 00:26:41,980 where it's evaluating currently. 533 00:26:42,360 --> 00:26:43,620 So this is a very simple way 534 00:26:43,620 --> 00:26:45,340 of clustering all my external nodes. 535 00:26:46,160 --> 00:26:48,480 Then I say, well, I want to have this thing read. 536 00:26:49,040 --> 00:26:51,920 So basically, if the field is external. 537 00:26:52,220 --> 00:26:53,960 I could also use matches here 538 00:26:53,960 --> 00:26:56,520 if I use external as a regex basically. 539 00:26:56,740 --> 00:26:58,620 But I chose to use field, 540 00:26:58,720 --> 00:27:00,020 which is another function that I have. 541 00:27:00,620 --> 00:27:02,740 That just returns the current field it looks at. 542 00:27:03,100 --> 00:27:04,900 And then you can compare that to something. 543 00:27:06,600 --> 00:27:07,820 Then the event, 544 00:27:08,080 --> 00:27:10,140 so that's the dark blue nodes there. 545 00:27:10,300 --> 00:27:11,160 I want to have them blue 546 00:27:11,160 --> 00:27:13,760 if they match my internal address range. 547 00:27:14,620 --> 00:27:17,520 I hope that all my nodes are going to be blue now. 548 00:27:18,080 --> 00:27:20,240 However, you see there are a couple of light blue ones 549 00:27:20,240 --> 00:27:20,880 in the bottom left. 550 00:27:21,220 --> 00:27:22,580 So I just, what I did there is, 551 00:27:22,600 --> 00:27:24,780 I say everything else that's not blue is light blue. 552 00:27:25,040 --> 00:27:26,500 And that's actually kind of interesting. 553 00:27:26,640 --> 00:27:28,500 Why do I have the light blue ones on the bottom left? 554 00:27:29,140 --> 00:27:30,600 Well, if you look a little closer, 555 00:27:31,060 --> 00:27:32,880 you see that my machines were connecting out 556 00:27:32,880 --> 00:27:33,900 to those guys in the internet. 557 00:27:34,160 --> 00:27:35,680 And they're using port 20. 558 00:27:37,060 --> 00:27:39,500 And that's an artifact of FTP 559 00:27:40,660 --> 00:27:44,940 because the way PF2CSV parses my file, 560 00:27:45,060 --> 00:27:48,900 it doesn't know that there is a back connection out 561 00:27:48,900 --> 00:27:50,640 from FTP. 562 00:27:51,060 --> 00:27:52,680 So that still stays in there. 563 00:27:52,780 --> 00:27:53,880 But it's kind of nice to see that. 564 00:27:54,000 --> 00:27:56,780 So I know that two machines in my network 565 00:27:56,780 --> 00:27:58,480 were actually FTPing back to me. 566 00:27:58,500 --> 00:27:58,600 So I don't have to go back out 567 00:27:58,600 --> 00:28:01,760 or sending traffic data out to the internet. 568 00:28:03,420 --> 00:28:04,860 And everything else is just red. 569 00:28:06,800 --> 00:28:08,160 And what I see in this graph now, 570 00:28:08,200 --> 00:28:09,020 if I look a little closer, 571 00:28:09,160 --> 00:28:10,260 I see all kinds of different ports. 572 00:28:10,380 --> 00:28:11,140 I see port 25. 573 00:28:11,680 --> 00:28:12,980 Yeah, I have a mail server. 574 00:28:13,560 --> 00:28:14,800 I have port 22. 575 00:28:15,080 --> 00:28:17,440 Yes, I do SSH administration on there. 576 00:28:17,760 --> 00:28:19,120 I have some echo requests. 577 00:28:20,240 --> 00:28:22,300 Well, hopefully that was me pinging those machines 578 00:28:22,300 --> 00:28:22,900 and no one else. 579 00:28:23,320 --> 00:28:24,600 I have FTP. 580 00:28:24,780 --> 00:28:25,280 I have web. 581 00:28:25,500 --> 00:28:27,420 I have HTTPS. 582 00:28:27,520 --> 00:28:28,100 I have some DNS. 583 00:28:28,740 --> 00:28:30,300 And then I have port 100. 584 00:28:31,760 --> 00:28:33,320 And it's actually a log file of mine. 585 00:28:33,400 --> 00:28:34,880 And I had that lying around for like two years. 586 00:28:35,020 --> 00:28:35,700 And I visualized it. 587 00:28:35,760 --> 00:28:36,800 And I'm like, what is port 100? 588 00:28:37,680 --> 00:28:39,720 And it showed up only 21 times. 589 00:28:40,240 --> 00:28:43,760 And I remembered, yes, that was my backdoor SSH access 590 00:28:44,300 --> 00:28:46,620 whenever I updated SSH on port 22. 591 00:28:46,820 --> 00:28:48,920 And I didn't quite know how to do that back then. 592 00:28:49,060 --> 00:28:52,460 If I bounced it, I always locked myself out. 593 00:28:52,820 --> 00:28:54,920 So I just had another SSH on port 100. 594 00:28:55,600 --> 00:28:58,080 So I could connect in there, bounce the one on 22, 595 00:28:58,080 --> 00:28:59,320 update it, and whatever. 596 00:28:59,900 --> 00:29:02,000 So I remembered it was all OK. 597 00:29:02,220 --> 00:29:03,040 So I was good. 598 00:29:04,280 --> 00:29:04,840 All right. 599 00:29:04,920 --> 00:29:07,740 So the next use case is a very simple one. 600 00:29:07,860 --> 00:29:10,340 I want to see everything that goes out of my network. 601 00:29:11,580 --> 00:29:15,260 And here, again, I'm using very loose syntax. 602 00:29:15,600 --> 00:29:18,180 You don't see the PF to CSV up there in the command. 603 00:29:18,340 --> 00:29:20,180 So if you run this literally, it won't work. 604 00:29:20,400 --> 00:29:23,360 But just instead of the graph pass out, 605 00:29:23,640 --> 00:29:26,360 plug your PF to CSV in there and the things you want to do. 606 00:29:28,120 --> 00:29:31,080 So basically, I look at all the things that are going out. 607 00:29:31,160 --> 00:29:32,760 And this is the graph that shows up. 608 00:29:33,080 --> 00:29:34,720 You can't read the node labels, I know. 609 00:29:35,300 --> 00:29:37,060 In the middle, it's an external node again. 610 00:29:38,800 --> 00:29:40,520 And everything connects to it. 611 00:29:40,900 --> 00:29:44,020 Those four machines or three machines, no, four of mine, 612 00:29:44,120 --> 00:29:46,900 the light blue ones, the circles that you see, 613 00:29:46,980 --> 00:29:48,120 they all connect out. 614 00:29:48,280 --> 00:29:50,460 And you see the red ones are all the target ports. 615 00:29:51,040 --> 00:29:54,660 I don't see much of concern in here. 616 00:29:54,820 --> 00:29:56,700 There is a lot of web traffic. 617 00:29:56,700 --> 00:29:57,860 There's some echo replies. 618 00:29:58,520 --> 00:30:01,680 So maybe I could actually filter that because I have people pinging me. 619 00:30:01,780 --> 00:30:04,640 So I might want to restrict them from knowing that my machines are up. 620 00:30:05,520 --> 00:30:07,380 I have some DNS traffic going out. 621 00:30:07,580 --> 00:30:11,080 And a little bit of the traffic is 123 NTP. 622 00:30:13,400 --> 00:30:16,400 That's probably okay if I'm syncing out with some external source. 623 00:30:16,640 --> 00:30:19,660 What I might want to do is verify what the target addresses 624 00:30:19,660 --> 00:30:21,480 of those NTP connections were, 625 00:30:21,580 --> 00:30:24,120 whether they were really NTP servers I configured 626 00:30:24,700 --> 00:30:25,740 and not some other machines. 627 00:30:25,740 --> 00:30:28,080 And someone is trying to tunnel something or so. 628 00:30:29,800 --> 00:30:32,140 Well, the next thing I want to try here 629 00:30:32,520 --> 00:30:37,720 is I want to look at all the traffic that gets blocked going outbound. 630 00:30:37,980 --> 00:30:41,280 And remember, this is either a misconfiguration of my internal machine 631 00:30:41,280 --> 00:30:43,440 or the ACL is misconfigured 632 00:30:43,440 --> 00:30:46,160 because there is a service that is needed by internal machines 633 00:30:46,160 --> 00:30:46,860 and it's not allowed. 634 00:30:47,460 --> 00:30:50,680 What comes up is this really nice cluster of nodes. 635 00:30:52,360 --> 00:30:53,180 What happened? 636 00:30:55,740 --> 00:30:57,820 There's a lot of target ports that are being blocked. 637 00:30:58,060 --> 00:31:00,840 So does that mean all my machines are misconfigured 638 00:31:00,840 --> 00:31:03,100 or the ACL is wrong? 639 00:31:03,640 --> 00:31:04,200 Probably not. 640 00:31:04,400 --> 00:31:05,280 Let's think about this. 641 00:31:05,980 --> 00:31:07,180 We have a client and a server. 642 00:31:08,120 --> 00:31:08,480 Simplified. 643 00:31:08,520 --> 00:31:10,320 I have some machines in my network which are the servers. 644 00:31:10,400 --> 00:31:11,600 The client is probably on the Internet. 645 00:31:11,960 --> 00:31:13,600 I have my firewall with two interfaces. 646 00:31:15,120 --> 00:31:18,180 If I have a connection, again, this request-response thing. 647 00:31:18,620 --> 00:31:21,020 And this is going to screw you up all the time. 648 00:31:21,160 --> 00:31:22,560 So always think about this when you have, 649 00:31:22,640 --> 00:31:24,880 if you've got a graph like this, whether there is something wrong. 650 00:31:25,740 --> 00:31:30,340 So what happened here is when I built my firewall rule set, 651 00:31:30,540 --> 00:31:33,100 I was not very consistent on what interface I'm logging. 652 00:31:33,960 --> 00:31:36,980 And I logged on the responses going outside. 653 00:31:37,560 --> 00:31:40,940 So not just did I not only log on the requests, 654 00:31:42,100 --> 00:31:44,660 I also started logging on different interfaces. 655 00:31:45,000 --> 00:31:48,660 So always think about, already when you set up your firewall, 656 00:31:48,920 --> 00:31:50,000 what do you log? 657 00:31:50,240 --> 00:31:52,740 Do you just log requests or responses as well? 658 00:31:52,940 --> 00:31:54,680 And on what interface do you log them? 659 00:31:54,680 --> 00:31:57,820 And it also depends on where you want to have your ACLs, 660 00:31:57,940 --> 00:31:59,980 on the internal interface or the external interface. 661 00:32:00,360 --> 00:32:02,540 A lot of firewalls don't give you that option. 662 00:32:02,900 --> 00:32:06,000 But especially if you start playing with IP tables or PF 663 00:32:06,000 --> 00:32:11,620 or anything else like more hand-woven firewalls, 664 00:32:11,640 --> 00:32:12,880 you will run into this problem. 665 00:32:13,040 --> 00:32:14,260 So think about it before you do it. 666 00:32:14,940 --> 00:32:18,440 So this is the reason why we have this huge cluster of nodes here. 667 00:32:19,040 --> 00:32:23,420 So what I did is I basically extended my PF to CSV. 668 00:32:23,420 --> 00:32:26,840 And unlike the TCP dump parser, 669 00:32:26,960 --> 00:32:30,820 I didn't want it to take care of the swapping right away 670 00:32:30,820 --> 00:32:32,780 and kind of transparently to me. 671 00:32:32,940 --> 00:32:35,020 But what I wanted is I just wanted to see, 672 00:32:35,540 --> 00:32:39,460 it should just tell me if it thinks that it should be switched. 673 00:32:40,240 --> 00:32:44,720 So if I say reversed as a parameter to PF to CSV, 674 00:32:45,160 --> 00:32:48,080 it will write an R in the last column. 675 00:32:48,520 --> 00:32:50,620 And it was really late in the night when I coded this. 676 00:32:50,680 --> 00:32:52,820 And I haven't changed it yet, so bear with me. 677 00:32:52,980 --> 00:32:53,400 All right. 678 00:32:54,380 --> 00:32:56,800 If it's reversed, if it thinks it should be reversed, 679 00:32:57,080 --> 00:32:58,840 it just writes an R in the last column. 680 00:32:59,320 --> 00:33:02,540 So if I do a grep minus V of an R in the end, 681 00:33:02,700 --> 00:33:05,660 I won't see all those responses. 682 00:33:06,740 --> 00:33:08,760 So if I filter out all the responses, 683 00:33:08,960 --> 00:33:11,900 and you could use any other method of getting rid of your responses 684 00:33:11,900 --> 00:33:12,500 in the log files. 685 00:33:12,560 --> 00:33:13,560 It's just one way to do it. 686 00:33:14,040 --> 00:33:16,320 Then I end up with a more sane graph here. 687 00:33:17,240 --> 00:33:19,740 It's still a lot of target ports if you think about it. 688 00:33:19,760 --> 00:33:21,100 Everything that's blocked going out, 689 00:33:21,200 --> 00:33:22,360 there really shouldn't be anything. 690 00:33:23,780 --> 00:33:26,860 But there are some artifacts, like very high port numbers, 691 00:33:27,100 --> 00:33:30,620 where the heuristic to actually determine whether it was reversed 692 00:33:31,240 --> 00:33:32,340 probably didn't kick in. 693 00:33:32,440 --> 00:33:35,000 It didn't have enough state to figure that out. 694 00:33:35,200 --> 00:33:37,920 You could probably go ahead and improve that heuristic. 695 00:33:38,460 --> 00:33:41,060 But I was kind of satisfied with the graph I got here. 696 00:33:41,200 --> 00:33:43,820 I can read this and kind of filter them manually. 697 00:33:44,720 --> 00:33:46,460 But there are some other interesting ports. 698 00:33:48,040 --> 00:33:51,920 One is 427, a service location. 699 00:33:51,920 --> 00:33:57,760 And what this told me is that I had four Macs standing in my network. 700 00:33:58,020 --> 00:34:00,440 And they're using, I'm not a Mac person, 701 00:34:00,520 --> 00:34:02,540 so I'm not quite sure what this service actually does. 702 00:34:02,680 --> 00:34:07,640 But it's some kind of an automatic setup service broadcasting, 703 00:34:08,080 --> 00:34:10,720 and it advertises itself to the network saying, 704 00:34:10,820 --> 00:34:12,220 hey, I have these services, I'm here. 705 00:34:12,600 --> 00:34:14,660 So this concerned me a little bit. 706 00:34:14,840 --> 00:34:18,440 And they actually showed up like 16,000 times in my log file. 707 00:34:18,520 --> 00:34:21,040 It's probably more than, 708 00:34:21,520 --> 00:34:23,840 that's probably almost all the blocked traffic that I had. 709 00:34:24,500 --> 00:34:27,220 If you had to go through a log file, 710 00:34:27,320 --> 00:34:29,320 this log file manually or textually, 711 00:34:29,460 --> 00:34:33,120 you would have seen about 16,000 of these guys. 712 00:34:33,340 --> 00:34:34,760 And somewhere intermingled, 713 00:34:34,900 --> 00:34:37,380 you probably would have gotten tired finding those other ones, 714 00:34:38,120 --> 00:34:39,660 the other ports that were blocked. 715 00:34:40,380 --> 00:34:43,160 So this helped a whole lot to actually find this, 716 00:34:43,280 --> 00:34:47,260 and hopefully none of this traffic was actually leaving the network 717 00:34:47,260 --> 00:34:48,360 and it was all blocked. 718 00:34:51,040 --> 00:34:55,580 All right, now we're looking at the blocked incoming traffic. 719 00:34:58,380 --> 00:35:00,160 Yes, it's going to be way messy. 720 00:35:02,540 --> 00:35:06,640 So I'm not even going to show you the graph that was computed by this. 721 00:35:08,640 --> 00:35:12,760 I decided to still tackle the problem 722 00:35:13,180 --> 00:35:15,360 and kind of figure out what is in the data center 723 00:35:15,360 --> 00:35:17,260 and what is in the data that actually tries to hit me. 724 00:35:17,880 --> 00:35:20,220 And one of the things is, it's always the low-hanging fruit, 725 00:35:20,220 --> 00:35:21,120 find your port scans. 726 00:35:21,800 --> 00:35:23,420 You can do it a thousand ways. 727 00:35:23,820 --> 00:35:25,560 I'm just going to show you how to do it here. 728 00:35:28,460 --> 00:35:30,920 So basically, I'm using the minus G capability. 729 00:35:31,320 --> 00:35:34,280 So remember, that was the fan-out filtering. 730 00:35:35,020 --> 00:35:37,520 And G looks at the event node, so the middle node. 731 00:35:38,160 --> 00:35:39,680 And if I say minus G2, 732 00:35:40,160 --> 00:35:43,620 that means everything that has a fan-out of 3 or higher 733 00:35:44,380 --> 00:35:47,540 or not 2 or 1, I don't want to see. 734 00:35:47,740 --> 00:35:49,800 All the ones of 3 or higher, I want to see. 735 00:35:50,220 --> 00:35:53,620 And everything that has more than 2 ports that we're connected to, 736 00:35:53,700 --> 00:35:54,340 I want to show them. 737 00:35:54,800 --> 00:35:57,000 So if someone would port scan me, I would see that 738 00:35:57,000 --> 00:35:59,900 because they hope the port scan is more than 2 ports 739 00:35:59,900 --> 00:36:01,480 or whatever threshold is set. 740 00:36:02,080 --> 00:36:05,160 It's actually very interesting what shows up on the right side in the graph. 741 00:36:05,960 --> 00:36:07,260 I didn't have a port scan, 742 00:36:07,420 --> 00:36:10,420 so I don't see any fan where things are hitting me. 743 00:36:10,660 --> 00:36:13,980 I have 3 nodes at most there, 744 00:36:14,140 --> 00:36:19,100 and there were people probably just trying to get to some well-known ports of mine, 745 00:36:19,100 --> 00:36:22,820 very specific targeting, port 80, 22, 443. 746 00:36:23,840 --> 00:36:27,440 And it's only about 3 or 4 attackers that really did this. 747 00:36:27,580 --> 00:36:31,400 So the kind of yellowish nodes that you see. 748 00:36:31,520 --> 00:36:32,680 So that's actually kind of interesting. 749 00:36:32,920 --> 00:36:36,460 And the data set was probably a couple of days 750 00:36:36,460 --> 00:36:38,500 in a very, very busy web server farm. 751 00:36:38,620 --> 00:36:39,620 So this is pretty good. 752 00:36:41,060 --> 00:36:42,280 How do you configure this? 753 00:36:43,640 --> 00:36:45,380 And actually, I cheated a little bit. 754 00:36:45,720 --> 00:36:48,400 If I look at port scans, 755 00:36:48,400 --> 00:36:52,760 I'm not necessarily interested in the things that hit me on ports above 1,024 756 00:36:53,280 --> 00:36:55,760 because I usually don't have anything running there anyway. 757 00:36:55,900 --> 00:36:56,960 No services are up there. 758 00:36:57,060 --> 00:36:59,020 Maybe there is some Oracle running on 1521 759 00:36:59,020 --> 00:37:01,040 or some other SQL server, 760 00:37:01,200 --> 00:37:03,820 and you might want to include those as an exception here. 761 00:37:03,940 --> 00:37:06,020 I didn't do so because I didn't have any. 762 00:37:06,340 --> 00:37:10,080 But what I wanted to do is I clustered my target node, the ports, 763 00:37:10,780 --> 00:37:14,460 and I wanted to make a cluster for all the ports bigger than 30,000. 764 00:37:15,000 --> 00:37:18,380 So it's basically say the node should be bigger 30,000, 765 00:37:18,400 --> 00:37:19,760 just that string, 766 00:37:20,840 --> 00:37:24,160 if the third column is more than 30,000. 767 00:37:25,120 --> 00:37:28,560 And then, so that's taking care of all the ports higher than 30,000. 768 00:37:28,920 --> 00:37:30,620 And then I say, well, everything else, 769 00:37:30,700 --> 00:37:33,920 if it's bigger than 1,024, I want to cluster it again. 770 00:37:34,780 --> 00:37:36,120 And then the rest I'll leave alone. 771 00:37:36,280 --> 00:37:38,240 I want to see those individual ones. 772 00:37:40,120 --> 00:37:41,780 And again, I used the minus G, 773 00:37:41,900 --> 00:37:44,160 and this basically gave me the graph on the right. 774 00:37:44,780 --> 00:37:47,080 This is kind of how you can find port scans. 775 00:37:47,080 --> 00:37:54,980 The same you can do with tree maps by basically what I did here 776 00:37:54,980 --> 00:38:01,200 is I set up the hierarchy as source IP, destination IP, destination port. 777 00:38:02,240 --> 00:38:06,680 So you will see a big rectangle for the source IP, 778 00:38:06,860 --> 00:38:09,880 and inside you will see all different destinations that that source went to. 779 00:38:10,040 --> 00:38:14,460 And inside of that, you'll see the different destination ports that were accessed. 780 00:38:15,500 --> 00:38:16,720 We can see the port scan. 781 00:38:21,200 --> 00:38:21,640 Exactly. 782 00:38:21,820 --> 00:38:22,920 It's very easy to find. 783 00:38:23,080 --> 00:38:25,160 There's just a lot of nodes there. 784 00:38:25,620 --> 00:38:28,360 And what you can do is you can actually zoom in, 785 00:38:29,700 --> 00:38:33,200 and now I just see this one source IP going to this destination IP, 786 00:38:33,240 --> 00:38:34,640 and I see all the destination ports. 787 00:38:35,280 --> 00:38:39,700 What is kind of interesting is there are all these random port numbers on the right side, 788 00:38:39,820 --> 00:38:44,920 and then on the left, about 50% of the traffic hit a port 6346. 789 00:38:45,320 --> 00:38:47,060 I think that's some kind of file number. 790 00:38:47,080 --> 00:38:47,280 It's file sharing. 791 00:38:48,300 --> 00:38:52,000 So someone really hit me hard on that port and didn't get in. 792 00:38:55,300 --> 00:38:59,640 Something else I usually do is I want to see whether there are any IP addresses 793 00:38:59,640 --> 00:39:01,780 that are spoofed or abused. 794 00:39:02,100 --> 00:39:04,960 And there is a bogon address space, 795 00:39:05,100 --> 00:39:08,720 basically all the IP addresses that are not assigned to anyone by IANA. 796 00:39:09,040 --> 00:39:10,680 So no one should be using them. 797 00:39:10,800 --> 00:39:12,500 No one has really allocated that space. 798 00:39:13,060 --> 00:39:15,460 That's published on the IANA web page. 799 00:39:17,080 --> 00:39:19,680 So make sure if you do this, you update your configuration. 800 00:39:20,240 --> 00:39:24,360 But I want to see all the connections coming from those IP addresses to my network 801 00:39:24,360 --> 00:39:26,440 because no one should be using those. 802 00:39:28,960 --> 00:39:32,740 So again, I just grabbed the blocks incoming. 803 00:39:34,660 --> 00:39:37,460 And I warn you right now, this config is going to be crazy. 804 00:39:37,620 --> 00:39:40,680 If you thought that it was complicated before, it's going to hit you. 805 00:39:41,900 --> 00:39:43,540 So what do you do in a configuration file? 806 00:39:44,260 --> 00:39:45,860 First, I need to let Afterglow know 807 00:39:45,860 --> 00:39:47,960 what is the bogon address space. 808 00:39:48,720 --> 00:39:51,360 So there is a command called variable. 809 00:39:52,340 --> 00:39:55,100 And then you just provide any Perl expression you want, 810 00:39:55,180 --> 00:39:57,600 any Perl command, and we'll just evaluate it. 811 00:39:57,940 --> 00:40:02,780 And if you assign, what I did here is I built my array ranges 812 00:40:03,980 --> 00:40:07,620 with all the stop nets that are in the bogon address space. 813 00:40:07,900 --> 00:40:10,440 You could put anything in there, any Perl code. 814 00:40:10,680 --> 00:40:11,800 It would evaluate it. 815 00:40:11,900 --> 00:40:15,200 It would assign the variables and keep them. 816 00:40:15,200 --> 00:40:17,600 And you can use them in further assignments 817 00:40:17,600 --> 00:40:18,620 and do all kinds of things. 818 00:40:18,760 --> 00:40:22,100 So I'm just defining a variable here or an array. 819 00:40:23,520 --> 00:40:27,460 Then for my color assignment, it gets a little complicated. 820 00:40:27,940 --> 00:40:32,360 So basically what I want to do is every value I get, 821 00:40:32,860 --> 00:40:35,220 I want to check every IP address. 822 00:40:35,420 --> 00:40:37,180 I want to check against the array 823 00:40:37,180 --> 00:40:40,700 and see whether it's in any of those subnets specified. 824 00:40:41,600 --> 00:40:44,200 And you basically start with, 825 00:40:45,260 --> 00:40:46,620 the subnet assignment here. 826 00:40:47,600 --> 00:40:51,240 So you check if the field is in the subnet 827 00:40:51,240 --> 00:40:52,720 that we are looking at right now. 828 00:40:52,900 --> 00:40:56,200 So it basically runs through all the entries in the array. 829 00:40:56,660 --> 00:40:58,040 And the array range is up here. 830 00:40:58,960 --> 00:41:01,080 So it goes through all these entries and checks 831 00:41:01,080 --> 00:41:02,960 whether the field that I'm looking at right now 832 00:41:02,960 --> 00:41:03,720 is in this subnet. 833 00:41:05,040 --> 00:41:07,620 If yes, it just returns one. 834 00:41:07,820 --> 00:41:10,200 And I'm basically counting in dollar value 835 00:41:10,200 --> 00:41:12,920 how many times and how many of those it was. 836 00:41:13,160 --> 00:41:14,160 It's always going to be one. 837 00:41:15,580 --> 00:41:18,060 My definition there is mutually exclusive 838 00:41:18,060 --> 00:41:19,580 of the individual entries. 839 00:41:19,940 --> 00:41:22,800 Anyways, so what it does then, 840 00:41:22,900 --> 00:41:25,500 it just says it's going to be read, the node, 841 00:41:26,480 --> 00:41:28,220 if it actually found it. 842 00:41:28,300 --> 00:41:30,000 So if value is set. 843 00:41:32,100 --> 00:41:35,200 So if you don't quite follow how this map thing works, 844 00:41:35,520 --> 00:41:38,140 just copy it and use it for your own things. 845 00:41:39,040 --> 00:41:40,320 And then what I want to do is 846 00:41:40,320 --> 00:41:41,840 I want to have everything else green. 847 00:41:42,020 --> 00:41:43,040 If it's not in my, 848 00:41:43,220 --> 00:41:45,180 or everything else that is in my internal array, 849 00:41:45,200 --> 00:41:46,080 my internal network is green. 850 00:41:46,220 --> 00:41:49,480 So I provide the match on my internal address space. 851 00:41:50,140 --> 00:41:51,460 And everything else is blue. 852 00:41:55,200 --> 00:41:56,640 We'll see in a second how that looks. 853 00:41:57,300 --> 00:41:58,700 But we're not quite done yet. 854 00:41:58,800 --> 00:42:00,880 Because what is going to happen with this graph, 855 00:42:01,500 --> 00:42:04,780 you'll see a lot, a lot, a lot of source IP addresses 856 00:42:04,780 --> 00:42:05,620 that connected. 857 00:42:07,780 --> 00:42:10,540 There's going to be a million individual nodes. 858 00:42:10,780 --> 00:42:12,820 So you won't be able to find those red ones 859 00:42:12,820 --> 00:42:13,480 that we just defined. 860 00:42:13,480 --> 00:42:15,480 So what we need to do is some clustering. 861 00:42:16,020 --> 00:42:17,800 This looks horribly complicated. 862 00:42:18,560 --> 00:42:20,680 But that's just because I was a little anal 863 00:42:20,680 --> 00:42:21,660 on what I want to see here. 864 00:42:22,620 --> 00:42:24,440 Basically, what I want to do is 865 00:42:24,440 --> 00:42:27,920 I want to cluster by class A network. 866 00:42:28,700 --> 00:42:30,620 I don't want to see each individual address. 867 00:42:30,860 --> 00:42:34,000 I just want to see what class A is connected to my network. 868 00:42:34,440 --> 00:42:38,000 That's basically what I do here with this regex replace. 869 00:42:39,160 --> 00:42:42,820 What you can do is it's a function I provide for Afterglow. 870 00:42:42,820 --> 00:42:45,460 And what it does, it just matches the regular expression 871 00:42:45,460 --> 00:42:48,080 I give there, the backslash, backslash, D plus. 872 00:42:49,240 --> 00:42:51,700 If that matches, so if it has a number, 873 00:42:51,820 --> 00:42:55,460 if it starts with a number, then it returns that number 874 00:42:55,460 --> 00:42:56,500 because I do a match there. 875 00:42:57,440 --> 00:42:59,740 So it will return the first octet 876 00:43:00,280 --> 00:43:02,460 and add the string slash eight. 877 00:43:03,160 --> 00:43:07,040 So I see that it is an eight class that I clustered. 878 00:43:09,300 --> 00:43:12,080 If it does not match my internal addresses, 879 00:43:12,820 --> 00:43:14,740 because I want to see if there's actually a source 880 00:43:14,740 --> 00:43:15,780 that's my internal address, 881 00:43:17,280 --> 00:43:20,900 and if it's not one of the bogan address spaces 882 00:43:20,900 --> 00:43:23,160 because I don't want to cluster those together. 883 00:43:23,300 --> 00:43:25,720 I want to see exactly what IP address hit me 884 00:43:25,720 --> 00:43:28,360 and not just, oh, it was in this class A. 885 00:43:30,020 --> 00:43:30,860 You follow me? 886 00:43:31,480 --> 00:43:32,460 It's early, I know. 887 00:43:34,040 --> 00:43:35,960 All right, and I do the same thing for my targets. 888 00:43:38,580 --> 00:43:39,800 Just for your own reference, 889 00:43:39,960 --> 00:43:41,540 these are the new features we just introduced. 890 00:43:41,540 --> 00:43:43,020 And this is how it looks. 891 00:43:43,700 --> 00:43:44,740 It's actually quite sane. 892 00:43:45,400 --> 00:43:49,120 So you will see the bogan address space is the red ones. 893 00:43:49,600 --> 00:43:52,220 Then you have the regular external addresses 894 00:43:52,220 --> 00:43:53,680 clustered by A class. 895 00:43:54,500 --> 00:43:57,300 You have my internal machines, the blue ones. 896 00:43:57,680 --> 00:43:58,600 Suddenly, it's actually interesting, 897 00:43:58,780 --> 00:44:00,920 suddenly there are more than my four machines from before. 898 00:44:01,060 --> 00:44:01,820 It's actually kind of funny. 899 00:44:02,220 --> 00:44:03,580 I didn't realize that earlier. 900 00:44:05,060 --> 00:44:07,040 But the interesting part is the red nodes, 901 00:44:07,280 --> 00:44:09,480 I had a lot of bogan address space. 902 00:44:09,560 --> 00:44:11,080 And this is real, I didn't make this up. 903 00:44:11,980 --> 00:44:14,540 But if you look, there are 10 addresses. 904 00:44:14,860 --> 00:44:16,640 There are 192, 168 addresses. 905 00:44:17,340 --> 00:44:19,060 There are some multicast addresses. 906 00:44:19,920 --> 00:44:22,520 But still, this was in a hosting environment, 907 00:44:22,780 --> 00:44:23,520 in a data center. 908 00:44:23,760 --> 00:44:26,620 And why would there be other things leaking over 909 00:44:26,620 --> 00:44:29,720 to my network from 192 spaces and 10 spaces? 910 00:44:30,280 --> 00:44:33,180 So maybe some other people that were hosting there 911 00:44:33,180 --> 00:44:36,260 were trying to play tricks and try to see what they can do. 912 00:44:36,520 --> 00:44:39,020 Spoofing IP addresses are just like leaking over 913 00:44:39,020 --> 00:44:40,920 to my connections. 914 00:44:43,080 --> 00:44:45,160 All right, I'm actually right on time. 915 00:44:47,140 --> 00:44:48,800 Before I give you the summary, 916 00:44:50,520 --> 00:44:54,440 I have one thing that I keep doing with Afterglow, 917 00:44:54,520 --> 00:44:55,280 which is kind of interesting. 918 00:44:55,740 --> 00:45:01,240 I basically run a Unix command on my box. 919 00:45:01,800 --> 00:45:03,120 It's just a while loop. 920 00:45:03,500 --> 00:45:05,380 And you'll find the command on, 921 00:45:05,420 --> 00:45:08,800 if you go to afterglow.sourceforge.net in the FAQ, 922 00:45:08,980 --> 00:45:09,960 I have a little command line. 923 00:45:10,640 --> 00:45:12,700 So basically what I want to do is I want to show 924 00:45:13,160 --> 00:45:15,380 the network traffic in my screen saver. 925 00:45:16,140 --> 00:45:18,180 It's kind of cool if people walk by your desk 926 00:45:18,180 --> 00:45:19,880 and they see the traffic that's on your box. 927 00:45:20,420 --> 00:45:22,040 Some people might start playing with you 928 00:45:22,040 --> 00:45:24,000 and sending you traffic so they show up in the notes. 929 00:45:24,360 --> 00:45:26,520 So don't encourage them. 930 00:45:26,900 --> 00:45:29,480 So basically what you do is you run a while loop, 931 00:45:30,280 --> 00:45:31,540 continuous, just never stop. 932 00:45:33,020 --> 00:45:33,820 Run tcpdump. 933 00:45:35,220 --> 00:45:35,780 Pipe it. 934 00:45:36,320 --> 00:45:38,020 The output into tcp to csv. 935 00:45:38,020 --> 00:45:39,740 Get the fields you want. 936 00:45:40,660 --> 00:45:43,860 And then just do like head minus 1,000 or something. 937 00:45:44,100 --> 00:45:48,120 So every 1,000 packets will actually continue. 938 00:45:49,300 --> 00:45:52,620 Then pipe that into Afterglow, into neato. 939 00:45:53,380 --> 00:45:56,180 And the output file that I usually write in neato 940 00:45:56,180 --> 00:45:58,880 is just a file with the date in there. 941 00:45:59,280 --> 00:46:04,500 Just add the date as a parameter to the file name. 942 00:46:05,380 --> 00:46:06,740 And then it will just write 943 00:46:06,740 --> 00:46:09,140 every 1,000 packets it will write a file. 944 00:46:09,600 --> 00:46:11,020 And then you can have a cleanup script 945 00:46:11,020 --> 00:46:12,440 that kills the ones that are older 946 00:46:12,440 --> 00:46:14,100 or just keep two around or something. 947 00:46:14,780 --> 00:46:16,740 Configure your screen saver to pick up the pictures 948 00:46:16,740 --> 00:46:19,520 from that directory and just slideshow them. 949 00:46:20,280 --> 00:46:21,600 And it's really cool. I like it. 950 00:46:21,940 --> 00:46:23,380 All right, so let's go to summary. 951 00:46:24,160 --> 00:46:25,380 We looked at Afterglow. 952 00:46:25,800 --> 00:46:26,760 You can do filtering. 953 00:46:27,420 --> 00:46:28,300 You can do coloring. 954 00:46:28,960 --> 00:46:30,860 You can do clustering if you get brave. 955 00:46:32,520 --> 00:46:34,320 And why would we do all that? 956 00:46:34,540 --> 00:46:36,420 Well, I hope I was able to show you 957 00:46:36,740 --> 00:46:38,720 some use cases where I was able to find my port 100 958 00:46:38,720 --> 00:46:39,720 that I connected to 959 00:46:40,280 --> 00:46:42,260 or if you find the BOGO and address space. 960 00:46:42,700 --> 00:46:44,200 You find outliers. 961 00:46:44,360 --> 00:46:46,040 You find relationships among things. 962 00:46:46,360 --> 00:46:47,940 Who is talking on the network? 963 00:46:49,520 --> 00:46:52,260 And I know people in here that use Afterglow 964 00:46:52,260 --> 00:46:54,020 to find people that are connecting 965 00:46:54,020 --> 00:46:58,040 from countries of concern, things of that nature. 966 00:47:00,980 --> 00:47:02,400 Suspicious activity, basically. 967 00:47:03,300 --> 00:47:05,280 All right, so don't read log files. 968 00:47:05,280 --> 00:47:06,260 Visualize them. 969 00:47:07,560 --> 00:47:08,260 Thank you. 970 00:47:16,760 --> 00:47:20,060 I think I have time for a couple questions if anyone. 971 00:47:20,300 --> 00:47:20,520 Yes? 972 00:47:20,880 --> 00:47:22,700 Did you ever try clustering by country? 973 00:47:23,140 --> 00:47:24,840 Did I try cluster by country? 974 00:47:25,060 --> 00:47:25,420 Yes. 975 00:47:25,760 --> 00:47:28,360 Basically, what you can do is there is a mapping 976 00:47:28,360 --> 00:47:32,060 that's published that maps IP addresses to countries. 977 00:47:32,360 --> 00:47:34,120 So just block that in somewhere. 978 00:47:34,120 --> 00:47:36,440 Exchange your IP addresses by country. 979 00:47:36,940 --> 00:47:39,420 And automatically, you will have them clustered by country. 980 00:47:42,240 --> 00:47:42,680 Yes? 981 00:47:43,880 --> 00:47:48,700 Is there a reason why you can't use this with proxy logs as well? 982 00:47:48,860 --> 00:47:49,540 No, not at all. 983 00:47:49,640 --> 00:47:51,980 So I just gave you one example, firewall logs. 984 00:47:52,160 --> 00:47:55,040 I actually, yesterday, sitting in one of the sessions and 985 00:47:55,920 --> 00:47:56,880 sorry, I was a little bored. 986 00:47:57,500 --> 00:47:59,720 I was basically running Kismet 987 00:47:59,720 --> 00:48:02,700 and I quickly used an aux script to pick out 988 00:48:02,700 --> 00:48:06,420 the access points that are there, the machines connecting, 989 00:48:07,200 --> 00:48:08,860 and I visualized that quickly. 990 00:48:09,060 --> 00:48:11,480 So I see that all these machines go to this access point 991 00:48:11,480 --> 00:48:13,560 and suddenly you see this machine goes to the other access point. 992 00:48:13,880 --> 00:48:15,260 There's really cool things you can do. 993 00:48:15,820 --> 00:48:16,800 One quick question. 994 00:48:17,720 --> 00:48:18,780 Do you have any competition? 995 00:48:19,180 --> 00:48:21,740 I mean, who's second in IT? 996 00:48:22,640 --> 00:48:23,980 Do I have any competition? 997 00:48:24,380 --> 00:48:24,820 Lots. 998 00:48:26,220 --> 00:48:27,200 There are a few people. 999 00:48:27,240 --> 00:48:29,500 Greg Conti does some visualization with Ramint. 1000 00:48:30,180 --> 00:48:32,560 There's a lot of university work that's done in visualization. 1001 00:48:32,560 --> 00:48:33,740 There's a lot of organization of network traffic. 1002 00:48:34,140 --> 00:48:36,720 I'm not sure if anyone has a very simple method 1003 00:48:36,720 --> 00:48:38,840 of visualizing just open source. 1004 00:48:40,420 --> 00:48:42,460 If you have any, let me know. 1005 00:48:42,960 --> 00:48:45,160 Have you extended this to look at the amount of data 1006 00:48:45,160 --> 00:48:47,840 that's going out in the direction of ? 1007 00:48:49,240 --> 00:48:51,660 Have I extended this to look at the amount of traffic, 1008 00:48:52,220 --> 00:48:54,660 things like amount of bandwidth and so on? 1009 00:48:54,740 --> 00:48:57,060 So basically what you have to do, you have to do that yourself. 1010 00:48:57,360 --> 00:48:58,740 So I kind of offload that work to you 1011 00:48:58,740 --> 00:49:01,000 because I just visualize your CSVs, right? 1012 00:49:01,000 --> 00:49:03,580 So you just write some kind of an aggregator 1013 00:49:03,580 --> 00:49:05,280 that aggregates all the traffic. 1014 00:49:05,420 --> 00:49:07,480 Use awk and do sums in there. 1015 00:49:07,600 --> 00:49:08,640 It's not too complicated. 1016 00:49:10,760 --> 00:49:11,200 Oh. 1017 00:49:11,760 --> 00:49:13,700 All right, so questions, please go to the mic 1018 00:49:13,700 --> 00:49:14,580 so they're recorded. 1019 00:49:14,960 --> 00:49:15,560 Thank you. 1020 00:49:15,760 --> 00:49:18,360 Can you weight the size of the nodes 1021 00:49:18,360 --> 00:49:21,940 by the number of packets from them? 1022 00:49:24,360 --> 00:49:25,540 Can I weigh them? 1023 00:49:26,100 --> 00:49:28,480 Can you make them larger if there's a lot more traffic? 1024 00:49:28,480 --> 00:49:29,160 Oh, can I make it larger? 1025 00:49:29,300 --> 00:49:30,340 I didn't put that in. 1026 00:49:30,340 --> 00:49:33,040 It shouldn't be too complicated to extend afterglow 1027 00:49:33,040 --> 00:49:33,820 if you want to do that. 1028 00:49:35,020 --> 00:49:36,580 It would take me a little bit of coding. 1029 00:49:37,240 --> 00:49:38,740 Download it and extend it if you want. 1030 00:49:39,020 --> 00:49:39,960 I might do it. 1031 00:49:40,020 --> 00:49:40,840 That's actually a good idea. 1032 00:49:41,240 --> 00:49:41,640 Thanks. 1033 00:49:43,600 --> 00:49:45,580 How about parsing server logs? 1034 00:49:47,520 --> 00:49:49,040 Parsing server, any kind of server logs? 1035 00:49:49,320 --> 00:49:49,900 Yeah, any kind. 1036 00:49:49,960 --> 00:49:50,140 Sure. 1037 00:49:51,060 --> 00:49:54,320 You can, for example, Linux, you use syslog. 1038 00:49:54,520 --> 00:49:56,960 It's a pain to write your parser because every line is different. 1039 00:49:57,500 --> 00:49:59,160 Every entry has a different format. 1040 00:49:59,160 --> 00:50:01,980 But you can visualize logins, for example. 1041 00:50:02,120 --> 00:50:04,740 You just pick all your SSH messages or all your login messages. 1042 00:50:05,780 --> 00:50:06,820 Pick the source address. 1043 00:50:06,940 --> 00:50:07,720 Where did it come from? 1044 00:50:07,780 --> 00:50:09,960 If it's locked, it's not always the case in server logs. 1045 00:50:10,940 --> 00:50:13,000 Lock the username that's going to come in. 1046 00:50:13,540 --> 00:50:15,380 You can do all kinds of things, really. 1047 00:50:15,520 --> 00:50:18,160 This is giving you the toolbox to go off 1048 00:50:18,160 --> 00:50:19,800 and do your own visualization of your logs. 1049 00:50:20,040 --> 00:50:22,260 And please send me use cases if you have them. 1050 00:50:22,320 --> 00:50:23,040 I'm collecting them. 1051 00:50:24,560 --> 00:50:26,760 Server logs are very interesting in cases 1052 00:50:26,760 --> 00:50:29,080 where you're not trying to go after the perimeter thread. 1053 00:50:29,160 --> 00:50:30,720 Where things are coming out from the outside. 1054 00:50:31,140 --> 00:50:33,480 But if you're looking more from insider problems, 1055 00:50:33,780 --> 00:50:35,380 so people that are logging into machines 1056 00:50:35,380 --> 00:50:36,860 that might not be allowed to, 1057 00:50:36,960 --> 00:50:38,580 who accessed machines for, 1058 00:50:38,680 --> 00:50:40,720 if you're doing compliance reporting or something, 1059 00:50:41,020 --> 00:50:43,640 who got into my financial servers, 1060 00:50:44,120 --> 00:50:45,660 what networks did they come from, 1061 00:50:45,900 --> 00:50:47,060 things of that nature. 1062 00:50:48,280 --> 00:50:49,140 Anyone else? 1063 00:50:52,420 --> 00:50:54,940 Are you trying to make it real time? 1064 00:50:55,900 --> 00:50:56,920 Great question. 1065 00:50:56,920 --> 00:50:58,880 I was trying, yes. 1066 00:51:01,000 --> 00:51:02,400 The real time problem is, 1067 00:51:03,080 --> 00:51:04,780 that's kind of why I started to switch over 1068 00:51:04,780 --> 00:51:06,120 to that library I'm using for Java. 1069 00:51:07,040 --> 00:51:08,600 Because I wanted to have more control. 1070 00:51:09,220 --> 00:51:11,320 The way I set up Afterglow right now 1071 00:51:11,800 --> 00:51:15,660 is that it basically takes the log file, 1072 00:51:15,720 --> 00:51:17,980 the CSV file and generates one graph. 1073 00:51:19,380 --> 00:51:20,600 So I kind of lose state. 1074 00:51:21,800 --> 00:51:23,300 The problem is, I mean, 1075 00:51:23,300 --> 00:51:26,160 you can do what I told you about the TCP dump, 1076 00:51:26,160 --> 00:51:27,000 the while loop, 1077 00:51:27,180 --> 00:51:28,820 and then just get one picture after the other. 1078 00:51:28,880 --> 00:51:30,020 The problem with that is, 1079 00:51:31,000 --> 00:51:32,540 every picture you calculate 1080 00:51:32,540 --> 00:51:34,780 is going to rearrange all the nodes 1081 00:51:34,780 --> 00:51:35,840 because of the layouting. 1082 00:51:36,360 --> 00:51:38,940 So what you have to do is you have to remember, 1083 00:51:39,220 --> 00:51:41,040 you kind of do a sliding window, 1084 00:51:41,200 --> 00:51:42,720 you remember the current layout, 1085 00:51:43,100 --> 00:51:44,560 you feed that into the next layout, 1086 00:51:45,200 --> 00:51:47,120 and you just add the new ones 1087 00:51:47,120 --> 00:51:49,060 and then drop off things over time 1088 00:51:49,060 --> 00:51:50,120 to get rid of them. 1089 00:51:50,240 --> 00:51:52,280 It's not as easy as it sounds. 1090 00:51:52,740 --> 00:51:54,360 Or maybe it already sounds complicated. 1091 00:51:54,360 --> 00:51:56,280 But I was trying for a little bit. 1092 00:51:56,400 --> 00:51:58,120 I just don't have the time to do it right now. 1093 00:51:58,540 --> 00:52:00,020 But there are, I think, 1094 00:52:00,040 --> 00:52:06,460 Dan Kaminski with Xovi does something of that nature. 1095 00:52:06,560 --> 00:52:07,940 He tries to animate it. 1096 00:52:08,420 --> 00:52:09,760 You can try to download that. 1097 00:52:11,160 --> 00:52:12,780 It's slightly different what he does there. 1098 00:52:13,860 --> 00:52:15,040 Okay. Thank you. 1099 00:52:15,260 --> 00:52:16,800 All right. I think... 1100 00:52:19,460 --> 00:52:22,340 What kind of limitations do you have on log file sizes? 1101 00:52:23,400 --> 00:52:24,460 Your box. 1102 00:52:24,740 --> 00:52:25,400 Okay. 1103 00:52:26,560 --> 00:52:28,180 And Afterglow's memory.