forked from keitharm/Wicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apview.php
164 lines (160 loc) · 7.84 KB
/
apview.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
require_once("Wicker.php");
require_once("Scan.class.php");
require_once("AP.class.php");
$parent_ap = AP::fromDB($_GET['parent_scan'], $_GET['bssid']);
$ind_ap = AP::fromDB($_GET['scanid'], $_GET['bssid']);
$parent_scan = Scan::fromDB($_GET['parent_scan']);
$ind_scan = Scan::fromDB($_GET['scanid']);
if ($_GET['do'] == "terminate") {
$scan = Scan::fromDB($_GET['scanid']);
if ($scan->getPID() != 0 && $scan->getStatus() == 1) {
$scan->setStatus(2);
system("sudo kill " . $scan->getPID());
header('Location: apview.php?parent_scan=' . $_GET['parent_scan'] . '&scanid=' . $_GET['scanid'] . '&bssid=' . $_GET['bssid']);
die;
}
} else if ($_GET['do'] == "terminatenstart") {
// Terminate parent scan
$previous = Scan::fromDB($_GET['parent_scan']);
if ($previous->getPID() != 0 && $previous->getStatus() == 1) {
$previous->setStatus(2);
system("sudo kill " . $previous->getPID());
}
// Start new individual scan
$scan = Scan::newScan();
$scan->setStatus(1);
$scan->startIndScan($parent_ap->getBSSID(), $parent_ap->getChannel());
$parent_ap->setIndScanID($scan->getID());
header('Location: apview.php?parent_scan=' . $_GET['parent_scan'] . '&scanid=' . $scan->getID() . '&bssid=' . $_GET['bssid']);
die;
} else if ($_GET['do'] == "deauth") {
$wicker->deauth($_GET['bssid'], $_GET['deauthmac'], "scans/" . $ind_scan->getGUID() . ".log");
} else if ($_GET['do'] == "deauthbroadcast") {
$wicker->deauth($_GET['bssid'], null, "scans/" . $ind_scan->getGUID() . ".log");
} else if ($_GET['do'] == "associate") {
$wicker->associate($_GET['bssid'], "scans/" . $ind_scan->getGUID() . ".log");
} else if ($_GET['do'] == "0841") {
$wicker->attack0841($_GET['bssid'], $_GET['scanid'], "scans/" . $ind_scan->getGUID() . ".log");
} else if ($_GET['do'] == "sendyes") {
system("echo \"y\" > scans/" . $_GET['bssid'] . $_GET['scanid'] . "fifo");
} else if ($_GET['do'] == "sendno") {
system("echo \"n\" > scans/" . $_GET['bssid'] . $_GET['scanid'] . "fifo");
}
if ($_GET['scanid'] == 0) {
$data = $parent_ap;
} else {
$data = $ind_ap;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?=$wicker->head("Viewing " . $data->getESSID())?>
<link href="css/view.css" rel="stylesheet">
<id hidden><?=$_GET['scanid']?></id>
<running hidden><?=(($ind_scan->getStatus() == 1) ? "yes" : "no")?></running>
<bssid hidden><?=$_GET['bssid']?></bssid>
<parent hidden><?=$_GET['parent_scan']?></parent>
</head>
<body>
<?=$wicker->heading()?>
<div class="container-fluid">
<div class="row">
<?=$wicker->menu("null")?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<div id="apinfo">
<!-- apview info here -->
</div>
<h1 class="sub-header"><small>Actions</small></h1>
<?php
if ($parent_scan->getStatus() != 2 && $parent_scan->getStatus() != 3) {
?>
<input type="button" class="btn-success" value="Terminate parent scan and start individual scan" onClick="window.location='apview.php?do=terminatenstart&parent_scan=<?=$parent_scan->getID()?>&bssid=<?=$_GET['bssid']?>'">
<?php
} else {
if ($_GET['scanid'] == 0 || ($_GET['scanid'] != 0 && $ind_scan->getStatus() >= 2)) {
?>
<input type="button" class="btn-success" value="Start individual scan" onClick="window.location='apview.php?do=terminatenstart&parent_scan=<?=$parent_scan->getID()?>&bssid=<?=$_GET['bssid']?>'">
<?php
} else if ($ind_scan->getStatus() == 1) {
?>
<input type="button" class="btn-danger" value="Terminate individual scan" onClick="window.location='apview.php?do=terminate&parent_scan=<?=$_GET['parent_scan']?>&scanid=<?=$_GET['scanid']?>&bssid=<?=$_GET['bssid']?>'">
<input type="button" class="btn-success" value="Broadcast deauth" onClick="window.location='apview.php?do=deauthbroadcast&parent_scan=<?=$_GET['parent_scan']?>&scanid=<?=$_GET['scanid']?>&bssid=<?=$_GET['bssid']?>'">
<input type="button" class="btn-primary" value="Associate with AP" onClick="window.location='apview.php?do=associate&parent_scan=<?=$_GET['parent_scan']?>&scanid=<?=$_GET['scanid']?>&bssid=<?=$_GET['bssid']?>'">
<input type="button" class="btn-warning" value="0841 attack" onClick="window.location='apview.php?do=0841&parent_scan=<?=$_GET['parent_scan']?>&scanid=<?=$_GET['scanid']?>&bssid=<?=$_GET['bssid']?>'">
<input type="button" class="btn-default" value="Send yes" onClick="window.location='apview.php?do=sendyes&parent_scan=<?=$_GET['parent_scan']?>&scanid=<?=$_GET['scanid']?>&bssid=<?=$_GET['bssid']?>'">
<input type="button" class="btn-default" value="Send no" onClick="window.location='apview.php?do=sendno&parent_scan=<?=$_GET['parent_scan']?>&scanid=<?=$_GET['scanid']?>&bssid=<?=$_GET['bssid']?>'">
<?php
}
}
?>
<h1 class="sub-header"><small>Clients for current scan</small></h1>
<div class="table-responsive" id="currentclients">
<!--Clients for current scan here-->
</div>
<h1 class="sub-header"><small>Previous Scans</small></h1>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Scan #</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php
unset($a);
$statement = $wicker->db->con()->prepare("SELECT * FROM `aps` WHERE `bssid` = ? AND `scan_id` <> ? ORDER BY `scan_id` DESC");
$statement->execute(array($parent_ap->getBSSID(), $_GET['scanid']));
while ($info = $statement->FetchObject()) {
$a++;
?>
<tr>
<td><a href="scanview.php?id=<?=$info->scan_id?>" target="_blank"><?=$info->scan_id?></a></td>
<td><?=$wicker->timeconv($info->first_seen)?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<h1 class="sub-header"><small>All known clients</small></h1>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Scan #</th>
<th>BSSID</th>
<th>First Seen</th>
</tr>
</thead>
<tbody>
<?php
unset($a);
$statement = $wicker->db->con()->prepare("SELECT * FROM `clients` WHERE `bssid` = ? GROUP BY `mac` ORDER BY `scan_id` DESC");
$statement->execute(array($parent_ap->getBSSID()));
while ($info = $statement->FetchObject()) {
$a++;
?>
<tr>
<td><?=$a?></td>
<td><a href="scanview.php?id=<?=$info->scan_id?>" target="_blank"><?=$info->scan_id?></a></td>
<td><span title="<?=$wicker->getMan($info->mac)?>"><?=$info->mac?></span></td>
<td><?=$wicker->timeconv($info->first_seen)?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?=$wicker->footer()?>
<script src="js/updateAP.js"></script>
</body>
</html>