Beispiel #1
0
    async def test_run(self):
        passwords = [str(random.random()) for _ in range(0, 20)]

        # Orchestrate the running of these operations
        async with MemoryOrchestrator.basic_config(*OPIMPS) as orchestrator:

            definitions = Operation.definitions(*OPERATIONS)

            passwords = [
                Input(value=password,
                      definition=definitions['UnhashedPassword'],
                      parents=None) for password in passwords
            ]

            output_spec = Input(value=['ScryptPassword'],
                                definition=definitions['get_single_spec'],
                                parents=None)

            async with orchestrator() as octx:
                # Add our inputs to the input network with the context being the URL
                for password in passwords:
                    await octx.ictx.add(
                        MemoryInputSet(
                            MemoryInputSetConfig(
                                ctx=StringInputSetContext(password.value),
                                inputs=[password, output_spec])))
                try:
                    async for _ctx, results in octx.run_operations(
                            strict=True):
                        self.assertTrue(results)
                except AttributeError as error:
                    if "module 'hashlib' has no attribute 'scrypt'" \
                            in str(error):
                        return
                    raise
Beispiel #2
0
    async def test_run(self):
        dataflow = DataFlow.auto(*OPIMPS)
        passwords = [str(random.random()) for _ in range(0, 20)]

        # Orchestrate the running of these operations
        async with MemoryOrchestrator.withconfig({}) as orchestrator:

            definitions = Operation.definitions(*OPERATIONS)

            passwords = [
                Input(
                    value=password,
                    definition=definitions["UnhashedPassword"],
                    parents=None,
                ) for password in passwords
            ]

            output_spec = Input(
                value=["ScryptPassword"],
                definition=definitions["get_single_spec"],
                parents=None,
            )

            async with orchestrator(dataflow) as octx:
                try:
                    async for _ctx, results in octx.run({
                            password.value: [password, output_spec]
                            for password in passwords
                    }):
                        self.assertTrue(results)
                except AttributeError as error:
                    raise
Beispiel #3
0
    async def test_run(self):
        repos = [
            "http://pkg.freebsd.org/FreeBSD:13:amd64/latest/All/ImageMagick7-7.0.8.48.txz",
            "https://download.clearlinux.org/releases/10540/clear/x86_64/os/Packages/sudo-setuid-1.8.17p1-34.x86_64.rpm",
            "https://rpmfind.net/linux/fedora/linux/updates/29/Everything/x86_64/Packages/g/gzip-1.9-9.fc29.x86_64.rpm",
            "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/20/Everything/x86_64/os/Packages/c/curl-7.32.0-3.fc20.x86_64.rpm",
        ]

        dataflow = DataFlow.auto(
            URLToURLBytes,
            files_in_rpm,
            urlbytes_to_rpmfile,
            urlbytes_to_tarfile,
            is_binary_pie,
            Associate,
            cleanup_rpm,
        )
        async with MemoryOrchestrator.withconfig({}) as orchestrator:

            definitions = Operation.definitions(*OPERATIONS)

            async with orchestrator(dataflow) as octx:
                async for ctx, results in octx.run(
                    {
                        URL: [
                            Input(value=URL, definition=definitions["URL"]),
                            Input(
                                value=["rpm_filename", "binary_is_PIE"],
                                definition=definitions["associate_spec"],
                            ),
                        ]
                        for URL in repos
                    },
                    strict=True,
                ):
                    self.assertTrue(results)