| skipped 96 lines |
97 | 97 | | logger.end("ending") |
98 | 98 | | exit(0) |
99 | 99 | | except URLError as e: |
100 | | - | logger.critical(f"error: {e}") |
101 | | - | logger.end("ending") |
102 | | - | exit(0) |
| 100 | + | tried = 1 |
| 101 | + | logger.critical(f"{e.reason}. Ghauri is going to retry..") |
| 102 | + | response_ok = False |
| 103 | + | while tried <= conf.retry: |
| 104 | + | attack = inject_expression( |
| 105 | + | url, |
| 106 | + | data, |
| 107 | + | proxy, |
| 108 | + | delay=delay, |
| 109 | + | timesec=timesec, |
| 110 | + | timeout=timeout, |
| 111 | + | headers=headers, |
| 112 | + | parameter=parameter, |
| 113 | + | expression=expression, |
| 114 | + | is_multipart=is_multipart, |
| 115 | + | injection_type=injection_type, |
| 116 | + | ) |
| 117 | + | tried += 1 |
| 118 | + | if attack.ok: |
| 119 | + | response_ok = True |
| 120 | + | break |
| 121 | + | if response_ok: |
| 122 | + | return attack |
| 123 | + | else: |
| 124 | + | logger.end("ending") |
| 125 | + | exit(0) |
103 | 126 | | except ConnectionAbortedError as e: |
104 | 127 | | raise e |
105 | 128 | | except ConnectionRefusedError as e: |
| skipped 5 lines |
111 | 134 | | except TimeoutError as e: |
112 | 135 | | raise e |
113 | 136 | | except Exception as e: |
| 137 | + | tried = 1 |
| 138 | + | logger.critical(f"{e.reason}. Ghauri is going to retry..") |
| 139 | + | response_ok = False |
| 140 | + | while tried <= conf.retry: |
| 141 | + | attack = inject_expression( |
| 142 | + | url, |
| 143 | + | data, |
| 144 | + | proxy, |
| 145 | + | delay=delay, |
| 146 | + | timesec=timesec, |
| 147 | + | timeout=timeout, |
| 148 | + | headers=headers, |
| 149 | + | parameter=parameter, |
| 150 | + | expression=expression, |
| 151 | + | is_multipart=is_multipart, |
| 152 | + | injection_type=injection_type, |
| 153 | + | ) |
| 154 | + | tried += 1 |
| 155 | + | if attack.ok: |
| 156 | + | response_ok = True |
| 157 | + | break |
| 158 | + | if response_ok: |
| 159 | + | return attack |
114 | 160 | | raise e |
115 | 161 | | return attack |
116 | 162 | | |