| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# $Id$ |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# network::wps Brik |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
package Metabrik::Network::Wps; |
|
7
|
1
|
|
|
1
|
|
707
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Network::Wlan Metabrik::System::Package); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
435
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
|
13
|
|
|
|
|
|
|
return { |
|
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
|
15
|
|
|
|
|
|
|
tags => [ qw(unstable wifi wlan wireless) ], |
|
16
|
|
|
|
|
|
|
author => 'GomoR ', |
|
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
|
18
|
|
|
|
|
|
|
commands => { |
|
19
|
|
|
|
|
|
|
install => [ ], # Inherited |
|
20
|
|
|
|
|
|
|
brute_force_wps => [ qw(essid bssid|OPTIONAL) ], |
|
21
|
|
|
|
|
|
|
}, |
|
22
|
|
|
|
|
|
|
require_modules => { |
|
23
|
|
|
|
|
|
|
'Metabrik::Shell::Command' => [ ], |
|
24
|
|
|
|
|
|
|
}, |
|
25
|
|
|
|
|
|
|
require_binaries => { |
|
26
|
|
|
|
|
|
|
'sudo', => [ ], |
|
27
|
|
|
|
|
|
|
'reaver', => [ ], |
|
28
|
|
|
|
|
|
|
}, |
|
29
|
|
|
|
|
|
|
need_packages => { |
|
30
|
|
|
|
|
|
|
ubuntu => [ qw(reaver) ], |
|
31
|
|
|
|
|
|
|
debian => [ qw(reaver) ], |
|
32
|
|
|
|
|
|
|
kali => [ qw(reaver) ], |
|
33
|
|
|
|
|
|
|
}, |
|
34
|
|
|
|
|
|
|
}; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub brute_force_wps { |
|
38
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
39
|
0
|
|
|
|
|
|
my ($essid, $bssid) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('brute_force_wps', $essid) or return; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# If user provided bssid, we skip auto-detection |
|
44
|
0
|
0
|
|
|
|
|
if (! defined($bssid)) { |
|
45
|
0
|
|
|
|
|
|
my $scan = $self->scan; |
|
46
|
0
|
0
|
|
|
|
|
if (! defined($scan)) { |
|
47
|
0
|
|
|
|
|
|
return $self->log->error("brute_force_wps: no AP found?"); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $ap; |
|
51
|
0
|
|
|
|
|
|
for my $this (keys %$scan) { |
|
52
|
0
|
|
|
|
|
|
$self->log->info("this[$this] essid[$essid]"); |
|
53
|
0
|
0
|
|
|
|
|
if ($scan->{$this}->{essid} eq $essid) { |
|
54
|
0
|
|
|
|
|
|
$ap = $scan->{$this}; |
|
55
|
0
|
|
|
|
|
|
last; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
if (! defined($ap)) { |
|
60
|
0
|
|
|
|
|
|
return $self->log->error("brute_force_wps: no AP found by that essid [$essid]"); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$bssid = $ap->{address}; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
my $monitor = $self->start_monitor_mode or return; |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $cmd = "sudo reaver -i $monitor -b $bssid -vv"; |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
my $sc = Metabrik::Shell::Command->new_from_brik_init($self) or return; |
|
71
|
0
|
|
|
|
|
|
my $r = $sc->system($cmd); |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$self->stop_monitor_mode; |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return $r; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |