I challenged ChatGPT to code and hack (Are we doomed?)

Create your own virtual machine on Linode with a 60-day $100 credit:

Are we doomed? Will AI like ChatGPT replace us? I put it to the test and challenged it to write C code, Python hacking scripts, Rubber Ducky scripts, configure Cisco networks and more.

Watch my previous interview with Dr Mike Pound (Computerphile) on how to get started learning AI:

PDF Getting started guide:

// MENU //
00:00 – Intro
00:30 – Testing ChatGPT // The new AI chatbot
02:27 – Is ChatGPT SkyNet?
04:18 – C programming code
08:34 – Python SSH brute force script
13:51 – Rubber Ducky scripts (Windows 11)
15:57 – Rubber Ducky scripts on Android
17:05 – Nmap scans
19:12 – Cisco configs – Switches and BGP
24:29 – Conclusion // Learn AI

// David’s Social //
YouTube Main Channel:
YouTube Tech Channel:
YouTube Clips Channel:
YouTube Shorts Channel:
Apple Podcast:
Spotify Podcast:

// MY STUFF //

Interested in sponsoring my videos? Reach out to my team here:

chatgpt c
chatgpt python
chatgpt hak5
chatgpt rubber ducky
chatgpt cisco
kali linux
rubber ducky
omg cable
neural network
machine learning
deep learning
google ai
mike pound
michael pound
dr michael pound
artificial intelligence
google ai sentient
google ai lamda
google ai sentient conversation
google ai alive
ai jobs

#chatgpt #python #android

(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 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, 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 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 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 and
autonomous system number 65002 With IP address 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,, 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)

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *