Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clientbot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aleajactaest
clientbot
Commits
8c4e52f6
Commit
8c4e52f6
authored
Nov 11, 2020
by
aleajactaest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update decoder database.xml
parent
8e9c92c5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
654 additions
and
75 deletions
+654
-75
spykhanat.py
spykhanat.py
+4
-2
tools/BitStream.py
tools/BitStream.py
+104
-20
tools/CBitSet.py
tools/CBitSet.py
+24
-0
tools/DecodeDatabase.py
tools/DecodeDatabase.py
+415
-22
tools/Enum.py
tools/Enum.py
+14
-1
tools/Impulse.py
tools/Impulse.py
+82
-30
tools/getPowerOf2.py
tools/getPowerOf2.py
+11
-0
No files found.
spykhanat.py
View file @
8c4e52f6
...
...
@@ -107,9 +107,10 @@ class SpyPcap():
databaseRawXml
=
fp
.
read
()
fp
.
close
()
self
.
databaseXml
=
ET
.
fromstring
(
databaseRawXml
)
self
.
decodeImpulseSimple
.
loadDatabase
(
self
.
databaseXml
)
#
self.decodeImpulseSimple.loadDatabase(self.databaseXml)
self
.
decodeDatabase
=
DecodeDatabase
.
DecodeDatabase
()
self
.
decodeDatabase
.
loadDatabase
(
self
.
databaseXml
)
self
.
decodeImpulseSimple
.
loadDatabase
(
self
.
decodeDatabase
)
# outyaml
self
.
outyaml
=
outyaml
...
...
@@ -946,12 +947,13 @@ def main():
# logger.append(logging.getLogger(CStringManager.LOGGER))
#logger.append(logging.getLogger(CAction.LOGGER))
#logger.append(logging.getLogger(CActionFactory.LOGGER))
#
logger.append(logging.getLogger(BitStream.LOGGER))
logger
.
append
(
logging
.
getLogger
(
BitStream
.
LOGGER
))
#logger.append(logging.getLogger(DecodeDatabase.LOGGER))
#logger.append(logging.getLogger(Impulse.LOGGER))
#logger.append(logging.getLogger(TVPNodeBase.LOGGER))
# CImpulseDecoder
# logger.append(logging.getLogger('CGenericMultiPartTemp'))
logger
.
append
(
logging
.
getLogger
(
DecodeDatabase
.
LOGGER
))
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--khanat-host-service"
,
help
=
"filter to detect khanat host:service (FES)"
)
...
...
tools/BitStream.py
View file @
8c4e52f6
This diff is collapsed.
Click to expand it.
tools/CBitSet.py
View file @
8c4e52f6
...
...
@@ -57,6 +57,9 @@ class CBitSet:
mask
=
bitNumber
&
(
self
.
NL_BITLEN
-
1
);
mask
=
1
<<
mask
;
return
self
.
data
[
bitNumber
>>
5
]
&
mask
!=
0
def
setUint
(
self
,
srcValue
,
i
):
self
.
data
[
i
]
=
srcValue
def
setBit
(
self
,
bitNumber
):
self
.
set
(
bitNumber
,
True
)
...
...
@@ -66,6 +69,10 @@ class CBitSet:
def
__str__
(
self
):
return
'.'
.
join
([
hex
(
x
)
for
x
in
self
.
data
])
def
showBitString
(
self
):
return
''
.
join
([
"{0:032b}"
.
format
(
x
)
for
x
in
reversed
(
self
.
data
)])
def
writeSerial
(
self
,
msgout
):
# v = 0 # currentVersion
# if v >= 0xff:
...
...
@@ -94,6 +101,23 @@ class CBitSet:
y
=
msgin
.
readUint32
(
name
+
':Data'
)
self
.
data
[
i
]
=
y
def
readSerialExtra
(
self
,
msgin
,
nbBit
,
name
):
needread
=
nbBit
print
(
"----"
,
nbBit
,
nbBit
//
32
+
1
)
self
.
resize
(
nbBit
)
i
=
0
while
needread
>
32
:
print
(
"---<"
,
nbBit
,
nbBit
//
32
+
1
,
i
,
needread
)
y
=
msgin
.
readUint32
(
name
+
' Data'
+
str
(
i
))
self
.
data
[
i
]
=
y
needread
-=
32
i
+=
1
print
(
self
.
data
)
if
needread
>
0
:
print
(
"--->"
,
nbBit
,
nbBit
//
32
+
1
,
i
,
needread
)
y
=
msgin
.
readSerial
(
needread
,
name
+
' Data'
+
str
(
i
),
typeName
=
"I"
+
str
(
needread
)
)
self
.
data
[
i
]
=
y
def
TestCBitSet
():
cBitSet
=
CBitSet
()
cBitSet
.
resize
(
1024
)
...
...
tools/DecodeDatabase.py
View file @
8c4e52f6
This diff is collapsed.
Click to expand it.
tools/Enum.py
View file @
8c4e52f6
...
...
@@ -21,6 +21,18 @@
from
enum
import
IntEnum
def
GetNameIntEnum
(
typeEnum
,
value
):
for
key
in
typeEnum
.
__dict__
:
try
:
print
(
"-"
*
80
)
print
(
key
,
dir
(
typeEnum
.
__dict__
[
key
]))
print
(
key
,
typeEnum
.
__dict__
[
key
].
value
)
if
typeEnum
.
__dict__
[
key
].
value
==
value
:
return
key
except
:
pass
return
None
class
TConnectionState
(
IntEnum
):
NotInitialised
=
0
# nothing happened yet
NotConnected
=
1
# init() called
...
...
@@ -610,7 +622,8 @@ class TCDBBank(IntEnum):
CDBOutpost
=
2
,
# CDBGlobal,
NB_CDB_BANKS
=
3
,
INVALID_CDB_BANK
=
4
INVALID_CDB_BANK
=
4
,
NB_BITS_FOR_CDBBANK
=
2
# normally calculate with NB_CDB_BANKS // ------ for ( nbits=1; (1<<nbits) < NB_CDB_BANKS; ++nbits ) {}
class
TPropIndex
(
IntEnum
):
PROPERTY_POSITION
=
0
,
...
...
tools/Impulse.py
View file @
8c4e52f6
This diff is collapsed.
Click to expand it.
tools/getPowerOf2.py
View file @
8c4e52f6
...
...
@@ -34,3 +34,14 @@ def getPowerOf2_Bis(v):
ret
+=
1
res
*=
2
return
ret
def
getPowerOf2_ter
(
v
):
res
=
1
;
ret
=
0
;
while
res
<
v
:
ret
+=
1
res
*=
2
if
ret
==
0
:
ret
=
1
return
ret
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment