Change in osmo-sim-auth[master]: Replace tabs by spaces

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Oct 28 17:24:19 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sim-auth/+/20896 )

Change subject: Replace tabs by spaces
......................................................................

Replace tabs by spaces

± pycodestyle osmo-sim-auth.py
osmo-sim-auth.py:31:1: W191 indentation contains tabs
osmo-sim-auth.py:32:1: W191 indentation contains tabs
[...]

Change-Id: Id026fcd3975113a8bec2e30c58ac7b521ec1707f
---
M osmo-sim-auth.py
1 file changed, 79 insertions(+), 79 deletions(-)

Approvals:
  laforge: Looks good to me, approved; Verified



diff --git a/osmo-sim-auth.py b/osmo-sim-auth.py
index 3224e15..c580dad 100755
--- a/osmo-sim-auth.py
+++ b/osmo-sim-auth.py
@@ -28,107 +28,107 @@
 from card.SIM import SIM
 
 def handle_usim(options, rand_bin, autn_bin):
-	u = USIM()
-	if not u:
-		print("Error opening USIM")
-		exit(1)
+    u = USIM()
+    if not u:
+        print("Error opening USIM")
+        exit(1)
 
-	if options.debug:
-		u.dbg = 2;
+    if options.debug:
+        u.dbg = 2;
 
-	imsi = u.get_imsi()
-	print("Testing USIM card with IMSI %s" % imsi)
+    imsi = u.get_imsi()
+    print("Testing USIM card with IMSI %s" % imsi)
 
-	print("\nUMTS Authentication")
-	ret = u.authenticate(rand_bin, autn_bin, ctx='3G')
+    print("\nUMTS Authentication")
+    ret = u.authenticate(rand_bin, autn_bin, ctx='3G')
         if ret == None:
                 print("UMTS Authentication failed")
                 exit(1)
-	if len(ret) == 1:
-		print("AUTS:\t%s" % b2a_hex(byteToString(ret[0])))
-	else:
-		print("RES:\t%s" % b2a_hex(byteToString(ret[0])))
-		print("CK:\t%s" % b2a_hex(byteToString(ret[1])))
-		print("IK:\t%s" % b2a_hex(byteToString(ret[2])))
-		if len(ret) == 4:
-			print("Kc:\t%s" % b2a_hex(byteToString(ret[3])))
+    if len(ret) == 1:
+        print("AUTS:\t%s" % b2a_hex(byteToString(ret[0])))
+    else:
+        print("RES:\t%s" % b2a_hex(byteToString(ret[0])))
+        print("CK:\t%s" % b2a_hex(byteToString(ret[1])))
+        print("IK:\t%s" % b2a_hex(byteToString(ret[2])))
+        if len(ret) == 4:
+            print("Kc:\t%s" % b2a_hex(byteToString(ret[3])))
 
-	print("\nGSM Authentication")
-	ret = u.authenticate(rand_bin, autn_bin, ctx='2G')
-	if not len(ret) == 2:
-		print("Error during 2G authentication")
-		exit(1)
-	print("SRES:\t%s" % b2a_hex(byteToString(ret[0])))
-	print("Kc:\t%s" % b2a_hex(byteToString(ret[1])))
+    print("\nGSM Authentication")
+    ret = u.authenticate(rand_bin, autn_bin, ctx='2G')
+    if not len(ret) == 2:
+        print("Error during 2G authentication")
+        exit(1)
+    print("SRES:\t%s" % b2a_hex(byteToString(ret[0])))
+    print("Kc:\t%s" % b2a_hex(byteToString(ret[1])))
 
 def handle_sim(options, rand_bin):
-	s= SIM()
-	if not s:
-		print("Error opening SIM")
-		exit(1)
+    s= SIM()
+    if not s:
+        print("Error opening SIM")
+        exit(1)
 
-	imsi = s.get_imsi()
-	if not options.ipsec:
-		print("Testing SIM card with IMSI %s" % imsi)
-		print("\nGSM Authentication")
+    imsi = s.get_imsi()
+    if not options.ipsec:
+        print("Testing SIM card with IMSI %s" % imsi)
+        print("\nGSM Authentication")
 
-	ret = s.run_gsm_alg(rand_bin)
+    ret = s.run_gsm_alg(rand_bin)
 
-	if not options.ipsec:
-		print("SRES:\t%s" % b2a_hex(byteToString(ret[0])))
-		print("Kc:\t%s" % b2a_hex(byteToString(ret[1])))
+    if not options.ipsec:
+        print("SRES:\t%s" % b2a_hex(byteToString(ret[0])))
+        print("Kc:\t%s" % b2a_hex(byteToString(ret[1])))
 
-	if options.ipsec:
-		print("1%s at uma.mnc%s.mcc%s.3gppnetwork.org,%s,%s,%s" % (imsi, imsi[3:6], imsi[0:3], b2a_hex(byteToString(rand_bin)), b2a_hex(byteToString(ret[0])), b2a_hex(byteToString(ret[1]))))
+    if options.ipsec:
+        print("1%s at uma.mnc%s.mcc%s.3gppnetwork.org,%s,%s,%s" % (imsi, imsi[3:6], imsi[0:3], b2a_hex(byteToString(rand_bin)), b2a_hex(byteToString(ret[0])), b2a_hex(byteToString(ret[1]))))
 
 def handle_sim_info(options):
-	s= SIM()
-	if not s:
-		print("Error opening SIM")
-		exit(1)
+    s= SIM()
+    if not s:
+        print("Error opening SIM")
+        exit(1)
 
-	if options.debug:
-		s.dbg = 1
+    if options.debug:
+        s.dbg = 1
 
-	s.caller.get(options.param)()
+    s.caller.get(options.param)()
 
 if __name__ == "__main__":
-	parser = OptionParser()
-	parser.add_option("-a", "--autn", dest="autn",
-			  help="AUTN parameter from AuC")
-	parser.add_option("-r", "--rand", dest="rand",
-			  help="RAND parameter from AuC")
-	parser.add_option("-d", "--debug", dest="debug",
-			  help="Enable debug output",
-			  action="store_true")
-	parser.add_option("-s", "--sim", dest="sim",
-			  help="SIM mode (default: USIM)",
-			  action="store_true", default=False)
-	parser.add_option("-I", "--ipsec", dest="ipsec",
-			  help="IPSEC mode for strongswan triplets.dat",
-			  action="store_true")
-	parser.add_option("-p", "--param", dest="param",
-			  help="Retrieve SIM card parameter (mode: SIM) KC|IMSI|LOCI|HPPLMN|PLMN_SEL|ICCID|ACC|FPLMN|MSISDN|SMSP")
+    parser = OptionParser()
+    parser.add_option("-a", "--autn", dest="autn",
+              help="AUTN parameter from AuC")
+    parser.add_option("-r", "--rand", dest="rand",
+              help="RAND parameter from AuC")
+    parser.add_option("-d", "--debug", dest="debug",
+              help="Enable debug output",
+              action="store_true")
+    parser.add_option("-s", "--sim", dest="sim",
+              help="SIM mode (default: USIM)",
+              action="store_true", default=False)
+    parser.add_option("-I", "--ipsec", dest="ipsec",
+              help="IPSEC mode for strongswan triplets.dat",
+              action="store_true")
+    parser.add_option("-p", "--param", dest="param",
+              help="Retrieve SIM card parameter (mode: SIM) KC|IMSI|LOCI|HPPLMN|PLMN_SEL|ICCID|ACC|FPLMN|MSISDN|SMSP")
 
-	(options, args) = parser.parse_args()
+    (options, args) = parser.parse_args()
 
-	if options.param:
-		handle_sim_info(options)
-		exit(2)
+    if options.param:
+        handle_sim_info(options)
+        exit(2)
 
-	if not options.rand:
-		print("You have to specify RAND")
-		exit(2)
+    if not options.rand:
+        print("You have to specify RAND")
+        exit(2)
 
-	rand_bin = stringToByte(a2b_hex(options.rand))
-	if options.autn:
-		autn_bin = stringToByte(a2b_hex(options.autn))
+    rand_bin = stringToByte(a2b_hex(options.rand))
+    if options.autn:
+        autn_bin = stringToByte(a2b_hex(options.autn))
 
-	if options.sim == True:
-		handle_sim(options, rand_bin)
-	else:
-		if not options.autn:
-			print("You have to specify AUTN")
-			exit(2)
-		handle_usim(options, rand_bin, autn_bin)
+    if options.sim == True:
+        handle_sim(options, rand_bin)
+    else:
+        if not options.autn:
+            print("You have to specify AUTN")
+            exit(2)
+        handle_usim(options, rand_bin, autn_bin)
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sim-auth/+/20896
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sim-auth
Gerrit-Branch: master
Gerrit-Change-Id: Id026fcd3975113a8bec2e30c58ac7b521ec1707f
Gerrit-Change-Number: 20896
Gerrit-PatchSet: 1
Gerrit-Owner: rousseau <ludovic.rousseau+osmocom at free.fr>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201028/98e9c951/attachment.htm>


More information about the gerrit-log mailing list