OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python27
/
lib
/
python2.7
/
site-packages
/
postomaat
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
01/08/2025 10:42:48 AM
rwxr-xr-x
📄
__init__.py
712 bytes
03/16/2023 02:20:00 PM
rw-r--r--
📄
__init__.pyc
309 bytes
12/18/2024 09:49:00 AM
rw-r--r--
📄
addrcheck.py
4.1 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
addrcheck.pyc
5.29 KB
12/18/2024 09:49:00 AM
rw-r--r--
📁
bin
-
12/18/2024 09:49:00 AM
rwxr-xr-x
📄
checkLogfileConfig.py
4.76 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
checkLogfileConfig.pyc
3.28 KB
12/18/2024 09:49:00 AM
rw-r--r--
📁
conf
-
12/18/2024 09:49:00 AM
rwxr-xr-x
📄
core.py
27.75 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
core.pyc
23.77 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
daemon.py
5.05 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
daemon.pyc
4.73 KB
12/18/2024 09:49:00 AM
rw-r--r--
📁
extensions
-
12/18/2024 09:49:00 AM
rwxr-xr-x
📄
funkyconsole.py
2.24 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
funkyconsole.pyc
2.12 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
logtools.py
12.22 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
logtools.pyc
11.35 KB
12/18/2024 09:49:00 AM
rw-r--r--
📁
plugins
-
12/18/2024 09:49:00 AM
rwxr-xr-x
📄
procpool.py
10.58 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
procpool.pyc
9.79 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
scansession.py
11.69 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
scansession.pyc
12.12 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
service.py
14.48 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
service.pyc
11.49 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
shared.py
21.93 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
shared.pyc
24.04 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
stats.py
7.29 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
stats.pyc
7.55 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
stringencode.py
13.49 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
stringencode.pyc
10.66 KB
12/18/2024 09:49:00 AM
rw-r--r--
📄
threadpool.py
8.92 KB
03/16/2023 02:20:00 PM
rw-r--r--
📄
threadpool.pyc
8.19 KB
12/18/2024 09:49:00 AM
rw-r--r--
📁
utils
-
12/18/2024 09:49:00 AM
rwxr-xr-x
📄
workaround.py
935 bytes
03/16/2023 02:20:00 PM
rw-r--r--
📄
workaround.pyc
667 bytes
12/18/2024 09:49:00 AM
rw-r--r--
Editing: addrcheck.py
Close
# -*- coding: utf-8 -*- # Copyright 2012-2018 Fumail Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # import re import logging class AddrException(Exception): pass # Singleton implementation for Addrcheck class Addrcheck(object): """ Singleton implementation for Addrcheck. Note it is important not to initialise "self._method" by creating a "__init__" function since this would be called whenever asking for the singleton... (Addrcheck() would call __init__). """ __instance = None def __new__(cls): """ Returns Singleton of Addrcheck (create if not yet existing) Returns: (Addrcheck) The singleton of Addrcheck """ if Addrcheck.__instance is None: Addrcheck.__instance = object.__new__(cls) Addrcheck.__instance.set("Default") return Addrcheck.__instance def set(self, name): """ Sets method to be used in valid - function to validate an address Args: name (String): String with name of validator """ logger = logging.getLogger("%s.Addrcheck"%__package__) if name == "Default": logger.info("Set default address checker method") self._method = Default() elif name == "LazyLocalPart": logger.info("Set LazyLocalPart address checker method") self._method = LazyLocalPart() else: logger.warning("Mail address check \"%s\" not valid, using default..."%name) self._method = Default() def valid(self, address): """ Args: address (String): Address to be checked Returns: (Boolean) True if address is valid using internal validation method """ return self._method(address) class Addrcheckint(object): """ Functor interface for method called by Addrcheck """ def __init__(self): pass def __call__(self, mailAddress): raise NotImplemented class Default(Addrcheckint): """ Default implementation (and backward compatible) which does not allow more than one '@' """ def __init__(self): super(Default, self).__init__() def __call__(self,mailAddress): leg = mailAddress !='' and re.match(r"[^@]+@[^@]+$", mailAddress) if not leg and mailAddress !='': logger = logging.getLogger("postomaat.Addrcheck.Default") logger.warning("Address validation check failed for: %s" % mailAddress) return leg class LazyLocalPart(Addrcheckint): """ Allows '@' in local part. Note: In fuglu the original envelope address is received. For the policy daemon protocol the address is not quoted anymore. If there are quotes around the local part it is removed by Postfix before passed to Postomaat. Knowing: - there is only one mail address in the string - address has been RFC compliant because it was received by Postomaat So to make LazyLocalPart consistent with fuglu's version there's no need to check distinguis a quoted and an unquoted localpart. """ def __init__(self): super(LazyLocalPart, self).__init__() def __call__(self,mailAddress): leg = mailAddress !='' and ( re.match(r"^[\x00-\x7f]+@[^@]+$", mailAddress) ) # here, the address received does not contain quotes. quoted local parts can # contain more characters than unquoted according. if not leg and mailAddress !='': logger = logging.getLogger("postomaat.Addrcheck.LazyLocalPart") logger.warning("Address validation check failed for: %s"%mailAddress) return leg