- Now, before we get started,
I need to warn you that what I'm gonna show you,
how to compile in this video
is code such as this Python Keylogger
and the script that extracts wifi password
stored on a windows device.
Very important warning,
do not just download software from the internet
and run it because it could be code such as this.
I'm hoping that this video is a warning
that you can use for yourself,
but also for your parents and grandparents perhaps,
to show them that they should never just download files
from the internet.
Especially executable files
or code that's not signed by a trusted developer.
You don't just wanna download code from the internet
because you don't know what that code is going to do.
In this video I'm showing you,
a very simple Python Keylogger,
windows will block this code on a computer
if you try and run it directly as a Python Script.
So the antivirus on Windows 10, Windows 11 as an example,
will block this code.
But once I've compiled it,
Windows doesn't recognize the problem
and it allows me to run this code without any problems,
that's in my tests.
Hopefully Microsoft will update the antivirus
to block software such as this.
But for the moment in my tests,
I was able to run this compiled code
on a Windows 11 computer that was fully up to date
and had antivirus enabled.
Another warning,
this video is for educational purposes only.
Don't use this code for malicious purposes,
don't go out there and break the law and get into trouble.
This is to show you the risks of code that's been compiled,
because malicious code could easily be compiled
as an executable.
Again, my simple Python scripts are gonna be compiled
to run on a Windows 11 computer,
and they run without a problem in my tests.
(static music)
Now, if you enjoy these types of ethical hacking videos,
please consider subscribing to my YouTube channel.
Please like this video
and click on the bell to get notifications.
That really does help me with the YouTube robots
and also means that you don't miss
any of the content that our upload.
This windows laptop does not have Python installed.
I'm remotely controlling this windows 11 computer
from my Mac, but what I'm demonstrating now,
is happening on the Windows 11, a laptop.
So if I open up a Command Prompt and type Python.
What you'll notice as we take into the Windows Store
and we asked to get Python.
Python is not installed on this Windows computer.
What I also want you to see,
is that antivirus is enabled on this computer.
So I haven't disabled a real-time protection.
I haven't disabled any of the antivirus settings
on this Windows computer.
So that's fully enabled.
I've also got this computer fully updated.
So if I check for updates on the Windows computer,
you'll see that it's fully up to date.
So updated at 3:36 according to this time.
And the version of windows that I'm running
is Windows 11 Version 21H2.
So latest release at the time of this recording.
Now, with all of that being said,
notice what happens when I run my key logging application,
this is the compiled version of my Python code.
In this directory, Python exe I only have two files.
But when I double click on that file,
a Command Prompt Window displays.
This is a very basic keylogger.
But I could print something out to the screen
to tell the person for instance, that windows is updating
please continue with your normal tasks
and leave this Window open
or do something for example, to hide the window
so that it doesn't appear.
But what I want you to see here is a key logs file
has been created.
So if I go to a website,
let's say facebook.com
or another website.
Whatever I type in here, test@test.com
and let's set the password to password.
Whatever I type there is stored in that key logging file.
So notice Facebook and I made a typo.
So backspace, backspace .com.
I press Enter.
Made some more mistakes, so backspace backspace,
here's my username test@test.com,
press Tab, made a few more mistakes.
And then I put in my password,
which is password in this example.
So whatever I type,
and let me open up notepad for this demonstration.
Whatever I type here, is stored
in that key logging application.
So MYSECUREPASSWORD for example.
So scrolling down through that log,
you can see that I opened up notepad
and then I put in my password
and my very secure password is MYSECUREPASSWORD.
That is an example,
of why you should never just download software
and run it on your computer.
Again, this windows computer is up to date.
Antivirus is enabled.
I haven't disabled any antivirus options within Windows.
The software still runs
and I'm able to log all the keystrokes on this computer.
That's because the Python script has been compiled
and is running as compiled code on this computer.
What I'll do now, is open up a cmd Prompt
and let's run the second application windows11-wifi.
Press Enter, and that shows me,
all the password stored on this window's computer.
Now, both of these scripts are very simple.
This is a very basic Python Keylogger.
The WiFi Extract application is actually quite short.
This looks long because it has a whole bunch of comments in
to try and help you understand what's happening.
But basically all it's doing
is extracting stored wifi passwords
on this windows computer.
So there's a reason why when you try and download files
from the internet,
that windows tries and stops you doing that.
There's a very good reason
why you shouldn't just download stuff off the internet.
In this case, I manually copied the file
to the Windows computer
using a flash drive or thumb drive such as this.
And I was able to run it without any problems.
Browser such as Chrome or Edge,
will try and stop you downloading files such as these
from the internet.
Now, in this example, I'm using nuitka
to do the compiling of the Python code,
forgive my bad pronunciation.
But what I've done to try and make this easier for you
is I've created a PDF document, which I've linked below,
which shows you all the steps to install the software.
So firstly, we have to go to nuitka.net as an example,
we need to download the software.
But to show you the full process of this,
I'm running Windows 11
within a virtual machine on my Mac here,
it's a brand new installation of Windows 11.
The only thing I've installed is Brave
because I don't wanna use Edges on my browser,
I haven't installed anything else on this Windows computer.
Again, this is running as a virtual machine
on my Mac brand new installation.
Now, before you installed nuitka,
you need a specific version of Python.
Nuitka only supports Python up to 3.9
at the time of this recording.
So on the downloads page, on the Nuitka Website,
we can download an MSI file for Python 3.9.
So I'll download that software.
But before I can actually run that software,
I need Python installed.
This is a brand new version of windows.
So Python is not installed.
So if I go to the python.org website and go to downloads,
I can select the version of Python that I want.
In my example, I'm gonna download 3.9.9.
So I'll scroll down to the end of this page
and I'll get to the installer for Windows 64.
But in this example, once again, I'm using,
(keyboarding clanking)
Windows 11 within a virtual machine.
I downloaded the ISO from Microsoft's website
and set up the virtual machine.
So I'll install Python.
Now, if you've got Python installed already,
go to this timestamp
to look at the nuitka installation directly,
rather than Python.
But I'll install Python here.
And it's very simple installation
and then all install the nuitka software.
Okay, so I'll disable path length limit
in Python and click Close.
And now I can run the nuitka installation software.
Now, notice we get to this warning in windows.
As I was saying earlier,
you don't just wanna install any software on your computer.
So if you install anything like this,
you install it at your own risk.
So Windows has protected your PC we told,
because this is an unrecognized app.
I'm gonna click More info
and I'm gonna run the installation anyway,
and then I'm gonna install it for all users.
Click Next,
say Yes to allow the software to be installed.
Okay, software's installed so I can click Finish.
And there we go, we've got the software installed.
Now again, in the link PDF,
I gave you all of those instructions.
So I've shown you,
in the video now how to do this installation.
But if you prefer following the PDF you can download that.
Once we've installed it, we need to check the version.
So in PowerShell,
(mouse clicking)
I'm gonna type nuitka version
and we can see the version is 3.9.9.
And the next step now is to get code to compile.
You use all the code on my GitHub at your own risk.
Again, do not use this for malicious purposes.
The code is for educational purposes only.
So don't use this for something malicious.
But as an example, if I go to github.com/davidbombal.
And in this example, I'll go to red-python-scripts
and I'm gonna download for instance,
this windows-10-wifi script.
I'll click Raw,
and I'll click Save as.
That's a Python files, so I'm gonna click save to save it.
So in my downloads directory, I have that Python script.
I can open up PowerShell in this directory once again,
Ls shows me my Python script.
And what I can do now is type Python -m
nuitka--mingw64
(keyboard clanking)
name of script, which is windows-10-wifi.py.
We're gonna make this a standalone
(keyboard clanking)
and we're gonna make it one file.
Now again, in the documentation, I show you all those steps.
So standalone,
and one file makes it basically an executable file
that's independent of the Python installation.
So you don't need Python to run the script.
This MinGW64 allows you to download the C Compiler
and also download a C caching tool.
We're gonna say yes to both of those options.
So when I press enter now, the software will be compiled.
Now, it may take it a while,
you just need to wait for the prompts,
and say yes to both options.
So if I say yes,
that software is downloaded.
I'll just move this up a bit,
we've got to say yes once again.
And then you go, if I type dir,
you can see the executable file has been created.
So there's the file 25 ming, I'll open up a cmd prompt,
and type windows-10-wifi exe.
There are no wifi networks on this device
because it's a virtual machine.
So what I'll do is copy the file
from this computer to my Windows 11 computer.
So I'll connect to the memory script to my virtual machine.
I'll copy that,
and put it into this directory.
(mouse clicking)
Okay, I'll inject the software.
So I can take it out of the Mac.
And in this example, I'll put it into my Windows computer.
So back on my Dell, I'll go to my USB Drive.
(mouse clicking)
Go to the relevant directory I'll copy that,
(mouse clicking)
to my downloads directory.
Open up a cmd prompt dir, windows-10-wifi exe.
And there you go, it run the script.
So I've shown you now how to compile a Python Script
on one Windows computer,
and then move it to another one and test it.
So in this case, I tested it on a physical Windows computer.
Now, one thing to be aware of,
is that if you use this script, the Python Keylogger script,
you need to install additional software.
So make sure that you use pip install pynput,
before you compile your script.
So back on my virtual machine,
I need to type pip install pynput,
before I compile the key logging script.
So back on my GitHub page,
(mouse clicks)
under Repositories,
I've got this Python Keylogger script
I'll put the link below.
I'll copy that,
(mouse clicking)
I'll save that as a Python Script.
Notice the problem here,
Windows Security finds this as a threat.
So if you're gonna compile this code,
and this is the problem with any type of hacking top code,
windows is gonna try and block it.
But you saw that the compiled code wasn't blocked
on the Windows 11 laptop.
But under virus and threat protection,
you're gonna need to disable real-time protection.
Otherwise you won't be able to compile the script.
So dir, under downloads, my key logging software is there.
What I can do now,
(keyboard clanking)
is compile that key logging software.
I'll make this a bit bigger.
So Python, nuitka, key logging software standalone one file
and it compiles that software.
Just make sure that you install any of the modules
that are required to make the software run
before you compile it.
Okay, so that was a really long video
hopefully you enjoyed it, hopefully I showed you,
number one, the problem with downloading files
from the internet.
You shouldn't just download any software from the internet
because you don't know if it could be bad code
or hacking code such as I demonstrated here.
You also should make sure that you enable your antivirus.
If you have a real-time protection on,
it blocks a lot of the malicious code.
In this case, I was able to circumvent this.
Hopefully, Microsoft will update the antivirus
to block this type of thing.
When you try and download files from the internet,
your browser will also warn you about downloading software.
Make sure that both you and your family,
for instance, your parents or grandparents,
are aware about the issues of downloading software
from the internet.
You don't just wanna download anything
because it could be malicious code, could be hacking code.
But lastly, notice,
that key logging software has been compiled
and I could run that on my Windows computer.
(static music)