def test_benign(benign_fp):
    try:
        benign = imp.load_source('benign', benign_fp)
        from benign import Benign
        print 'Benign..'
        b = Benign()
        b.execute(HOST, PORT, '', '')
        res = b.result()
        print 'Result: %s' % str(res)
        assert res['ERROR'] == 0
    except AssertionError:
        print 'AssertionError while executing Benign'
        print traceback.format_exc()
        print '----------------------'
        print RED + 'ERROR' + ENDC
        sys.exit(2)
    except Exception:
        print 'Exception while executing Benign'
        print traceback.format_exc()
        print '----------------------'
        print RED + 'ERROR' + ENDC
        sys.exit(2)
Exemplo n.º 2
0
FLAG = 'xxxflagxxx'

print 'Setflag..'
sf = SetFlag()
sf.execute(HOST, PORT, FLAG)
res = sf.result()
print 'Result: %s' % str(res)
flag_id = res['FLAG_ID']
cookie = res['TOKEN']

print 'Exploit..'
e = Exploit()
e.execute(HOST, PORT, flag_id)
res = e.result()
print 'Result: %s' % str(res)
assert res['FLAG'] == FLAG

print 'Getflag..'
cf = GetFlag()
cf.execute(HOST, PORT, flag_id, cookie)
res = cf.result()
print 'Result: %s' % str(res)
assert res['FLAG'] == FLAG

print 'Benign..'
b = Benign()
b.execute(HOST, PORT)
res = b.result()
print 'Result: %s' % str(res)
assert res['ERROR'] == 0
Exemplo n.º 3
0
FLAG = 'xxxflagxxx'

print 'Setflag..'
sf = SetFlag()
sf.execute(HOST, PORT, FLAG)
res = sf.result()
print 'Result: %s' % str(res)
flag_id = res['FLAG_ID']
token = res['TOKEN']

print 'Exploit..'
e = Exploit()
e.execute(HOST, PORT, flag_id)
res = e.result()
print 'Result: %s' % str(res)
assert res['FLAG'] == FLAG

print 'Getflag..'
cf = GetFlag()
cf.execute(HOST, PORT, flag_id, token)
res = cf.result()
print 'Result: %s' % str(res)
assert res['FLAG'] == FLAG

print 'Benign..'
b = Benign()
b.execute(HOST, PORT, FLAG_ID, TOKEN)
res = b.result()
print 'Result: %s' % str(res)
assert res['ERROR'] == 0