From 0d5da3729c0b149fc23ec7b53d5c3097cfd1e1a0 Mon Sep 17 00:00:00 2001 From: Armando Ceballos Date: Wed, 24 May 2023 20:16:40 -0600 Subject: [PATCH] Ya funciona con expresion regular --- app/Commands/Redes_wifi.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Commands/Redes_wifi.php b/app/Commands/Redes_wifi.php index 904df03..4f81a45 100644 --- a/app/Commands/Redes_wifi.php +++ b/app/Commands/Redes_wifi.php @@ -29,9 +29,10 @@ class Redes_wifi extends Command */ public function handle() { - //$this->getProfilesRegex(); + $essid = $this->argument('essid'); - $profiles = $this->getProfiles(); + //$profiles = $this->getProfiles(); + $profiles = $this->getProfilesRegex(); if (isset($essid) && (!$this->option('list'))) { $this->line("[{$essid}] ".$this->getPassword($essid)); return 0; @@ -46,9 +47,11 @@ class Redes_wifi extends Command public function getProfilesRegex() { - $parse = file_get_contents('profiles.txt'); - preg_match("/: \s*(.*)/", $parse, $profiles); - dd($profiles); + $result = Process::run('netsh wlan show profile'); + $salidaprofiles = $result->output(); + //$salidaprofiles = file_get_contents('profiles.txt'); + preg_match_all("/: \s*(.*)/", $salidaprofiles, $profiles); + return $profiles[1]; } public function getProfiles() {