Exemplo n.º 1
0
    def test_example_02_hawkeye_config(self):
        data = self.download_from_malshare(
            'ee790d6f09c2292d457cbe92729937e06b3e21eb6b212bf2e32386ba7c2ff22c')
        rsrc = perc('RCDATA')(data)

        pipeline = xtp(
            'guid')[PBKDF2(48, 'rep[8]:H:00') | cca(rsrc)
                    | aes('CBC', 'x::32', '--iv=x::16', quiet=True)] | dnds

        result = json.loads(pipeline(data))
        config = result[2]['Data']['Members']

        self.assertEqual(config['_EmailServer'],
                         F'mail{"."}bandaichemical{"."}com')
        self.assertEqual(config['_EmailUsername'],
                         F'cv{"@"}bandaichemical{"."}com')
        self.assertEqual(config['_EmailPassword'], F'kingqqqqqq1164')
        self.assertEqual(config['_EmailPort'], 587)
Exemplo n.º 2
0
 def test_layered_frame_01(self):
     p = chop(4, '[') | chop(2, '[') | ccp('F', ']') | cca('?') | sep(']')
     self.assertEqual(p(B'OOOO' * 12), B'\n'.join([B'FOOFOO?'] * 12))
Exemplo n.º 3
0
 def test_only_local_scope(self):
     pipeline = rep[scope(1) | rep[scope(0) | cca('.')]]  # noqa
     self.assertEqual(pipeline(B'FOO'), B'FOOFOO.FOO')
Exemplo n.º 4
0
 def test_layer2_rescope(self):
     pipeline = rep(6)[scope('4:') | chop(1)[scope('1:') | cca('A')
                                             | scope(0) | ccp('-')]]  # noqa
     self.assertEqual(pipeline(B'NA'), B'NANANANA-NAA-NAA')
Exemplo n.º 5
0
 def test_layer1_rescope(self):
     pipeline = rep[scope(0) | cca(',') | scope(1) | cca('.')]  # noqa
     self.assertEqual(pipeline(B'FOO'), B'FOO,FOO.')
Exemplo n.º 6
0
 def test_documentation_example_02(self):
     self.assertEqual(B'FOO.FOO.\nFOO.FOO.', (r.chop(4)[r.chop(2)[r.ccp('F') | r.cca('.')] | r.sep])(B'OOOOOOOO'))