remove crappy non-ascii (hidden) characters
This commit is contained in:
parent
2d61be3350
commit
decc023abd
|
@ -932,7 +932,7 @@ Specific attribute:
|
||||||
else:
|
else:
|
||||||
return {'base10Value': '%s' % (self._val[0]*(2**self._val[2]))}
|
return {'base10Value': '%s' % (self._val[0]*(2**self._val[2]))}
|
||||||
else:
|
else:
|
||||||
#self._val[1] == 10
|
#self._val[1] == 10
|
||||||
# TODO: some constraints on the mantissa / base / exponent should
|
# TODO: some constraints on the mantissa / base / exponent should
|
||||||
# lead to an integer encoding instead of this scientific notation
|
# lead to an integer encoding instead of this scientific notation
|
||||||
return {'base10Value': '%ie%i' % (self._val[0], self._val[2])}
|
return {'base10Value': '%ie%i' % (self._val[0], self._val[2])}
|
||||||
|
|
|
@ -215,7 +215,7 @@ class Buf(Atom):
|
||||||
|
|
||||||
|
|
||||||
# BufAuto is used when a Buf requires to have its length automatically computed
|
# BufAuto is used when a Buf requires to have its length automatically computed
|
||||||
# (i.e. in get_bl()) also when building the value (i.e. calling get_val())
|
# (i.e. in get_bl()) also when building the value (i.e. calling get_val())
|
||||||
# and not only at parsing (i.e. in _from_char())
|
# and not only at parsing (i.e. in _from_char())
|
||||||
class BufAuto(Buf):
|
class BufAuto(Buf):
|
||||||
|
|
||||||
|
@ -355,10 +355,10 @@ class String(Atom):
|
||||||
# format routines
|
# format routines
|
||||||
#--------------------------------------------------------------------------#
|
#--------------------------------------------------------------------------#
|
||||||
# Warning: there is no specific processing against fixed bit / byte length
|
# Warning: there is no specific processing against fixed bit / byte length
|
||||||
# because it is highly improbable to have such encoded string with fixed
|
# because it is highly improbable to have such encoded string with fixed
|
||||||
# length.
|
# length.
|
||||||
# However, in case some fixed length is applied to such type, things could
|
# however, in case some fixed length is applied to such type, things could
|
||||||
# fail silently...
|
# fail silently...
|
||||||
|
|
||||||
def _get_bl_from_val(self):
|
def _get_bl_from_val(self):
|
||||||
return 8 * len(self.get_val().encode(self.CODEC))
|
return 8 * len(self.get_val().encode(self.CODEC))
|
||||||
|
|
|
@ -738,7 +738,7 @@ class Element(object):
|
||||||
try:
|
try:
|
||||||
val = val[self._name]
|
val = val[self._name]
|
||||||
except Exception:
|
except Exception:
|
||||||
raise(EltErr('{0} [_from_jval]: invalid value, {1!r}'.format(self._name, val)))
|
raise(EltErr('{0} [_from_jval]: invalid value, {1!r}'.format(self._name, val)))
|
||||||
else:
|
else:
|
||||||
self._from_jval(val)
|
self._from_jval(val)
|
||||||
|
|
||||||
|
@ -4120,9 +4120,9 @@ class Alt(Element):
|
||||||
|
|
||||||
# Warning:
|
# Warning:
|
||||||
# When setting the selection callback as class attribute _sel, prototype is
|
# When setting the selection callback as class attribute _sel, prototype is
|
||||||
# lambda a, b: ... both a & b being self when instantiated
|
# lambda a, b: ..., both a & b being self, when instantiated
|
||||||
# When setting the selection callback during / after initialization, prototype is
|
# When setting the selection callback during / after initialization, prototype is
|
||||||
# lambda a: ... a being self
|
# lambda a: ..., a being self
|
||||||
|
|
||||||
__attrs__ = ('_env',
|
__attrs__ = ('_env',
|
||||||
'_name',
|
'_name',
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# * Software Name : pycrate
|
# * Software Name : pycrate
|
||||||
# * Version : 0.4
|
# * Version : 0.4
|
||||||
# *
|
# *
|
||||||
# * Copyright © 2013. Benoit Michau. ANSSI.
|
# * Copyright 2013. Benoit Michau. ANSSI.
|
||||||
# *
|
# *
|
||||||
# * This library is free software; you can redistribute it and/or
|
# * This library is free software; you can redistribute it and/or
|
||||||
# * modify it under the terms of the GNU Lesser General Public
|
# * modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# * Software Name : pycrate
|
# * Software Name : pycrate
|
||||||
# * Version : 0.4
|
# * Version : 0.4
|
||||||
# *
|
# *
|
||||||
# * Copyright © 2013. Benoit Michau. ANSSI.
|
# * Copyright 2013. Benoit Michau. ANSSI.
|
||||||
# *
|
# *
|
||||||
# * This library is free software; you can redistribute it and/or
|
# * This library is free software; you can redistribute it and/or
|
||||||
# * modify it under the terms of the GNU Lesser General Public
|
# * modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -325,14 +325,12 @@ class FGSIDType(Envelope):
|
||||||
# TS 24.501, 9.11.3.4
|
# TS 24.501, 9.11.3.4
|
||||||
#------------------------------------------------------------------------------#
|
#------------------------------------------------------------------------------#
|
||||||
|
|
||||||
FGSIDType_dict = {
|
FGSIDFMT_IMSI = 0
|
||||||
0 : 'No identity',
|
FGSIDFMT_NAI = 1
|
||||||
1 : 'SUCI',
|
|
||||||
2 : '5G-GUTI',
|
FGSIDFmt_dict = {
|
||||||
3 : 'IMEI',
|
0 : 'IMSI',
|
||||||
4 : '5G-S-TMSI',
|
1 : 'NAI'
|
||||||
5 : 'IMEISV',
|
|
||||||
6 : 'MAC address'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FGSIDTYPE_NO = 0
|
FGSIDTYPE_NO = 0
|
||||||
|
@ -343,6 +341,15 @@ FGSIDTYPE_TMSI = 4
|
||||||
FGSIDTYPE_IMEISV = 5
|
FGSIDTYPE_IMEISV = 5
|
||||||
FGSIDTYPE_MAC = 6
|
FGSIDTYPE_MAC = 6
|
||||||
|
|
||||||
|
FGSIDType_dict = {
|
||||||
|
0 : 'No identity',
|
||||||
|
1 : 'SUCI',
|
||||||
|
2 : '5G-GUTI',
|
||||||
|
3 : 'IMEI',
|
||||||
|
4 : '5G-S-TMSI',
|
||||||
|
5 : 'IMEISV',
|
||||||
|
6 : 'MAC address'
|
||||||
|
}
|
||||||
|
|
||||||
_ProtSchemeID_dict = {
|
_ProtSchemeID_dict = {
|
||||||
0 : 'Null scheme',
|
0 : 'Null scheme',
|
||||||
|
@ -424,12 +431,14 @@ class SUPI_IMSI(Envelope):
|
||||||
class SUPI_NAI(UTF8String):
|
class SUPI_NAI(UTF8String):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
FGSIDFMT_IMSI = 0
|
||||||
|
FGSIDFMT_NAI = 1
|
||||||
|
|
||||||
class FGSIDSUPI(Envelope):
|
class FGSIDSUPI(Envelope):
|
||||||
_name = '5GSIDSUPI'
|
_name = '5GSIDSUPI'
|
||||||
_GEN = (
|
_GEN = (
|
||||||
Uint('spare', bl=1),
|
Uint('spare', bl=1),
|
||||||
Uint('Fmt', bl=3, dic={0:'IMSI', 1:'NAI'}),
|
Uint('Fmt', val=FGSIDFMT_IMSI, bl=3, dic=FGSIDFmt_dict),
|
||||||
Uint('spare', bl=1),
|
Uint('spare', bl=1),
|
||||||
Uint('Type', val=FGSIDTYPE_SUPI, bl=3, dic=FGSIDType_dict),
|
Uint('Type', val=FGSIDTYPE_SUPI, bl=3, dic=FGSIDType_dict),
|
||||||
Alt('Value', GEN={
|
Alt('Value', GEN={
|
||||||
|
|
Loading…
Reference in New Issue