Skip to content

fix suid command

fix suid command #16

GitHub Actions / Black failed Mar 21, 2024 in 0s

29 errors

Black found 29 errors

Annotations

Check failure on line 28 in /home/runner/work/FFM/FFM/commands/help_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/help_commands.py#L12-L28

     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 <http://www.gnu.org/licenses/>.
 """
+
 import time
 from commands.command_manager import register_plugin
 from model.plugin.command import Command
 from model.driver.input_api import *
 
 # -----------------------------------------------------------------------------
+
 
 class Debug(Command):
     def __init__(self, *args, **kwargs):
         pass
 

Check failure on line 22 in /home/runner/work/FFM/FFM/commands/notty_sudo.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/notty_sudo.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import os
 import random
 import string
 
 from model.driver.input_api import *

Check failure on line 22 in /home/runner/work/FFM/FFM/commands/log_control.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/log_control.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 from model.driver.input_api import *
 from model.plugin.command import Command
 from commands.command_manager import register_plugin
 import os
 

Check failure on line 22 in /home/runner/work/FFM/FFM/commands/remote_elf.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/remote_elf.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import base64
 import io
 import tqdm
 
 from model.driver.input_api import *

Check failure on line 22 in /home/runner/work/FFM/FFM/commands/remote_elf3.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/remote_elf3.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import base64
 import io
 import tqdm
 
 from model.driver.input_api import *

Check failure on line 22 in /home/runner/work/FFM/FFM/commands/remote_script.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/remote_script.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 from abc import abstractmethod
 
 from model.driver.input_api import *
 from model.plugin.command import Command
 from commands.command_manager import register_plugin

Check failure on line 28 in /home/runner/work/FFM/FFM/commands/stealth_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/stealth_commands.py#L12-L28

     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 <http://www.gnu.org/licenses/>.
 """
+
 import time
 from commands.command_manager import register_plugin
 from model.plugin.command import Command
 from model.driver.input_api import *
 
 # -----------------------------------------------------------------------------
+
 
 class PtySpawn(Command):
     def __init__(self, *args, **kwargs):
         pass
 

Check failure on line 71 in /home/runner/work/FFM/FFM/commands/stealth_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/stealth_commands.py#L61-L71

         pass_command("unset SSH_CONNECTION")
 
 
 # -----------------------------------------------------------------------------
 
+
 class Shred(Command):
     def __init__(self, *args, **kwargs):
         self.file = None
         if len(args) == 2:
             self.file = args[1]

Check failure on line 106 in /home/runner/work/FFM/FFM/commands/stealth_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/stealth_commands.py#L95-L106

 
     def execute(self):
         if not check_command_existence("shred"):
             shell_exec(f"FN={self.file}")
             shell_exec(
-                'dd bs=1k count="`du -sk "${FN}" | cut -f1`" if=/dev/urandom > "${FN}"; rm -f "${FN}"',print_output=True,)
+                'dd bs=1k count="`du -sk "${FN}" | cut -f1`" if=/dev/urandom > "${FN}"; rm -f "${FN}"',
+                print_output=True,
+            )
             write_str("{} deleted with dd/rm\r\n".format(self.file), LogLevel.ERROR)
         else:
             shell_exec("shred -uz {}".format(self.file))
             write_str("{} deleted with shred\r\n".format(self.file), LogLevel.ERROR)
 

Check failure on line 22 in /home/runner/work/FFM/FFM/commands/upload_file.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/upload_file.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 from model.plugin.command import Command
 from model.driver.input_api import *
 from commands.command_manager import register_plugin
 import base64
 import gzip

Check failure on line 22 in /home/runner/work/FFM/FFM/misc/logging.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/misc/logging.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import re
 
 from model import context
 
 

Check failure on line 23 in /home/runner/work/FFM/FFM/commands/enumeration_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/enumeration_commands.py#L12-L23

     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 <http://www.gnu.org/licenses/>.
 """
-import random 
+
+import random
 import string
 import time
 from commands.command_manager import register_plugin
 from model.plugin.command import Command
 from model.driver.input_api import *

Check failure on line 263 in /home/runner/work/FFM/FFM/commands/enumeration_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/enumeration_commands.py#L252-L263

     def usage():
         return "Usage: !mtime 5"
 
     def execute(self):
         write_str(
-            "[+] Files Modified in the last {}m:\r\n".format(self.time), LogLevel.WARNING
+            "[+] Files Modified in the last {}m:\r\n".format(self.time),
+            LogLevel.WARNING,
         )
         shell_exec(
             'find / -type f -mmin -{} ! -path "/proc/*" ! -path "/sys/*" ! -path "/run/*" ! -path "/dev/*" ! -path "/var/lib/*" 2>/dev/null'.format(
                 self.time
             ),

Check failure on line 308 in /home/runner/work/FFM/FFM/commands/enumeration_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/enumeration_commands.py#L294-L308

             print_output=False,
         )
         if len(test_sudo) == 0:
             write_str("[+] Sudo Version is likely NOT Vulnerable\r\n", LogLevel.WARNING)
         elif "not found" in test_sudo:
-            write_str("[!] Sudo not found, are you in a container?\r\n", LogLevel.WARNING)
+            write_str(
+                "[!] Sudo not found, are you in a container?\r\n", LogLevel.WARNING
+            )
         else:
             write_str(
-                "[!] Sudo Version might be Vulnerable, examine further\r\n", LogLevel.ERROR
+                "[!] Sudo Version might be Vulnerable, examine further\r\n",
+                LogLevel.ERROR,
             )
 
 
 class VM(Command):
     def __init__(self, *args, **kwargs):

Check failure on line 490 in /home/runner/work/FFM/FFM/commands/enumeration_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/enumeration_commands.py#L473-L490

             "ls -R {} 2>/dev/null | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/    /' -e 's/-/|/'".format(
                 self.path
             ),
             print_output=True,
         )
-        res = ''.join(random.choices(string.ascii_uppercase +
-                             string.digits, k=5))	
+        res = "".join(random.choices(string.ascii_uppercase + string.digits, k=5))
         if not os.path.isdir("dirwalk"):
             os.mkdir("dirwalk")
-        with open("dirwalk/" + res + ".txt", 'w') as fp:
+        with open("dirwalk/" + res + ".txt", "w") as fp:
             fp.write(command_output)
-        write_str("[+] Wrote dirwalk output to dirwalk/{}\r\n".format(res), LogLevel.WARNING)
+        write_str(
+            "[+] Wrote dirwalk output to dirwalk/{}\r\n".format(res), LogLevel.WARNING
+        )
 
 
 register_plugin(GetOS)
 register_plugin(Suid)
 register_plugin(Info)

Check failure on line 22 in /home/runner/work/FFM/FFM/misc/silent_argparse.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/misc/silent_argparse.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import argparse
 
 
 class SilentArgumentParser(argparse.ArgumentParser):
     """ArgumentParser is subclassed to avoid printing the help on invalid command lines."""

Check failure on line 22 in /home/runner/work/FFM/FFM/misc/process_utils.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/misc/process_utils.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import os
 from collections import deque
 
 
 def get_children():

Check failure on line 22 in /home/runner/work/FFM/FFM/misc/pretty_printing.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/misc/pretty_printing.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import os
 
 
 def print_columns(strings, fd, width=80):
     """

Check failure on line 22 in /home/runner/work/FFM/FFM/model/plugin/command.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/model/plugin/command.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 from abc import abstractmethod, ABCMeta
 
 
 class Command(metaclass=ABCMeta):
     @abstractmethod

Check failure on line 22 in /home/runner/work/FFM/FFM/model/plugin/processor.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/model/plugin/processor.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 from abc import abstractmethod, ABCMeta
 from enum import Enum
 
 # -----------------------------------------------------------------------------
 

Check failure on line 22 in /home/runner/work/FFM/FFM/model/driver/input_api.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/model/driver/input_api.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 from enum import Enum
 import misc.logging
 from model import context
 import os
 import random

Check failure on line 22 in /home/runner/work/FFM/FFM/commands/replacement_commands.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/commands/replacement_commands.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import time
 from commands.command_manager import register_plugin
 from model.plugin.command import Command
 from model.driver.input_api import *
 

Check failure on line 22 in /home/runner/work/FFM/FFM/processors/assert_torify.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/processors/assert_torify.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import os
 
 from model import context
 from model.plugin.processor import Processor, ProcessorType, ProcessorAction
 from processors.processor_manager import register_processor

Check failure on line 22 in /home/runner/work/FFM/FFM/processors/sample_output_processor.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/processors/sample_output_processor.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import re
 from model.plugin.processor import Processor, ProcessorType, ProcessorAction
 from processors.processor_manager import register_processor
 
 

Check failure on line 22 in /home/runner/work/FFM/FFM/test/command/test_log_command.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/FFM/FFM/test/command/test_log_command.py#L12-L22

     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 <http://www.gnu.org/licenses/>.
 """
+
 import os
 from commands.command_manager import parse_commands
 from model.driver.input_api import write_str
 from test.fixture.dummy_context import DummyContextTest