Latest / CyberCode Academy / Course 8 - Penetration Testing OSINT Gathering with Recon-ng | Episode 1: Recon-ng Installation, Shell Exploration and Data Management
Transcript
- 0:00Speaker 1: Welcome back to the deep dive. So if you're in cybersecurity,
- 0:04Speaker 1: you know the absolute first rule. Before you even think
- 0:07Speaker 1: about an active exploit, you have to do your reconnaissance. Yeah,
- 0:10Speaker 1: your information gathering. But that stage, I mean, for so
- 0:14Speaker 1: many people, it just turns into chaos. You've got spreadsheets everywhere,
- 0:17Speaker 1: random scripts, data all over the place.
- 0:19Speaker 2: Oh, it's a complete information overload exercise. You're trying to
- 0:22Speaker 2: track domains and contacts, maybe some credentials, ips, company names,
- 0:28Speaker 2: and it's all in different tools exactly. So our mission
- 0:31Speaker 2: today is to do a deep dive on a framework
- 0:34Speaker 2: that was built, I mean really built from the ground
- 0:36Speaker 2: up to fix that chaos. It's called Recon, okay, and
- 0:40Speaker 2: we're going to look past just the commands and really
- 0:42Speaker 2: focus on the architecture. You know, how it turns this
- 0:45Speaker 2: scattered mess into a structured, manageable project.
- 0:48Speaker 1: I like that a project management system. So let's unpack
- 0:51Speaker 1: that design. When we talk about a tool that specialized,
- 0:54Speaker 1: we had to start with the environment. Where does this
- 0:57Speaker 1: thing live. It's not just a drag and drop piece
- 0:59Speaker 1: of software, it is not.
- 1:01Speaker 2: Recon is very firmly rooted in the Linux world. That
- 1:06Speaker 2: is the only place that's officially supported. Okay, so if
- 1:09Speaker 2: you want to run it reliably, you need a Linux
- 1:11Speaker 2: distribution ready to go, and that right.
- 1:13Speaker 1: There is going to raise a flag for anyone on
- 1:16Speaker 1: Windows or mac os as their daily driver. But there
- 1:19Speaker 1: are solutions for that, right, This is a pretty common problem.
- 1:22Speaker 2: Oh. Absolutely. The beauty of modern computing is you don't
- 1:25Speaker 2: have to wipe your machine and install Linux. You can
- 1:28Speaker 2: just use virtualization, right, like virtual box or something. Yeah,
- 1:31Speaker 2: you could run a lightweight Linux in virtual box or
- 1:34Speaker 2: and this is probably the most efficient way. Just run
- 1:36Speaker 2: the tool inside a Docker container.
- 1:39Speaker 1: That makes sense.
- 1:40Speaker 2: It keeps it all sandboxed and you meet all the
- 1:42Speaker 2: requirements without messing with your main setup.
- 1:45Speaker 1: Now, speaking of requirements, a lot of listeners are probably
- 1:48Speaker 1: using something like Collie Linux where recon just comes pre installed.
- 1:52Speaker 2: It's just there.
- 1:52Speaker 1: Yeah. But if you want a clean setup, say on
- 1:55Speaker 1: a server or a fresh Aubuntu machine, you need to
- 1:58Speaker 1: know the dependencies. So what are they? What do you need?
- 2:01Speaker 2: The biggest one, and this is a kind of a
- 2:04Speaker 2: fascinating point, is Python two?
- 2:05Speaker 1: Python two really still?
- 2:07Speaker 2: Yeah, it's an architectural thing. The tool was developed right
- 2:10Speaker 2: in that transition period from Python two to Python three,
- 2:13Speaker 2: and a lot of it is still heavily dependent on
- 2:16Speaker 2: that older ecosystem. Wow, so you have to make sure
- 2:18Speaker 2: Python two is installed that and you'll need get, which
- 2:21Speaker 2: is how you actually, you know, clone the repository to
- 2:25Speaker 2: get the code in the first place.
- 2:26Speaker 1: Okay, so we've got Python two. We use git to
- 2:28Speaker 1: pull the code, and then we fire it up. What
- 2:31Speaker 1: happens next because you're immediately in a new environment.
- 2:35Speaker 2: You are. You're dropped into this very specialized shell, and
- 2:39Speaker 2: it is not the Linux bash shell you're used to.
- 2:41Speaker 2: It's a custom command line, a whole new world it is.
- 2:45Speaker 2: And a quick note on that. If you fire it
- 2:47Speaker 2: up and see a bunch of red error messages right away,
- 2:49Speaker 2: don't panic.
- 2:50Speaker 1: Don't assume you broke it exactly.
- 2:52Speaker 2: The framework is usually just telling you that you're missing
- 2:54Speaker 2: apikeys for some of the modules. It's a configuration thing
- 2:58Speaker 2: you deal with later, not a broken installed got it.
- 3:01Speaker 1: So we're inside this special shell. We can type help
- 3:04Speaker 1: and see the top level commands. But you said, the
- 3:07Speaker 1: real genius here isn't the commands themselves. It's the philosophy.
- 3:11Speaker 2: The structure, Yes, the architecture. It stands on three pillars,
- 3:15Speaker 2: The first one.
- 3:15Speaker 1: Is the modules, the actual tools.
- 3:17Speaker 2: The workhorses exactly. They're about ninety of them. Each one
- 3:21Speaker 2: is a dedicated script that does one thing. Search for
- 3:24Speaker 2: domain contacts, find company names, that kind of thing.
- 3:27Speaker 1: Okay, modules, What's pillar number two?
- 3:29Speaker 2: The database? Every single piece of information, whether you put
- 3:33Speaker 2: it in or a module finds it, it all goes
- 3:35Speaker 2: into a centralized database. It uses sec light on the
- 3:38Speaker 2: back end, which makes it super portable.
- 3:40Speaker 1: And that brings us to the third pillar, the one
- 3:42Speaker 1: you said is the real game changer here.
- 3:44Speaker 2: This is the feature that makes it more than just
- 3:47Speaker 2: a folder of scripts, and that's workspaces.
- 3:49Speaker 1: Workspaces, right, I mean.
- 3:51Speaker 2: Think about it. If you're just doing a small test, fine,
- 3:53Speaker 2: dumb all your results into one database. But what if
- 3:56Speaker 2: you're running two totally separate pen tests, one for a
- 4:00Speaker 2: bank and one for I don't know, a hospital.
- 4:02Speaker 1: You absolutely cannot mix that data.
- 4:04Speaker 2: That's a huge problem, a huge problem. You risk data leakage,
- 4:08Speaker 2: scope confusion, everything. So this framework solves that by forcing
- 4:13Speaker 2: you to separate projects into workspaces.
- 4:16Speaker 1: So when I do a fresh install, I start in
- 4:18Speaker 1: the default workspace you do. But the very first thing
- 4:22Speaker 1: I should do for a real project is type workspaces
- 4:25Speaker 1: ad and then my project name.
- 4:27Speaker 2: Precisely, that command doesn't just like add a label in
- 4:30Speaker 2: the database. It creates an entirely new directory on your
- 4:34Speaker 2: file system just for that project.
- 4:36Speaker 1: Oh wow.
- 4:37Speaker 2: And inside that directory crucially is its own separate database
- 4:41Speaker 2: file data dot dB. So it's true separation.
- 4:44Speaker 1: That's brilliant. That guarantees data integrity. I can delete one
- 4:47Speaker 1: workspace and I haven't touched anything from my other projects.
- 4:50Speaker 2: That's the one.
- 4:50Speaker 1: It guarantees it at the file level, and I'm guessing
- 4:52Speaker 1: that project directory is also where my final reports and
- 4:55Speaker 1: stuff will get saved.
- 4:56Speaker 2: You got it. It becomes the single source of truth
- 4:59Speaker 2: for that whole engagement, and you always know where you
- 5:01Speaker 2: are because the workspace name is right there in the
- 5:03Speaker 2: command prompt.
- 5:04Speaker 1: And it's a switch. It's just workspaces select and the
- 5:08Speaker 1: name just like that. Okay, so we've got a clean
- 5:10Speaker 1: workspace open system's ready. How do we get the ball rolling?
- 5:14Speaker 1: How do we feed it some initial data for the
- 5:17Speaker 1: modules to chew on?
- 5:18Speaker 2: You talk directly to the database tables with the AD command. Okay,
- 5:21Speaker 2: you just type ad then the plural name of the table.
- 5:25Speaker 2: So to set your target, you'd type ad domains BBC
- 5:28Speaker 2: dot com.
- 5:30Speaker 1: Simple enough.
- 5:31Speaker 2: What if I'm looking at an organization, then it would
- 5:34Speaker 2: be AD companies and then the name of.
- 5:35Speaker 1: The company, and I can check what's in there with
- 5:37Speaker 1: show YEP.
- 5:38Speaker 2: Show domains or show companies. That command is your window
- 5:42Speaker 2: into what's currently in your database for that project.
- 5:45Speaker 1: Now you mentioned a little quirk.
- 5:46Speaker 2: Here, ah, yes, a little inconsistency to remember. While you
- 5:50Speaker 2: use AD domains to put data in, you have to
- 5:53Speaker 2: use workspace's AD to create the workspace.
- 5:56Speaker 1: Right. You can't just type adworkspace.
- 5:57Speaker 2: You can't. It's a small syntax exception, but one that
- 6:00Speaker 2: trips people up at first.
- 6:01Speaker 1: Every system has its quirks. So data is loaded, we're
- 6:05Speaker 1: ready to actually collect some intelligence. Walk me through running
- 6:08Speaker 1: a module.
- 6:09Speaker 2: It's a simple workflow. Step one, pick your module. You
- 6:15Speaker 2: type use and then the module's name. Let's say we
- 6:18Speaker 2: pick one that searches whois records?
- 6:20Speaker 1: Okay, so use and the name.
- 6:22Speaker 2: Then step two, and this is probably the most important
- 6:24Speaker 2: step of all, You have to type show info show info.
- 6:27Speaker 1: Why is that the secret sauce?
- 6:29Speaker 2: Because that screen tells you everything the module needs to run.
- 6:33Speaker 2: It'll list any required settings. If you need an API key,
- 6:37Speaker 2: any parameters you have to set. If you skip this,
- 6:40Speaker 2: you'll just get errors, or even worse, you'll get in
- 6:42Speaker 2: complete results and not know it.
- 6:44Speaker 1: So the key isn't memorizing all ninety modules.
- 6:47Speaker 2: No, the key is knowing how to read that show
- 6:50Speaker 2: info page for the one you're using. Once you've checked
- 6:52Speaker 2: it and everything looks good, the final step is just.
- 6:55Speaker 1: Just run and it goes off and does its thing.
- 6:57Speaker 1: I can imagine though, after running a dozen of these,
- 7:00Speaker 1: staring at text output in a terminal gets a little tiring.
- 7:03Speaker 1: It can.
- 7:04Speaker 2: Yeah, looking at database dumps and a command line window
- 7:07Speaker 2: is not for everyone.
- 7:08Speaker 1: Is there any kind of visual relief?
- 7:11Speaker 2: There is? Actually, there's a really great convenience feature. You
- 7:14Speaker 2: can launch a web interface. It gives you a browser
- 7:17Speaker 2: based view of all your workspaces and what's in their databases.
- 7:21Speaker 1: Okay, how do we get that?
- 7:22Speaker 2: Going from the main recon directory, there's a script called
- 7:25Speaker 2: recon web.
- 7:25Speaker 1: You just run that and that starts up a server.
- 7:27Speaker 2: YEP, a little self hosted web server, usually on port
- 7:30Speaker 2: five thousand. You might need to use PIP to install
- 7:33Speaker 2: a couple of extra Python things for it to work,
- 7:35Speaker 2: but it's pretty straightforward.
- 7:36Speaker 1: And then I just opened my browser to what local
- 7:39Speaker 1: host point five zero zero.
- 7:40Speaker 2: That's it one two oh seven dot zero point one
- 7:42Speaker 2: point five zero zero. You'll get a clean little GUI.
- 7:45Speaker 2: You can click on your big project workspace and see
- 7:48Speaker 2: all the domains, contacts, everything right there in your browser.
- 7:51Speaker 1: It's a fantastic feature. It really closes the loop between
- 7:55Speaker 1: the deep technical work and just you know, visually checking
- 7:59Speaker 1: your data.
- 7:59Speaker 2: It really does. So if we zoom out, what we've
- 8:01Speaker 2: seen is that Recon isn't just a toolkit. It's a
- 8:04Speaker 2: whole environment built to solve the biggest problem in INTEL gathering,
- 8:08Speaker 2: which is organization.
- 8:10Speaker 1: Right, we set up the foundation Linux Python two and
- 8:13Speaker 1: then learn the hierarchy.
- 8:15Speaker 2: The hierarchy that guarantees data separation, the power of workspaces,
- 8:19Speaker 2: and then we walk through the core loop, manage data
- 8:22Speaker 2: in the tables, then execute with the modules, always remembering
- 8:25Speaker 2: to use show info.
- 8:26Speaker 1: And that whole architecture means you're always in control. The
- 8:30Speaker 1: data for company A will never ever leak into an
- 8:34Speaker 1: assessment for company B. It just it saves time and
- 8:37Speaker 1: maintains those professional lines absolutely.
- 8:38Speaker 2: And that brings us to our final thought for you
- 8:40Speaker 2: to chew on. So imagine you're using apikeys to run
- 8:44Speaker 2: some of these discovery modules, maybe searching business records or
- 8:47Speaker 2: social media. You have two separate projects AMB and two
- 8:50Speaker 2: separate workspaces. What steps would you have to take beyond
- 8:54Speaker 2: just keeping the file separate in those workspaces to make
- 8:57Speaker 2: sure your own network traffic doesn't reveal to those exits.
- 9:00Speaker 2: External APIs that both assessments are coming from the exact
- 9:03Speaker 2: same person.