38 lines
835 B
PHP
38 lines
835 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
class StealerParser
|
|
{
|
|
/**
|
|
* @param string $content
|
|
*/
|
|
public function __construct(
|
|
private readonly string $content = ''
|
|
){
|
|
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function parse(): array{
|
|
|
|
$items = explode("===============\n", $this->content);
|
|
$credentials = [];
|
|
|
|
foreach ($items as $item) {
|
|
preg_match_all('/URL:\s(.*)\nUsername:\s(.*)\nPassword:\s(.*)\nApplication:\s(.*)\n/m',$item,$matches);
|
|
$credentials[] = [
|
|
'url' => trim($matches[1][0] ?? ''),
|
|
'username' => trim($matches[2][0] ?? ''),
|
|
'password' => trim($matches[3][0] ?? ''),
|
|
'application' => trim($matches[4][0] ?? '')
|
|
];
|
|
}
|
|
|
|
return $credentials;
|
|
|
|
}
|
|
}
|