131 Static method to determine all permutations of host name and path |
131 Static method to determine all permutations of host name and path |
132 which can be applied to blacklisted URLs. |
132 which can be applied to blacklisted URLs. |
133 |
133 |
134 @param url URL string to be permuted |
134 @param url URL string to be permuted |
135 @type str |
135 @type str |
136 @return generator of permuted URL strings |
136 @yield permutated URL strings |
137 @rtype generator of str |
137 @ytype str |
138 """ |
138 """ |
139 def hostPermutations(host): |
139 def hostPermutations(host): |
140 """ |
140 """ |
141 Method to generate the permutations of the host name. |
141 Method to generate the permutations of the host name. |
142 |
142 |
143 @param host host name |
143 @param host host name |
144 @type str |
144 @type str |
145 @return generator of permuted host names |
145 @yield permutated host names |
146 @rtype generator of str |
146 @ytype str |
147 """ |
147 """ |
148 if re.match(r'\d+\.\d+\.\d+\.\d+', host): |
148 if re.match(r'\d+\.\d+\.\d+\.\d+', host): |
149 yield host |
149 yield host |
150 return |
150 return |
151 parts = host.split('.') |
151 parts = host.split('.') |
159 """ |
159 """ |
160 Method to generate the permutations of the path. |
160 Method to generate the permutations of the path. |
161 |
161 |
162 @param path path to be processed |
162 @param path path to be processed |
163 @type str |
163 @type str |
164 @return generator of permuted paths |
164 @yield permutated paths |
165 @rtype generator of str |
165 @ytype str |
166 """ |
166 """ |
167 yield path |
167 yield path |
168 query = None |
168 query = None |
169 if '?' in path: |
169 if '?' in path: |
170 path, query = path.split('?', 1) |
170 path, query = path.split('?', 1) |