 Okay, again, this is part of a series on using Ncat, Netcat, NC, different programs, or trying to get them so they can run as web servers. Again, in a real-life situation, you really should use a real web server, even a very lightweight one, like the one that's built into Busybox, which we're going to be using Ncat or NC from Busybox today, since that's the lightest weight of the three that I'm talking about here and the one that you're most likely to have on a lightweight system. But yeah, run a real web server, either Apache, Busybox, or even the built-in web server that's built into Python, if you can, before you use this. This is more for learning, understanding, having fun, or in some cases, you might be in a pinch where this is the only tool you have, or you might have something similar so you're going to understand a little bit more on how things work when you're passing data through HTML, because it is all just plain text. So let's go ahead and get started here. So last time, let me remove this index file, because we're going to create this index file right now, I showed you how to pass just a string of text, in this case, with some HTML tags to Ncat, so I'm going to go ahead and hit enter there, I can refresh down here, and you can see it outputted, we got the output down here in our web browser by going to the IP address, or in this case, since it's the same machine, localhost colon 8000. So let's go ahead, and what we're going to do today is the same thing, we're going to start off with the same thing, but put it into a file. So I'm going to vimindex.html, and in here I'm just going to put some paragraph tags, and I'm going to say, hello from my server, we'll save that. And here, we're going to run the same command, but instead of echoing out this information, what I'm going to do is I'm just going to cat out our index file. And again, we're here, we're saying echo, we're saying HTTP, this is saying that this is a web server, 200 okay is saying that you've successfully connected, and then we have a few new line characters here before we output our HTML. Normally in a, whoops, normally in a web server, the web server outputs that for you, but since we're using Netcat, which isn't really a web server, an HTTP server, we're having to manually do that. So let's go ahead and pass that information, we'll refresh down here, and you can see it says hello from my web server. We'll go ahead and kill that server, and we're going to go ahead and now that we have that, let's go ahead and do a little more complex of a web server. Let's delete that, I'm going to put in some basic HTML, I'm going to put a title of my server, and we'll go ahead and run that server again, and when we refresh down here, you can see I have a nice looking HTML page, you know, with a nice looking list and hover over these, they highlight a little bit, but really I cheated here. Let me show you what I mean by that. We go back into our index file here, you can see I've linked to external resources that aren't on our server, because Netcat can only pass at the information within that one command, so it can't pass it without getting really complex and adding some very complex scripts, it can't pass separate files. So I'm linking to stuff that's out on the internet, as long as the user who's connecting to the web browser is also connected to the internet, you can do this. But if you're on a closed network that doesn't have internet access, this page will not display properly because it's not accessing this Bootstrap.js or this Bootstrap.css or this jQuery mini, just be aware of that. Now you can obviously, with CSS and JavaScript, copy all that code directly into the one file and it will work great. But well, I'm going to, I'm getting into next week, so the next videos, but you can get into issues when you want to pass it, things like photos, videos and sound, but we will make it do that in future weeks. Anyway, so we can pass it files, it doesn't matter whether we call that HTML or index or whatever, because it doesn't matter here if let's run that same command right here, so we're passing it this file, but our web server really isn't asking or client isn't really asking for anything. I'm pretty sure if I hit enter here, it passes it the same file. Let me refresh this so you can see when I reload the same thing, it's hard to see anything is happening. But yeah, there you go, you see it loaded up, because since we're not really running a web server, Netcat doesn't care that we passed all this other stuff after the port number. So be aware of that, we're only passing it the output of this command. So if your HTML file asks for any other files on the server, it's not going to get passed to it. Let's move on and show that we can pass it the output of commands, clear the screen and we're going to pass it basically the same command as before, but this time instead of passing it the cat, we're going to pass it LS and we're going to list the files. I think if I just do LS, it should just pass it the current files in the current directory and I'm going to pass that into and I'm going to show you with busy box and see dash L dash P 8000 again, we'll go ahead and hit enter. And if I refresh down here, you can see that it gave us a list of files. Now, as far as our web browser is concerned, we sent it a plain text file. So let me show you a little more in depth here. If we were to take that same command, but we were to do, I'm going to copy and paste because this is a long command. I do have my notes over here to the side. So the same echo command starts off the same, then we're going to pass it this document type of HTML and that's important. I'll show you why in a moment. We're saying this is an HTML file. Then I'm going to pass it this UL for a list in HTML. And then I'm going to say for I in say everything in this directory and we're going to echo out each one as a list item. Let's actually run that command without having it piped to busy box. So if I do this, our output is some basic HTML. This is what we're outputting. And so people get confused when I say this. Any programming language that can output to a shell, which is pretty much any programming language can generate HTML output for a GUI interface. So here we go. We have that output. Let's run that again. But this time we're going to pass it into busy boxes and cat. And now when I run it, you can see that it actually gave, oh, and I did it for my root directory, which is fine. But it actually put it in like a list format, but you can do any type of HTML this way. The important part of this is this doc type. So let me go ahead and remove that and hit enter and restart this. And you'll notice that now it's actually displaying the HTML code down here because without that doc type, the browser thinks that I'm passing it a plain text file. It's also important to note that when we do the doc type file, I used single quotations here or you can backslash out the special characters. Because if we were to put double quotes, the exclamation mark means something else in this case in bash. So it's important that you have that there. If we run this again, it outputs our HTML. And again, you can put, you can design HTML around this to where you can have, you can pass it, you can have a shell script that generates some more complex HTML pages. So that is creating a web page based on command output. So again, let's quickly review. We could just say LS and we'll refresh this. It gives us the output of that. I could also do, what's another command that I can run? I could do, I wasn't playing under this, any command, any command, think of any command. I could probably do a command that outputs something, how about this if config? There we go, should work. I should be able to refresh this and we get my network information here, my local network information. So yeah, any command output, but then if you wanted to be formatted a certain way, you're going to want to pass in those HTML tags, which is very simple, since it's all plain text, which is what we're going to get into on our next video. Our next video, we're going to talk about embedding images. Because again, NCAT or netcat can't output multiple files unless they're within that command you're passing it. So if you pass the HTML and the HTML is asking for an image on this server that you're running, NCAT's going to go, oh, let me get that image for you. No, you need to specifically tell it this image. So that's what we're going to go over in the next video. We're going to go over displaying images and other types of media. So again, this is part of a series. There'll be a link at the end of this video, as well as in the description of this video, linking to the full playlist. I sure hope you check them all out. Also check out filmsbychrist.com. That's Chris at the K. There should be a link in the description of there. And also my Patreon page, sorry, patreon.com. forward slash mail x1000. There you can help support my site in these videos for as little as a dollar a month. Or you can also go to my website again, link in the description, filmsbychrist.com. And click on support. And there you can also support through PayPal if you'd like. I do appreciate your support. I appreciate you watching. As always, I hope that you have a great day.