Skip to content

Commit

Permalink
Ignore error when parsing Client row.
Browse files Browse the repository at this point in the history
Explanation of bug (Why error wasn't being caught):

```
try:
    ...
except IndexError, ValueError:
    # Only catches IndexError.
    # ValueError is a *variable* holding the IndexError !
```
  • Loading branch information
derv82 committed Feb 27, 2018
1 parent 080e674 commit af5e3aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion py/Airodump.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_targets_from_csv(csv_filename):
# The current row corresponds to a "Client" (computer)
try:
client = Client(row)
except IndexError, ValueError:
except (IndexError, ValueError) as e:
# Skip if we can't parse the client row
continue

Expand Down
13 changes: 4 additions & 9 deletions py/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,10 @@ def __init__(self, fields):
5 BSSID, (Access Point's MAC address)
6 Probed ESSIDs
'''
try:
self.station = fields[0].strip()
self.power = int(fields[3].strip())
self.packets = int(fields[4].strip())
self.bssid = fields[5].strip()
except ValueError, e:
print "\nValueError ({})".format(e)
print "\twhile parsing {}".format(fields)
raise e
self.station = fields[0].strip()
self.power = int(fields[3].strip())
self.packets = int(fields[4].strip())
self.bssid = fields[5].strip()


def __str__(self):
Expand Down

0 comments on commit af5e3aa

Please sign in to comment.