Instructor: In this lesson, 2 2
we're going to dig into the world 3 3
of APIs, webhooks, and plugins. 4 4
First, let's cover APIs. 5 5
An API, or application programming interface, 6 6
is a set of protocols and routines 7 7
for building and interacting with software applications. 8 8
Essentially, 9 9
it serves as an intermediary between different systems, 10 10
allowing them to communicate 11 11
and exchange data with each other. 12 12
This is a key concept 13 13
when discussing the use of service-oriented architectures 14 14
to be able to include different systems 15 15
and piece them all together. 16 16
APIs allow for automated administration, management, 17 17
and monitoring of cloud services, 18 18
as well as many other different types of applications. 19 19
They are typically built 20 20
using either the representational state transfer, 21 21
known as REST, 22 22
or the Simple Object Access Protocol, 23 23
known as SOAP. 24 24
When considering APIs, 25 25
it's always important to think about their role 26 26
in the integration that you're going to create 27 27
because APIs allow for direct integration 28 28
of different third-party applications 29 29
into your own web applications, 30 30
and they provide a means 31 31
for integrating different cloud services 32 32
by configuring, provisioning, and automating 33 33
a bunch of different business functions for us. 34 34
For example, in my own company, Dion Training, 35 35
we utilize a centralized service management tool 36 36
known as Freshdesk. 37 37
This is a commercially available and proprietary product 38 38
that we use to track and answer 39 39
questions and trouble tickets 40 40
from our students. 41 41
So, if you email support@diontraining.com, 42 42
it's actually going to go into our Freshdesk system 43 43
that receives your email. 44 44
It parses it, creates a support ticket for you, 45 45
and sends you an automatic reply 46 46
to let you know we received your email. 47 47
Then our student support analysts 48 48
are going to work on answering your questions 49 49
and supporting your needs 50 50
by using our Freshdesk system. 51 51
But we have a lot of students 52 52
who take our courses on other sites like Udemy. 53 53
And if you post a question on Udemy 54 54
in their Q&A section of the course, 55 55
they actually don't even send us an email 56 56
to tell us you posted a question. 57 57
And this is a really big problem for us 58 58
because we have about a million students on Udemy, 59 59
and trying to answer all those questions 60 60
directly in the Udemy Q&A system 61 61
would be really inefficient for our team, 62 62
and we don't even know 63 63
when one of those happens 64 64
because they don't tell us by email. 65 65
So, instead, we use Udemy's API 66 66
to be able to ask and check for any new questions 67 67
about every four hours. 68 68
If we find one, 69 69
then we parse that information, 70 70
create a ticket inside of our Freshdesk system, 71 71
and our student support analysts 72 72
can see it and answer it directly within Freshdesk. 73 73
Now, once they answer it, 74 74
Freshdesk is actually going to send a response 75 75
back to our automation code 76 76
that uses a webhook. 77 77
And then this allows us to send that response 78 78
all the way back to Udemy's API 79 79
as the response to your question, 80 80
and then it gets posted inside Udemy's Q&A 81 81
inside of their website. 82 82
For you, it looks like I went into the Udemy website 83 83
and answered it directly on Udemy, 84 84
but for us, 85 85
it's much easier and quicker 86 86
and allows us to manage all these questions at scale 87 87
to help all of our students much more quickly. 88 88
Now, in order to do all of this, 89 89
we have to have a syncing function 90 90
that occurs every four hours or so 91 91
to check for new questions from our students, 92 92
and then we check the answers from our team 93 93
and post them back as responses to those questions. 94 94
All of this was done by writing a small program 95 95
of about 50 to 100 lines of Python code. 96 96
And we actually connect to both APIs, 97 97
one for Freshdesk to create those tickets, 98 98
and one for Udemy to get those questions. 99 99
And then in the reverse order, 100 100
getting the answer from Freshdesk 101 101
and pushing it back to the Udemy question as an answer. 102 102
This allows us to manage 103 103
both of these two different cloud systems directly 104 104
because everything is just an API call, 105 105
either to Freshdesk or Udemy 106 106
depending on the direction of that information flow. 107 107
Now, this is just one example of how APIs can be used 108 108
to improve efficiency 109 109
and aid in the integration of different systems. 110 110
Using an API will give you the ability 111 111
to call on somebody else's function 112 112
and let them do all the hard work for you 113 113
rather than having to build out the entire service yourself. 114 114
And this, at essence, 115 115
is what we're talking about 116 116
with a service-oriented architecture. 117 117
Now, this isn't the only example of an API 118 118
that we use inside of our company. 119 119
Another great example 120 120
is the API we use 121 121
to access our online cloud-based services 122 122
with the integration of our hands-on cloud-based labs 123 123
for all of our courses at diontraining.com. 124 124
When you take a course at diontraining.com, 125 125
we actually have labs 126 126
that are directly built into our course, 127 127
but we didn't build those labs. 128 128
So, if you're taking a CompTIA course 129 129
at diontraining.com, 130 130
you're going to get all the video lessons, 131 131
the study guide, the quizzes, and the practice exams 132 132
that Dion Training created for our courses. 133 133
But it also comes with labs, 134 134
and we don't build those labs ourself. 135 135
Instead, we're integrating 136 136
the CompTIA CertMaster lab product 137 137
directly into your course experience. 138 138
Now, as a student, 139 139
when you're going through our course on our website, 140 140
it looks like it's all one big product to you. 141 141
You're going through the videos, 142 142
you're going through the articles, 143 143
you're going through the quizzes, 144 144
and eventually you'll hit the different labs 145 145
in the right places. 146 146
When you reach a lab, 147 147
you'll have a short description of the lab 148 148
and a link that you'll click to open up that lab. 149 149
When you click on that link, 150 150
it's actually going to send the information over an API 151 151
with which lab to start up, 152 152
which student is requesting the lab, 153 153
which course it's for, 154 154
and which lesson it's actually associated with. 155 155
And all that gets sent to our lab partner system. 156 156
They then respond back with the right lab for you 157 157
and allow you to be able to actually use it. 158 158
Now, when you're working with APIs, 159 159
there are lots of different tools you can use 160 160
to test these out as a cybersecurity analyst. 161 161
One such tool is known as curl, 162 162
and curl is used to transfer data from one server to another 163 163
using any supported protocol, 164 164
including HTTP, HTTPS, 165 165
FTP, FTPS, 166 166
SCP, SFTP, 167 167
TFTP, DICT, 168 168
TELNET, LDAP, or FILE. 169 169
As a cybersecurity analyst, 170 170
if you want to test an API, 171 171
you're going to use a command like curl --data 172 172
in order to send data like your first name and last name 173 173
over to a server. 174 174
And then the server 175 175
can return a list of arguments and fields 176 176
that come back from that API. 177 177
This allows you to ensure 178 178
that the API calls are being programmed correctly 179 179
and that you're getting the expected responses. 180 180
In this case, 181 181
I'm sending first name equals Boolean 182 182
and last name equals world. 183 183
And where I'm sending it in this case 184 184
is https://httpbin.org/post. 185 185
When I send that information, 186 186
what am I going to get back? 187 187
Well, I'm going to get back the list 188 188
that you see here on the screen, 189 189
which includes a list of arguments and fields 190 190
that come back from that particular API. 191 191
This allows you to send data over 192 192
and then see what comes back. 193 193
Next, we need to discuss the use of webhooks. 194 194
Now, webhooks and APIs are both commonly used 195 195
in the development of software applications, 196 196
but they are fundamentally different 197 197
in terms of their purpose and functionality. 198 198
Remember, an API, or application programming interface, 199 199
is a set of protocols and routines 200 200
for building and interacting with software applications. 201 201
And essentially it serves as this intermediary 202 202
between different systems 203 203
and allows them to communicate 204 204
and exchange data with each other. 205 205
On the other hand, 206 206
a webhook is a way for one application 207 207
to provide other applications 208 208
with real-time information. 209 209
Instead of the client 210 210
having to repeatedly check for updates, 211 211
the server sends a message, or payload, 212 212
over to the client 213 213
when an event of interest occurs. 214 214
Webhooks can use the HTTP or HTTPS protocols 215 215
just like an API does. 216 216
But rather than the client pulling the data, 217 217
the server is actually pushing the data to the client. 218 218
In this way, 219 219
webhooks are more like notifications 220 220
than a traditional API call 221 221
where you have to request the information. 222 222
Now, webhooks are usually set up 223 223
to listen for specific events to occur, 224 224
such as an item being added to a shopping cart, 225 225
a payment being processed, 226 226
or a message being sent in a chat application. 227 227
Once that event has been detected as happening, 228 228
the webhook will then send a message 229 229
containing information about that event 230 230
over to a specific URL. 231 231
This URL can be a server or an endpoint 232 232
that belongs to the client, 233 233
or it can be a third-party service 234 234
that can handle the payload 235 235
and take the appropriate action. 236 236
Webhooks are particularly useful 237 237
in situations where real-time information is critical 238 238
and where low latency is necessary. 239 239
For example, 240 240
if you go over to diontraining.com/vouchers 241 241
to purchase a certification exam voucher, 242 242
when your credit card is validated 243 243
and the payment is received, 244 244
our credit card processor sends a webhook 245 245
to our voucher-issuing system 246 246
so we know your payment was made 247 247
and we can now issue your exam voucher. 248 248
Instead of simply waiting to request the information 249 249
using an API to our credit card processor 250 250
like once an hour, 251 251
we instead can use the webhook 252 252
so we get notified in real time, 253 253
and we can then issue that voucher to you 254 254
as soon as possible. 255 255
By using webhooks instead of an API, 256 256
our vouchers are usually issued to our students 257 257
within a few minutes, 258 258
instead of a few hours or a few days 259 259
like some other companies out there. 260 260
Now, in terms of usage, 261 261
webhooks are generally easier to set up and use 262 262
than a traditional API. 263 263
These webhooks rely on the server pushing data 264 264
instead of a client pulling data, 265 265
and therefore they don't require the client 266 266
to repeatedly check for updates. 267 267
This means that the client 268 268
can focus on handling data it receives 269 269
instead of spending resources 270 270
on constantly asking, 271 271
"Is there a new update? 272 272
"Has something changed?" 273 273
Additionally, because webhooks are event-driven, 274 274
they're usually less likely 275 275
to suffer from problems of over-fetching or under-fetching 276 276
that can plague traditional APIs. 277 277
Now, remember, 278 278
APIs and webhooks are two different ways 279 279
of allowing systems to communicate with each other. 280 280
While APIs provide a way 281 281
for a client to request information from a server, 282 282
webhooks provide a way for the server 283 283
to proactively push information 284 284
over to the the client in real time. 285 285
Finally, we need to discuss plugins. 286 286
Now, plugins are also known as connectors or add-ons, 287 287
and they're usually used to extend the functionality 288 288
of some kind of software program. 289 289
These plugins will allow users 290 290
to customize and enhance 291 291
the capabilities of their software 292 292
to meet their specific needs and requirements. 293 293
Plugins are commonly used 294 294
with many of the tools you're going to use 295 295
as a cybersecurity analyst, 296 296
including things like SIEMs and vulnerability scanners. 297 297
For example, 298 298
if you're using a SIEM, 299 299
a plugin can be used to integrate 300 300
with other security tools and technologies, 301 301
such as your firewall logs, 302 302
your intrusion detection systems, 303 303
and your endpoint security solutions. 304 304
This allows the SIEM 305 305
to collect and analyze data 306 306
from a variety of sources 307 307
and provides a more comprehensive view 308 308
of your organization's security posture. 309 309
Another example would be a plugin 310 310
that's used to collect logs from a firewall 311 311
and then forwards them to the SIEM for analysis. 312 312
This allows the SIEM 313 313
to then correlate events from the firewall 314 314
with other security events, 315 315
such as intrusion attempts, 316 316
to detect and respond to those potential threats. 317 317
Vulnerability scanners, on the other hand, 318 318
also use plugins, 319 319
but they use 'em a little bit differently. 320 320
A vulnerability scanner will use plugins 321 321
to add support for specific types 322 322
of devices and applications. 323 323
For example, 324 324
a vulnerability scanner may have a plugin 325 325
for all of your Windows tools, 326 326
another one for your Linux tools, 327 327
and yet another one for mobile devices. 328 328
This allows the vulnerability scanner 329 329
to assess those devices for specific vulnerabilities 330 330
based on those plugins 331 331
and then provide you with actionable information 332 332
on how to remediate them. 333 333
Now, plugins can also be used 334 334
to extend the capabilities of a scanner. 335 335
For example, some scanners provide plugins 336 336
that can check for misconfigurations 337 337
or PCI DSS compliance issues 338 338
and things like that. 339 339
And this will ensure that a device is configured 340 340
according to your industry standards or best practices. 341 341
This can help your organization 342 342
to ensure your systems are secure 343 343
and that you're in compliance 344 344
with relevant regulations and standards. 345 345
When it comes to developing plugins, 346 346
they can be developed by the vendor 347 347
or by third-party software developers. 348 348
In the case of open-source software, 349 349
really anybody can develop a plugin for it. 350 350
But when it comes to commercial software, 351 351
the vendors or third-party developers 352 352
will need to ensure 353 353
that the plugin is compatible 354 354
with the software it's going to be integrated with. 355 355
Remember, plugins are an important way 356 356
for organizations to customize and enhance 357 357
the capabilities of their cybersecurity software. 358 358
They allow organizations 359 359
to integrate with other tools and technologies, 360 360
as well as extend the capabilities of their software 361 361
to meet specific needs and requirements. 362 362
This helps organizations improve their security posture 363 363
to be able to detect and respond 364 364
to potential threats much quicker 365 365
and ensure compliance 366 366
with relevant regulations and standards. 367 367
However, it is important to realize 368 368
that plugins are not without risk. 369 369
Every plugin you add 370 370
is increasing the attack surface of your software, 371 371
and they could be introducing 372 372
new vulnerabilities and weaknesses to it as well. 373 373
Therefore, organizations need to carefully evaluate 374 374
the security of the plugins that they want to use, 375 375
ensure they're only using plugins 376 376
that come from trusted and reputable sources 377 377
to make sure they're maintaining 378 378
the highest levels of security in their networks.