Преглед на файлове

Corregir para implementar el regex

master
Armando Ceballos Vargas преди 1 година
родител
ревизия
e0f6c97e02
променени са 1 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. +8
    -1
      app/Commands/Redes_wifi.php

+ 8
- 1
app/Commands/Redes_wifi.php Целия файл

@@ -29,6 +29,7 @@ class Redes_wifi extends Command
*/ */
public function handle() public function handle()
{ {
$this->getProfilesRegex();
$essid = $this->argument('essid'); $essid = $this->argument('essid');
$profiles = $this->getProfiles(); $profiles = $this->getProfiles();
if (isset($essid) && (!$this->option('list'))) { if (isset($essid) && (!$this->option('list'))) {
@@ -37,12 +38,18 @@ class Redes_wifi extends Command
} }
foreach ($profiles as $profile) { foreach ($profiles as $profile) {
$linea = "[{$profile}] "; $linea = "[{$profile}] ";
if (!$this->option('list'))
if (!$this->option('list'))
$linea .= $this->getPassword($profile); $linea .= $this->getPassword($profile);
$this->line($linea); $this->line($linea);
} }
} }


public function getProfilesRegex()
{
$parse = file_get_contents('profiles.txt');
preg_match("/: \s*(.*)/", $parse, $profiles);
dd($profiles);
}
public function getProfiles() public function getProfiles()
{ {
$result = Process::run('netsh wlan show profile'); $result = Process::run('netsh wlan show profile');


Зареждане…
Отказ
Запис