Run all security tests
()
| 625 | |
| 626 | |
| 627 | def main(): |
| 628 | """Run all security tests""" |
| 629 | print("=" * 80) |
| 630 | print("Serial Studio API Security Test Suite") |
| 631 | print("=" * 80) |
| 632 | print("\nWARNING: This will attempt to exploit the Serial Studio API.") |
| 633 | print("Only run this against a test instance!") |
| 634 | print() |
| 635 | |
| 636 | tester = SecurityTester() |
| 637 | |
| 638 | try: |
| 639 | # Check if server is running |
| 640 | with SerialStudioClient() as client: |
| 641 | print("[+] Connected to Serial Studio API\n") |
| 642 | |
| 643 | # Run all attack categories |
| 644 | test_json_parsing_exploits(tester) |
| 645 | test_command_injection(tester) |
| 646 | test_buffer_exhaustion(tester) |
| 647 | test_batch_abuse(tester) |
| 648 | test_connection_exhaustion(tester) |
| 649 | test_raw_data_injection(tester) |
| 650 | test_parameter_validation(tester) |
| 651 | test_information_disclosure(tester) |
| 652 | test_state_manipulation(tester) |
| 653 | |
| 654 | except ConnectionError as e: |
| 655 | print(f"[ERROR] Cannot connect to Serial Studio API: {e}") |
| 656 | print("Make sure Serial Studio is running with API Server enabled.") |
| 657 | return 1 |
| 658 | |
| 659 | except KeyboardInterrupt: |
| 660 | print("\n\n[!] Tests interrupted by user") |
| 661 | |
| 662 | finally: |
| 663 | # Generate report |
| 664 | tester.report() |
| 665 | |
| 666 | return 0 |
| 667 | |
| 668 | |
| 669 | if __name__ == "__main__": |
no test coverage detected