[GH-ISSUE #2299] krbpa2john.py fix for broken user extraction #1538

Closed
opened 2026-10-15 04:19:35 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @ghostop14 on GitHub (Oct 6, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2299

Originally assigned to: @kholia on GitHub.

Recently the tshark conversion of pcap files was failing on Kali rolling when extracting the user field from the packets. Some troubleshooting found that the field name has changed in the pdml output.

In krbpa2john.py, the field name "kerberos.KerberosString" should be changed to "kerberos.CNameString" in the line:

r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]')

Originally created by @ghostop14 on GitHub (Oct 6, 2016). Original GitHub issue: https://github.com/openwall/john/issues/2299 Originally assigned to: @kholia on GitHub. Recently the tshark conversion of pcap files was failing on Kali rolling when extracting the user field from the packets. Some troubleshooting found that the field name has changed in the pdml output. In krbpa2john.py, the field name "kerberos.KerberosString" should be changed to "kerberos.CNameString" in the line: r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]')
bsakaguchi 2026-10-15 04:19:35 +07:00
Author
Owner

@magnumripper commented on GitHub (Oct 6, 2016):

Thanks for reporting. Would this change break older stuff?

<!-- gh-comment-id:252059139 --> @magnumripper commented on GitHub (Oct 6, 2016): Thanks for reporting. Would this change break older stuff?
Author
Owner

@ghostop14 commented on GitHub (Oct 6, 2016):

Possibly. It may be best to add it as an additional "or" clause for
backward compatibility. It just showed up as an issue in Kali rolling
within the past few months. I had just used the script back in August as
it is in the git repo and it had worked fine, so something's changed,
possibly in tshark since then to produce the field name change.

On Thu, Oct 6, 2016 at 3:07 PM, magnum notifications@github.com wrote:

Thanks for reporting. Would this change break older stuff?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/magnumripper/JohnTheRipper/issues/2299#issuecomment-252059139,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMY1FSp6iqfRCYpnO3D3201fMHHjOoUcks5qxUbvgaJpZM4KQRGZ
.

<!-- gh-comment-id:252063582 --> @ghostop14 commented on GitHub (Oct 6, 2016): Possibly. It may be best to add it as an additional "or" clause for backward compatibility. It just showed up as an issue in Kali rolling within the past few months. I had just used the script back in August as it is in the git repo and it had worked fine, so something's changed, possibly in tshark since then to produce the field name change. On Thu, Oct 6, 2016 at 3:07 PM, magnum notifications@github.com wrote: > Thanks for reporting. Would this change break older stuff? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > https://github.com/magnumripper/JohnTheRipper/issues/2299#issuecomment-252059139, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AMY1FSp6iqfRCYpnO3D3201fMHHjOoUcks5qxUbvgaJpZM4KQRGZ > .
Author
Owner

@magnumripper commented on GitHub (Oct 6, 2016):

@kholia will you do this please? I'd probably just break something 😝

<!-- gh-comment-id:252089219 --> @magnumripper commented on GitHub (Oct 6, 2016): @kholia will you do this please? I'd probably just break something 😝
Author
Owner

@kholia commented on GitHub (Oct 7, 2016):

This code is quite fragile due to its dependency on tshark (which keeps changing its field names). I have already spent quite some time on this program.

@ghostop14 Does the following patch work for you on Kali Linux?

diff --git a/run/krbpa2john.py b/run/krbpa2john.py
index 4a86fcc..5f0c53f 100755
--- a/run/krbpa2john.py
+++ b/run/krbpa2john.py
@@ -85,7 +85,7 @@ def process_file(f):
             realm = r.attrib["show"]

             # locate cname
-            r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]')
+            r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]') or msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.CNameString"]')
             if r:
                 if isinstance(r, list):
                     r  = r[0]
<!-- gh-comment-id:252155447 --> @kholia commented on GitHub (Oct 7, 2016): This code is quite fragile due to its dependency on tshark (which keeps changing its field names). I have already spent quite some time on this program. @ghostop14 Does the following patch work for you on Kali Linux? ``` diff --git a/run/krbpa2john.py b/run/krbpa2john.py index 4a86fcc..5f0c53f 100755 --- a/run/krbpa2john.py +++ b/run/krbpa2john.py @@ -85,7 +85,7 @@ def process_file(f): realm = r.attrib["show"] # locate cname - r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]') + r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]') or msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.CNameString"]') if r: if isinstance(r, list): r = r[0] ```
Author
Owner

@ghostop14 commented on GitHub (Oct 8, 2016):

Yes worked great. Thanks!

On Fri, Oct 7, 2016 at 1:20 AM, Dhiru Kholia notifications@github.com
wrote:

This code is quite fragile due to its dependency on tshark (which keeps
changing its field names). I have already spent quite some time on this
program.

@ghostop14 https://github.com/ghostop14 Does the following patch work
for you on Kali Linux?

diff --git a/run/krbpa2john.py b/run/krbpa2john.py
index 4a86fcc..5f0c53f 100755
--- a/run/krbpa2john.py
+++ b/run/krbpa2john.py
@@ -85,7 +85,7 @@ def process_file(f):
realm = r.attrib["show"]

         # locate cname
  •        r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]')
    
  •        r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]') or msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.CNameString"]')
         if r:
             if isinstance(r, list):
                 r  = r[0]
    

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magnumripper/JohnTheRipper/issues/2299#issuecomment-252155447,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMY1FZbbcLODayWtatb9HSzT6s1jFEtlks5qxdamgaJpZM4KQRGZ
.

<!-- gh-comment-id:252432306 --> @ghostop14 commented on GitHub (Oct 8, 2016): Yes worked great. Thanks! On Fri, Oct 7, 2016 at 1:20 AM, Dhiru Kholia notifications@github.com wrote: > This code is quite fragile due to its dependency on tshark (which keeps > changing its field names). I have already spent quite some time on this > program. > > @ghostop14 https://github.com/ghostop14 Does the following patch work > for you on Kali Linux? > > diff --git a/run/krbpa2john.py b/run/krbpa2john.py > index 4a86fcc..5f0c53f 100755 > --- a/run/krbpa2john.py > +++ b/run/krbpa2john.py > @@ -85,7 +85,7 @@ def process_file(f): > realm = r.attrib["show"] > > ``` > # locate cname > ``` > - r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]') > - r = msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.KerberosString"]') or msg.xpath('.//field[@name="kerberos.kdc_req_body"]//field[@name="kerberos.name_string"]') or msg.xpath('.//field[@name="kerberos.req_body_element"]//field[@name="kerberos.CNameString"]') > if r: > if isinstance(r, list): > r = r[0] > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > https://github.com/magnumripper/JohnTheRipper/issues/2299#issuecomment-252155447, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AMY1FZbbcLODayWtatb9HSzT6s1jFEtlks5qxdamgaJpZM4KQRGZ > .
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1538
No description provided.