Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patches to dionaea to be able to build package on modern systems #343

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ project(
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
# ToDo: move to source file?
list(APPEND CMAKE_C_FLAGS "-D_GNU_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Expand Down Expand Up @@ -66,7 +66,27 @@ option(WITH_MODULE_PCAP "Build the pcap module" ON)

option(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" OFF)

# Default install prefix for Dionaea
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(STATUS "INFO: Setting the CMAKE_INSTALL_PREFIX to default - /opt/dionaea")
set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "/opt/dionaea")
endif()

message(STATUS "Before GNUInstallDirs: CMAKE_INSTALL_FULL_LOCALSTATEDIR = ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}")
include(GNUInstallDirs)
message(STATUS "After GNUInstallDirs: CMAKE_INSTALL_FULL_LOCALSTATEDIR = ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}")

### Dionaea non-FHS compliant defaults /opt/dionaea
# Dionaea defaults are different from FHS as used in GNUInstallDirs
# for example the default when prefix is set to /opt/dionaea, the configuration
# is expected in /opt/dionaea/etc and not in /etc/opt/dionaea, same for the state dirs
# expected to be in /opt/dionaea/var/lib and not in /var/opt/dionaea/lib
if(CMAKE_INSTALL_PREFIX STREQUAL "/opt/dionaea")
set(CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE PATH "Configuration")
set(CMAKE_INSTALL_FULL_LOCALSTATEDIR "${CMAKE_INSTALL_PREFIX}/var" CACHE PATH "Modifiable single-machine data (var)" FORCE)
set(CMAKE_INSTALL_FULL_RUNSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run" CACHE PATH "Run-time variable data (LOCALSTATEDIR/run)")
endif()

include(InstallConfig)
include(Packaging)

Expand All @@ -90,12 +110,12 @@ endif()

set(DIONAEA_USER "dionaea" CACHE STRING "Dionaea user")
set(DIONAEA_GROUP "dionaea" CACHE STRING "Dionaea group")
set(DIONAEA_MODDIR ${CMAKE_INSTALL_LIBDIR}/dionaea)
set(DIONAEA_CONFDIR ${CMAKE_INSTALL_SYSCONFDIR}/dionaea)
set(DIONAEA_RUNDIR "${CMAKE_INSTALL_LOCALSTATEDIR}/run" CACHE STRING "/run directory")
set(DIONAEA_STATEDIR ${CMAKE_INSTALL_LOCALSTATEDIR}/lib/dionaea)
set(DIONAEA_LOGDIR ${CMAKE_INSTALL_LOCALSTATEDIR}/log/dionaea)
set(DIONAEA_PYTHON_SITELIBDIR ${CMAKE_INSTALL_LIBDIR}/dionaea/python)
set(DIONAEA_MODDIR ${CMAKE_INSTALL_FULL_LIBDIR}/dionaea CACHE PATH "Dionaea directory for plugin modules")
set(DIONAEA_CONFDIR ${CMAKE_INSTALL_FULL_SYSCONFDIR}/dionaea CACHE PATH "Dionaea configuration directory")
set(DIONAEA_RUNDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run" CACHE PATH "Dionaea /run directory")
set(DIONAEA_STATEDIR ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/dionaea CACHE PATH "Dionaea directory for storing the status")
set(DIONAEA_LOGDIR ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/dionaea CACHE PATH "Dionaea log directory")
set(DIONAEA_PYTHON_SITELIBDIR ${CMAKE_INSTALL_FULL_LIBDIR}/dionaea/python CACHE PATH "Dionaea location of python modules")

########### requirements ###############

Expand Down
8 changes: 4 additions & 4 deletions cmake/InstallConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ function(install_if_not_exists src dest)
get_filename_component(src_name "${src}" NAME)
get_filename_component(basename_dest "${src}" NAME)
install(CODE "
if(\${CMAKE_INSTALL_FULL_PREFIX} MATCHES .*/_CPack_Packages/.* OR NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${dest}/${src_name}\")
message(STATUS \"Installing: \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${dest}/${src_name}\")
if(\${CMAKE_INSTALL_FULL_PREFIX} MATCHES .*/_CPack_Packages/.* OR NOT EXISTS \"\$ENV{DESTDIR}/${dest}/${src_name}\")
message(STATUS \"Installing: \$ENV{DESTDIR}/${dest}/${src_name}\")
execute_process(COMMAND \${CMAKE_COMMAND} -E copy \"${src}\"
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${dest}/${src_name}\"
\"\$ENV{DESTDIR}/${dest}/${src_name}\"
RESULT_VARIABLE copy_result
ERROR_VARIABLE error_output)
if(copy_result)
message(FATAL_ERROR \${error_output})
endif()
else()
message(STATUS \"Skipping : \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${dest}/${src_name}\")
message(STATUS \"Skipping : \$ENV{DESTDIR}/${dest}/${src_name}\")
endif()
")
endfunction()
4 changes: 2 additions & 2 deletions cmake/InstallPythonConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ function(install_enabled_python_config)
if(NOT EXISTS "${_conf_dst}")
install(DIRECTORY DESTINATION "${_conf_dst}")
foreach(filename ${MY_FUNC_FILES})
install(CODE "message(STATUS \"Enabling Service: ${filename} in \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_conf_dst}\")")
install(CODE "message(STATUS \"Enabling Service: ${filename} in \$ENV{DESTDIR}/${_conf_dst}\")")
install(CODE "
EXECUTE_PROCESS(
COMMAND \"${CMAKE_COMMAND}\" -E create_symlink
${MY_FUNC_SOURCE_REL_DIR}/${filename}
${filename}
WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_conf_dst}\"
WORKING_DIRECTORY \"\$ENV{DESTDIR}/${_conf_dst}\"
)
")
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
# The short X.Y version.
version = "undefined"
regex_version = re.compile(
"^project\s*\([^)]+?\s+VERSION\s+(?P<version>[0-9]+\.[0-9]+\.[0-9]+)$",
r"^project\s*\([^)]+?\s+VERSION\s+(?P<version>[0-9]+\.[0-9]+\.[0-9]+)$",
re.MULTILINE|re.DOTALL
)
data = open("../../CMakeLists.txt", "r").read()
Expand Down
2 changes: 1 addition & 1 deletion include/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#ifndef HAVE_CONNECTION_H
#define HAVE_CONNECTION_H

#include <netinet/in.h>
#include <sys/socket.h>
#include <stdbool.h>
#include <stdint.h>

#include <netinet/in.h>
//#include <linux/if.h>
#include <ev.h>
#include <glib.h>
Expand Down
2 changes: 1 addition & 1 deletion modules/curl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ target_link_libraries(

install(
TARGETS module_curl
LIBRARY DESTINATION lib/dionaea
LIBRARY DESTINATION ${DIONAEA_MODDIR}
)
2 changes: 1 addition & 1 deletion modules/emu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ target_link_libraries(

install(
TARGETS module_emu
LIBRARY DESTINATION lib/dionaea
LIBRARY DESTINATION ${DIONAEA_MODDIR}
)
2 changes: 1 addition & 1 deletion modules/nfq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ target_link_libraries(

install(
TARGETS module_nfq
LIBRARY DESTINATION lib/dionaea
LIBRARY DESTINATION ${DIONAEA_MODDIR}
)
2 changes: 1 addition & 1 deletion modules/nl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ target_link_libraries(

install(
TARGETS module_nl
LIBRARY DESTINATION lib/dionaea
LIBRARY DESTINATION ${DIONAEA_MODDIR}
)
2 changes: 1 addition & 1 deletion modules/pcap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ target_link_libraries(

install(
TARGETS module_pcap
LIBRARY DESTINATION lib/dionaea
LIBRARY DESTINATION ${DIONAEA_MODDIR}
)
2 changes: 1 addition & 1 deletion modules/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (PYTHONINTERP_FOUND)
)

#install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --prefix=${CMAKE_INSTALL_PREFIX})")
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --install-lib=\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DIONAEA_PYTHON_SITELIBDIR})")
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --install-lib=\$ENV{DESTDIR}/${DIONAEA_PYTHON_SITELIBDIR})")
endif()

add_library(
Expand Down
2 changes: 1 addition & 1 deletion modules/python/dionaea/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, w):
else:
self.send = self.void
self.files = {}
self.cwd = 'C:\WINDOWS\System32'
self.cwd = 'C:\\WINDOWS\\System32'


def handle_io_in(self, data):
Expand Down
16 changes: 8 additions & 8 deletions modules/python/dionaea/emu_scripts/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, config=None):
self._regex_detect = []

self._regex_url = re.compile(
b"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)"
r"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)"
)

def run(self, data):
Expand Down Expand Up @@ -52,7 +52,7 @@ def __init__(self, config=None):
self._config = config

self._regex_url = re.compile(
b"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)"
r"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)"
)

def run(self, data):
Expand All @@ -70,13 +70,13 @@ def __init__(self, config=None):

self.min_match_count = 2
self._regex_detect = [
re.compile(b"New-Object\s+System\.Net\.WebClient"),
re.compile(b"DownloadFile([^,]+?,[^,]+?)"),
re.compile(b"Invoke-Expression([^)]+?)")
re.compile(r"New-Object\s+System\.Net\.WebClient"),
re.compile(r"DownloadFile([^,]+?,[^,]+?)"),
re.compile(r"Invoke-Expression([^)]+?)")
]

self._regex_url = re.compile(
b"\w+\s*=\s*\"\s*(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)\s*\""
r"\w+\s*=\s*\"\s*(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)\s*\""
)


Expand All @@ -88,9 +88,9 @@ def __init__(self, config=None):

self.min_match_count = 1
self._regex_detect = [
re.compile(b"Set\s+\w+\s+=\s+CreateObject\(.*?(Msxml2.XMLHTTP|Wscript.Shell).*?\)")
re.compile(r"Set\s+\w+\s+=\s+CreateObject\(.*?(Msxml2.XMLHTTP|Wscript.Shell).*?\)")
]

self._regex_url = re.compile(
b"\.Open\s+\"GET\"\s*,\s*\"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)\""
r"\.Open\s+\"GET\"\s*,\s*\"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)\""
)
10 changes: 5 additions & 5 deletions modules/python/dionaea/memcache/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def from_line(cls, cmd_line):

class Decrement(Command):
name = "decr"
regex_cmd = re.compile(b"^decr (?P<key>\w+) (?P<value>\d+)( (?P<noreply>noreply))?$")
regex_cmd = re.compile(r"^decr (?P<key>\w+) (?P<value>\d+)( (?P<noreply>noreply))?$")

def __init__(self, key=None, value=0, no_reply=False):
self.key = key
Expand All @@ -37,7 +37,7 @@ def from_line(cls, cmd_line):

class Delete(Command):
name = "delete"
regex_cmd = re.compile(b"^(?P<command>\w+) (?P<key>\w+)( (?P<noreply>noreply))?$")
regex_cmd = re.compile(r"^(?P<command>\w+) (?P<key>\w+)( (?P<noreply>noreply))?$")

def __init__(self, key=None, no_reply=None):
self.key = key
Expand Down Expand Up @@ -73,7 +73,7 @@ def from_line(cls, cmd_line):

class Increment(Command):
name = "incr"
regex_cmd = re.compile(b"^incr (?P<key>\w+) (?P<value>\d+)( (?P<noreply>noreply))?$")
regex_cmd = re.compile(r"^incr (?P<key>\w+) (?P<value>\d+)( (?P<noreply>noreply))?$")

def __init__(self, key=None, value=0, no_reply=False):
self.key = key
Expand All @@ -91,7 +91,7 @@ def from_line(cls, cmd_line):


class StorageCommand(Command):
regex_cmd = re.compile(b"^(?P<command>\w+) (?P<key>\w+) (?P<flags>\d+) (?P<exptime>\d+) (?P<byte_count>\d+)( (?P<noreply>noreply))?")
regex_cmd = re.compile(r"^(?P<command>\w+) (?P<key>\w+) (?P<flags>\d+) (?P<exptime>\d+) (?P<byte_count>\d+)( (?P<noreply>noreply))?")

def __init__(self, key=None, flags=None, exptime=None, byte_count=None, noreply=None):
self.key = key
Expand Down Expand Up @@ -171,7 +171,7 @@ def from_line(cls, cmd_line):

class Touch(Command):
name = "touch"
regex_cmd = re.compile(b"^touch (?P<key>\w+) (?P<exptime>\d+)( (?P<noreply>noreply))?$")
regex_cmd = re.compile(r"^touch (?P<key>\w+) (?P<exptime>\d+)( (?P<noreply>noreply))?$")

def __init__(self, key=None, exptime=None, no_reply=None):
self.key = key
Expand Down
16 changes: 8 additions & 8 deletions modules/python/dionaea/mysql/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
logger = logging.getLogger('mysqld')

re_show_var = re.compile(
b"show\s+((?P<global>global)\s+)?variables(\s+like\s+(?P<sep>\"|')(?P<like>.*?)(?P=sep))?",
r"show\s+((?P<global>global)\s+)?variables(\s+like\s+(?P<sep>\"|')(?P<like>.*?)(?P=sep))?",
re.I
)

re_select_var = re.compile(
b"select\s+(?P<full_name>@(?P<global>@)?(?P<name>\w+))(\s+limit\s+\d+)?",
r"select\s+(?P<full_name>@(?P<global>@)?(?P<name>\w+))(\s+limit\s+\d+)?",
re.I
)

Expand All @@ -42,7 +42,7 @@ def __init__(self):
self.config = None
self.state = ""
self.regex_statement = re.compile(
b"""([A-Za-z0-9_.]+\(.*?\)+|\(.*?\)+|"(?:[^"]|\"|"")*"+|'[^'](?:|\'|'')*'+|`(?:[^`]|``)*`+|[^ ,]+|,)"""
r"""([A-Za-z0-9_.]+\(.*?\)+|\(.*?\)+|"(?:[^"]|\"|"")*"+|'[^'](?:|\'|'')*'+|`(?:[^`]|``)*`+|[^ ,]+|,)"""
)
self.download_dir = None
self.download_suffix = ".tmp"
Expand Down Expand Up @@ -146,7 +146,7 @@ def _handle_COM_QUERY(self, p):
if re.match(b'set ', p.Query, re.I):
r = MySQL_Result_OK(Message="#2")

elif re.match(b'select\s+database\s*\(\s*\)$', p.Query, re.I):
elif re.match(r'select\s+database\s*\(\s*\)$', p.Query, re.I):
r = [
MySQL_Result_Header(FieldCount=1),
MySQL_Result_Field(
Expand All @@ -167,7 +167,7 @@ def _handle_COM_QUERY(self, p):
MySQL_Result_EOF(ServerStatus=0x002)
]

elif re.match(b"show\s+databases$", p.Query, re.I):
elif re.match(r"show\s+databases$", p.Query, re.I):
r = [
MySQL_Result_Header(FieldCount=1),
MySQL_Result_Field(
Expand All @@ -192,7 +192,7 @@ def _handle_COM_QUERY(self, p):
# r.append(MySQL_Result_Row_Data(ColumnValues=['information_schema']))
r.append(MySQL_Result_EOF(ServerStatus=0x002))

elif re.match(b'show\s+tables$', p.Query, re.I):
elif re.match(r'show\s+tables$', p.Query, re.I):
r = [
MySQL_Result_Header(FieldCount=1),
MySQL_Result_Field(
Expand Down Expand Up @@ -273,8 +273,8 @@ def _handle_com_query_select(self, p, query):
if len(query) == 0:
return False

regex_function = re.compile(b"(?P<name>[A-Za-z0-9_.]+)\((?P<args>.*?)\)+")
regex_url = re.compile(b"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)")
regex_function = re.compile(r"(?P<name>[A-Za-z0-9_.]+)\((?P<args>.*?)\)+")
regex_url = re.compile(r"(?P<url>(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)")

m = re_select_var.match(p.Query)
if m:
Expand Down
2 changes: 1 addition & 1 deletion modules/python/dionaea/sip/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_sdp_by_name(self, name, media_ports, **params):
sdp = data[0]
for n,v in media_ports.items():
if v is None:
sdp = re.sub("\[" + n +"\].*\[\/" + n + "\]", "", sdp, 0, re.DOTALL)
sdp = re.sub("\\[" + n +"\\].*\\[\\/" + n + "\\]", "", sdp, 0, re.DOTALL)
else:
params[n] = v

Expand Down
18 changes: 9 additions & 9 deletions modules/python/dionaea/sip/rfc2396.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class Address(object):
b'"John Doe" <sip:[email protected]>'
"""
_syntax = [
re.compile(b'^(?P<name>[a-zA-Z0-9\-\.\_\+\~\ \t]*)<(?P<uri>[^>]+)>( *; *(?P<params>.*))?'),
re.compile(b'^(?:"(?P<name>[a-zA-Z0-9\-\.\_\+\~\ \t]+)")[\ \t]*<(?P<uri>[^>]+)>( *; *(?P<params>.*))?'),
re.compile(b'^[\ \t]*(?P<name>)(?P<uri>[^;]+)( *; *(?P<params>.*))?')
re.compile(r'^(?P<name>[a-zA-Z0-9\-\.\_\+\~\ \t]*)<(?P<uri>[^>]+)>( *; *(?P<params>.*))?'),
re.compile(r'^(?:"(?P<name>[a-zA-Z0-9\-\.\_\+\~\ \t]+)")[\ \t]*<(?P<uri>[^>]+)>( *; *(?P<params>.*))?'),
re.compile(r'^[\ \t]*(?P<name>)(?P<uri>[^;]+)( *; *(?P<params>.*))?')
]

def __init__(self, display_name = None, uri = None, must_quote = None, params = None):
Expand Down Expand Up @@ -128,12 +128,12 @@ class URI(object):
True
"""

_syntax = re.compile(b"^(?P<scheme>[a-zA-Z][a-zA-Z0-9\+\-\.]*):" # scheme
+ b"(?:(?:(?P<user>[a-zA-Z0-9\-\_\.\!\~\*\'\(\)&=\+\$,;\?\/\%]+)" # user
+ b"(?::(?P<password>[^:@;\?]+))?)@)?" # password
+ b"(?:(?:(?P<host>[^;\?:]*)(?::(?P<port>[\d]+))?))" # host, port
+ b"(?:;(?P<params>[^\?]*))?" # parameters
+ b"(?:\?(?P<headers>.*))?$" # headers
_syntax = re.compile(r"^(?P<scheme>[a-zA-Z][a-zA-Z0-9\+\-\.]*):" # scheme
+ r"(?:(?:(?P<user>[a-zA-Z0-9\-\_\.\!\~\*\'\(\)&=\+\$,;\?\/\%]+)" # user
+ r"(?::(?P<password>[^:@;\?]+))?)@)?" # password
+ r"(?:(?:(?P<host>[^;\?:]*)(?::(?P<port>[\d]+))?))" # host, port
+ r"(?:;(?P<params>[^\?]*))?" # parameters
+ r"(?:\?(?P<headers>.*))?$" # headers
)

def __init__(self, scheme = None, user = None, password = None, host = None, port = None, params = None, headers = None):
Expand Down
2 changes: 1 addition & 1 deletion modules/python/dionaea/sip/rfc3261.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class Via(object):
b'z9hG4bK77asjd' b'192.0.2.207'
"""

_syntax = re.compile(b"SIP */ *2\.0 */ *(?P<protocol>[a-zA-Z]+) *(?P<address>[^ :;]*) *(:(?P<port>[0-9]+))?( *; *(?P<params>.*))?")
_syntax = re.compile(r"SIP */ *2\.0 */ *(?P<protocol>[a-zA-Z]+) *(?P<address>[^ :;]*) *(:(?P<port>[0-9]+))?( *; *(?P<params>.*))?")

def __init__(self, protocol = None, address = None, port = None, params = None):
if params is None:
Expand Down
10 changes: 5 additions & 5 deletions modules/python/dionaea/smb/include/asn1/mib.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
## MIB parsing ##
#################

_mib_re_integer = re.compile("^[0-9]+$")
_mib_re_both = re.compile("^([a-zA-Z_][a-zA-Z0-9_-]*)\(([0-9]+)\)$")
_mib_re_integer = re.compile(r"^[0-9]+$")
_mib_re_both = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_-]*)\(([0-9]+)\)$")
_mib_re_oiddecl = re.compile(
"$\s*([a-zA-Z0-9_-]+)\s+OBJECT([^:\{\}]|\{[^:]+\})+::=\s*\{([^\}]+)\}",re.M)
_mib_re_strings = re.compile('"[^"]*"')
_mib_re_comments = re.compile('--.*(\r|\n)')
r"$\s*([a-zA-Z0-9_-]+)\s+OBJECT([^:\{\}]|\{[^:]+\})+::=\s*\{([^\}]+)\}",re.M)
_mib_re_strings = re.compile(r'"[^"]*"')
_mib_re_comments = re.compile(r'--.*(\r|\n)')

class MIBDict(DADict):
def _findroot(self, x):
Expand Down
Loading
Loading