 Okay, again this video is part of a series. We're looking at using Netcat as a web server Which again is something that you would do in a pinch or for fun not for a productive server But hopefully I'm showing you some things that you may have not known about being able to use this so far I've shown you how to pass it files and command output and also how to embed images and sounds and videos as well Using the server using Netcat Well today, we're gonna take a little bit further. Let's say you have some sort of document that you want to To pass to it. So for example Let me go ahead up and this again part of a series If I didn't say that link in the description or at the end of this video for the full series Definitely watch previous videos or you might be a little lost I'm opening up LibreOffice and I am going to create a little document here. I'm gonna drag some images over I'm gonna put them in different places and I am going to type in hello world I am going to make that font rather large and I'm gonna use a special font. So there we go Let's say I want to set up server that displays this in a web page Can we do that? Well using the techniques we've used previously it would take a lot of work You'd have to you know, ramp the html code embed each image Blah blah blah. Well luckily if you're working in LibreOffice here, you can go file export We can go to the file our server is in and we're gonna call it index dot html and Make sure that we have html selected here. We're gonna click save and What that just did if we open up that file here is It creating html file with all the images embedded and also, let's go ahead and just go ahead and We're gonna cap that out to our our busy box. So Go back to our web browser here. So again, we're saying here This is a web server and that you connected successfully and they're going to pass it that file and if we come down here and refresh It did not work Let's try that again. I'm so silly. It did work. We just didn't look at the whole page. It's down here so If we were to look at the the the file here Vim index you can see that it passes it the dock type and Has all this information embedded in here. You can see the base 64. So it embedded all that we needed But let's look at our original document. Hello world up here images down here and Our website doesn't look like that. Why is that? well the problem here is HTML we're It's giving all the information, but it's just not displaying it right and if you had a very basic document that might work and But depending on how big I make my web browser and like display different So it kind of works, right? well Let's make it so it looks exactly the same every single time in all web browsers. How's that? Okay? So you might think What document format? Can do that and You might be right if you said something like PDF Or you're mostly right you're right up until the fact that it won't work in this case But we will make it work. So I'm gonna take the same office document. I'm going to say create a PDF I'm going to go to that folder. I'm gonna call it index to dot PDF save that and If I go here and here and let me just open up that PDF file XDG open our index to PDF. This is what the PDF looks like, but can we serve that up and You might think that we'd be able to do something like this Same thing as before But we're gonna say Cat index to and we'll refresh down here. Oh, it tries it sees that it's a PDF file But it doesn't load. I don't know why and there might be a way to get that to load properly But let's Convert that PDF to HTML. I might say but Chris We just tried creating an HTML file from that document and it did not work and you'd be right, but We're going to convert it using a different tool so There is a program that you can get should be in a repository is called PDF to HTML EX capital EX there And what that's going to do is it's going to generate an HTML file using I'm going to say this wrong It's latex latex, whatever, which is a Format for making documents to put it simply do not confuse this program do not confuse it with to HTML That will give you a horribly formatted that that's okay Maybe in some cases if you just want to grab some text out of an HTML file, but no that that's that's no good It's PDF to the number to HTML EX We're going to give it the index to file and by default if you don't give an output it's going to create an HTML file Called index to that HTML whatever this PDF was called same thing, but with HTML Now if we were to run our same command as before but instead of passing busy box the PDF file We pass it the HTML file We'll hit enter it'll come down here. We'll refresh this and lo and behold it looks just like our Original document it will format it perfectly You will have this gray area in the background because unlike a regular HTML document, which will change size Depending on what size your screen is what browser on all this different stuff this up. I'm gonna call it latex I don't know if that's how you say it. It's L a t e x latex latex I'm gonna latex The latex is going to make it like a PDF file to where it displays exactly the same in all browser And this is this I've used this for other uses in the past, but it will look the same on your cell phone Your desktop on your tablet it will always display the same It's not responsive. It's not gonna change size, but you will get a static thing and it's not just an image They are separate Well, some things might be images so so like your text here it embedded the font and then our images here It obviously merged them as one image because they were touching there So it's very smart and we'll look at how the page is displayed and decide what needs to be converted to an image What it needs to be converted to a separate image blah blah blah So if we go in here, we can actually look at this file Vim index to dot HTML dot HTML And we go to the very top you can see that already tells our server This is a doc HTML file doc type It gives you a link to the project here, and if we scroll through here, you can see that there's a lot of CSS in here There's Java script in here, and there's the HTML in here, and there's even the base 64 if we come up here There's base 64 they they've embedded the font that we used as an HTML which also, you know make sure Not that most people will get in trouble for this, but you know Fonts can be here and usually are copyrighted, so you may not be allowed to do this make sure you have the rights to use your fonts but everything all embedded in a single and it has all this Java script that looks at what type of browser Are you using and it changes how it works for different browsers? And I've never had a browser that I've used at least the current browser that Then it didn't display the same in all all Browsers so that is it and quickly So you can do that with any PDF file if you have an existing PDF file or any anything I mean on your system you can print to PDF from anything I can go to a web page, and I can say print to PDF Although sometimes printing the PDF from a web page doesn't make the web page look exactly like it originally does But if you have anything you can print a PDF, whatever it's gonna look like as a PDF you can convert it using PDF to HTML EX and then you can you can use that on any web server and Or in this case using our net cap and I might do other tutorials on things You can do with this program because it's really easy to make Documents take documents either a word document or a PDF Converge this and then using HTML 5 you can make the content editable editable editable not edible It's not edible. You can't eat it editable, and um or Sections of it editable edit. Yeah, why is that so hard to say editable? And then you can send people a link to your web server and they can fill out the document and print it up Not that that's the best way to do things you really want to submit forms But if they have forms that need to fill out and print That's a great way to do it rather than giving someone a word document that Might not look the same on their machine, or they might not have the office application that you use to open it anyway that is All for the series. I think I'm done with the series now. I hope you enjoyed it I hope that you liked it. I hope that you learned something again lots and lots of people have done You know examples on using netcats to to as a web server, but I Hope that I showed you how to use it in a way that works better with different versions of netcat or even endcat and Maybe took it steps further to where we actually were able to display real content Images and audio and formatted documents using a very lightweight simple Netcat server and again use a real HTTP server when you can Busy box has one built in and most likely if you're on a very lightweight system You have busy boxes built in but sometimes you'll open up a router or a modem or something and They have busy box, but stripped down They don't have the HTTP server and maybe you don't have time or the tools to copy over a full version or the space To copy a full version. Maybe though. Maybe I'm assuming if they remove the HTTP server that They prior remove netcat, but if it's there you can use it in a pinch I do. Thank you for watching. Please visit films by Chris calm That's Chris decay There's a link in the description as always hope that you have a great day Be sure visit my patreon page patreon.com forward slash metal x1000 link to that in the description as well I really I really do appreciate the support and I hope that you have a great day