-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdhcp.php
More file actions
222 lines (215 loc) · 5.86 KB
/
dhcp.php
File metadata and controls
222 lines (215 loc) · 5.86 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
<!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 - DHCP Server</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>DHCP Server</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
include('phpincs.php');
$output = $return = 0;
exec('cat /etc/udhcpd.conf',$return);
$conf = ParseConfig($return);
$conf2 = ParseConfig2($return);
$RangeStart = $conf[start];
$leasetime = $conf2[option];
$sselected = " selected";
$RangeEnd = $conf[end];
exec('pidof udhcpd | wc -l',$dnsmasq);
if($dnsmasq[0] == 0) {
$status = 'udhcpd not running';
} else {
$status = 'udhcpd is running';
}
echo '
<form method="POST">
<div id="box1">
<h2>
DHCP Server Information
</h2>
<p>
Status : '.$status.'<br />
Interface: '.$conf['interface'].'<br />
Range Start: '.$RangeStart.'<br />
Range End: '.$RangeEnd.'<br />
Lease Time: '.$leasetime.'<br />
</p>
</div>
<div id="box1">
<h2>
DHCP Server Controls
</h2>
<p>
<input type="submit" value="Start UDHCPD" name="startudhcpd" />
<input type="submit" value="Stop UDHCPD" name="stopudhcpd" />
<input type="submit" value="Restart UDHCPD" name="restartudhcpd" />
</p>
</div>
<br class="clear" />';
if(isset($_POST['startudhcpd'])) {
exec('sudo ifconfig wlan1 10.0.0.1');
exec('sudo service udhcpd start',$return);
echo "Attempting to start udhcpd";
}
if(isset($_POST['stopudhcpd'])) {
exec('sudo service udhcpd stop',$return);
echo "Stopping udhcpd";
}
if(isset($_POST['restartudhcpd'])) {
exec('sudo service udhcpd stop',$return);
exec('sudo ifconfig wlan1 10.0.0.1');
exec('sudo service udhcpd start',$return);
echo "Restarting udhcpd";
}
?>
</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>