text
stringlengths
4
952
start
float64
0
9.37k
duration
float64
0
0
meta
dict
So again, it's just going to make it a lot easier to keep robust, reliable code. We have net HTTP finishing. How long did that take? A minute and 13 seconds. So net HTTP took around the same time. I'm curious if fast HTTP again will just take under a minute. But I really expected fast HTTP to be about the same as net H...
1,686.08
0
{ "video_id": "BhLpqRev80s", "title": "Golang For Hackers: LDAP Injector - Episode 02 - Dependency Injection", "url": "https://www.youtube.com/watch?v=BhLpqRev80s" }
I'm going to pause the video just so um I don't have to kill dead time. And there we have it. Fast HTTP yet again was just a little bit quicker. Um I'm not exactly sure why, but it's still getting the password correct. So, I think fast HTTP may have some type of um performance improvement over that net HTTP client. I'm...
1,714.32
0
{ "video_id": "BhLpqRev80s", "title": "Golang For Hackers: LDAP Injector - Episode 02 - Dependency Injection", "url": "https://www.youtube.com/watch?v=BhLpqRev80s" }
I don't know exactly what it's doing under the hood, but um having this isolated that just let me like say, "Hey AI, take what I did. Use this updated library that's supposed to go faster." It did and we had a performance improvement. So, um I guess that's cool.
1,747.76
0
{ "video_id": "BhLpqRev80s", "title": "Golang For Hackers: LDAP Injector - Episode 02 - Dependency Injection", "url": "https://www.youtube.com/watch?v=BhLpqRev80s" }
I did not expect that. I wish I did so I could have prepared to talk about why it's faster, but that's going to be the video. Um hope you guys enjoyed dependency injection. Let me know in the comments what you thought and then we'll do another video. So stay tuned.
1,763.919
0
{ "video_id": "BhLpqRev80s", "title": "Golang For Hackers: LDAP Injector - Episode 02 - Dependency Injection", "url": "https://www.youtube.com/watch?v=BhLpqRev80s" }
What's going on, YouTube? This is Ipsac and welcome to episode three of the Golang for hacker series. And this episode's going to be all about the functional options pattern, which isn't unique to Golang, but it's used much more frequently in Go because Go lacks optional arguments, overloads, etc. And at first, it's go...
0.08
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
part of the net HTTP implementation in out of the LDAP injector and made it its own project so we can just focus on the piece of code that's important. And then once we're done this, we'll go and add this into our LDAP injector. But the code I have here is relatively straightforward. We just have the definition of our ...
44.96
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
to use this, it becomes a bit cumbersome, right? Because we have all these arguments that we're passing in.
91.119
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And we don't know what's needed, what's optional, what's not. And also, it's only hard-coded to use the status code, right? This is just testing if a password is valid or not in the website.
96.96
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And we're identifying if it's valid just based upon the status code. But what if both invalid and valid password returned HTTP 200? And we wanted to look for a string on the page, right? Then we'd have to add a string up here so we can then define it, right? We could say like expected string. Um then we have to also ad...
107.439
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Instead of status code, this is just a string and it's a string like this. And then when we go to use it, let's see, it's after the username. Um we don't want an expected string here. So we just kind of got to give it a blank value because there's no optional. And this really isn't intuitive, right? You could just pass...
130.239
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Uh C URL like this. There we go. And now we can get rid of all of this. And then we just pass in um this and then define each thing here.
168.68
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Right? So this does also works and then we do go run. And what this allows us to do is just have like optional arguments, right? Because we don't have to pass in every parameter. But the flip side is how do we do default options here, right? And this like will just become a bunch of if thens validating it, right?
187
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
We'll put like if URL starts with HTTP, if the options in these HTTP verbs, there's just so many things that we'd put in this and it just becomes messy.
208
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
It's also just like not intuitive to use a function this way, right? Because when I call this, I peek at the definition like, oh, I need this implementation. I go and look at the implementation. I'm like, huh, what what do I need with all these? Right? So, this is going to be where like the functional options pattern s...
217.12
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
any arguments right now to keep it simple. And then we can say http ops is going to be equal to the default options. And we have to create that. So I'm going to create funk default ops. I probably should do like default HTTP ops to keep it all like in sync, but that's fine. The output of this is going to be the strruct...
270.639
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
let's do um, please sub, then go run, we can see that's now please sub. So, let's put this back over to get. We can say the username, uh, the default username, let's always get admin. But that's it for the default options right now. So, what we want to do is be able to edit, um, all these options. And this is going to ...
350.8
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
So, that's going to be a type. I'm going to do HTTP opt funk and funk um http ops. So, what this is going to enable us to do is create a slice of functions that modify um our thing. And essentially, we're going to create a bunch of setters to set variables. So, we have that code.
390.479
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Now, what we need to do is create the higher order function. So that's going to be um let's start with with method.
411.759
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
So we can do funk with method and then pass in the method that's like get postput delete and that's going to return a function. So since we're returning a function we'll do return funk and we're going to pass in our current HTTP options. So we'll do a pointer to hpops and then we're just going to set it. So we'll do op...
418.88
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
our options and that should let us set it. So if you understand this pretty much everything's done. This is all downhill from here. If you don't understand it, hopefully after you um do it a few times, it starts making sense.
489.68
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
You can always leave comments. I try to respond and help people out. But now in this function, we can say with method and then I'm going to change this to post, right? And I'm going to put this on a new line. I think that's just easier to read. Go run. And now method is post. We can change that to um if go run method i...
503.199
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Uh, expected string is a string. And that's also going to be pretty much the same thing. And we can do funk expected status code. And then let um, co-pilot finish it off. So, that's that. So, we have string status code. Uh, let's do username real quick because this is also the same thing. We can do funk with username a...
555.32
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
change slightly um but not that much. So we can do funk um with header and then like that. So, we're taking in the header and the value. And what's different here is because we have this map here, if this map isn't initialized, then um the program will panic out because you can't assign a value to a nout map. I will sh...
621.68
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Go down here. We can say um with header and then we'll say please subscribe. And this hopefully will crash, right? That's what we expected. Um, assignment to entry in nil map. So, let's leave that code in. So, go back here. We can do this.
652.079
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
So, now it's going to make that map if it doesn't exist. And there we have it.
678.959
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And this will also let us do multiple headers. So, if we wanted to add two headers, we can just say with header again, right? So, we can say um let's go back here with header and then say thank you, right? That's another header. Close that out. I'll just do that so it's a bit easier. Go run. And you can see we have hea...
682.959
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Uh, we don't have with URL. We don't have a way to set the URL. That's crazy.
718.56
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Um, let's set that real quick. Uh, let's do funk with URL. And then we can say URL string HP optf funk. And we could do this, right? But I think the URL is going to be a requirement. So maybe I don't want to put that as my functional option pattern, right? We could also say new HP brute implementation and then put the ...
722.64
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Uh we can pass in the URL and we can take in URL here or we can do default options and set it. That's easier. So we can do O.
757.44
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
URL is equal to URL. That's another way we can do it.
770.399
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And then here in our thing we have to specify. So we can do http ipsack rocks. And now we pass in the URL and then all the kind of optional things we need. Right? That's generally how I like coding my things. If I'm just giving you um like the functional option pattern, these are things that are probably going to be um...
775.68
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
So when we look at the definition, you see, oh, we need the URL and all these are options we can do. We can change the request to a post if we want to. In the like documentation, you may see like the default. So it defaults to a get request, things like that. But um, yeah.
810.079
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
So that's that. if we wanted to check things. So let's say we want to create a check function because we don't want invalid HTTP methods, right? So let's create a check there. And you can just put the check in after here after we do all the assignments. Um so we can do a funk and let's see. I'm going to actually say um...
826.16
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
an error and let's see we can say the valid methods are going to be a slice of string and we can say what um get post uh put and we'll do three. I can't think of anything else off the top of my head. We can just say for um method range methods and then we can do if strings equal fold. So we're saying if the method is e...
885.36
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Because it did not match anything. So we can do um invalid method percent s like this and we just put method there. So that should be fine. And then invalidate we can say if check HP method um C do method let's see if error like this then error does not equal nil awesome return error and then return nil here and then i...
930.959
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And then here return the object and nothing. And then when we call it we also have to have error there because it's capable. And if error does not equal nil um fmt print f we'll just do print line on error. I think that'll work.
1,003.519
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Let's see. Does this work? Go run. That printed out. So, let's change this post to something that is not valid. So, we'll just change it to and then go run.
1,031.199
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And we get invalid method. So, that's the library telling us that doesn't work. Right. So, what was I talking about a better way to do this? Well, I don't like having um this function be on its own. I'd rather just do this all inside of validate. And the reason why I did this on the own because it gets somewhat complex...
1,042.959
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And then down in the function say if found, right? That's not really that elegant and it it's just ugly. But let's use a um map lookup here. So I'm going to do a var valid methods and that's going to be a map string. Uh did I do that right? No. Um what is it? I do map string and what is it? I don't do that.
1,084.559
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
I think it's just struck like this.
1,115.84
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Uh, no, I'm getting ahead of myself. I think that's it. Yeah. And then C-pilot can finish me. There we go. Uh, get post put. That's fine. So, we have a a map here.
1,120.28
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
I really hope that's right. Um, and now with this we're just going to say check if it's in it. So this would be the value that we extract. But um, we don't really care about that. We just care if it extracted, right? So we do that. And then we can say um, let's just delete this rest of line valid methods. And I'm going...
1,136.64
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
That's good. So, that is going to be how we can validate options. I'm not going to spend a lot of time creating that, but if I was creating a library, I'd put a lot more work into the validation. So, with all of this, I think we're ready to start migrating this code over into our LDAP injector. So, let's go back to our...
1,209.36
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And then we can just open up zed again and then start working on this. So we want to open up um what is it? HTTP ops and then probably main and net hp. These are the three files we want. So first I'm going to get rid of this funk main, right? Because we definitely don't want that. And then let's see this new brute impl...
1,244.24
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Paste that. Save it. And I think most of this is pretty much done. Uh, save this code. Save this code. And here is where we're going to have our main change. So, we can say HTTP client error is equal to new HTTP brute implementation.
1,301.12
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
The URL we're going to do http internet ghost http 808 login and then we have to start doing the options. So I'll do a comma here. We can say with method post like that. And then let's see we need a with username. This can be get t temp principle.
1,328.72
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Awesome.
1,362.44
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Uh then with or expect status code.
1,364.679
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Expected status code 303. What's the next thing? Oh, we need the headers. So, let's just yank these two. Put with header like this. That's a comma. And then do the same thing here.
1,369.84
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And this can be deleted. And I think we're pretty much done. So if error does not equal nil, we can panic on this error. And you should only use panics when you're within main. Um because you never want your thread panicking. So only do it when you're in main. It's normally bad habit. Golang doesn't like you using pani...
1,398
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Um, we could have a thing like follow redirects. So, we can create something follow redirects and this can be boolean. And because we're not going to pass an option here, uh, we could simplify it. So, I'm going to show both ways. So, the easiest way, um, we'll say, uh, with redirects, I guess, um, I guess that's fine. ...
1,451.799
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
It did not save rerun. It's false. But since we're not passing in any argument here, we could simplify it a little bit and just make this the um HP op funk. I think let's see how am I doing this. Um we'll do ops HTTP ops. And I don't think we return anything.
1,510.799
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
And we can just say opsfollow redirects is equal to true.
1,539.12
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
Yep, this is it. And then for this, you could just say with redirects and not pass in like you don't do the parenthesis there because we're not passing in any extra options. And just by specifying that um you can see it gets set to true. So you could do it that way. Um, a lot of people generally frown upon this even th...
1,543.84
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
So, I think that's pretty much going to be the video. So, hope you guys enjoyed it. Take care and I will see you all next time.
1,590.679
0
{ "video_id": "p4VqejsO6oU", "title": "Golang for Hackers - LDAP Injector - Episode 04 - Functional Options Pattern", "url": "https://www.youtube.com/watch?v=p4VqejsO6oU" }
What's going on YouTube? This is Ipsac and welcome to episode three of the Golink for hacker series where we are diving into error handling. This is a pretty hot topic in the Go community because people love to hate the whole if error does not equal nil pattern as it can feel repetitive especially if you're coming from...
0.08
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Rust, which uses a more resultbased approach, and it also gives you the shortand that I'm very envious of, that is the question mark that you can just tack onto a function call, and if there's an error, it will automatically bubble it up, kind of like an early return, keeping your code clean while still being explicit....
41.04
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
And if Go is your first language, then I would imagine a lot of the example code is just better quality. So there's less chances you'll just pick up bad habits as you learn. So before we jump into the LDAP injector, let us compare how Python and Go handle errors just so you can really see the difference in mindset.
85.84
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
And I have a Python application already loaded in Z. And this code may not be the prettiest. I don't even know if it runs. I just made this to kind of highlight error handling. Um, looking at it, I actually noticed I have a unused import. Go really doesn't like things like this. Uh, Python, it's fine. I just had SQL li...
105.6
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
So, let's just get to what this function does. We have fetch user data. We're going to make sure it's an integer. We're going to get data off an API server. We're going to decode the JSON data. Extract username and role. and then return. It's pretty simple. If you're thinking about error handling, the place you'd proba...
130.8
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
fails. What happens to data? Do we keep going down? What happens? It's not explicit in how we're doing the error handling there. Um, we have username and RO. Of course, we can get key errors if either of those fields are not in the JSON. So, there's a lot of places this script could error out. And if we go over to the ...
182.319
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
do because it's dynamic typing. So variables can be whatever type they want. They can even change in Golang.
234.799
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
It's a statically typed language. So you can't really just magically change the type of a variable between like an int and a string. Um you have to create a new variable for that. Right? So we also have roll make sure it's a string and then we return. So go a lot more explicit. And that's not to say you couldn't do som...
241.12
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
they comparing it to? If they're comparing it to a language like Python where they're just not really caring about errors, of course it's going to have a lot more lines of code because you're just not thinking about the errors in Python. And if you write this Python script and decide you want to do error handling later...
298.4
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
we went over all of this, I'm going to uh close out of zed and then we're going to go into a quick demo of some error handling and then we're going to go modify the LDAP injector. So, let's go ahead and open Whoops. I should have main.go. I don't know why that's not opening. There we go. Main.go. There we go. So, this ...
343.12
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
um business logic error, I guess. or we do error business logic and then that can be errors new um do not panic save that and then here in this throw error we can um return the error business logic. So now if we run this the same thing's going to happen we have the panic that says do not panic right because we did not ...
397.4
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
have uh what? I thought that would call it as a string. Maybe not. I thought I would just see do not panic. We'll make sure that's written. Go run. There we go.
472.72
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Maybe I did not save it last time, but that's what I expected. So, this is one way to do it. Um, you can also use a switch statement, and that's not really like normal in Go, but there's nothing that stops you. So, you could do uh let's see if I can get it right real quick. Switch. Then, this would turn into a um case ...
484.639
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
But now, how I would normally do errors is I wouldn't put them hardcoded like this because we'll have a long list of just strings. I like creating more of a class and then I can just um like do it that way. It's hard to explain but I'm gonna do my best. Um and this all starts with looking at what error is and go. So if...
556.519
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
that. And now we can open up errors.go. We'll do a package main. And to start things off, we're going to create a new strct called application. Oh, we'll call it um password error because in LDAP injector, we're going to deal with password errors. So, we're just going to copy and paste this code. So, it's going to be c...
615.8
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
do is um satisfy that condition of this having a um error function. So it would do funk e password error and then call error no arguments in it. We're going to output a string and then all we're going to return is error error um wait it would be e do error and then e dot there we go this is it. Um, so we're returning i...
666.88
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
if we go back to our code uh we can return a new password error and then we're just going to say fmt error f um invalid password. And we can also put um this and do please subscribe. Uh maybe we to make it clear we should do password is equal to please subscribe. Uh that may be a bit easier to read because I'm using th...
740.8
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Uh let's see how do we do this? Um normally we would declare an error before. So I'm just going to do that. I'll do pwd error is a pointer to password error and then pwd error. This should be fine. Um, the reason why we do this because normally when you're doing this, you may be going into a loop and you don't want to ...
808.32
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Um, why is it W? Oh, because I put a W here. Awesome. So, if I do this as a string and then we run it, we see invalid password. Please subscribe. Right. So if we wanted to, we could keep this as a W. And then if we had like a code, so I'm going to do a code as an integer. And then let's just return this as code one, ri...
847.21
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
So, we could do error. Uh, let's do back slashn um message percent s back slashn code. That's a digit. So, we can say error then error dot I wonder if I can't go into this because I'm not declaring it as that yet. Okay. So, if we want to do what I'm showing is we have to um I forget what it's called. maybe type possess...
906
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Okay, let's see. And then was it any error dot password error?
954.04
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Okay. Is this going to be right? So, we're passing in pwd error and pwd error. I think that's right. Go run. There we go. Yes. So, we have the message invalid password. Please subscribe. And then we added extra detail in that error as the code.
969.959
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Right. So what we did here is um this okay means we are able to take this error and convert it into a password error and that will then give us this object which is a pwd error and then that lets us go down into it and use the other parameters like code. So hopefully this makes sense. I don't think we're going to be us...
996.639
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Never have a panic outside of Maine because that'll cause your whole program to die. Um, but yeah, so hopefully this error handling makes sense. So now let's go and um we're going to delete the code and then I'm going to copy all this into our LDAP injector and we're going to start updating that code. So let's save all...
1,051.2
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
password errors and HTTP errors be part of the do. And I'm actually going to um not use fast HTTP at all. So, I'm just going to um rename this to fast http uh till day. So, that gets out of a project. If you want to convert fast http yourself, uh, feel free. But let's go focus on this. And all we have to do is change t...
1,115.12
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
um let's do fmt error f and we'll say invalid password and we'll put in the password here. So what is the password variable?
1,182.12
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Uh that's probably near the top of this. Um just password simple. Okay. And then here we just want to return nil. And it's as simple as that. If we wanted to, um, we may like, uh, add a code here because I probably would put the actual status code. Um, we could say invalid password, um, status code and we'll do percent...
1,197.12
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
um what we want to do is declare password error up here. So we do that password error because we don't want to um instantiate password error every character in the character set. Right? So we just do it once at the top and then that will allow us to use the um errors as easier and we no longer return a boolean and erro...
1,275.76
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
character also returning string like this. Um, we can now also have this be a error. So we can do um what is it? New password error.
1,340.32
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
And this can be FMT error F. And let's just say um exhausted character set. So what we're doing here is if the character is valid then we're going to return that immediately and that's not going to error at all. Then if the error is not a password error, we're just going to um continue. And if it is um if it's not a pa...
1,356.24
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
string first. Then we're going to do this for loop. So this is going to loop over until um it thinks we're done, right? So this is kind of like an infinite loop. And then we have some logic in that says we're done.
1,428.4
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
So we're going to test the character and then if the error is not nil we're going to immediately return. So this is going to be where we have to start doing the logic, right?
1,441.2
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Because if we get this blank string, which is how we used to identify exhausted character set, then um it would do it again and that would identify if it's a partial password because if we do a test character and we return nothing, it either means we reach the end of the password or the character in the password wasn't...
1,454.64
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
So this is going to be if we're a password error, we want to do the request again. So let's get rid of this. Okay. And then if the request is successful, then we're going to break out of this. And then we'll say else if errors as and pass error. Then this is going to be um let's see we will return the result and then f...
1,526.48
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
else return error. I think that may be fine. That's delete. That's gone. That's gone. That's gone. That's gone.
1,585.4
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Let's see else error is not nil. Why is that erroring? Uh one string error.
1,609.12
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Okay. So it did not need this twice. That's fine.
1,629.559
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Okay. So, what we're going to do here is we're going to um run test character for every character in the string. And if test character passes no error messages, we're just going to append the result and then run it again. If it does have an error message, then we're going to check if that error message is a password er...
1,637.559
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
I'm trying to think if I need this or not. Um, I'm pretty sure I do need it because this is part of this. So, this is saying if it's not a password error and this one is saying if we test the password and the um server responds with like a connection refused. So, I think that's all good. And I think there's going to be...
1,713.44
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
to my VPN just to make sure I'm connected. I'm going to do gor run dot. And we're going to wait uh probably a minute to two minutes for this to run. and hopefully we get a result back. So, I'm going to pause the video. Awesome. The program still works as we expected. Now, the last thing I wanted to do real quick is um ...
1,786.64
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
Um, I think this would just be handy. So, we have that. And here we'll do new password error with code. We'll do invalid password like that. And then I think that's good. Let's see. We close that out. There we go. So that should be fine. Um what I also want to test is the partial password is working. So we can test tha...
1,843.48
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
So it is working as we expected, right? Um we remove that. We can save it. We can do a time on this. And it'll probably take somewhere between one and two minutes. And once we see this result, I'm going to um call it a wrap and that'll be the video. So, um hope you guys enjoyed this. Take care and I will see you next t...
1,895.039
0
{ "video_id": "9_aJN3-mOFw", "title": "Golang for Hackers: LDAP Injector - Episode 03 - Error Handling", "url": "https://www.youtube.com/watch?v=9_aJN3-mOFw" }
What's going on YouTube? This is IPSC and we'll be doing administrator from hack the box which is an assumed breach active directory machine meaning we start out with the main credentials and from end mapap we can see just active directory and FTP is running however we cannot connect to FTP because a user doesn't have ...
0.16
0
{ "video_id": "Miam4nw9pmE", "title": "HackTheBox - Administrator", "url": "https://www.youtube.com/watch?v=Miam4nw9pmE" }
So we can change both users password and on the second user hop it gives us access to a user in the share moderators group which grants us FTP access and that FTP server host a password safe database which cracking it gives us access to another user. This user has generic right over a user with DC sync privileges. And ...
24.4
0
{ "video_id": "Miam4nw9pmE", "title": "HackTheBox - Administrator", "url": "https://www.youtube.com/watch?v=Miam4nw9pmE" }
directory and call it administrator and then the IP address of 1010.11.42. This can take some time to run, so I've already ran it. Looking at the results, we have 12 ports open. The first one is FTP on port 21. And the banner just tells us it's Microsoft FTPD. Then we have DNS on port 53. That simple DNS plus. And agai...
68.479
0
{ "video_id": "Miam4nw9pmE", "title": "HackTheBox - Administrator", "url": "https://www.youtube.com/watch?v=Miam4nw9pmE" }