Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c88ceaa3
authored
Feb 10, 2024
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
registry fix
parent
3ad709c2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
12 deletions
+13
-12
agent-winservice.py
+3
-2
agent.py
+2
-3
utils.py
+1
-1
win_exe/agent-winservice.exe
+0
-0
win_exe/client.exe
+0
-0
win_exe/watchdog-winservice.exe
+0
-0
windows/_win32context.py
+7
-6
No files found.
agent-winservice.py
View file @
c88ceaa3
...
...
@@ -18,8 +18,9 @@ formatter = logging.Formatter(
"
%(asctime)
s -
%(name)
s [
%(levelname)
s]
%(message)
s"
)
fh
.
setFormatter
(
formatter
)
logger
.
addHandler
(
fh
)
level
=
os
.
environ
.
get
(
'LOGLEVEL'
,
'DEBUG'
)
logger
.
setLevel
(
level
)
#level = os.environ.get('LOGLEVEL', 'DEBUG')
logger
.
setLevel
(
'INFO'
)
logger
.
info
(
"
%
s loaded"
,
__file__
)
...
...
agent.py
View file @
c88ceaa3
...
...
@@ -52,9 +52,8 @@ logging.basicConfig(
datefmt
=
"
%
d/
%
b/
%
Y
%
H:
%
M:
%
S"
,
)
logger
=
logging
.
getLogger
()
level
=
environ
.
get
(
'LOGLEVEL'
,
'INFO'
)
logger
.
setLevel
(
level
)
#level = environ.get('LOGLEVEL', 'DEBUG')
logger
.
setLevel
(
'INFO'
)
class
SerialLineReceiver
(
SerialLineReceiverBase
):
...
...
utils.py
View file @
c88ceaa3
...
...
@@ -39,7 +39,7 @@ class SerialLineReceiverBase(LineReceiver, object):
raise
NotImplementedError
(
"Subclass must implement abstract method"
)
def
lineReceived
(
self
,
data
):
logger
.
debug
(
"lineReceived:
%
s"
,
data
)
#
logger.debug("lineReceived: %s", data)
if
(
isinstance
(
data
,
unicode
)):
data
=
data
.
strip
(
'
\0
'
)
else
:
...
...
win_exe/agent-winservice.exe
View file @
c88ceaa3
No preview for this file type
win_exe/client.exe
View file @
c88ceaa3
No preview for this file type
win_exe/watchdog-winservice.exe
View file @
c88ceaa3
No preview for this file type
windows/_win32context.py
View file @
c88ceaa3
...
...
@@ -7,7 +7,7 @@ from os.path import join
import
logging
import
tarfile
from
io
import
String
IO
from
io
import
Bytes
IO
from
base64
import
b64decode
from
hashlib
import
md5
from
datetime
import
datetime
...
...
@@ -101,7 +101,7 @@ class Context(BaseContext):
@staticmethod
def
_update_registry
(
dir
,
executable
):
# HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\circle-agent
from
_
winreg
import
(
OpenKeyEx
,
SetValueEx
,
QueryValueEx
,
from
winreg
import
(
OpenKeyEx
,
SetValueEx
,
QueryValueEx
,
HKEY_LOCAL_MACHINE
,
KEY_ALL_ACCESS
)
with
OpenKeyEx
(
HKEY_LOCAL_MACHINE
,
r'SYSTEM\CurrentControlSet\services\circle-agent'
,
...
...
@@ -115,18 +115,19 @@ class Context(BaseContext):
def
update
(
filename
,
executable
,
checksum
,
uuid
):
with
open
(
filename
,
"r"
)
as
f
:
data
=
f
.
read
()
local_checksum
=
md5
(
data
)
.
hexdigest
()
logger
.
debug
(
"type(data)
%
s"
%
type
(
data
))
local_checksum
=
md5
(
data
.
encode
())
.
hexdigest
()
if
local_checksum
!=
checksum
:
raise
Exception
(
"Checksum missmatch the file is damaged."
)
decoded
=
String
IO
(
b64decode
(
data
))
decoded
=
Bytes
IO
(
b64decode
(
data
))
try
:
tar
=
tarfile
.
TarFile
.
open
(
"dummy"
,
fileobj
=
decoded
,
mode
=
'r|gz'
)
tar
.
extractall
(
working_directory
)
except
tarfile
.
ReadError
as
e
:
logger
.
error
(
e
)
logger
.
info
(
"Transfer completed!"
)
Context
.
_update_registry
(
working_directory
,
executable
)
logger
.
info
(
'
Updated'
)
old_exe
=
Context
.
_update_registry
(
working_directory
,
executable
)
logger
.
info
(
'
%
s Updated'
,
old_exe
)
reactor
.
stop
()
@staticmethod
...
...
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