ソースを参照

Password igual con expresion regular

master
コミット
cfe9e327eb
1個のファイルの変更18行の追加4行の削除
  1. +18
    -4
      app/Commands/Redes_wifi.php

+ 18
- 4
app/Commands/Redes_wifi.php ファイルの表示

@@ -40,19 +40,33 @@ class Redes_wifi extends Command
foreach ($profiles as $profile) {
$linea = "[{$profile}] ";
if (!$this->option('list'))
$linea .= $this->getPassword($profile);
$linea .= $this->getPasswordRegex($profile);
$this->line($linea);
}
}

public function getProfilesRegex()
{
$result = Process::run('netsh wlan show profile');
$salidaprofiles = $result->output();
//$salidaprofiles = file_get_contents('profiles.txt');
/*$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 getPasswordRegex($profile)
{
$result = Process::run("netsh wlan show profile \"{$profile}\" key=clear");
$salidapassword = $result->output();
if (str_contains($salidapassword, "No hay ninguna interfaz inalámbrica en el sistema.")) { //Esto evita que ejecute regex si hay fallo
$this->error("Fallo al ejecutar comando de password");
die();
}
//$salidapassword = file_get_contents('prueba.txt');
preg_match_all("/Contenido de la clave\s*:\s*(\S+)/", $salidapassword, $password);
return $password[1][0];
}

public function getProfiles()
{
$result = Process::run('netsh wlan show profile');


読み込み中…
キャンセル
保存