Commit d1bcca56 authored by Hardik Zinzuvadiya's avatar Hardik Zinzuvadiya
Browse files

Phase 13: Python 3 modernization and os.system cleanup

- Replace os.system("cd X; ...") no-op cd subshells with subprocess.run(cwd=...)
  in: xss_attack.py (XSSCon, XanXSS), payload_creator.py (TheFatRat update/troubleshoot),
      forensics.py (BulkExtractor gui/cli), phishing_attack.py (BlackPhish update)
- Replace os.system echo+boxes+lolcat in post_exploitation.py with console.print
- Fix socialmedia_finder.py: print()+os.system+lolcat → subprocess+console.print
- Fix forensics.py cli_mode: os.system apt/bulk_extractor → subprocess.run list form
parent daf253d2
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -43,21 +43,26 @@ class BulkExtractor(HackingTool):
        ], installable=False, runnable=False)

    def gui_mode(self):
        import subprocess
        from config import get_tools_dir
        console.print(Panel(Text(self.TITLE, justify="center"), style="bold magenta"))
        console.print("[bold magenta]Cloning repository and attempting to run GUI...[/]")
        os.system("git clone https://github.com/simsong/bulk_extractor.git")
        os.system("ls src/ && cd .. && cd java_gui && ./BEViewer")
        tools_dir = get_tools_dir()
        subprocess.run(["git", "clone", "https://github.com/simsong/bulk_extractor.git"],
                       cwd=str(tools_dir))
        be_dir = tools_dir / "bulk_extractor"
        subprocess.run(["./BEViewer"], cwd=str(be_dir / "java_gui"))
        console.print(
            "[magenta]If you get an error after clone go to /java_gui/src/ and compile the .jar file && run ./BEViewer[/]")
        console.print(
            "[magenta]Please visit for more details about installation: https://github.com/simsong/bulk_extractor[/]")

    def cli_mode(self):
        import subprocess
        console.print(Panel(Text(self.TITLE + " - CLI Mode", justify="center"), style="bold magenta"))
        os.system("sudo apt install bulk-extractor")
        console.print("[magenta]Showing bulk_extractor help and options:[/]")
        os.system("bulk_extractor -h")
        os.system('echo "bulk_extractor [options] imagefile" | boxes -d headline | lolcat')
        subprocess.run(["sudo", "apt", "install", "-y", "bulk-extractor"])
        console.print("[magenta]bulk_extractor [options] imagefile[/]")
        subprocess.run(["bulk_extractor", "-h"])


class Guymager(HackingTool):
+8 −8
Original line number Diff line number Diff line
@@ -28,14 +28,14 @@ class FacialFind(HackingTool):
    PROJECT_URL = "https://github.com/Greenwolf/social_mapper"

    def run(self):
        os.system("cd social_mapper/setup")
        os.system("sudo python social_mapper.py -h")
        print("""\033[95m 
                You have to set Username and password of your AC Or Any Fack Account
                [#] Type in Terminal nano social_mapper.py
        """)
        os.system(
            'echo "python social_mapper.py -f [<imageFoldername>] -i [<imgFolderPath>] -m fast [<AcName>] -fb -tw"| boxes | lolcat')
        from config import get_tools_dir
        import subprocess
        setup_dir = get_tools_dir() / "social_mapper" / "setup"
        subprocess.run(["python3", "social_mapper.py", "-h"], cwd=str(setup_dir))
        console.print(
            "[bold magenta]Set username and password in social_mapper.py before running.[/]\n"
            "[magenta]Usage: python social_mapper.py -f <folder> -i <path> -m fast <AcName> -fb -tw[/]"
        )


class FindUser(HackingTool):
+9 −2
Original line number Diff line number Diff line
@@ -23,10 +23,17 @@ class TheFatRat(HackingTool):
        ])

    def update(self):
        os.system("cd TheFatRat && bash update && chmod +x setup.sh && bash setup.sh")
        from config import get_tools_dir
        cwd = str(get_tools_dir() / "TheFatRat")
        subprocess.run(["bash", "update"], cwd=cwd)
        subprocess.run(["chmod", "+x", "setup.sh"], cwd=cwd)
        subprocess.run(["bash", "setup.sh"], cwd=cwd)

    def troubleshoot(self):
        os.system("cd TheFatRat && sudo chmod +x chk_tools && ./chk_tools")
        from config import get_tools_dir
        cwd = str(get_tools_dir() / "TheFatRat")
        subprocess.run(["chmod", "+x", "chk_tools"], cwd=cwd)
        subprocess.run(["./chk_tools"], cwd=cwd)


class Brutal(HackingTool):
+3 −1
Original line number Diff line number Diff line
@@ -199,7 +199,9 @@ class BlackPhish(HackingTool):
        super().__init__([("Update", self.update)])

    def update(self):
        os.system("cd BlackPhish && sudo bash update.sh")
        import subprocess
        from config import get_tools_dir
        subprocess.run(["bash", "update.sh"], cwd=str(get_tools_dir() / "BlackPhish"))


class Dnstwist(HackingTool):
+6 −4
Original line number Diff line number Diff line
@@ -20,10 +20,12 @@ class Vegile(HackingTool):
    PROJECT_URL = "https://github.com/Screetsec/Vegile"

    def before_run(self):
        os.system('echo "You can Use Command: \n'
                  '[!] Vegile -i / --inject [backdoor/rootkit] \n'
                  '[!] Vegile -u / --unlimited [backdoor/rootkit] \n'
                  '[!] Vegile -h / --help"|boxes -d parchment')
        console.print(
            "[bold magenta]Vegile commands:[/]\n"
            "  Vegile -i / --inject [backdoor/rootkit]\n"
            "  Vegile -u / --unlimited [backdoor/rootkit]\n"
            "  Vegile -h / --help"
        )


class ChromeKeyLogger(HackingTool):
Loading