OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python2.7
/
dist-packages
/
samba
Server IP: 10.0.0.4
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/15/2022 06:13:39 AM
rwxr-xr-x
📄
__init__.py
12.92 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
__init__.pyc
13.1 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
_glue.x86_64-linux-gnu.so
14.3 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
_ldb.x86_64-linux-gnu.so
45.16 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
auth.x86_64-linux-gnu.so
40.55 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
common.py
3.61 KB
02/07/2018 08:37:51 AM
rw-r--r--
📄
common.pyc
3.61 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
compat.py
834 bytes
07/04/2017 10:05:25 AM
rw-r--r--
📄
compat.pyc
284 bytes
02/03/2022 06:37:40 AM
rw-r--r--
📄
credentials.x86_64-linux-gnu.so
32.02 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
crypto.x86_64-linux-gnu.so
45.93 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
dbchecker.py
114.77 KB
02/07/2018 08:37:51 AM
rw-r--r--
📄
dbchecker.pyc
74.47 KB
02/03/2022 06:37:40 AM
rw-r--r--
📁
dcerpc
-
02/03/2022 06:37:40 AM
rwxr-xr-x
📄
descriptor.py
26.63 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
descriptor.pyc
23.43 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
dnsserver.py
5.98 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
dnsserver.pyc
6.65 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
drs_utils.py
13.17 KB
09/17/2017 07:15:34 PM
rw-r--r--
📄
drs_utils.pyc
11.17 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
dsdb.x86_64-linux-gnu.so
42.9 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
dsdb_dns.x86_64-linux-gnu.so
14.02 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
gensec.x86_64-linux-gnu.so
26.99 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
getopt.py
10.87 KB
09/17/2017 07:15:34 PM
rw-r--r--
📄
getopt.pyc
11.77 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
hostconfig.py
2.29 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
hostconfig.pyc
3.26 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
idmap.py
3.18 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
idmap.pyc
3.07 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
join.py
67.78 KB
09/17/2017 07:15:34 PM
rw-r--r--
📄
join.pyc
47 KB
02/03/2022 06:37:40 AM
rw-r--r--
📁
kcc
-
02/03/2022 06:37:40 AM
rwxr-xr-x
📄
messaging.x86_64-linux-gnu.so
18.65 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
ms_display_specifiers.py
4.58 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
ms_display_specifiers.pyc
3.61 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
ms_schema.py
8.1 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
ms_schema.pyc
6.97 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
ndr.py
4.76 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
ndr.pyc
4.65 KB
02/03/2022 06:37:40 AM
rw-r--r--
📄
net.x86_64-linux-gnu.so
26.62 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
netbios.x86_64-linux-gnu.so
14.46 KB
01/25/2022 03:20:03 PM
rw-r--r--
📁
netcmd
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📄
ntacls.py
10.4 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
ntacls.pyc
6.91 KB
02/03/2022 06:37:41 AM
rw-r--r--
📄
ntstatus.x86_64-linux-gnu.so
117.69 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
param.x86_64-linux-gnu.so
23.52 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
policy.x86_64-linux-gnu.so
9.99 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
posix_eadb.x86_64-linux-gnu.so
9.99 KB
01/25/2022 03:20:03 PM
rw-r--r--
📁
provision
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📄
registry.x86_64-linux-gnu.so
19.62 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
remove_dc.py
17.3 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
remove_dc.pyc
11.45 KB
02/03/2022 06:37:41 AM
rw-r--r--
📁
samba3
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📄
samdb.py
36.89 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
samdb.pyc
34.62 KB
02/03/2022 06:37:41 AM
rw-r--r--
📄
schema.py
8.16 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
schema.pyc
6.84 KB
02/03/2022 06:37:41 AM
rw-r--r--
📄
sd_utils.py
3.24 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
sd_utils.pyc
3.12 KB
02/03/2022 06:37:41 AM
rw-r--r--
📄
security.x86_64-linux-gnu.so
9.93 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
sites.py
3.94 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
sites.pyc
4.24 KB
02/03/2022 06:37:41 AM
rw-r--r--
📄
smb.x86_64-linux-gnu.so
22.63 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
subnets.py
6.76 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
subnets.pyc
5.95 KB
02/03/2022 06:37:41 AM
rw-r--r--
📁
subunit
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📄
tdb_util.py
1.46 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
tdb_util.pyc
989 bytes
02/03/2022 06:37:41 AM
rw-r--r--
📁
tests
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📁
third_party
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📄
upgrade.py
33.68 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
upgrade.pyc
24.59 KB
02/03/2022 06:37:41 AM
rw-r--r--
📄
upgradehelpers.py
31.83 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
upgradehelpers.pyc
26.92 KB
02/03/2022 06:37:41 AM
rw-r--r--
📁
web_server
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📄
werror.x86_64-linux-gnu.so
153.69 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
xattr.py
2.22 KB
07/04/2017 10:05:25 AM
rw-r--r--
📄
xattr.pyc
1.57 KB
02/03/2022 06:37:41 AM
rw-r--r--
📄
xattr_native.x86_64-linux-gnu.so
9.99 KB
01/25/2022 03:20:03 PM
rw-r--r--
📄
xattr_tdb.x86_64-linux-gnu.so
9.99 KB
01/25/2022 03:20:03 PM
rw-r--r--
Editing: subnets.py
Close
# Add/remove subnets to sites. # # Copyright (C) Catalyst.Net Ltd 2015 # Copyright Matthieu Patou <mat@matws.net> 2011 # # Catalyst.Net's contribution was written by Douglas Bagnall # <douglas.bagnall@catalyst.net.nz>. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import ldb from ldb import FLAG_MOD_ADD, FLAG_MOD_REPLACE, LdbError from sites import SiteNotFoundException class SubnetException(Exception): """Base element for Subnet errors""" pass class SubnetNotFound(SubnetException): """The subnet requested does not exist.""" pass class SubnetAlreadyExists(SubnetException): """The subnet being added already exists.""" pass class SubnetInvalid(SubnetException): """The subnet CIDR is invalid.""" pass class SiteNotFound(SubnetException): """The site to be used for the subnet does not exist.""" pass def create_subnet(samdb, configDn, subnet_name, site_name): """Create a subnet and associate it with a site. :param samdb: A samdb connection :param configDn: The DN of the configuration partition :param subnet_name: name of the subnet to create (a CIDR range) :return: None :raise SubnetAlreadyExists: if the subnet to be created already exists. :raise SiteNotFound: if the site does not exist. """ ret = samdb.search(base=configDn, scope=ldb.SCOPE_SUBTREE, expression='(&(objectclass=Site)(cn=%s))' % ldb.binary_encode(site_name)) if len(ret) != 1: raise SiteNotFound('A site with the name %s does not exist' % site_name) dn_site = ret[0].dn if not isinstance(subnet_name, str): raise SubnetInvalid("%s is not a valid subnet (not a string)" % subnet_name) dnsubnet = ldb.Dn(samdb, "CN=Subnets,CN=Sites") if dnsubnet.add_base(configDn) == False: raise SubnetException("dnsubnet.add_base() failed") if dnsubnet.add_child("CN=X") == False: raise SubnetException("dnsubnet.add_child() failed") dnsubnet.set_component(0, "CN", subnet_name) try: m = ldb.Message() m.dn = dnsubnet m["objectclass"] = ldb.MessageElement("subnet", FLAG_MOD_ADD, "objectclass") m["siteObject"] = ldb.MessageElement(str(dn_site), FLAG_MOD_ADD, "siteObject") samdb.add(m) except ldb.LdbError as (enum, estr): if enum == ldb.ERR_INVALID_DN_SYNTAX: raise SubnetInvalid("%s is not a valid subnet: %s" % (subnet_name, estr)) elif enum == ldb.ERR_ENTRY_ALREADY_EXISTS: # Subnet collisions are checked by exact match only, not # overlapping range. This won't stop you creating # 10.1.1.0/24 when there is already 10.1.0.0/16, or # prevent you from having numerous IPv6 subnets that refer # to the same range (e.g 5::0/16, 5::/16, 5:0:0::/16). raise SubnetAlreadyExists('A subnet with the CIDR %s already exists' % subnet_name) else: raise def delete_subnet(samdb, configDn, subnet_name): """Delete a subnet. :param samdb: A samdb connection :param configDn: The DN of the configuration partition :param subnet_name: Name of the subnet to delete :return: None :raise SubnetNotFound: if the subnet to be deleted does not exist. """ dnsubnet = ldb.Dn(samdb, "CN=Subnets,CN=Sites") if dnsubnet.add_base(configDn) == False: raise SubnetException("dnsubnet.add_base() failed") if dnsubnet.add_child("CN=X") == False: raise SubnetException("dnsubnet.add_child() failed") dnsubnet.set_component(0, "CN", subnet_name) try: ret = samdb.search(base=dnsubnet, scope=ldb.SCOPE_BASE, expression="objectClass=subnet") if len(ret) != 1: raise SubnetNotFound('Subnet %s does not exist' % subnet_name) except LdbError as (enum, estr): if enum == ldb.ERR_NO_SUCH_OBJECT: raise SubnetNotFound('Subnet %s does not exist' % subnet_name) samdb.delete(dnsubnet) def set_subnet_site(samdb, configDn, subnet_name, site_name): """Assign a subnet to a site. This dissociates the subnet from its previous site. :param samdb: A samdb connection :param configDn: The DN of the configuration partition :param subnet_name: Name of the subnet :param site_name: Name of the site :return: None :raise SubnetNotFound: if the subnet does not exist. :raise SiteNotFound: if the site does not exist. """ dnsubnet = ldb.Dn(samdb, "CN=Subnets,CN=Sites") if dnsubnet.add_base(configDn) == False: raise SubnetException("dnsubnet.add_base() failed") if dnsubnet.add_child("CN=X") == False: raise SubnetException("dnsubnet.add_child() failed") dnsubnet.set_component(0, "CN", subnet_name) try: ret = samdb.search(base=dnsubnet, scope=ldb.SCOPE_BASE, expression="objectClass=subnet") if len(ret) != 1: raise SubnetNotFound('Subnet %s does not exist' % subnet_name) except LdbError as (enum, estr): if enum == ldb.ERR_NO_SUCH_OBJECT: raise SubnetNotFound('Subnet %s does not exist' % subnet_name) dnsite = ldb.Dn(samdb, "CN=Sites") if dnsite.add_base(configDn) == False: raise SubnetException("dnsites.add_base() failed") if dnsite.add_child("CN=X") == False: raise SubnetException("dnsites.add_child() failed") dnsite.set_component(0, "CN", site_name) dnservers = ldb.Dn(samdb, "CN=Servers") dnservers.add_base(dnsite) try: ret = samdb.search(base=dnsite, scope=ldb.SCOPE_BASE, expression="objectClass=site") if len(ret) != 1: raise SiteNotFoundException('Site %s does not exist' % site_name) except LdbError as (enum, estr): if enum == ldb.ERR_NO_SUCH_OBJECT: raise SiteNotFoundException('Site %s does not exist' % site_name) siteDn = str(ret[0].dn) m = ldb.Message() m.dn = dnsubnet m["siteObject"] = ldb.MessageElement(siteDn, FLAG_MOD_REPLACE, "siteObject") samdb.modify(m)