Esempio n. 1
0
 def handle(self, *args, **options):
     logger.debug("Handling settings")
     GlobalConfig.initialize()
     try:
         for config in args:
             logger.debug('Config: {}'.format(config))
             first, value = config.split('=')
             first = first.split('.')
             if len(first) == 2:
                 mod, name = first
             else:
                 mod, name = GLOBAL_SECTION, first[0]
             if Config.update(mod, name, value) is False:  # If not exists, try to store value without any special parameters
                 Config.section(mod).value(name, value).get()
     except Exception:
         logger.exception('Exception processing {}'.format(args))
Esempio n. 2
0
def generateHtmlForNX(transport, idUserService, idTransport, ip, os, user, password, extra):
    isMac = os['OS'] == OsDetector.Macintosh
    applet = reverse('uds.web.views.transcomp', kwargs={ 'idTransport' : idTransport, 'componentId' : '1' })
    # Gets the codebase, simply remove last char from applet
    codebase = applet[:-1]
    # We generate the "data" parameter
    data = simpleScrambler('\t'.join([
        'user:'******'pass:'******'ip:' + ip,
        'port:' + extra['port'],
        'session:' + extra['session'],
        'connection:' + extra['connection'],
        'cacheDisk:' + extra['cacheDisk'],
        'cacheMem:' + extra['cacheMem'],
        'width:' + str(extra['width']),
        'height:' + str(extra['height']),
        'is:' + idUserService
        ]
    ))
    if isMac is True:
        msg = '<p>' + _('In order to use this transport, you need to install first OpenNX Client for mac') + '</p>'
        msg += '<p>' + _('You can oibtain it from ') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrlMACOS').get()) + _('OpenNx Website') + '</a></p>'
    else:
        msg = '<p>' + _('In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x') + '</p>'
        msg += '<p>' + _('you can obtain it for your platform from') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrl').get()) + _('nochamine web site') + '</a></p>'
    res = '<div idTransport="applet"><applet code="NxTransportApplet.class" codebase="%s" archive="%s" width="140" height="22"><param name="data" value="%s"/><param name="permissions" value="all-permissions"/></applet></div>' % (codebase, '1', data)
    res += '<div>' + msg + '</div>'
    return res
Esempio n. 3
0
    def get(self):
        cfg: CfgConfig.Value

        res: typing.Dict[str, typing.Dict[str, typing.Any]] = {}
        addCrypt = self.is_admin()

        for cfg in CfgConfig.enumerate():
            # Skip removed configuration values, even if they are in database
            logger.debug('Key: %s, val: %s', cfg.section(), cfg.key())
            if cfg.key() in REMOVED.get(cfg.section(), ()):
                continue

            if cfg.isCrypted() is True and addCrypt is False:
                continue
            # add section if it do not exists
            if cfg.section() not in res:
                res[cfg.section()] = {}
            res[cfg.section()][cfg.key()] = {
                'value': cfg.get(),
                'crypt': cfg.isCrypted(),
                'longText': cfg.isLongText(),
                'type': cfg.getType(),
                'params': cfg.getParams()
            }
        logger.debug('Configuration: %s', res)
        return res
Esempio n. 4
0
def custom(request, component):
    content_type = 'text/plain'
    value = ''

    if component == 'styles.css':
        content_type = 'text/css'
        value = Config.section('__custom').value('style').get(force=True)

    return HttpResponse(content_type=content_type, content=value)
Esempio n. 5
0
 def handle(self, *args, **options):
     logger.debug("Handling settings")
     GlobalConfig.initialize()
     try:
         for config in options['name_value']:
             logger.debug('Config: %s', config)
             first, value = config.split('=')
             first = first.split('.')
             if len(first) == 2:
                 mod, name = first
             else:
                 mod, name = GLOBAL_SECTION, first[0]
             if Config.update(
                     mod, name, value
             ) is False:  # If not exists, try to store value without any special parameters
                 Config.section(mod).value(name, value).get()
     except Exception as e:
         print('The command could not be processed: {}'.format(e))
         logger.exception('Exception processing %s', args)
Esempio n. 6
0
def generateHtmlForNX(transport, idUserService, idTransport, os, user,
                      password, extra):
    isMac = os['OS'] == OsDetector.Macintosh
    applet = reverse('uds.web.views.transcomp',
                     kwargs={
                         'idTransport': idTransport,
                         'componentId': '1'
                     })
    # Gets the codebase, simply remove last char from applet
    codebase = applet[:-1]
    # We generate the "data" parameter

    data = [
        'user:'******'pass:'******'session:' + extra['session'],
        'connection:' + extra['connection'], 'cacheDisk:' + extra['cacheDisk'],
        'cacheMem:' + extra['cacheMem'], 'width:' + str(extra['width']),
        'height:' + str(extra['height']), 'tun:' + extra['tun'],
        'is:' + idUserService
    ]
    data = simpleScrambler('\t'.join(data))
    if isMac is True:
        msg = '<p>' + _(
            'In order to use this transport, you need to install first OpenNX Client for mac'
        ) + '</p>'
        msg += '<p>' + _('You can oibtain it from ') + '<a href="{0}">'.format(
            Config.section('NX').value('downloadUrlMACOS').get()) + _(
                'OpenNx Website') + '</a></p>'
    else:
        msg = '<p>' + _(
            'In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x'
        ) + '</p>'
        msg += '<p>' + _('you can obtain it for your platform from'
                         ) + '<a href="{0}">'.format(
                             Config.section('NX').value('downloadUrl').get()
                         ) + _('nochamine web site') + '</a></p>'

    res = '<div idTransport="applet"><applet code="NxTunTransportApplet.class" codebase="%s" archive="%s" width="165" height="22"><param name="data" value="%s"/><param name="permissions" value="all-permissions"/></applet></div>' % (
        codebase, '1', data)
    res += '<div>' + msg + '</div>'
    return res
Esempio n. 7
0
    def get(self):
        res = {}
        addCrypt = self.is_admin()

        for cfg in cfgConfig.enumerate():
            if cfg.isCrypted() is True and addCrypt is False:
                continue
            # add section if it do not exists
            if cfg.section() not in res:
                res[cfg.section()] = {}
            res[cfg.section()][cfg.key()] = {
                "value": cfg.get(),
                "crypt": cfg.isCrypted(),
                "longText": cfg.isLongText(),
                "type": cfg.getType(),
            }
        logger.debug("Configuration: {0}".format(res))
        return res
Esempio n. 8
0
    def get(self):
        res = {}
        addCrypt = self.is_admin()

        for cfg in cfgConfig.enumerate():
            if cfg.isCrypted() is True and addCrypt is False:
                continue
            # add section if it do not exists
            if cfg.section() not in res:
                res[cfg.section()] = {}
            res[cfg.section()][cfg.key()] = {
                'value': cfg.get(),
                'crypt': cfg.isCrypted(),
                'longText': cfg.isLongText(),
                'type': cfg.getType()
            }
        logger.debug('Configuration: {0}'.format(res))
        return res
Esempio n. 9
0
    def get(self):
        res = {}
        addCrypt = self.is_admin()

        for cfg in cfgConfig.enumerate():
            if cfg.isCrypted() is True and addCrypt is False:
                continue
            # add section if it do not exists
            if cfg.section() not in res:
                res[cfg.section()] = {}
            res[cfg.section()][cfg.key()] = {
                'value': cfg.get(),
                'crypt': cfg.isCrypted(),
                'longText': cfg.isLongText(),
                'type': cfg.getType(),
                'params': cfg.getParams()
            }
        logger.debug('Configuration: {0}'.format(res))
        return res
Esempio n. 10
0
    def get(self):
        res = {}
        addCrypt = self.is_admin()

        for cfg in cfgConfig.enumerate():
            # Skip removed configuration values, even if they are in database
            logger.debug('Key: %s, val: %s', cfg.section(), cfg.key());
            if cfg.key() in REMOVED.get(cfg.section(), ()):
                continue

            if cfg.isCrypted() is True and addCrypt is False:
                continue
            # add section if it do not exists
            if cfg.section() not in res:
                res[cfg.section()] = {}
            res[cfg.section()][cfg.key()] = {
                'value': cfg.get(),
                'crypt': cfg.isCrypted(),
                'longText': cfg.isLongText(),
                'type': cfg.getType(),
                'params': cfg.getParams()
            }
        logger.debug('Configuration: {0}'.format(res))
        return res
Esempio n. 11
0
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''

from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.managers.DownloadsManager import DownloadsManager
from uds.core.util.Config import Config
from TSNXTransport import TSNXTransport
from django.utils.translation import ugettext_noop as _
import os.path, sys

Config.section('NX').value('downloadUrl', 'http://www.nomachine.com/download-3').get()
Config.section('NX').value('downloadUrlMACOS', 'http://opennx.net/download.html').get()

UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'), 
                                          [ 
                                           CommonPrefs.screenSizePref
                                        ])
Esempio n. 12
0
 def put(self):
     for section, secDict in self._params.items():
         for key, vals in secDict.items():
             cfgConfig.update(section, key, vals['value'])
     return 'done'
Esempio n. 13
0
#      without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''

from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.managers.DownloadsManager import DownloadsManager
from uds.core.util.Config import Config
from TSNXTransport import TSNXTransport
from django.utils.translation import ugettext_noop as _
import os.path, sys

Config.section('NX').value('downloadUrl',
                           'http://www.nomachine.com/download-3').get()
Config.section('NX').value('downloadUrlMACOS',
                           'http://opennx.net/download.html').get()

UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'),
                                         [CommonPrefs.screenSizePref])
Esempio n. 14
0
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""

from django.utils.translation import ugettext_noop as _

from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.util.Config import Config
from .NXTransport import NXTransport
from .TSNXTransport import TSNXTransport

Config.section('NX').value(
    'downloadUrl',
    'http://sourceforge.net/projects/opennx/files/opennx/CI-win32/OpenNX-0.16.0.725-Setup.exe/download'
).get()
Config.section('NX').value('downloadUrlMACOS',
                           'http://opennx.net/download.html').get()

UserPrefsManager.manager().registerPrefs('nx', _('NX/X2GO'),
                                         [CommonPrefs.screenSizePref])

# DownloadsManager.manager().registerDownloadable('udsactor-nx_1.0_all.deb',
#                                                _('UDS Actor connector for NX <b>(requires nomachine packages)</b>'),
#                                                os.path.dirname(sys.modules[__package__].__file__) + '/files/udsactor-nx_1.0_all.deb',
#                                                'application/x-debian-package')
Esempio n. 15
0
 def put(self):
     for section, secDict in six.iteritems(self._params):
         for key, vals in six.iteritems(secDict):
             cfgConfig.update(section, key, vals['value'])
     return 'done'
Esempio n. 16
0
#    * Redistributions of source code must retain the above copyright notice,
#      this list of conditions and the following disclaimer.
#    * Redistributions in binary form must reproduce the above copyright notice,
#      this list of conditions and the following disclaimer in the documentation
#      and/or other materials provided with the distribution.
#    * Neither the name of Virtual Cable S.L. nor the names of its contributors
#      may be used to endorse or promote products derived from this software
#      without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


"""

@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from uds.core.util.Config import Config
from .Authenticator import IPAuth

# Access configuration value as soon as we can, so it is available at db
Config.section('IPAUTH').value('autoLogin', '0').get()  # If 1, try to autologin
Esempio n. 17
0
#      may be used to endorse or promote products derived from this software
#      without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''

from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.managers.DownloadsManager import DownloadsManager
from uds.core.util.Config import Config
from .X2GOTransport import X2GOTransport
from django.utils.translation import ugettext_noop as _
import os.path


Config.section('X2GO').value('downloadUrl', 'http://wiki.x2go.org/doku.php/doc:installation:x2goclient').get()


UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'), [CommonPrefs.screenSizePref])
Esempio n. 18
0
 def put(self):
     for section, secDict in self._params.iteritems():
         for key, vals in secDict.iteritems():
             cfgConfig.update(section, key, vals["value"])
     return "done"
Esempio n. 19
0
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''

from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.managers.DownloadsManager import DownloadsManager
from uds.core.util.Config import Config
from .NXTransport import NXTransport
from .TSNXTransport import TSNXTransport
from django.utils.translation import ugettext_noop as _
import os.path

Config.section('NX').value('downloadUrl', 'http://sourceforge.net/projects/opennx/files/opennx/CI-win32/OpenNX-0.16.0.725-Setup.exe/download').get()
Config.section('NX').value('downloadUrlMACOS', 'http://opennx.net/download.html').get()


UserPrefsManager.manager().registerPrefs('nx', _('NX/X2GO'), [CommonPrefs.screenSizePref])

# DownloadsManager.manager().registerDownloadable('udsactor-nx_1.0_all.deb',
#                                                _('UDS Actor connector for NX <b>(requires nomachine packages)</b>'),
#                                                os.path.dirname(sys.modules[__package__].__file__) + '/files/udsactor-nx_1.0_all.deb',
#                                                'application/x-debian-package')