Niubi with Python hack wifi password


Python really is omnipotent, simply because there are a large number of Python libraries, countless ready-made wheels allow you to do many, many applications are very convenient. wifi with our lives, everywhere. Today, from the principle of WiFi connectivity, combined with the code to find out more of how to use python to crack WiFi. ,


 

01. How to connect wifi

First, our computer is how to connect wifi it? Take our laptops, our notebook computer has a wireless network card, as shown below:


 

When we connect WiFi, wireless card will automatically help us to scan the WiFi signal nearby, and will return some information WiFi signal, including the network's name (SSID), signal strength, encryption and authentication methods. When this information during our operations is invisible. When we want to specify WiFi connection, we need to be the role of certification, the certification is to protect access wifi, pay attention to password authentication is not our input here, but we enter the password is encrypted way.

That is, we enter the amount WiFi password, one way encrypted transmission. We commonly used method is WPA or WPA2PSK, mainly for personal or family networks, is not very high security requirements of the user. As shown below.


 

 

When we enter a password, you'll be prompted to tell us some information about hints, tips of this information is in fact designated certified encryption. We click "Yes", the fun you can get online.

02. analogue access using pywifi

pywifi This library is required in advance by a third-party pip install it, and then we use pywifi module to simulate this process. First, the computer determines whether the state is a WiFi connection, the code as shown in FIG.


 

The first is to create a pywifi of the object, and then assign the information to computer wireless network card ifaces. Then determines ifaces state (States) is connected to the computer to know the wireless network.

We mentioned above wireless card returns information of the wireless signal, then we take a look at the output we scan wireless signal in the vicinity and their information.


 

如上图左侧所示,我们输出了无线信号的名称和其对应的加密方式。二代码中的data其实就是一个个的配置文件。这里的配置文件我们可以理解为一个存储了我们连接的无线信号信息的文件,里面包含了无线信号的名称,密码,认证方式等等信息。

03.破解wifi密码

接下来,我们就要利用pywifi来进行破解WiFi密码的操作。我们仿照手动输入密码的过程,并进行验证,如果密码错误的话,我们就不停的更滑密码进行试验直到成功为止。部分的代码如下所示:


 

程序中,我们首先从console中读入我们想要破解额WiFi名称,然后从我们事先设置好的WiFi密码本中,不停的读入WiFi密码,然后配置profile的信息,包括WiFi的名称,认证方式和WiFi的密码。如果密码错误的话,就更换WiFi密码继续进行验证,直到验证正确为止。下图是实验的结果。


 

上述的破解方法也被称为暴力破解法,非常的消耗时间而且不一定正确。但是这是一个试凑的过程,万一成功了也说不准。

当然这种暴力破解需要有一个数据库样本,比如有数十万的破解密码的样本。这样通过充足的时间,可以用来尝试。本文只是从技术的角度来阐述如何利用python来玩WiFi,来学习Pywifi这个库!并不建议大家做任何破坏性的操作和任何不当的行为。

Guess you like

Origin www.cnblogs.com/7758520lzy/p/12173288.html