您的位置:首页 > 大数据 > 人工智能

Aircrack-ng之aircrack-ng命令(上)

2015-08-29 23:01 447 查看

描述

Aircrack-ng是一个802.11的WEP和WPA/WPA2-PSK破解程序。一旦使用airodump-ng捕捉了足够的加密数据包以后,Aircrack-ng可以用来破解WEP密钥。aircrack-ng破解WEP密钥有两种方式。

第一种是PTW(Pyshkin,Tews,Weinmann),这也是破解WEP默认的方法,它由两个阶段组成。第一个阶段,aircrack-ng只使用ARP包,如果找不到密钥,再尝试捕捉到的其他数据包。需要知道,并不是所有的数据包都可以用来进行PTW破解,这篇PTW破解方法支持的数据包给出了更加详细的说明。一个很大的限制是,目前PTW方法只能破解40位和104位的WEP密钥。而另一方面,PTW方法的优点是,它只需很少的数据包就可以破解WEP密钥了。

第二种方法是FMS/KoreK方法,这种方法包含了很多统计攻击方式用来破解WEP密钥,并且结合了暴力破解方式。此外,aircrack-ng也提供了一种词典比对的方法来破解WEP密钥。

而对于WPA/WPA2共享密钥,只有词典比对这一种方法。SEE2则可以极大地加速这个漫长的比对过程。破解WPA/WPA2时,需要一个四次握手包作为输入。对于WPA来说,需要4个包才能完成一次完整的握手,然而aircrack-ng只需要其中的两个就能够开始工作了。

屏幕截图



用法

aircrack-ng [options] <capture file(s)>


我们可以指定多个输入文件(可以是.cap或.ivs格式),也可以使用通配符。可以参见这里查看更多例子。而且,我们也可以同时运行airodump-ng和aircrack-ng,因为当捕捉到新的IVs时,aircrack-ng会自动更新。

参数表

OptionParam.Description
-aamodeForce attack mode (1 = static WEP, 2 = WPA/WPA2-PSK).
-bbssidLong version - -bssid. Select the target network based on the access point’s MAC address.
-eessidIf set, all IVs from networks with the same ESSID will be used. This option is also required for WPA/WPA2-PSK cracking if the ESSID is not broadcasted (hidden).
-pnbcpuOn SMP systems: # of CPU to use. This option is invalid on non-SMP systems.
-qnoneEnable quiet mode (no status output until the key is found, or not).
-cnone(WEP cracking) Restrict the search space to alpha-numeric characters only (0x20 - 0x7F).
-tnone(WEP cracking) Restrict the search space to binary coded decimal hex characters.
-hnone(WEP cracking) Restrict the search space to numeric characters (0x30-0x39) These keys are used by default in most Fritz!BOXes.
-dstart(WEP cracking) Long version –debug. Set the beginning of the WEP key (in hex), for debugging purposes.
-mmaddr(WEP cracking) MAC address to filter WEP data packets. Alternatively, specify -m ff:ff:ff:ff:ff:ff to use all and every IVs, regardless of the network.
-Mnumber(WEP cracking) Sets the maximum number of ivs to use.
-nnbits(WEP cracking) Specify the length of the key: 64 for 40-bit WEP, 128 for 104-bit WEP, etc. The default value is 128.
-iindex(WEP cracking) Only keep the IVs that have this key index (1 to 4). The default behaviour is to ignore the key index.
-ffudge(WEP cracking) By default, this parameter is set to 2 for 104-bit WEP and to 5 for 40-bit WEP. Specify a higher value to increase the bruteforce level: cracking will take more time, but with a higher likelyhood of success.
-HnoneLong version - -help. Output help information.
-lfile name(Lowercase L, ell) logs the key to the file specified.
-KnoneInvokes the Korek WEP cracking method. (Default in v0.x)
-kkorek(WEP cracking) There are 17 korek statistical attacks. Sometimes one attack creates a huge false positive that prevents the key from being found, even with lots of IVs. Try -k 1, -k 2, … -k 17 to disable each attack selectively.
-pthreadsAllow the number of threads for cracking even if you have a non-SMP computer.
-rdatabaseUtilizes a database generated by airolib-ng as input to determine the WPA key. Outputs an error message if aircrack-ng has not been compiled with sqlite support.
-x/-x0none(WEP cracking) Disable last keybytes brutforce.
-x1none(WEP cracking) Enable last keybyte bruteforcing (default).
-x2none(WEP cracking) Enable last two keybytes bruteforcing.
-Xnone(WEP cracking) Disable bruteforce multithreading (SMP only).
-ynone(WEP cracking) Experimental single bruteforce attack which should only be used when the standard attack mode fails with more than one million IVs
-unoneLong form - -cpu-detect. Provide information on the number of CPUs and MMX support. Example responses to “aircrack-ng - -cpu-detect” are “Nb CPU detected: 2” or “Nb CPU detected: 1 (MMX available)”.
-wwords(WPA cracking) Path to a wordlist or “-” without the quotes for standard in (stdin).
-znoneInvokes the PTW WEP cracking method. (Default in v1.x)
-PnoneLong version - -ptw-debug. Invokes the PTW debug mode.
-CMACsLong version - -combine. Merge the given APs to a virtual one.
-DnoneLong version - -wep-decloak. Run in WEP decloak mode.
-VnoneLong version - -visual-inspection. Run in visual inspection mode.
-1noneLong version - -oneshot. Run in oneshot mode.
-SnoneWPA cracking speed test.
-snoneShow the key in ASCII while cracking
-Efile>(WPA cracking) Create EWSA Project file v3
-Jfile(WPA cracking) Create Hashcat Capture file

用法范例

WEP

最简单的情形是破解一个WEP密钥。如果想要自己尝试一下,这里是一个测试文件。测试文件的密钥跟上截图相同,但是跟下面的例子没有关系。

简单破解

输入命令:

aircrack-ng 128bit.ivs


其中:128bit.ivs是含有IVs的文件名。屏幕会显示:

Opening 128bit.ivs
Read 684002 packets.

#  BSSID              ESSID                     Encryption

1  00:14:6C:04:57:9B                            WEP (684002 IVs)

Choosing first network as target.


如果文件中信息包含有不止一个网络,那么我们就要选择破解哪一个网络。默认情况下,aircrack-ng认为加密为128bit。然后破解开始,一旦破解成功,会出现以下信息提示:

Aircrack-ng 0.7 r130

[00:00:10] Tested 77 keys (got 684002 IVs)

KB    depth   byte(vote)
0    0/  1   AE( 199) 29(  27) 2D(  13) 7C(  12) FE(  12) FF(   6) 39(   5) 2C(   3) 00(   0) 08(   0)
1    0/  3   66(  41) F1(  33) 4C(  23) 00(  19) 9F(  19) C7(  18) 64(   9) 7A(   9) 7B(   9) F6(   9)
2    0/  2   5C(  89) 52(  60) E3(  22) 10(  20) F3(  18) 8B(  15) 8E(  15) 14(  13) D2(  11) 47(  10)
3    0/  1   FD( 375) 81(  40) 1D(  26) 99(  26) D2(  23) 33(  20) 2C(  19) 05(  17) 0B(  17) 35(  17)
4    0/  2   24( 130) 87( 110) 7B(  32) 4F(  25) D7(  20) F4(  18) 17(  15) 8A(  15) CE(  15) E1(  15)
5    0/  1   E3( 222) 4F(  46) 40(  45) 7F(  28) DB(  27) E0(  27) 5B(  25) 71(  25) 8A(  25) 65(  23)
6    0/  1   92( 208) 63(  58) 54(  51) 64(  35) 51(  26) 53(  25) 75(  20) 0E(  18) 7D(  18) D9(  18)
7    0/  1   A9( 220) B8(  51) 4B(  41) 1B(  39) 3B(  23) 9B(  23) FA(  23) 63(  22) 2D(  19) 1A(  17)
8    0/  1   14(1106) C1( 118) 04(  41) 13(  30) 43(  28) 99(  25) 79(  20) B1(  17) 86(  15) 97(  15)
9    0/  1   39( 540) 08(  95) E4(  87) E2(  79) E5(  59) 0A(  44) CC(  35) 02(  32) C7(  31) 6C(  30)
10    0/  1   D4( 372) 9E(  68) A0(  64) 9F(  55) DB(  51) 38(  40) 9D(  40) 52(  39) A1(  38) 54(  36)
11    0/  1   27( 334) BC(  58) F1(  44) BE(  42) 79(  39) 3B(  37) E1(  34) E2(  34) 31(  33) BF(  33)

KEY FOUND! [ AE:66:5C:FD:24:E3:92:A9:14:39:D4:27:4B ]


注:只有16进制数字密钥全部能被转化为ASCII字符密钥时,才会显示WEP的ASCII字符密钥。接下来这个密钥就可以用来连接网络了。下面,我们来看一下如何使用词典比对的方法破解WEP。

词典比对破解

首先,我们需要有一个含有ASCII字符或者十六进制密钥的词典。但需要注意,一个文件只能含两种格式的一种。下面的表格给出了不同加密强度下各自需要的位数。

WEP密钥的

比特长度
十六进制

数字长度
Ascii字符

长度
64105
1282613
1523216
2565829
例如:

64bit的ascii字符密钥:“ABCDE”

64bit的十六进制数密钥:“12:34:56:78:90” (注意数字之间的“:”)

128bit的ascii字符密钥:“ABCDEABCDEABC”

128bit的十六进制数密钥:”12:34:56:78:90:12:34:56:78:90:12:34:56”

如果想要破解一个64bit长的密钥,可输入以下命令:

aircrack-ng -w h:hex.txt,ascii.txt -a 1 -n 64 -e teddy wep10-01.cap


其中:

-w h:hex.txt,ascii.txt 表示使用的密钥文件,对于十六进制数字格式的密钥文件,必须在文件名前加上“h:”

-a 1 表示WEP

-n 64 表示密钥是64bit长的

-e teddy 选择接入点,也可以再加上-b来选择特定的MAC地址,都可选

wep10-01.cap表示包含数据的文件名,它可以是一个完整的数据包,或者仅包含IVs,最少需要包含4个IVs

可能得输出如下:

Aircrack-ng 0.7 r247

[00:00:00] Tested 2 keys (got 13 IVs)

KB    depth   byte(vote)
0    0/  0   00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0)
1    0/  0   00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0)
2    0/  0   00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0)
3    0/  0   00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0)
4    0/  0   00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0) 00(   0)

KEY FOUND! [ 12:34:56:78:90 ]
Probability: 100%


PTW攻击示例

需要注意,此方法需要将ARP请求或者应答包作为输入,需要是完整的包而不仅仅是IVs。这也就意味着我们在使用airodump-ng时不可以加“–ivs”参数选项。而且,此方法只对64位和128位的WEP加密方式有效。

输入命令:

aircrack-ng -z ptw*.cap


其中:

-z 表示我门使用PTW方法来破解密钥。注意,在v1.x中这种方式是默认方式,可使用-K切换到Korek

ptw*.cap表示捕捉数据的文件

屏幕显示:

Opening ptw-01.cap
Read 171721 packets.

#  BSSID              ESSID                     Encryption

1  00:14:6C:7E:40:80  teddy                     WEP (30680 IVs)

Choosing first network as target.


然后出现:

Aircrack-ng 0.9

[00:01:18] Tested 0/140000 keys (got 30680 IVs)

KB    depth   byte(vote)
0    0/  1   12( 170) 35( 152) AA( 146) 17( 145) 86( 143) F0( 143) AE( 142) C5( 142) D4( 142) 50( 140)
1    0/  1   34( 163) BB( 160) CF( 147) 59( 146) 39( 143) 47( 142) 42( 139) 3D( 137) 7F( 137) 18( 136)
2    0/  1   56( 162) E9( 147) 1E( 146) 32( 146) 6E( 145) 79( 143) E7( 142) EB( 142) 75( 141) 31( 140)
3    0/  1   78( 158) 13( 156) 01( 152) 5F( 151) 28( 149) 59( 145) FC( 145) 7E( 143) 76( 142) 92( 142)
4    0/  1   90( 183) 8B( 156) D7( 148) E0( 146) 18( 145) 33( 145) 96( 144) 2B( 143) 88( 143) 41( 141)

KEY FOUND! [ 12:34:56:78:90 ]
Decrypted correctly: 100%


WPA

破解WPA/WPA2密钥时,使用aircrack-ng的命令格式为:

aircrack-ng -w password.lst *.cap


其中:

-w password.lst是密钥词典文件名。如果文件不在运行路径中则需加上绝对地址

*.cap是包含有捕捉到的数据包的文件,此处我们使用了通配符

屏幕会显示:

Opening wpa2.eapol.cap
Opening wpa.cap
Read 18 packets.

#  BSSID              ESSID                     Encryption

1  00:14:6C:7E:40:80  Harkonen                  WPA (1 handshake)
2  00:0D:93:EB:B0:8C  test                      WPA (1 handshake)

Index number of target network ?


注意到此时,我们的文件中包含有不止一个网络,所以我们需要从中选取要攻击的网络。输入我们的选择“2”,破解出密钥:

Aircrack-ng 0.7 r130

[00:00:03] 230 keys tested (73.41 k/s)

KEY FOUND! [ biscotte ]

Master Key     : CD D7 9A 5A CF B0 70 C7 E9 D1 02 3B 87 02 85 D6
39 E4 30 B3 2F 31 AA 37 AC 82 5A 55 B5 55 24 EE

Transcient Key : 33 55 0B FC 4F 24 84 F4 9A 38 B3 D0 89 83 D2 49
73 F9 DE 89 67 A6 6D 2B 8E 46 2C 07 47 6A CE 08
AD FB 65 D6 13 A9 9F 2C 65 E4 A6 08 F2 5A 67 97
D9 6F 76 5B 8C D3 DF 13 2F BC DA 6A 6E D9 62 CD

EAPOL HMAC     : 52 27 B8 3F 73 7C 45 A0 05 97 69 5C 30 78 60 BD


现在就可以得到密钥连接到网络了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: