47
app/Services/StealerParser.php
Normal file
47
app/Services/StealerParser.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
class StealerParser
|
||||
{
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly string $content = ''
|
||||
){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function parse(): array{
|
||||
|
||||
$lines = explode("\n", $this->content);
|
||||
$credentials = [];
|
||||
$current = [];
|
||||
|
||||
foreach ($lines as $line) {
|
||||
if (strpos($line, 'URL:') === 0) {
|
||||
if (!empty($current)) {
|
||||
$credentials[] = $current;
|
||||
}
|
||||
$current = ['url' => trim(substr($line, 4))];
|
||||
} elseif (strpos($line, 'Username:') === 0) {
|
||||
$current['username'] = trim(substr($line, 9));
|
||||
} elseif (strpos($line, 'Password:') === 0) {
|
||||
$current['password'] = trim(substr($line, 9));
|
||||
} elseif (strpos($line, 'Application:') === 0) {
|
||||
$current['application'] = trim(substr($line, 12));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($current)) {
|
||||
$credentials[] = $current;
|
||||
}
|
||||
|
||||
return $credentials;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user