Beispiel #1
0
def import_from_script_in_same_dir():
    from foobar import foo, bar
    foo()
    bar()
    # Alternative import way
    import foobar
    foobar.foo()
    foobar.bar()
Beispiel #2
0
print("File Name: {}\nModule Name: {}".format( __file__, __name__))   # print __file__ and __name__

print("\nSymbol Table 1 {}\n{}:".format(__file__, dir())) # names in current scope 

import foobar

print("\nSymbol Table 2 {}\n{}:".format(__file__, dir())) # names in current scope after import of foobar

print("\nSymbol Table 3 {}\n{}:".format(__file__, dir(foobar))) # names in foobar

print()

foobar.foo()    # call functions in foobar.py as foobar.foo()

foobar.bar()
Beispiel #3
0
def test_bar():
    assert bar() == "bar"
Beispiel #4
0
print("File Name: {}\nModule Name: {}".format(
    __file__, __name__))  # print __file__ and __name__


def spam():
    print("In spam.py::spam()")


print("\nSymbol Table 1 {}\n{}:".format(__file__,
                                        dir()))  # names in current scope

from foobar import foo, bar

from foobar import spam as eggs

print("\nSymbol Table 2 {}\n{}:".format(
    __file__, dir()))  # names in current scope after import of foobar

print()

foo()  # call functions in foobar.py as foo()

bar()

spam()

eggs()
Beispiel #5
0
def test_bar():
    assert foobar.bar() == 'bar'
Beispiel #6
0
def test_bar():
    with my_app.test_client() as c:
        rv = c.get('/bar')
        assert rv.status_code == 200 and rv.data.decode() == foobar.bar()
Beispiel #7
0

for i in range(1, 600):
    log.info(io.recvline())
    challenge = io.recvlineS()
    log.info(challenge)
    if 'foo' in challenge:
        match = re.search('foo\((\?|\d+), (\?|\d+)\) = (\?|\d+)', challenge)
        args = [None if a == '?' else int(a) for a in match.groups()]

        # Iterations 50 and up contain flag information
        if i >= 50:
            if match.groups().index('?') == 1:
                set_flag_char(i, args[0], args[1], args[2])  # x is random_int
            elif match.groups().index('?') == 0:
                set_flag_char(i, args[0], args[1], args[2])  # y is random_int
            else:
                # skip this case for now, don't want to do the extra math
                pass
        io.sendline(str(foo(*args)))
    elif 'bar' in challenge:
        match = re.search('bar\((\?|\d+), (\?|\d+), (\?|\d+)\) = (\?|\d+)',
                          challenge)
        args = [None if a == '?' else int(a) for a in match.groups()]
        io.sendline(str(bar(*args)))
    log.info(io.recvline())

io.close()

display_flag_candidate()