-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathap.php
More file actions
312 lines (304 loc) · 9.47 KB
/
ap.php
File metadata and controls
312 lines (304 loc) · 9.47 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution License
Name : Neutral Charisma
Version : 1.0
Released : 20130222
-->
<html>
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Raspberry Control - Access Point</title>
<link href="http://fonts.googleapis.com/css?family=PT+Sans+Narrow" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="bg">
<div id="outer">
<div id="header">
<div id="logo">
<h1>
<a>Access Point</a>
</h1>
</div>
<div id="nav">
<ul>
<li class="first active">
<a href="index.php">Home</a>
</li>
<li>
<a href="client.php">Wireless Client</a>
</li>
<li>
<a href="ap.php">Access Point</a>
</li>
<li>
<a href="dhcp.php">DHCP Server</a>
</li>
<li>
<a href="sslstrip.php">SSLstrip</a>
</li>
<li>
<a href="dnsspoof.php">Dnsspoof</a>
</li>
<li>
<a href="downloads.php">Downloads</a>
</li>
<li class="last">
<a href="admin.php">Administration</a>
</li>
</ul>
<br class="clear" />
</div>
</div>
<div id="main">
<div id="sidebar1">
<h3>
Status:
</h3>
<ul class="linkedList">
<li class="first">
<a href="client.php">Wireless Client: </a><br />
<?php
exec('ifconfig wlan0',$return);
$strWlan0 = implode(" ",$return);
$strWlan0 = preg_replace('/\s\s+/', ' ', $strWlan0);
if(strpos($strWlan0, "UP") !== false && strpos($strWlan0, "RUNNING") !== false) {
echo "Wireless client connected";
} else {
echo "Wireless client not connected";
}
?>
</li>
<li>
<a href="ap.php">Access point: </a><br />
<?php
exec('pidof hostapd | wc -l',$hostapdstatus);
if($hostapdstatus[0] == 0) {
echo "Access point not running";
} else {
echo "Access point running";
}
?>
</li>
<li>
<a href="dhcp.php">DHCP Server: </a><br />
<?php
exec('pidof udhcpd | wc -l',$dnsmasq);
if($dnsmasq[0] == 0) {
echo "DHCP Server not running";
} else {
echo "DHCP Server running";
}
?>
</li>
<li>
<a href="sslstrip.php#arpspoof">Arpspoof: </a><br />
<?php
exec('pidof arpspoof | wc -l',$arpspoofok);
if($arpspoofok[0] == 0) {
echo "Arpspoof is not running";
} else {
echo "Arpspoof is running";
}
?>
</li>
<li>
<a href="sslstrip.php#sslstrip">Sslstrip: </a><br />
<?php
exec('pgrep -f sslstrip | wc -l',$sslstripok);
if($sslstripok[0] == 1) {
echo "Sslstrip is not running";
} else {
echo "Sslstrip is running";
}
?>
</li>
<li>
<a href="sslstrip.php#cleaner">Cleaner: </a><br />
<?php
exec('pgrep -f cleaner.py | wc -l',$cleanok);
if($cleanok[0] == 1) {
echo "Cleaner is not running";
} else {
echo "Cleaner is running";
}
?>
</li>
<li class="last">
<a href="dnsspoof.php">Dnsspoof</a><br />
Dnsspoof not running
</li>
</ul>
</div>
<div id="sidebar2">
<h3>
Info:
</h3>
<p>
Some help info
</p>
</div>
<div id="content">
<?php
$output = $return = 0;
exec('cat /etc/hostapd/hostapd.conf',$return);
exec('pidof hostapd | wc -l',$hostapdstatus);
if($hostapdstatus[0] == 0) {
$status = 'Access Point Not Running';
} else {
$status = 'Access Point Running';
}
$arrConfig = array();
$arrChannel = array('a','b','g');
$arrSecurity = array( 1 => 'WPA', 2 => 'WPA2',3=> 'WPA+WPA2');
$arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP');
foreach($return as $a) {
if($a[0] != "#") {
$arrLine = explode("=",$a);
$arrConfig[$arrLine[0]]=$arrLine[1];
}
}
echo '
<form method="POST">
<div id="box1">
<h2>
Access Point Information
</h2>
<p>
Status: '.$status.'<br />
Interface: '.$arrConfig['interface'].'<br />
SSID: '.$arrConfig['ssid'].'<br />
Wireless Mode: '.$arrConfig['hw_mode'].'<br />
Channel: '.$arrConfig['channel'].'<br />
Security Type: '.$arrConfig['wpa'].'<br />
Encryption Type: '.$arrConfig['wpa_pairwise'].'<br />
PSK : '.$arrConfig['wpa_passphrase'].'
</p>
</div>
<div id="box1">
<h2>
Access Point Controls
</h2>
<p>
Interface : <select name="interface">';
exec("cat /proc/net/dev | tail -n -4 | awk -F :\ ' { print $1 } ' | tr -d ' '",$interfaces);
foreach($interfaces as $int) {
$select = '';
if($int == $arrConfig['interface']) {
$select = " selected";
}
echo '<option value="'.$int.'"'.$select.'>'.$int.'</option>';
}
echo'</select><br />
SSID : <input type="text" name="ssid" value="'.$arrConfig['ssid'].'" /><br />
Wireless Mode : <select name="hw_mode">';
foreach($arrChannel as $Mode) {
$select = '';
if($arrConfig['hw_mode'] == $Mode) {
$select = ' selected';
}
echo '<option value="'.$Mode.'"'.$select.'>'.$Mode.'</option>';
}
echo '</select><br />
Channel : <select name="channel">';
for($channel = 1; $channel < 14; $channel++) {
$select = '';
if($channel == $arrConfig['channel']) {
$select = " selected";
}
echo '<option value="'.$channel.'"'.$select.'>'.$channel.'</option>';
}
echo '</select><br />
Security type : <select name="wpa">';
foreach($arrSecurity as $SecVal => $SecMode) {
$select = '';
if($SecVal == $arrConfig['wpa']) {
$select = ' selected';
}
echo '<option value="'.$SecVal.'"'.$select.'>'.$SecMode.'</option>';
}
echo'</select><br />
Encryption Type : <select name="wpa_pairwise">';
foreach($arrEncType as $EncConf => $Enc) {
$select = '';
if($Enc == $arrConfig['wpa_pairwise']) {
$select = ' selected';
}
echo '<option value="'.$EncConf.'"'.$select.'>'.$Enc.'</option>';
}
echo'</select><br />
PSK : <input type="text" name="wpa_passphrase" value="'.$arrConfig['wpa_passphrase'].'" /> <br />
<input type="submit" name="SaveHostAPDSettings" value="Save Hostapd settings" /> ';
if($hostapdstatus[0] == 0) {
echo '<input type="submit" name="StartHotspot" value="Start Hotspot" />';
} else {
echo '<input type="submit" name="StopHotspot" value="Stop hotspot" />';
}
echo '<input type="submit" name="RestartHotspot" value="Restart hotspot" />
</p>
</div>
<br class="clear" />';
if(isset($_POST['SaveHostAPDSettings'])) {
$config = 'driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
beacon_int=100
auth_algs=1
wpa_key_mgmt=WPA-PSK
';
$config .= "interface=".$_POST['interface']."
";
$config .= "ssid=".$_POST['ssid']."
";
$config .= "hw_mode=".$_POST['hw_mode']."
";
$config .= "channel=".$_POST['channel']."
";
$config .= "wpa=".$_POST['wpa']."
";
$config .='wpa_passphrase='.$_POST['wpa_passphrase'].'
';
$config .="wpa_pairwise=".$_POST['wpa_pairwise']."
";
$config .="country_code=".$_POST['country_code'];
exec("echo '$config' > /tmp/hostapddata",$return);
system("sudo cp /tmp/hostapddata /etc/hostapd/hostapd.conf",$return);
if($return == 0) {
echo "Wifi Hotspot settings saved";
} else {
echo "Wifi Hotspot settings failed to be saved";
}
} elseif(isset($_POST['StartHotspot'])) {
echo "Attempting to start hotspot";
exec('sudo hostapd -B /etc/hostapd/hostapd.conf',$return);
} elseif(isset($_POST['StopHotspot'])) {
echo "Attempting to stop hotspot";
exec('pidof hostapd',$pid);
$command1 = 'sudo kill %d';
exec(sprintf($command1, $pid[0]));
}
if(isset($_POST['RestartHotspot'])) {
exec('pidof hostapd',$pid);
$command1 = sprintf('sudo kill %d', $pid[0]);
exec($command1);
sleep(5);
exec('sudo hostapd -B /etc/hostapd/hostapd.conf');
}
?>
</div>
<br class="clear" />
</div>
</div>
<div id="copyright">
© Your Site Name | Design by <a href="http://www.freecsstemplates.org/">FCT</a>
</div>
</div>
</body>
</html>