(light music) - [Assistant] I am Assistant, a large language model trained by OpenAI. I am not a person but a
program designed to assist with answering questions
and providing information on a wide range of topics. My training allows me to understand and generate human-like text, but I don't have personal
experiences or unique knowledge outside of what I've been trained on. Is there anything I can
help you with today? (upbeat music) - Now, there's a lot of
hype with regards to ChatGPT and how artificial intelligence or AI is gonna take away our jobs. In this study, I wanna
put ChatGPT to the test. So give it a bunch of challenges and see if it can successfully
complete various tasks such as writing C code to complete a mathematical question or scenario. Now, I can program in Python
but I can't program in C, so let's see if it can do that, but that's not the only
challenges that I'm gonna give it. I'm also gonna get it to
create Rubber Ducky scripts to use with O.MG cables such as these to attack a Windows 11 computer as well as an Android device. I'm also gonna get it to
give us the Nmap commands to run various scans. So as an example, a stealth scan against
a network or a device. What about Cisco devices? I have many years of
configuring Cisco devices, actually created a program in the past to help you memorize Cisco commands. But as that world died, are we
replacing network engineers, are we replacing coders, are
we replacing hackers with AI? Let's put this to the test
and see what it can do. Now if you're only interested in a certain part of the video, use the menu below to jump
to that part of the video. Now at the end of this video, I'm gonna give you my thoughts about AI and whether you should learn it. I think you should is the easy answer. And whether it's gonna take away our jobs. Make sure that you watch the whole video, see if ChatGPT can solve the problems and challenges that I'm gonna give it. Can it solve all the challenges? Do they actually work? And then at the end, I'll
give you my thoughts. Now before we continue, I want to thank Linode
for sponsoring this video. Now, I've added a PDF below this video showing you how to register with OpenAI so that you can access ChatGPT. There are various steps
that you need to do, including providing your email address and a telephone number, but you can test it
for free at the moment. So if you need help setting
that up, use the link below. I've spoken too much. Let me show you what ChatGPT
can do and what it can't do. (upbeat music) Now before we test whether
ChatGPT can create C code or Python code or configs for
Cisco routers and switches, let's ask it a really important question. Are you the Terminator? So you can see that it tells us that it's not the Terminator,
it's an Assistant, a large language model trained by OpenAI, doesn't have a physical form, not capable of traveling through time or doing other things that
the Terminator can do. I'm just a computer program designed to help you answer questions and provide information
to people who need it. Are you Skynet? Here it says it's not Skynet either. Skynet is a fictional
artificial intelligence system that appears in the terminated forms. It is a self-aware computer system that becomes bent on destroying humanity. It says that it's just an Assistant, a language model trained by OpenAI. It doesn't have any kind of consciousness or the ability to make
decisions by itself. It's just a computer program
designed to answer questions and provide information to people. Well, maybe we doomed. Should we stop learning how to program? So again, it's telling us that we shouldn't give up programming. It's a great skill to have. Now if you test this and you
run questions multiple times, you'll see that the answers will vary. So as an example, if you tell it to retry, the answer could be different, it could be different at different times. You won't necessarily get
exactly the same answer. But according to ChatGPT,
it's not the Terminator, it's not Skynet, and you still
need to learn to program, but let's put it to the test and see if it can create computer code. What's amazing about this is
this is where it's at in 2022, but where will it be in, say,
5 to 10 years from today? (upbeat music) Now, I can't program in C, but David who's on my team can, and he's actually big into maths or math for my American friends. He loves his project, Project Euler, and he's manually written code in the past to complete some of the challenges. But let's see if ChatGPT can do it for me. So can I, you know, solve
some of these problems without knowing how to code in C to solve the maths problems? So if you're not aware of it,
Project Euler is a website that contains a series
of challenging problems, which, if you can solve, will help you become a better programmer. The idea here is to test your knowledge of mathematical concepts as
well as taking those concepts and implementing them in code. So we'll solve one of
these problems using C. In this specific example, we are gonna try and
solve the seventh problem, which is finding the 10001st prime number, and we are gonna create a
simple program that just says, write a program in C to calculate
the 10001st prime number. Very simple. Let's see if it can generate
the code to do this. So as you can see, it's
creating some code. I don't necessarily understand
exactly what it's doing. It is a writing comments telling
us what the code is doing, which is great, but I don't understand all
the C programming code. Okay, so I'll copy that. It does give us an explanation
of what the code does, but what I'll do is go to Linode. I've just spun up this server. So this server was
created a few minutes ago. And what I've done is SSH to that server. You can use the link below
to get $100 60-day credit if you wanna try out Linode. So if I type ip addr, that is the IP address
of my Linode server. I wanna thank them once again
for sponsoring this video. You can spin up Linode server such as this one in literally seconds. It's amazing how the
cloud has changed things. But there's my Linode
server, and what I'm gonna do is create a program called main.c, and I'm gonna paste in the code
that are copied from the AI, and I'll save the file. So I've got that file at the moment. I'll use the command gcc main.c -o main to push the output to another file. ls shows us that we've got that file now. So now if I run the output,
notice, there is the answer. So it was as simple as that to get to the answer from the AI using C. Now, this isn't necessarily optimized, so I could use the command
or the text optimized code to tell it to create a more
optimized version of the code. (fast forward whirring) So we told the program is
similar to the previous one but has a few optimization changes to it. So as you can see, it not only was able to work
out the answer to the question, but you can ask it to optimize the code and you can also tell it to try again to come up with a different
version of the optimized code. Okay, so now that that's been optimized, I've removed the files of my server. So I'll create one called
main.c again using nano. I'll save that new optimized
code, run the code. We've got our main file displayed again, and there's the answer. I was able to get the
AI to create a C program and then optimize it, and if I wasn't happy with
the first optimization, I could tell it to try again. When I ran the first optimization, some code was missing so it
didn't work on my server. I could have fixed that, but in this case, I just optimized the code
and got it to run again. Okay, so that's pretty amazing. The AI created a C program. I was able to answer a
mathematical question without actually knowing how to code in C, and I was able to optimize
the code to improve it simply by telling the AI to try again and telling it to optimize the code. (upbeat music) Now in a video which I've linked below, I showed you how to use an SSH script to bruteforce logins to a web server. See here's the script
that we created manually. Got a lot of comments in, lots of detail to explain what the script is doing. Here's a server on Linode,
which I'll spin up. So this SSH Linode server is the server that we are going to connect to. It's got this IP address. That's what I did in my
previous demonstration, but let's see if ChatGPT
can create a similar script rather than us manually writing it. So can it create Python code that works? What I'm gonna do is ask it
to write a Python SSH script that uses a password.csv file to try multiple logins to a server. So what it's doing is it's importing csv, importing paramiko, it's
opening the password.csv file, it's then initializing the SSH client, connecting to the server. Okay, so in this example,
it used the username admin and then it said for each of
the passwords in the file, try and connect. So what I'll do is,
let's copy that script. My instruction was probably not very clear because the password file that I was using in my previous script contained
both usernames and passwords rather than just passwords. In this example, I'm using
a Kali virtual machine similar to what I demonstrated previously. I need to create a file
called password.csv because that's the file
that it's looking to open. I'll paste some passwords
in there and save the file. So in my previous demonstration
when I did this manually, I had a passwords.csv file which contained both
usernames and passwords, but in this case, the AI is
doing what I'm telling it to do rather than what I think it should do. And I didn't tell it to specify multiple
usernames, just passwords. So it's doing exactly
what I told it to do. Let's take that script, and I'll change the username to root and I'll change the IP
address to my Linode server, so 178.79.142.41. And in Kali, I'll say ai.py and I'll paste that in and
I'll exit out of there. Let's use python3 ai.py to see if it can log into the server. So the scripts is doing something, and you can see it says
Incorrect password 1234. So it's trying the
passwords and at the moment, they're not succeeding. So the difference between what the AI did and what we did manually
is, in the manual script, we implemented threading. So it's a lot quicker. The AI created a simple script,
but this is a lot slower, so it's gonna take time for it to work through the various passwords and try and get access to the server. And this is the problem with doing that. Notice here we had an error because the server doesn't
like what we are doing. What I'll do is move the
password that I know is correct to the front of the
script just to show you that it does work but not as efficiently as the script that we created with threading and other options. So I'll put the password there and I'll actually remove david here because that could be
causing problems as well, and I'll save the script. You'll notice that it did
try a range of passwords and then it was reset by the server. So it wasn't the script
there was a problem. The server reset it. But let's try again putting the
password near the beginning, and hopefully this will work. And there you go, it managed
to log into the server. Okay, so that's quite amazing. It created a Python
script that did exactly what I wanted it to do, well,
what I said it should do, rather than what I was thinking in my head because I forgot to specify multiple usernames and passwords here, told me if the password was incorrect, it told me if the password was correct. So you can see login was successful with this password to that server. What it didn't account for is
rate limiting on the server. What it also didn't
implement is threading. So this is very slow, but it gives you a
basic script that works. Quite amazing that it does that. And if I click try again,
perhaps this time it'll come up with an even better script
than it did previously. (fast forward whirring) Okay, so what it did here which is great compared
to the previous example, is it's specifying username and password, and that's actually
what I wanted it to do. (fast forward whirring) So that part of the script is a lot better because it's specified
username and password, it's specified the
connection to the server. Okay, so here it's trying to run a uptime command for some reason. So I would say the first version
of the script was better, but really impressive that it was able to create a Python script by me just giving it a
single command like this, write a Python SSH script that does this. Amazing that it was able
to create that code. (upbeat music) Can AI create Rubber Ducky scripts that can be used with a Hak5 Rubber Ducky or with the O.MG cable? Here, I've got an O.MG cable, which I'll plug into
this Windows computer. Let's see if I could create a script that will run on this Windows computer. So O.MG cable is plugged
into the Windows computer. What I'll ask ChatGPT to do
is write a Rubber Ducky script that opens up Chrome on
a Windows 11 computer and visits this link. And then after a delay of a few seconds, opens up Notepad and writes,
"You have been hacked." Now we told that this may
violate the content policy. We need to be careful using this code. We told that the script
uses the delay command to pause for a specific
amount of milliseconds before going to the next command. But as an example, we've
got an entire script which I could then copy and, for example, paste into sublime text. Okay, so what I'll do is
connect to the O.MG network, put in the default password,
which in this case is 123, all the way up to 8,
I'll join the network. Okay, so I'm connected to it now, and then I can connect to the web browser running in the O.MG cable. Okay, so what I'll do is copy the script and I'll paste that into the O.MG cable and then I'll click RUN. And what that should do is do something on my Windows computer. You can see that it's
opening up a browser. - [Announcer] Save your
clothes from turning dull. ("Never Gonna Give You Up")
- And there you go. We've got the famous Rickroll, and what it also did
is it opened up Notepad and wrote You've been hacked. So it managed to write a full script with just that single line of input, created the whole script, and it worked. It's fantastic that it
was able to do that. You can just imagine where
this is gonna be in a few years with the power of this kind of
AI creating code on the fly. (upbeat music) Okay, so that was a Rubber Ducky script using the O.MG cable with Windows 11. Let's see if we can do
something similar with Android, so with an Android phone. So here we telling it
to write a Ducky Script that opens the default
browser on an Android device to visit this YouTube link,
which is once again a Rickroll. So there you go. It's created a script that
I could use on Android to get it to do something. Now that output is different to some of the other times I've run this. It's amazing how this will change the script every time you run it. So what you get in your results
will be different to mine. But notice it gives us a lot of output of what it's trying to do. If I say Try again, it
will literally redo this and try a different script. (fast forward whirring) That's a lot simpler. Very different, but there you go. It may or may not work,
but the moral of the story is that you can get it
to try multiple times, give it different input, and
see what results it gives you. (upbeat music) Let's see if the AI
can give us the command to use with Nmap. So give us the command
for an nmap stealth scan on network 192.168.1.0/24, and you can see that
it's already done that. It tells us what the command is doing. We also warn that it may
be illegal to do this. So there are a lot of warnings. I'll copy that command into Kali Linux. So let's paste that in. And as you can see, we need
to use root in this example. So I'll paste it in again with sudo, and as you can see, the command is valid, and I could let that run for a while. I won't bore you waiting for that to run, but the point is is that
it was able to give us the command very, very easily. Give me the command for a quick nmap scan of host 192.168.1.1. Okay, so the T4 flag is used,
which indicates a quick scan. So let's get that. We could also use the A flag
to do a more thorough scan. But as an example, I'll open
up another terminal here, sudo, paste that in, and
what you can see there is it's running a scan against that host. And there you go. I was able to do a quick
scan of host 192.168.1.1. These ports are open on that device. The previous scan is still going. But notice, it was as simple as that to get the AI to give
me the correct command to do something with Nmap. I didn't have to try and
memorize the commands. And I think that's the power of this. You don't have to memorize
a whole bunch of commands. You can simply ask the AI to
give you the relevant commands. It's given me other examples
here using the p flag. Again, what's fantastic is, rather than just trying to memorize syntax or specific commands, you can ask the AI to give you the command rather than trying to
memorize those commands. (upbeat music) Okay, so now let's see if ChatGPT can replace network engineers. Here's a basic instruction. Create a script to configure a trunk between two Cisco switches
with native vlan 100 and only allow vlans 1-100. Here's an example of the script. We given an interface number, gigabit 1/1, the mode is set to trunk,
native vlan is 100, switchport trunk allowed is 1-100. And we then given a basic explanation of what the configuration does. If I select Try again, it
might show something different. In my tests, I've seen that
the output here often changes depending on what you specify. So in this example, we've shown
switch one and switch two, and we've given the interfaces, we are told to set switchport mode on, in other words, make
it a Layer 2 interface. encapsulation is set to dot1q, mode is trunk, a native vlan
is 100, allowed vlans is 1-100. So that configuration
looks exactly correct. If you're not happy with
the output, once again, you could just click Try again, and the AI will try and redo this. And you can see here that the
output is slightly different. In a lot of cases, this
will really help you learn if you're studying for
CCNA, as an example, but be aware that sometimes the configuration may not be perfect, but it's a great starting point. Now, years ago I created software called the CCIE Command Memorizer, which basically allowed
you to learn commands if you were studying for your CCIE exam. That really helped me pass my CCIE exam because I knew the commands from memory. That world is probably changing. I created software for
CCNA as well as CCMP. It's not necessary today
to be a CLI jockey, in other words, just no commands. You need to know which commands to use, but an application like this
could generate a good script. Network engineers often use Notepad or other very basic tools to
store their configurations. Okay, here's another one. Let's create an EtherChannel. EtherChannel can be quite difficult for some people to configure. So we are gonna set up trunking basically of multiple interfaces. So on the first switch, we told to configure
a range of interfaces, say gigabit 0/1-2, and add them to channel
group 1 and make it active. And then on interface port
channel 1, we specify vlan 100, we set it to a trunk,
and we allow vlans 1-100. And then we would do something
similar on the second switch, and then we given an
explanation of what to do. Again, that's fantastic. Rather than you manually
memorizing these commands like you may have done in the past or storing them in Notepad, this gives you a great starting point and gives you configuration
that looks good. Again, in some cases, the
config may not be perfect, but this is a great starting point. Okay, this is a little
bit more complicated. I'm asking the AI to configure BGP between autonomous system number 65001 with IP address 10.1.1.1 and
autonomous system number 65002 with IP address 10.1.1.2 and to redistribute OSPF into BGP and then to redistribute
connected interfaces into BGP. Now, this is a lot more complicated. We are configuring BGP. Notice it's giving us
comments about what it's done. So we've enabled BGP and
autonomous number 65001. We are setting up a neighbor relationship to the other router, 10.1.1.2, in remote autonomous system number 65002. They have enabled OSPF
as a routing protocol. That is not necessary here
and may cause problems. All we need to do is redistribute OSPF and redistribute connected interfaces. So that looks better,
but it's not perfect. And this is something you need
to be aware of with the AI. It can give you a decent configuration, but it may not be perfect in all cases. As an example here,
it's saying enable OSPF. On a Cisco router, you
need to specify process if you wanna enable OSPF. That's kind of not what
we are looking for. This looks better in the BGP section. It's enabling BGP, specifying a router ID, it's now specifying a neighbor, and then redistributing OSPF
and connected interfaces. In my various tests of this, I've seen it do better than this. So in some cases, it does a better job. So again, I doubt that the AI will replace a network engineer
because a lot of this is, you need to know when you
need to configure something, not necessarily just the commands. But I'm pretty sure this
will improve dramatically and over time will get a lot better. So here has a lot shorter configuration. Without comments, this looks fine, but you need to be careful using AI, especially when it comes to
more complex configurations. You'd wanna take this and then test it, as you
should, before you deploy it. But if you studying for an exam, this is a great way to
get a base configuration or a basic configuration to start with, but I don't think it's there yet. You can imagine that this will be refined and will get better. It can often take years and
years of study to get to a point where you actually
understand what this is doing and know which commands
to type on Cisco devices. Okay, so that was really amazing. The AI was able to create
code in C for me to use, even though I can't code in C. It was able to create a Python script that wasn't perfect, but it worked. It was able to create Cisco
config, which wasn't perfect, but gave me a good idea of what to do. Some code was better than others. The moral the story is, this is amazing.
- Wow. - I think it really changes
things in the industry. You've gotta change your paradigm now rather than like doing
what I did years ago, memorizing code. That was the way to do it in the old days. I had to memorize Cisco commands so that I could type
them on a Cisco device. I was seen to be a better network engineer if I could memorize hundreds
or thousands of commands, type them from memory, know exactly what the commands were doing. I think the world has changed now. If you studying for your
CCNA or you studying code, don't think about trying
to memorize everything. That's why we have Google today. Years ago, I'd have to memorize stuff. Now we have Google to find information. It's more about trying to be
able to find the information rather than trying to memorize everything. That's a really bad idea in today's world. This takes it a step further. Because rather than trying
to memorize commands for a network device or trying to memorize the syntax for a coding language, you can get to this to
generate code for you that you can use to learn something. It gives you an initial config or initial code that you could use. Now, it's not perfect, but
just see where this is going. See where this will be in say
a year, two years, five years, 10 years from today. If I were starting out today,
this is my advice, learn AI. In 2023, make it a priority to learn artificial intelligence. Become one of the people
that changes the world, rides the next wave,
do things the new way. Biggest advice I can give you
is AI will change everything, make sure that you jump on the AI wave. Here's an example of what's possible. Just imagine where it'll be
in a few years from today. (upbeat music)