forked from knownsec/pocsuite3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_api_diy_options.py
63 lines (56 loc) · 1.78 KB
/
test_api_diy_options.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import unittest
from pocsuite3.api import init_pocsuite
from pocsuite3.api import start_pocsuite
from pocsuite3.api import get_results
from pocsuite3.api import paths
class TestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def verify_result(self):
config = {
'url': ['https://www.baidu.com/'],
'poc': [os.path.join(paths.POCSUITE_ROOT_PATH, "../tests/login_demo.py")],
'username': "asd",
'password': 'asdss',
'verbose': 0,
"timeout": 10,
}
init_pocsuite(config)
start_pocsuite()
result = get_results().pop()
self.assertTrue(result.status == 'success')
def test_cookie(self):
config = {
'url': ['http://httpbin.org/post'],
'poc': [os.path.join(paths.POCSUITE_ROOT_PATH, "../tests/login_demo.py")],
'username': "asd",
'password': 'asdss',
'cookie': 'test=1',
'verbose': 0,
"timeout": 10,
}
init_pocsuite(config)
start_pocsuite()
result = get_results().pop()
self.assertTrue(result.status == 'success')
def test_cookie_dict_params(self):
config = {
'url': ['http://httpbin.org/post'],
'poc': [os.path.join(paths.POCSUITE_ROOT_PATH, "../tests/login_demo.py")],
'username': "asd",
'password': 'asdss',
'cookie': {
"test": '123'
},
'verbose': 0,
"timeout": 10,
}
init_pocsuite(config)
start_pocsuite()
result = get_results().pop()
self.assertTrue(result.status == 'success')
def test_import_run(self):
self.verify_result()