Exemplo n.º 1
0
sys.path.append("..")
from lib.REST_WRAPPER import rest, create_new_config, create_traffic_profile, run_test, collect_stats

# CyPerf API test with 1 Traffic profile, 1 App, Throughput objective, custom payload and B2B agents
test_duration = 60
create_new_config()
create_traffic_profile(
    apps=["Portal Chrome to Apache"],
    objective="Throughput",
    objective_value=10,
    objective_unit="Mbps",
    duration=test_duration,
)
rest.set_application_custom_payload(appName="Portal Chrome to Apache 1",
                                    actionName="Upload Image",
                                    paramName="Uploaded file",
                                    fileName="../resources/payload_file")
rest.assign_agents()
rest.start_test()
start_time = time.time()
real_time_stats = []
while time.time() - start_time < test_duration:
    real_time_stats.append({})
    for stat in rest.get_available_stats_name():
        real_time_stats[-1][stat] = rest.get_stats_values(statName=stat)
print(real_time_stats)
print('Number of read in {} seconds is {}'.format(test_duration,
                                                  len(real_time_stats)))
rest.wait_test_finished()
collect_stats("../test_results", "stats_during_runtime")
import sys
sys.path.append("..")
from lib.REST_WRAPPER import rest, create_new_config, create_traffic_profile, run_test, collect_stats

# CyPerf API test with 1 Traffic profile, 3 Apps, Throughput objective, 1 DUT, static IP network ranges and B2B agents
test_duration = 60
create_new_config()
create_traffic_profile(
    apps=[
        "Portal Chrome to Apache", "eBanking Chrome to Apache",
        "Social Network Chrome to Apache"
    ],
    objective="Throughput",
    objective_value=10,
    objective_unit="Mbps",
    duration=test_duration,
)
rest.assign_agents()
rest.set_dut_host(host="1.2.3.4")
rest.set_https_health_check_port(port=8443)
rest.set_ip_range_automatic_ip(ip_auto=False, network_segment=1)
rest.set_ip_range_ip_start(ip_start="10.20.30.1", network_segment=1)
rest.set_ip_range_automatic_ip(ip_auto=False, network_segment=2)
rest.set_ip_range_ip_start(ip_start="10.20.30.2", network_segment=2)
run_test()
collect_stats("../test_results", "test_traffic_profile_1_app")
import sys
sys.path.append("..")
from lib.REST_WRAPPER import rest, create_new_config, create_attack_profile, create_traffic_profile, run_test, collect_stats

# CyPerf API test with 1 Attack profile, 1 Strike, 1 Traffic profile, 1 App, and B2B agents
test_duration = 60
create_new_config()
create_attack_profile(attacks=["Portal XSS Attack on Apache server"],
                      objective_value=50,
                      max_concurrent_attacks=5,
                      duration=test_duration,
                      ssl="TLSv1.2")
create_traffic_profile(
    apps=["Portal Chrome to Apache"],
    objective="Throughput",
    objective_value=10,
    objective_unit="Mbps",
    duration=test_duration,
)
agents_IPs = rest.get_agents_ips()
rest.assign_agents_by_ip(agents_ips=agents_IPs[0], network_segment=1)
rest.assign_agents_by_ip(agents_ips=agents_IPs[1], network_segment=2)
run_test()
collect_stats("../test_results", "test_attack_profile_1_strike")
import sys
sys.path.append("..")
from lib.REST_WRAPPER import rest, create_new_config, run_test, collect_stats


# CyPerf API test with 1 imported test config, Primary/Secondary objectives, SSL enabled and B2B agents
test_duration = 60
create_new_config("../test_configs/b2b_portal_chrome_to_apache.zip")
rest.set_test_duration(test_duration)
rest.set_primary_objective(objective="Throughput")
rest.add_secondary_objective()
rest.add_secondary_objective_value(objective="Simulated users", objective_value=5)
rest.set_traffic_profile_client_tls(version="TLSv1.2")
rest.set_traffic_profile_server_tls(version="TLSv1.2")
rest.assign_agents()
run_test()
collect_stats("../test_results", "test_imported_test_config_seconday_objective")
Exemplo n.º 5
0
import sys
sys.path.append("..")
from lib.REST_WRAPPER import rest, create_new_config, create_attack_profile, run_test, collect_stats


# CyPerf API test with 1 Attack profile, 2 Strikes, custom playlist and B2B agents
test_duration = 60
create_new_config()
create_attack_profile(
    attacks=["Portal XSS Attack on Apache server", "eBanking Attack on Chrome browser"],
    objective_value=50,
    max_concurrent_attacks=5,
    duration=test_duration,
    ssl="TLSv1.2")
rest.set_attack_custom_playlist(
    attackName="Portal XSS Attack on Apache server 1",
    actionName="Login",
    paramName="Login username",
    fileName="Strike SQLi Vector Detect MSSQL.csv"
)
rest.set_attack_custom_playlist(
    attackName="Portal XSS Attack on Apache server 1",
    actionName="Login",
    paramName="Login password",
    fileName="Strike SQLi Vector Detect MSSQL.csv"
)
rest.assign_agents()
run_test()
collect_stats("../test_results", "test_attack_profile_1_strike_custom_playlist")
import sys
sys.path.append("..")
from lib.REST_WRAPPER import rest, create_new_config, create_traffic_profile, run_test, collect_stats

# CyPerf API test with 1 Traffic profile, 1 App, Throughput objective, custom payload and B2B agents
test_duration = 60
create_new_config()
create_traffic_profile(
    apps=["Portal Chrome to Apache"],
    objective="Throughput",
    objective_value=10,
    objective_unit="Mbps",
    duration=test_duration,
)
rest.set_application_custom_payload(appName="Portal Chrome to Apache 1",
                                    actionName="Upload Image",
                                    paramName="Uploaded file",
                                    fileName="../resources/payload_file")
rest.assign_agents()
run_test()
collect_stats("../test_results", "test_traffic_profile_1_app_custom_payload")