Compare commits

...

3 Commits

Author SHA1 Message Date
5e51fa1454 Improve parser using REGEX capturing group 2024-11-12 19:20:15 +01:00
0fdd5c5fba Fix docker-compose.yaml / Update parser with str_starts_with instead of strpos 2024-11-12 19:06:49 +01:00
850d48b07e Update remote url
Signed-off-by: Andrea Pavone <info@andreapavone.com>
2024-11-12 19:02:34 +01:00
3 changed files with 11 additions and 21 deletions

View File

@ -12,7 +12,7 @@ Is based on these technologies:
### Setup
```text
git clone git@github.com:andp97/asm-dashboard.git
git clone git@git-de.pavo.pw:andp97/asm-dashboard.git
cd asm-dashboard
docker compose up
```

View File

@ -18,27 +18,17 @@ class StealerParser
*/
public function parse(): array{
$lines = explode("\n", $this->content);
$items = 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;
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;

View File

@ -5,7 +5,7 @@ services:
context: .
dockerfile: Dockerfile
ports:
- "8000:8080"
- "8000:80"
environment:
- APP_ENV=production
- DB_CONNECTION=sqlite