 Hey everyone, welcome back to some more Python programming videos and tutorials. We've been looking at the PX SSH module We've been using that to kind of connect to servers send different commands all through SSH and that's been pretty cool So I want to show you a little bit more that you can do with this library And then with this with this object here that we've created with it So there are another option that I there is another option that I kind of want to show off to you or another attribute and property part of the object and Of course, there is some kind of a cool interaction interactive thing that pretty much puts you at an SSH terminal Which would probably be pretty convenient if that's what you want to have So I'll go ahead and log in for us and that works just fine What I want to show you guys is an interesting thing called SSH ops So s dot SSH underscore ops for SSH options and you'll notice that okay There are certain options that you're passing to the SSH program that you actually run when you run SSH So there's talking about RSA authentication and the public key authentication Now both of these are set to no Now it's interesting because if you actually try an SSH to something From your command line from your actual shell like if I wanted to connect to you bandit zero at bandit Dot labs dot, you know over the wire or the same thing that we've been doing there out this entire video series If I connect to it, okay, it allows me to connect just fine But if you were a server that I had never connected to before SSH is gonna kind of perk its ears up and say, oh hang on this server has an RSA RSA key. Is it a public key that we know? Have we seen it before? Can we trust this host? Can we trust this server? So it'll ask you that and Here I'll show you how it works behind the scenes. I'll actually show you Krypton one Because I know I haven't connected this before Krypton At labs over the wire now it'll ask me hey Authenticity can't be established here's kind of an RSA fingerprint or at least a key Do you want to continue connecting and I'll say no so That's what SSH does if you connect to a server that you haven't seen before that's what SSH normally does You can supply these arguments and these options and say We don't really have to worry about the authentication about the key or any of that stuff. So if I try to do that from PX SSH, I tried to go to Krypton Krypton one and I just happen to know the password is Krypton is great and all capital letters I run this. Oh, yeah, I got a reset pit. Sorry Now if I run this, okay, cool, we log in just fine But it didn't ask me Was my RSA was my was this key valid? Do I trust this? So I want to bring this to your attention because PX SSH with those options that it has SSH ops By default it'll put that server that you don't know yet in your SSH known hosts thing So if I go back to this here Okay, it's gonna ask me this question again Because it hasn't been stored in my known hosts. Okay, I guess I'm jumping to conclusions here PX SSH and Python the module won't store it in your known hosts It'll just go ahead and connect to it without any authentication and verifying. Do you want to do this? If you say yes, then it adds it to the list of known hosts From the shell from normal SSH execution So that's the difference that I wanted to show you and just kind of bring to your attention this SSH ops variable By default it doesn't worry about authentication But you can change this variable and you can probably even add more options to it and then just Connect to your server afterwards Okay, so that's enough talk about the SSI ops or options That was really all that I wanted to show you and hopefully you guys understand that It won't store the authentication key with PX SSH It'll ask you if you want to do it with normal SSH execution without those Options specified, but you can of course change those in PX SSH Okay, now the other function that I want to show off was interact Now in idle This is gonna freak out That's what it will tell you that okay It's an inappropriate input and output controller for this device because it's not obviously a terminal You can echo in and out of in idle, but what that function would do I'll show you It gives control of the child process to the interactive user or the human at the keyboard you yourself Keystrokes are sent to the child process and the centered output and centered error the program are printed This pretty much just echoes the child's standard output and set it up with the real output and does the same thing To a standard input and output There might be a little bit more of that and I know that description was cut off So you can look at it in the help file So you've got different escape characters that you can allow Filters you can set up Why that original and default escape character is set so you can modify it to whatever you need to And I wanted to show you that okay in idle it doesn't work But in Python the shell inside of a console or a terminal obviously will because that's pretty much what it is Secure shell running inside a shell. So if I import PXSNH If I set it all up and stop log in throw in our server name get us Logged in pretty okay Hopefully return true Be able to connect with it a problem now if I run interact Echo hello And now you see a little bit more of the behind-the-scenes as to how PXSNH SSH sorry actually works you can see our prompt that we would normally see and Anything that we else anything else that we do here like LS the command output is going to be given and Input is passed in like everything else, but it's pretty much just an SSH shell and You can just type in the commands here, but of course you're not automating things in this way You're at the interactive shell So it pretty much just works like SSH would if you were to run it from the command line kind of takes away from what you would have wanted with Doing it in Python, but I wanted to show you that you did have that functionality So thank you guys for watching. I think that's all I wanted to demonstrate in this video I hope it was pretty okay for you. I hope you liked it and Hope you were able to tolerate how bad I am and all this stuff Thanks again guys. I'll see you in the next tutorial