Skip to content

Commit

Permalink
add device.listen_addr parameter (#337)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Pivnyak <apivnyak@yandex-team.ru>
  • Loading branch information
beerman17 and Alexander Pivnyak authored Jan 19, 2024
1 parent 148d74b commit 2d21cd7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion opencanary/modules/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class CanaryGit(Factory, CanaryService):
def __init__(self, config=None, logger=None):
CanaryService.__init__(self, config=config, logger=logger)
self.port = config.getVal("git.port", default=9418)
self.listen_addr = config.getVal("device.listen_addr", default="")
self.logtype = logger.LOG_GIT_CLONE_REQUEST

def getService(self):
return internet.TCPServer(self.port, self)
return internet.TCPServer(self.port, self, interface=self.listen_addr)
5 changes: 5 additions & 0 deletions opencanary/modules/rdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from twisted.internet.protocol import Protocol
from twisted.internet.protocol import Factory
from twisted.application import internet


class RemoteDesktopProtocol(Protocol):
Expand Down Expand Up @@ -45,7 +46,11 @@ class CanaryRDP(Factory, CanaryService):
def __init__(self, config=None, logger=None):
CanaryService.__init__(self, config, logger)
self.port = config.getVal("rdp.port", 3389)
self.listen_addr = config.getVal("device.listen_addr", default="")
self.logtype = logger.LOG_RDP

def getService(self):
return internet.TCPServer(self.port, self, interface=self.listen_addr)


CanaryServiceFactory = CanaryRDP
3 changes: 2 additions & 1 deletion opencanary/modules/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,10 @@ class CanaryRedis(Factory, CanaryService):

def __init__(self, config=None, logger=None):
CanaryService.__init__(self, config=config, logger=logger)
self.listen_addr = config.getVal("device.listen_addr", default="")
self.port = config.getVal("redis.port", default=6379)
self.max_arg_length = config.getVal("redis.max_arg_length", default=30)
self.logtype = logger.LOG_REDIS_COMMAND

def getService(self):
return internet.TCPServer(self.port, self)
return internet.TCPServer(self.port, self, interface=self.listen_addr)
5 changes: 5 additions & 0 deletions opencanary/modules/vnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from twisted.internet.protocol import Protocol
from twisted.internet.protocol import Factory
from twisted.application import internet

from opencanary.modules.des import des

Expand Down Expand Up @@ -172,7 +173,11 @@ class CanaryVNC(Factory, CanaryService):
def __init__(self, config=None, logger=None):
CanaryService.__init__(self, config, logger)
self.port = config.getVal("vnc.port", 5900)
self.listen_addr = config.getVal("device.listen_addr", default="")
self.logtype = logger.LOG_VNC

def getService(self):
return internet.TCPServer(self.port, self, interface=self.listen_addr)


CanaryServiceFactory = CanaryVNC

0 comments on commit 2d21cd7

Please sign in to comment.