marioskourtesis/wafbypasser — pull request #2 by DePierre (2014-05-19 15:31:20+00:00)
Title: Fix usages of python's basic features.

As my Peer Review for the GSoC, I changed your source code in order to use the python's basic features such as:

+ Apply for each loops principle.
+ Use the keyword `in` instead of `find()` when you don't need to know the .
+ Use the keyword `with` in order to open the payloads file.

For instance, the code:
```python
for i in range(0, len(packets)):
http_client.fetch(
packets[i],
# . . .
```
Can be written as follow:
```python
for packet in packets:
http_client.fetch(
packet,
# . . .
```

For instance, the code:
```python
if url.find(self.fsig) > -1: # check if we are fuzzing url or headers
fuzzing_url = True
```
Can be written (since you don't care about the index):
```python
if self.fsig in url: # check if we are fuzzing url or headers
fuzzing_url = True
```

Check the `load_payload_file` which now uses the `with` statement. That way you dont have to explicitely close your file handle since it is implicitely closed when python reaches the end of the `with` statement.
Plus it now uses the `readlines()` function and the `continue` statement instead of using a boolean when checking the constraints.

**I do not advise you** to merge that pull request without testing it. Even though I did not change the semantic of your code, an error might have been added into my code.
**I advise you** to check the changes in order to know what python can offer.