From patchwork Mon Jan 2 14:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1720755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=imlTkHbw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Nl+GXt/9; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NlzFT2w7sz23dw for ; Tue, 3 Jan 2023 01:46:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=97Hfn79O+DNg73hLDo0z/KnI3oZQ8jJgRv0KTyhR8aE=; b=imlTkHbwa3SWLF wypSB+aHJ2T3Ht0xo3D3V6wALkfAngVxRqW1kSCmVdO49Cw2nifkO6YvKiD9vuEX25P13PcUmnjco Xudr1M5RucoRwLMa5NoUJFA3aOWor0wlcLmFsAYItR4ZNzcb5THlavXE5GYPe/LVlgIlkI3hQ3KrG sYbNfrAV1FnB/eOjXxm/UEFXvPloZ3vA7tDcpiiHwn9LUeBOUIOLnJu19p2PuBu33DABGgiNSqT3F 1fPHRsu4gFchBKYQhrktivOSZRgEuPPzdwIGXxg/NrYC1yrLbjpsBeU2pzX0ktjmv6lN6n9qxYDD5 hS6TMnLVHAs1caPF8TDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCM3J-00BqLT-9F; Mon, 02 Jan 2023 14:44:37 +0000 Received: from mga06b.intel.com ([134.134.136.31] helo=mga06.intel.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCM3D-00BqJe-Pj for hostap@lists.infradead.org; Mon, 02 Jan 2023 14:44:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672670671; x=1704206671; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sfPr+Yu9pLo9Ip7D3ER5hyJURa7TpLIfNmMT96K7rWc=; b=Nl+GXt/9wsuGWQyIBUS/TuNLZoodQbegD2GcJ5MVt5CMykmNdmCSmcTI +6cblbL2mS3RMvtS1m7AA+/QX38HUE0rVU9KsgI9BlfVh8dVq4ZfVYGGt NtS08MqNRL7Vgu+6qSU9pvctFH1iwsnNZpJNYMND068RvTWo32DtcRtO4 0eLKm53MPT6JzqjtzV6+f63DOIQlbkmrDu4Unu3DbteyOxXJE+V47diq3 MGnGb1T634fiUMQTEjcHy5Il7n21L5RDQznqq4O8eGEL3zz3FPuf0GbzD babnUb17FCIMf/2YHJdeO8djhJs80DVuys8KO9MIGBr49cvv+x9PIFBTb g==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="383794808" X-IronPort-AV: E=Sophos;i="5.96,294,1665471600"; d="scan'208";a="383794808" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 06:44:27 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="899896531" X-IronPort-AV: E=Sophos;i="5.96,294,1665471600"; d="scan'208";a="899896531" Received: from gdanny-mobl.ger.corp.intel.com (HELO aotchere-desk.intel.com) ([10.255.201.114]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 06:44:25 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Mordechay Goodstein , Andrei Otcheretianski Subject: [PATCH] utils: Move log2pcap to python3 Date: Mon, 2 Jan 2023 16:44:16 +0200 Message-Id: <20230102144416.43453-1-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230102_064432_058426_DDEEA616 X-CRM114-Status: UNSURE ( 8.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Mordechay Goodstein python2 is deprecated so move script to python3. While at it, make some minor adjustments. Signed-off-by: Mordechay Goodstein Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/utils/log2pcap.py | 9 +++++---- 1 file chan [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [134.134.136.31 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Mordechay Goodstein python2 is deprecated so move script to python3. While at it, make some minor adjustments. Signed-off-by: Mordechay Goodstein Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/utils/log2pcap.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/utils/log2pcap.py b/wpa_supplicant/utils/log2pcap.py index 141aecbe51..9a3f08de84 100755 --- a/wpa_supplicant/utils/log2pcap.py +++ b/wpa_supplicant/utils/log2pcap.py @@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -# Copyright (c) 2012, Intel Corporation +# Copyright (c) 2012-2022, Intel Corporation # # Author: Johannes Berg # @@ -8,6 +8,7 @@ # See README for more details. import sys, struct, re +from binascii import unhexlify def write_pcap_header(pcap_file): pcap_file.write( @@ -32,7 +33,7 @@ if __name__ == "__main__": sys.exit(2) input_file = open(input, 'r') - pcap_file = open(pcap, 'w') + pcap_file = open(pcap, 'wb') frame_re = re.compile(r'(([0-9]+.[0-9]{6}):\s*)?nl80211: MLME event frame - hexdump\(len=[0-9]*\):((\s*[0-9a-fA-F]{2})*)') write_pcap_header(pcap_file) @@ -47,7 +48,7 @@ if __name__ == "__main__": ts = 0 hexdata = m.group(3) hexdata = hexdata.split() - data = ''.join([chr(int(x, 16)) for x in hexdata]) + data = unhexlify("".join(hexdata)) pcap_addpacket(pcap_file, ts, data) input_file.close()