Skip to content

Commit

Permalink
pyrit: provide patch files.
Browse files Browse the repository at this point in the history
  • Loading branch information
noptrix committed Dec 6, 2024
1 parent 4b8d329 commit 18778f3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/pyrit/fix-broken-join.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
Date: Tue, 4 Feb 2020 12:35:11 +0100
Subject: Fix broken join

---
cpyrit/storage.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpyrit/storage.py b/cpyrit/storage.py
index 3933f62..dcf3a51 100644
--- a/cpyrit/storage.py
+++ b/cpyrit/storage.py
@@ -962,7 +962,10 @@ if 'sqlalchemy' in sys.modules:
pwtotal = 0 if pwtotal is None else int(pwtotal)
q = session.query(ESSID_DBObject.essid,
sql.func.sum(PAW2_DBObject.numElems))
- q = q.outerjoin(PYR2_DBObject).outerjoin(PAW2_DBObject)
+ q = q.outerjoin(PYR2_DBObject,
+ PYR2_DBObject.essid_id==ESSID_DBObject.essid_id)
+ q = q.outerjoin(PAW2_DBObject,
+ PAW2_DBObject.key==PYR2_DBObject.key)
q = q.group_by(ESSID_DBObject.essid)
essid_results = {}
for essid, pwcount in q:
42 changes: 42 additions & 0 deletions packages/pyrit/scapy-2.3.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 14ec997174b8e8fd20d22b6a97c57e19633f12a0 Mon Sep 17 00:00:00 2001
From: Ilya Terentyev <[email protected]>
Date: Tue, 1 Nov 2016 20:40:15 +0300
Subject: [PATCH] update isinstance(EnumField) for scapy 2.3.3+

scapy 2.3.2- requires that scapy.fields.EnumField is passed to
isinstance, while scapy 2.3.3+ needs scapy.fields._EnumField.
This patch accomodates pyrit for both versions.
Fixes #500.
---
cpyrit/pckttools.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/cpyrit/pckttools.py b/cpyrit/pckttools.py
index 326829d..d58fff1 100644
--- a/cpyrit/pckttools.py
+++ b/cpyrit/pckttools.py
@@ -54,12 +54,23 @@
scapy.layers.dot11.PrismHeader)


+def isEnumField(f):
+ """Return True if f is an instance of EnumField. This function tries to be
+ portable: scapy versions 2.3.2 and earlier need isinstance(EnumField),
+ while scapy 2.3.3+ requires isinstance(_EnumField).
+ """
+ try:
+ return isinstance(f, scapy.fields._EnumField)
+ except AttributeError:
+ return isinstance(f, scapy.fields.EnumField)
+
+
def isFlagSet(self, name, value):
"""Return True if the given field 'includes' the given value.
Exact behaviour of this function is specific to the field-type.
"""
field, val = self.getfield_and_val(name)
- if isinstance(field, scapy.fields.EnumField):
+ if isEnumField(field):
if val not in field.i2s:
return False
return field.i2s[val] == value

0 comments on commit 18778f3

Please sign in to comment.