forked from sksalahuddin2828/PHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwifi_password_list.php
37 lines (29 loc) · 1.04 KB
/
wifi_password_list.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
<?php
$command = shell_exec("netsh wlan show profiles");
$profiles = [];
preg_match_all("/All User Profile\s+:\s+(.*)\r/", $command, $profiles);
$WifiList = [];
if (count($profiles[1]) != 0) {
foreach ($profiles[1] as $name) {
$WifiProfile = array();
$profile_info = shell_exec("netsh wlan show profile \"$name\"");
if (preg_match("/Security key\s+:\s+Absent/", $profile_info)) {
continue;
} else {
$WifiProfile["ssid"] = $name;
$profile_info_pass = shell_exec("netsh wlan show profile \"$name\" key=clear");
preg_match("/Key Content\s+:\s+(.*)\r/", $profile_info_pass, $password);
if ($password == null) {
$WifiProfile["password"] = null;
} else {
$WifiProfile["password"] = $password[1];
}
$WifiList[] = $WifiProfile;
}
}
}
foreach ($WifiList as $wifi) {
echo "SSID: " . $wifi["ssid"] . "\n";
echo "Password: " . $wifi["password"] . "\n";
}
?>