

Hackers generally are of three types:
Letโs discuss each component for this course:
Target Machine: The Machines which we will be trying to hack into.
We will be using 2 target machines for this course.

What we are utilising here to have these VMs is called Virtualization. Virtualization allows you to Run Guest OS on top of Hypervisor over Host OS. This is different from concept of Containerizartion, where we run apps over the Docker Engine, and all apps sharing a common Host OS. This is not the case with Virtualization.
Each machine has itโs own resources and fucntions like a real machine.
In this section, we will maily cover three topics:
Letโs try to understand a scenario where there are multiple, client systems, now these client systems actually wnat to have reach to the resources over the internet for which there needs to be a server. Letโs say for now this resource is internet in our case. So, the router will act as server for the clients to reach to the internet. You can also refer to this router as an access point
This router or server is the only device, that havse access to the resource or the internet, so none of these clients has direct access to the resource, even after connecting to the network.
Letโs say so all the client are connected to this router, and you search google.com. The Client will send a request to the access point searching for google.com. The router will take this request, and look for google.com over the internet.
It will recieve google.com from the internet, and will forward that response to our computer, and as a result we will see the website loading on our browser.

Why we need wireless adapter:
The Wireless Adapter must support:
The Brand of the Adapter doesnโt matter, but it should have either of the chipset:
To connect the Wireless Adapter to Kali, follow these steps:
Settings > USB.Start your Kali VM and check if the adapter is recognized using the command:
ifconfig
For mac, thie USB Controller is automatically enabled, so you donโt need to do anything. Just plug in the Wireless Adapter and it will be recognized by Kali.
Now, we run the python script to change the MAC address of the Wireless Adapter:
/root/PycharmProjects/hacking-tutorial/.venv/bin/python /root/PycharmProjects/hacking-tutorial/mac-address-change.py
Enter the interface name (e.g., eth0, wlan0): wlan0
Enter the new MAC address (format: xx:xx:xx:xx:xx:xx): 00:11:22:33:44:55
[+] Changing MAC address of wlan0 to 00:11:22:33:44:55
[+] MAC address changed successfully
New MAC address for wlan0 is 00:11:22:33:44:55
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 2312
ether 00:11:22:33:44:55 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[+] Verification complete for wlan0.
Process finished with exit code 0
As, you can see now the MAC address of the Wireless Adapter has been changed to 00:11:22:33:44:55.
So, we now know that a machine will only recieve the packets if the Destination MAC address of the packet matches with the MAC address of the machine. But, what if we want to capture all the packets that are being sent over the network, even if they are not meant for our machine? This is where Wireless Modes come into play.
Run the following command to check the current mode of your Wireless Adapter, and wireless interfaces only:
root@kali:~# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 unassociated ESSID:"" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency=2.412 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
We can see out Wireless adapter wlan0, which is set to Mode:Managed. This means that the Wireless Adapter is currently in Managed Mode, which is the default mode for most wireless adapters. In this mode, the adapter can only communicate with the access point it is connected to.
This also means this device will only capture packets that has the Destination MAC as MAC Address of this device. What we want is to be able to capture all the packets that are within our range, even if they are sent to the router, and even if there Destination MAC Address is set to other device. For this we need to change the mode of our Wireless Adapter to Monitor Mode.
To enable Monitor Mode on your Wireless Adapter, run the following command:
root@kali:~# ifconfig wlan0 down
root@kali:~# airmon-ng check kill
Killing these processes:
PID Name
3171 wpa_supplicant
root@kali:~# iwconfig wlan0 mode monitor
root@kali:~# ifconfig wlan0 up
root@kali:~# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11b ESSID:"" Nickname:"<WIFI@REALTEK>"
Mode:Monitor Frequency:2.412 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
ifconfig wlan0 down.airmon-ng check kill to kill any processes that might interfere with the Wireless Adapter.After that, we change the mode of the Wireless Adapter to Monitor Mode using:
iwconfig wlan0 mode monitor
ifconfig wlan0 up.iwconfig again, we can see that the mode of the Wireless Adapter has been changed to Monitor Mode.RSA (named after its inventors: Rivest, Shamir, and Adleman) is one of the most famous public-key cryptosystems in the world.
It is used for:
๐ Unlike symmetric encryption (same key for both sides), RSA uses two keys:
RSAโs strength comes from the fact that itโs easy to multiply big primes but hard to factor them back. Letโs see how the keys are built:
Choose two secret primes:
[
p, \ q
]
In the real world, these are HUGE (hundreds of digits long).
[
n = p \times q
]
This number ( n ) is part of both the public and private keys.
Compute Eulerโs totient:
[
\varphi(n) = (p-1)(q-1)
]
This is how many numbers less than ( n ) are โcoprimeโ with it.
Choose ( e ), such that:
[
gcd(e, \varphi(n)) = 1
]
In other words, ( e ) and ( \varphi(n) ) donโt share factors.
Popular choices: ( e = 3 ) or ( e = 65537 ) (fast and secure).
Compute the private exponent ( d ) by solving:
[
d \times e \equiv 1 \ (\text{mod } \varphi(n))
]
This means ( d ) is the modular inverse of ( e ).
Finding ( d ) is easy if you know ( \varphi(n) ), but impossible without factoring ( n )!
Encryption (lock it): [ C = M^e \ \text{mod } n ]
Decryption (unlock it): [ M = C^d \ \text{mod } n ]
Magic: thanks to modular arithmetic, this always works!
flowchart TD
A[๐ Start: RSA Key Generation] --> B[โจ Pick two large primes p & q]
B --> C[๐ฒ Compute modulus n = p * q]
C --> D[๐งโ๐ซ Compute Euler's totient ฯ of n = p-1 * q-1]
D --> E[๐ Choose public exponent e = 3 or 65537]
E --> F[๐ง Find private exponent d such that d * e โก 1 mod ฯ of n]
F --> G[๐ Keys Ready]
G --> H1[๐ Public Key: e , n]
G --> H2[๐ Private Key: d , n]
H1 --> I1[๐ค Encryption: C = M^e mod n]
H2 --> I2[๐ฅ Decryption: M = C^d mod n]
I1 --> J[๐ Message securely transmitted]
I2 --> J
โ ๏ธ Donโt try this at home with real secrets โ small numbers are too easy to crack. This is just a classroom demo.
Pick primes:
( p = 5, q = 11 )
Compute modulus:
( n = 5 \times 11 = 55 )
Compute totient:
( \varphi(55) = (5-1)(11-1) = 4 \times 10 = 40 )
Choose ( e = 3 ) (coprime with 40).
Find ( d ): solve ( 3 \times d \equiv 1 \ (\text{mod } 40) ).
โจ ( d = 27 ) works because ( 3 \times 27 = 81 \equiv 1 \ (\text{mod } 40) ).
Keys:
Letโs Encrypt a Message!
Say our message is ( M = 9 ).
Encrypt:
[
C = 9^3 \ \text{mod } 55 = 729 \ \text{mod } 55 = 14
]
๐ Ciphertext = 14
Decrypt:
[
M = 14^{27} \ \text{mod } 55 = 9
]
โ
Original message recovered!
RSA is strong in theory, but weak in practice if misused: