-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup_search_ch.php
More file actions
161 lines (136 loc) · 3.09 KB
/
setup_search_ch.php
File metadata and controls
161 lines (136 loc) · 3.09 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
<?php
set_time_limit(30);
function is_printable($ssid)
{
$ssid_len = strlen($ssid);
for($i = 0; $i < $ssid_len; $i++)
{
$code = bin2int($ssid, $i, 1);
if($code == 0x00)
return false;
}
return true;
}
$pid = pid_open("/mmap/net1");
pid_ioctl($pid, "scan qsize 64");
pid_ioctl($pid, "scan start");
while(pid_ioctl($pid, "scan state"))
;
?>
<!DOCTYPE html>
<html>
<head>
<title>PHPoC</title>
<meta content="initial-scale=0.7, maximum-scale=1.0, minimum-scale=0.5, width=device-width, user-scalable=yes" name="viewport">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
body { font-family: verdana, Helvetica, Arial, sans-serif, gulim; }
.midHeader {
color: white;
background-color: rgb(6, 38, 111);
z-index:3;
margin-bottom:20px
}
.headerTitle {
font-size: 200%;
font-weight: normal;
font-family: impact;
padding: 10px;
}
.headerMenu{
position:relative;
width: 430px;
}
.right {
color: white;
position: absolute;
right: 1px;
bottom: 4px;
font-size:9pt;
}
.right a
{
color: white;
background-color: transparent;
text-decoration: none;
margin: 0;
padding:0 2ex 0 2ex;
}
.right a:hover
{
color: white;
text-decoration: underline;
}
table {width:480px; font-size:10pt;}
.theader { font-weight: bold; width:100px;}
tr { height :28px;}
td { padding: 10px;}
.zebra {background-color : #ECECEC;}
</style>
<script type="text/javascript">
function select(ch)
{
window.opener.parent.document.phpoc_setup.channel.value = ch;
window.close();
}
function search()
{
window.location.reload();
}
</script>
</head>
<body>
<form name="searchap" method="post">
<center>
<div class="midHeader">
<div class="headerTitle">Channel List</div>
<div class="headerMenu">
<div class="right">
<a href="javascript:search();">SEARCH</a>
</div>
</div>
</div>
<table>
<?php
for($ch = 1; $ch <= 14; $ch++)
{
if ($ch % 2 == 1)
$tr_class = "zebra";
else
$tr_class = "";
?>
<tr class="<?php echo $tr_class;?>">
<?
$n = pid_ioctl($pid, "scan result $ch");
$total_ssid = "";
for($id = 0; $id < $n; $id++)
{
$scan = pid_ioctl($pid, "scan result $ch $id");
if($scan)
{
$scan = explode(" ", $scan);
$ch = (int)$scan[0];
$ssid = hex2bin($scan[3]);
if(!is_printable($ssid))
continue;
$total_ssid = $ssid . ", " . $total_ssid;
}
else
break;
}
$total_ssid = substr($total_ssid, 0, strlen($total_ssid)-2); //remove last comma.
?>
<td class="theader"><?php echo "Channel $ch";?></td>
<td width="300px"><?php echo $total_ssid;?></td>
<td align="center"><button type="button" onclick="select('<?php echo $ch?>')";>Select</button></td>
</tr>
<?
}
pid_close($pid);
?>
</table>
<br>
</center>
</form>
</body>
</html>