k3nn3dy commited on
Commit
f7e8a6b
·
verified ·
1 Parent(s): e004892

Add Golang_For_Hackers__LDAP_Injector_-_Episode_01.jsonl

Browse files
Golang_For_Hackers__LDAP_Injector_-_Episode_01.jsonl ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"text": "What's going on YouTube? This is IPSC and this is the start of a video series I wish existed when I was getting started with Golang. In this video, we're going to write a very basic Golang program to perform Boolean LDAP injection and exfiltrate a password. It likely will take around 40 seconds to get that one password. Then I hope to spend at least 2 hours over the span of five or more videos improving the code. And at the end of it, it will probably take around 40 seconds. This may sound crazy as we're going to sink a lot of extra hours into this program without any performance improvement, but we're going to tackle many topics like dependency injection, error handling, functional option patterns, middleware, microservices, and whatever the heck is a rune. All of these concepts I had trouble learning because many of the", "start": 0.16, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
2
+ {"text": "guides use gimmicky programs talking about Dragon Ball Z characters, mountain climbers, etc. So, while this series may be longer than um what you expected, hopefully it brings a bit more to the table because it's going to be exactly what you want. But before we get into programming, let's go over the basics of LDAP injection because it's pretty hard to automate something if you don't know how to do it manually first. So, um to get started, I'm going to be using the ghost machine from Hack the Box because the very first step of this machine involves LDAP injection. And if you don't know what Hack the Box is, well, welcome to this channel. Um, definitely check out the other videos I have where we solve many of these machines. But hack the box is just a place where you can learn hacking or cyber security in general. I would highly recommend it. But if you spawn the machine and want to", "start": 42.8, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
3
+ {"text": "play along, feel free. Um, the first thing we get is this internet.go.htb login portal. And if we do like admin admin, we'll get invalid combination username and secret saying that's an invalid password. Now if we just use the wild card and LDAP which is a star it performs the LDAP injection and we get logged in. The username was not star I mean was logged in as Katherine Holland. So Katherine's either the first or last user in the LDAP database. Right? If we click on the users we see Katherine listed first. So she's probably the first user. That's why the LDAP injection worked. It's very similar to or one equals 1 in SQL. So if we read this page, the challenge is we want to get the password for this account. And whenever you have an authentication bypass because of a boolean, um you can also have a way to exfiltrate data one character at a time", "start": 89.04, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
4
+ {"text": "because you can ask the database questions, right? So we're going to take this account and then go over to Burpswuite where I already have the um request put out. And if we send this request with username and secret as star, we get a 303 C other and in the body it's just open and closed brackets. If we put something else in the secret like not the password, we see a 200 okay and the error message is invalid combination username and secret. So this is one of the odd cases where we don't want to see a 200 okay because that means invalid password. We want to see that 303 redirect. So let's go ahead and put that get t temp principle for the username. And we get a 303 redirect which is good. The first thing I always test for is case sensitivity. So I'll do a capital L. That still works. So the username is not case sensitive. Most likely the password is not either but", "start": 143.2, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
5
+ {"text": "we'll test that when the time comes. Now, I like testing for case sensitivity when we're doing these boolean injections because that eliminates having to do both lowerase and uppercase, which is like 26 requests that we just no longer have to do, which is nice. The other thing I want to test for is how wild cards are being used.", "start": 196.879, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
6
+ {"text": "Wild cards have multiple like definitions, I guess. Like there's theall, which means the wild card will match every character, including special. You can have it just match new lines, everything but new lines. there's other multiple behaviors, right? And we care about that because we're going to want to do something called character set pruning, which is identifying all the characters in a password because it'll lower the number of requests. And we'll get into that in a little bit, but um to test for that, you may think this would always match string, right? But if the wild card's not matching special characters, then this wild card matches the s and then you're left with this and this no longer equals this. Right? So every string has special characters at the beginning. Um and then also the end", "start": 215.2, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
7
+ {"text": "of line. Maybe I should do like b. I don't know what that like terminology is. But that way the wild card will match this. Then it matches the beginning of line or string I guess I should say. And now we're left with SAR which matches this. Right? So we can test for that by just putting a wild card at the end of this. And if we get a password correct then the wild card is matching everything. So that is going to tell us we can enumerate um characters in a password easily because if we couldn't then that's going to give us a little bit of trouble. But let's go with the boolean injection and finding out how we get a password. So we're going to do a wild card failure, B wild card, C wild card, and go all the way up to the first character, which is S. So there we go. The password begins with S. We can do a capital S as well and see that's still successful. So the password is", "start": 265.6, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
8
+ {"text": "also not case sensitive. So the next thing we want to do is find characters in a password. So we can do a star A and that's invalid combination. B um star B star invalid combination and go all the way until we get it. So there is a C in this password. So that is how we can do um the character set um pruning that we'll do later. Now the other subtleties of LDAP, you can't enumerate the number of characters in a password. A lot of times you'll just like use the number of wild cards until it no longer matches. If we do two wild cards, we get unknown errors. So the um we didn't get like that um invalid combination and secret we got unknown error. So we just completely caused that LDAP query to crash. If we there LDAP doesn't have any like question mark to match a single character. Um it doesn't have like single uh a question mark or percentage sign would do that in", "start": 320.32, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
9
+ {"text": "other languages. And if this was no SQL, then we would use like regular expression and that would allow us to do binary search by um asking questions that eliminate half. If it was SQL, we could probably either do reg x. We could convert a character over to hex and saves it greater than or less than and do binary search, divide and conquer or whatever. If you don't know what binary search is, we can go over it really quick. Even though we're not going to be using it, it's still something handy to know. Let's say we have this as a potential password, the alphabet, right? Binary search would just say we divide it in half and then ask the question is the password A through M? No. Okay, so we know the password is N through Z now.", "start": 379.84, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
10
+ {"text": "So the next question you would ask is the password N through T? Yes. So we would eliminate the second half, right? And then we just keep going down the list. Is the password N through P?", "start": 423.199, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
11
+ {"text": "Nope. Then it must be um is it Q or R? No, it's S or T. Then you ask, hey, is it S? No, it's T. And that would be binary search. So instead of guessing the whole alphabet, we take that um 26 characters, I think, to 1 2 3 4 5 six. So it makes a lot less requests, but that's not something we can do. If you want to see that implemented, then go over to ipsc.rocks, rocks search binary search and check out this video the automating boolean SQL injection and evading filters because we go over that there but in this we're not doing that. Um let's get ahead and start our program. So I'm going to do a go mod anit LDAP injector uh already exist so I already had made it. We can touch main.go and then I'm going to use zed which is my IDE of choice to open this up. And now let us um open the file. Whoops, wrong key.", "start": 437.759, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
12
+ {"text": "Open the file main.go. And we're going to do package main. And then we're going to do funk main. And we're just going to make sure a go environment works by doing a print string. So do print length of hello world or print line, not length. And now let's do a go run dot.", "start": 499.84, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
13
+ {"text": "And we get hello world. So our computer is running go. Awesome. Now, the first step into automating this is being able to replicate what we did over in Burpsweet. So, we just want to be able to make this request. So, I'm going to create a um strct or class or object. I don't know the correct terminology. It's not really important if you get the terms right as long as you know how they operate and things like that. As long as people know what you're talking about, right? So, let's do LDAP injector is going to be this and we'll do strct. I'm going to give it um the URL, which is going to be a string. I'm also going to give it the username, which is a string, because I want to set the username when I create this object. And that's going to let me not have to like pass the username to every single function afterwards because I can just pull it", "start": 519.12, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
14
+ {"text": "from the object itself or class or whatever this is. So, let's instantiate it. And we could instantiate it with like C is equal to LDAP injector and then specify variables. But this isn't really the Golang way. Right now it works because we don't have defaults. We don't have a functional option pattern things like that. But we really should be using a function to instantiate it or initiate it. So we'll do function new LDAP injector like that. Pass it the URL and username. And let's go ahead and update our code.", "start": 568.399, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
15
+ {"text": "So I'm going to do C is equal to new LDAP injector. The URL is going to be HTTP um internet.go.htbport 808 and login. And then the username, this is just going to be um gett temp principle. There we go. So now that that's done, we can create the first method of this um strct. So we'll do funk and then li for lap injector. Say what it is and we're going to call this test password. We're going to pass in the password which is a string. And then right now we're going to return both a boolean and an error.", "start": 604.08, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
16
+ {"text": "When we go into error handling and understand how to differentiate different errors, we'll only return error, right? But if we go into error handling, that's going to be a little bit much for this video. Ideally, we just return error. And then if it's an application error, we know, okay, that um password was incorrect. And then if it's a transport error, we would then say, okay, well, we probably should exit the program because our HTTP request field, we couldn't get to the server. So, we're not going to get into those error handlings. Instead, we're going to put if the password is successful or not as this boolean. So, the first step is to do payload is equal to fmt sprintf. And then copilot wants us to do a LDAP query. That's what they look like, but we're actually just going to be putting in the data of our post request. So,", "start": 649.36, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
17
+ {"text": "we're going to copy this, paste this in, and then where there is input, so the username, we're going to put a percent s. And then for the password, we're going to do the same thing. And then we'll top it off by ending the sprint f with the username and password. So those get put into the payload. So now we can start making our HTTP request. So we'll do request error is equal to HTTP new request. And this is going to be a post.", "start": 698.8, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
18
+ {"text": "It's going to go to the URL. And this looks mostly right. Right.", "start": 729.44, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
19
+ {"text": "So post URL and we have the payload is putting it in the body. We're going to set the header as x dubdubdub url form encoded. And then we also will have to set one more header because this is a nextjs app. Um and that is going to be the next action. So we'll set that and then put this here. And if we wanted to support many next.js JS apps because this hash could be different. Maybe on the new LDAP injector, it would hit the login page, see what that u metadata is for the next action, and then populate this. But thankfully, we just have one application to worry about. So, we're just going to hardcode it here. But that could be something in the future. And I think I may have hit a key. Nope, I did not. So, there we go. Now the last thing we have to do before we actually make this client perform a request is disable", "start": 736.24, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
20
+ {"text": "follow redirects because the Golink HTTP client by default will follow a redirect and the valid password is a 303. So it follow it to be a 200 and then we could probably parse either the cookie or the body or something else in the request to identify if it was valid or not.", "start": 790.16, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
21
+ {"text": "However, that makes two requests per attempt. We want to make one request. So, we're going to tell it not to follow the redirect because we can depend on the status code. So, we'll do a comment that says do not follow redirect because Golang does it a bit weird. So, I'm going to start typing and hope Copilot takes the wheel. There we go. That's how you tell the HTTP client to no longer um follow redirections. I wish it was just like um request.fall follow redirect equals false but um it's not. So now we can make the request. So we'll do response error is equal to client.do on the request and then um if error is not nil that's fine. This defer just means it's going to execute response body close when the function exits. So defers always happen when like you return out of it or when the program panics. It's a really good way to clean things up. If", "start": 808.56, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
22
+ {"text": "you're from Python, it's very similar to the width statement. Uh, PHP now has defers. A lot of languages do have it.", "start": 870.16, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
23
+ {"text": "Um, another case instead of just like cleaning things up would be I like doing it for my structured logging. So, at the start of a function, I would write a start of a log and then I would defer and send that log event. And what that enables me to do is update that log uh object throughout the function. And then whenever it returns, that's when it triggers the defer which writes the log.", "start": 876.48, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
24
+ {"text": "So that way I just get one log line that's very detailed versus if I put a bunch of different logs in the function.", "start": 901.12, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
25
+ {"text": "Then when you go to just look at the log, it just becomes a mess because you have five lines where you could have just had one good line, right? So that's generally what I do. The other thing we want to do is change this to be 300, right? Because this is saying um exit this boolean. So when the response status code is 303, we want that to say true. When it's not, then false because that's an invalid password. So now that we have this, let us see if our test password feature works. So I'm going to do response error is equal to see test password. That is fine. Let's go ahead and go run dot to print this false. That is what we expect because our password is not password. So I'm going to change that to be a star. Save it. Run it.", "start": 907.519, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
26
+ {"text": "go run dot to run it again and we get true. So our function to test password works. Now the next thing I'm going to do is create a character set because we're going to need that in the future. So um I'm going to do funk and I'm just going to say create care set and we're not going to pass in any variables. Um, when we get into functional option patterns, that's where we're going to pass in like with lower, with al uh with upper, with digit, with symbols. But for this, we're going to keep it simple. Um, it's going to return a string. And we could hardcode this, but I'm going to use a function like we that may be fine. we'd probably just delete the uppercase, but I'm going to do for C is equal to A and then until C is less or while C is less than or equal to Z, we're going to increment C and then we're going to", "start": 956.16, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
27
+ {"text": "um we'll say for result string or maybe I should call that carouset. We'll do carouset string. We can say um this actually probably be what is see a rune this can be just a list of bytes like that. Okay. So now we can say carouset is equal to append carouset and c right uh we have to convert this to a bite I'm not sure if that's correct but it looks like it may work um okay so the next thing we have to do is uh for i is equal to range 10 and then like that. That should be fine. And then we can return string of carouset. And I did the walrus operator here. We just want to do equals. And let's make sure the carouset is what we expect. So I'm going to do uh we can comment this out. fmt print line create carouset like that go run and we only did digits let's see for i range 10 we may have to hold on I think I know uh we'll have to convert this into a", "start": 1017.839, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
28
+ {"text": "string. So we'll do C is equal to string convert uh dot integer to ASI like that. And then we can probably just append C. There we go. Go run uh C variable type of string. Uh how do we get this back into a bite?", "start": 1132.72, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
29
+ {"text": "Um, you know what? Let's just do this as a string. We won't do it properly. Um, carouset plus equals string C. That's fine. And then this can be carouset plus equals string C.", "start": 1161.16, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
30
+ {"text": "It's always um tough to do things while talking and everything, but this is not optimal memory management. When we talk about runes and what they are and how gerling handle strings, uh we'll probably fix all this up, but um for now that should be fine. There we go. Now we have the character set. So what we want to do is go to the top and our LDAP injector. I'm going to do carouset is equal to string and then in a new LDAP injector we can say um carouset is equal to create car set and there we go. So now our LDAP injector starts off with a character strat set of lower alpha right and numeric. So, what we want to do now is start creating the brute force functionality. And we're not going to do it right off the bat because I'll show you like the issue we run into. So, I'm going to do LDAP injector. We're going to call this brute. Uh, we're not going to pass in anything, but we're going to", "start": 1184.16, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
31
+ {"text": "return both a string and an error. And for this, we have to do two loops. And I always hate doing two loops because we have to loop over every single character. And then we also have to do a loop for each of those characters, right? And whenever you do that, it it's just not pretty code because you have to break out. You don't know exactly what one you're breaking. So I like just breaking when you go into these double for loops into another function. So we're going to create one called um test character. So we'll do LDAP injector uh test character and we're going to pass in the password prefix as a string. And then we're going to return a string and error. That should be fine. And now we want to say for uh CN range liar set and we'll do if test password that may oh that's not fine.", "start": 1253.28, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
32
+ {"text": "Um, so we'll do okay error li.est password and then we need to do fmt.sprintf and we'll do percent s because that's going to be prefix. That's going to be the character and then we need a wild card. So that looks better. Um, this is currently a rune. We probably should make this a string.", "start": 1317.28, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
33
+ {"text": "And then we can return this as a string. And the whole reason behind that is every string is essentially like a bite buffer, right? And a rune um will except uni code. So that can be two bytes. And if you do a string against uni code, it's not going to work. I think I think strings are just for asy.", "start": 1346.88, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
34
+ {"text": "Maybe wrong there, but um we'll definitely do a video where we dive into runes more in depth. But we're going to do here is test the P password with that character or take every character loop over each one test it. If that character is in the password, then we're going to um return that. And then if that character is not in the character set, we're going to return an empty string and no error. So when our code sees this function returns an empty string, it's going to assume we've reached the end of the password.", "start": 1365.679, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
35
+ {"text": "So, let's just comment this out real quick and then we're going to test our program. So, now we can do the C new LDAP injector. Um, we'll do okay error C do test character and we're going to pass in nothing for the prefix and print that out. So when we go run this, hopefully it says um S. Yeah.", "start": 1402.0, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
36
+ {"text": "And I should have said okay here. Um this should have been uh what is it? Response probably. Whoops. That was not rename variable, right? Because that's not a boolean. We should have done response. But there we go. And if we passed in S to this, we should get back the second character of the password. And hopefully the second character isn't an S because then we'll go into some troubleshooting. But I want to say that second character, yes, was a Z. So our test character functionality works. So now we can go into the brute force. So let us uncomment this. And now we can do a loop here. And now we're going to say um let's see. Well, before this we want to define the result. So we do v result string and then um let's see c error is equal to uh li test character and then we're going to pass in the", "start": 1433.039, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
37
+ {"text": "result and then if error is not nil return error. That looks good.", "start": 1496.84, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
38
+ {"text": "And I think this is good. So let's look at this function. So we start out with an empty string. It runs through. It's going to test the character. It's going to get s. This is not equal to nothing. So it's going to keep going. And we do this. That is right. Goes the second. And soon as we hit that, we could return. We could also do a break here. And then return result nil.", "start": 1508.559, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
39
+ {"text": "doesn't really matter, but I always like having the last line have be a return, so that's why I did the break. So, this looks like it works. Um, I guess the moment of truth. Well, before we get to that, we have to code the brute force. So, if error is nil, let's do password. And this will be brute. And at the end of the video, we're going to go over the program really quickly. So if something doesn't make sense, um I'd stick around till the end just to have it go over. Right. So now that that's running, um that'll probably take 90 seconds. So we can go over um how we're going to do the optimization and the character set pruning. So let's go back to our terminal. And I'm going to first talk about like the number of characters. So let's say um there's 80 possible characters for every character because", "start": 1536.88, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
40
+ {"text": "that would be like lower upper numeric symbols. So there's 80 and let's say the password is um first this we're talking about no optimization. So no optimization, right? And the password's 10 characters long. So at max we have 800 requests, right? If we go and do binary search, whoops, binary search, then it starts out um 80 40 20 10 53 2 1 I think. Um you may be able to remove one of those requests, but that should be fine. 1 2 3 4 5 6 7 8. So it only takes us eight requests to narrow down every single character. So that now becomes 8 * 10 which is 80 request if we did binary search. Now we can't do binary search as we said earlier. We're going to do character set pruning. So um car set pruning we're going to find out all the characters in the password. So, we're going to make 80 requests right away and", "start": 1600.08, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
41
+ {"text": "then we can get a maximum of 10 characters back. We can't get like 12 characters or in a 10 character password, right? So, at max 10. So, we do 80 + 10 * 8 and that's going to equal 180 requests at max. And really, that's lower than um that because like once we guess that character, we remove it from the possibility. So all the future requests will be minus one, but napkin math says 180 max even though it's a little bit less. Binary search still more efficient. Character set pruning is much more efficient than no optimizations. So with all that being said, let's get back to our program and hope it worked. Uh that is the password, but I did not do a time. So I will run time with that now so we can see how long it takes. Ah, I was doing so well. But let's start with the character set pruning while that goes. So let's do", "start": 1674.12, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
42
+ {"text": "funk and we'll say um lidep injector and I'll say prune carouset. And I guess we can return an error if things go horribly wrong. Uh yeah, we'll just do that. So what do we want to do? Um we have to loop over the entire word list. So we'll do four care and range this. So range li.care set and then we want to test the password. So we will say um okay error then li.est test password and we want to do fmt sprint f and this is where we do star percent s star and then we say this is going to be the character if error is not equal to nil so it took 1 minute and 12 seconds to run we'll return nil and then if Okay, let's do um new car set string like that. If it's okay then we will append this and we got to return nil at the end. So this should be with character set pruning. I think that is it. Uh why are you", "start": 1732.88, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
43
+ {"text": "erroring wrong type rune? Let's do string here just to keep that happy.", "start": 1847.0, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
44
+ {"text": "Okay, so now we can do C. prune carouset and we're going to do fmt uh we'll do print ln carouset and then we will say pruned carouset and then brute force the password and print it. So we're hoping to beat 1 minute and 12 seconds. So I'm going to do go run. we get the character set and then it's going to prune it and then start going through each character. Um, that did not work because I know I forgot one last thing and this is going to be a silly thing. So, let's go back to prune car set.", "start": 1856.6, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
45
+ {"text": "Um, before we return nil, we have to do li.caret is equal to new to set it. Save that. Now we can run. Okay. So, let's see. We probably should start going over the program while that runs. Um, I'm guessing it's going to take 39 seconds. So, what function do we want to start with? Um, test password. So, this we build the payload. We're starting the request. We add the headers we want. We could also put things like the user agent so we blend in a little bit more. There's a lot of things you could do there. Now we're going to disable the redirects. And here we're making the request. We're making sure the body is closed after it. And then we're going to return true if the status code is 303. Otherwise, it's false. And the program finished. We brute force that password um in 38 seconds. So that is how the test uh password function works. The test", "start": 1906.6, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
46
+ {"text": "character is just going to loop over the character set that we have which is lower alpha numeric. It's going to test for the password. And I want to say I did not do this well.", "start": 1974.559, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
47
+ {"text": "Um this really isn't a good way to do things in Golang like the if then loop like this. We probably should do it. Um, if okay error is equal to that then if error let's see error does not equal nil return nothing error then else.", "start": 1990.12, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
48
+ {"text": "Okay. Or else if Okay, this would be a more golangy way to do that. I think um and I'm showing you this because I don't know what it's having me accept. Um, the difference what I just did is again I said Golang really cares about like variable scopes or at least I think I've said that before. But if we left it this way then okay is going to exist further down. When you do things like this like this if okay error and put this all on one line then after here okay is not defined. Um let's see. Okay.", "start": 2029.399, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
49
+ {"text": "If we go here, undefined, right? But if we comment this block out, I wish I remember the hotkey off the top of my head to comment all these, but I don't.", "start": 2077.76, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
50
+ {"text": "Um, now, okay, is going to be defined. Uh, we have to get rid of that slash. What are you?", "start": 2092.839, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
51
+ {"text": "it's a boolean. So, it's all about scope when you do it that way. Um, hopefully that makes sense. I know that confuses a lot of people when they start with Golang is why does everyone write if then this way? It's so different than the other ways I'm used to seeing it. But that's why. So, let's just make sure that still runs. Um, let's see. We did test character. Let's go into test. We did test password. Test character. we can go into prune word list or carouset. So we're going to initiate a variable and again this is because goling really cares about that scope. If I didn't initiate this and we kind of just went through here um as soon as I exit this for loop then that new car set will no longer exist because that was tied to um this piece right so you initiate it outside the loop. We loop through every single character. We're going to test the", "start": 2106.48, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
52
+ {"text": "password putting star um character star and then appending and again we should probably use that same um logic. So if like this then error is not nil return nil else if okay put this up here. Whoops. I don't know what I just did. Move that there. There we go. So that's a little bit cleaner. And then we just set the character set to be that and return nil. You could also um do both. We could return string error here and also return the new character set which just makes it a little bit easier to access. That is all up to you.", "start": 2161.2, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
53
+ {"text": "And then finally the brute force. We're going to define the result here and um loop through. Right. And we probably could update our if then logic here as well if we wanted to, but I think right here is fine. I normally only do that for like booleans. We may want to use that um single character later on, maybe test something. Um maybe like if we have additional logic like checking a dictionary and seeing if we're starting to build a word, maybe we want to. So you don't always have to. It's just something. So um that's how the brute force works. We define string. We test if the character is valid. If that is part of the password, then we're going to append it to result and move to the next um character. If that character returns no string, then we're just going to break out of the loop and say we found the password because the next character was not in our word list.", "start": 2217.28, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
54
+ {"text": "Right? If this was no SQL, then my final character would be a dollar that I test for. Actually, it would be in the character set. The final one would be a dollar because that means end of line.", "start": 2279.599, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
55
+ {"text": "So, that would confirm we got through all the um passwords, right? Or the characters. This does have the issue if um there's a character not in a character set, we won't get the complete password because it's just going to assume it got it. So, um, you may want to put some type of logic into the brute force that just tests it, right? So, we could go here. Let's see. We test character if C is that we could do like if okay error li test password then fmt. Whoops. Uh, we don't even have to do that. We can just do uh result like this and say if error is not equal error not equal to nil return error like that then else if not Okay, return. I'm going to do fmt error f.", "start": 2292.079, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
56
+ {"text": "Um, partial password found like that. And then if it's okay, that should be fine. So that would be one way to do it. And let's see where do we do um rune carouset. Let's just actually scroll up. We're going to take this character set. We're going to copy it and we're going to say c.car set is equal to Whoops.", "start": 2370.839, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
57
+ {"text": "C. Set is equal to. Let's make sure we have this copied. We can paste it. And let's remove the sec. Uh, where's the password? It was CZ. Uh, where is it?", "start": 2419.96, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
58
+ {"text": "SZ. We could remove the C.", "start": 2442.44, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
59
+ {"text": "Okay. So now when we run the program, hopefully it's going to error, right?", "start": 2448.359, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
60
+ {"text": "Because we removed one of the possible characters. It's going to go to test the password and it's going to come back.", "start": 2454.4, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}
61
+ {"text": "Hey, this password is not okay. And then error out. Um that is my hope. I'm surprised it's taking this long. Uh partial password found. There we go. So we did error. um it knows it did not get the full thing. So with that being said, I hope you guys enjoyed the video. Let me know in the comments if you enjoy this um format. The next video is probably going to be in dependency injection because I think that's one of the topics most people don't understand and I think that's what turns like scripts into programs. Um so yeah stay tuned.", "start": 2460.88, "duration": 0.0, "meta": {"video_id": "uJFW4c4QE0U", "title": "Golang For Hackers: LDAP Injector - Episode 01", "url": "https://www.youtube.com/watch?v=uJFW4c4QE0U"}}