Ejemplo n.º 1
0
class RemoveForm(Form):
	select = SelectField(choices=[(i[0],i[0]) for i in getModules(1)])
	password = PasswordField("Clave")
	remove = SubmitField("Remover")

	def setChoices(self):
		self.select.choices = [(i[0],i[0]) for i in getModules(1)]
Ejemplo n.º 2
0
 def viewProfile():
     profile = request.args.get('name')
     moduleList = modules.getModules()
     traversalList = modules.getTraversals()
     profileJson = profiles.getProfiles()
     if profile in profileJson:
         return render_template('profile.html',
                                traversals=traversalList,
                                modules=moduleList,
                                profile=profileJson[profile],
                                name=profile)
     else:
         return json.dumps({"error": "something went wrong."}), 400
Ejemplo n.º 3
0
    def fillList(self):
        """ Fill the list of modules """
        rows = []
        for (name, data) in modules.getModules():
            instance     = data[modules.MOD_INSTANCE]
            mandatory    = data[modules.MOD_INFO][modules.MODINFO_MANDATORY]
            configurable = data[modules.MOD_INFO][modules.MODINFO_CONFIGURABLE]

            if configurable or not mandatory:
                if configurable and instance is not None: icon = tools.consts.icoBtnPrefs
                else:                                     icon = None

                text = '<b>%s</b>\n<small>%s</small>' % (cgi.escape(_(name)), cgi.escape(data[modules.MOD_INFO][modules.MODINFO_DESC]))
                rows.append((instance is not None, text, icon, not mandatory, instance, data[modules.MOD_INFO]))

        rows.sort(key=lambda row: row[ROW_TEXT])
        self.list.replaceContent(rows)
Ejemplo n.º 4
0
    def fillList(self):
        """ Fill the list of modules according to the currently selected category """
        rows = []
        for (name, data) in modules.getModules():
            instance     = data[modules.MOD_INSTANCE]
            category     = data[modules.MOD_INFO][modules.MODINFO_CATEGORY]
            mandatory    = data[modules.MOD_INFO][modules.MODINFO_MANDATORY]
            configurable = data[modules.MOD_INFO][modules.MODINFO_CONFIGURABLE]

            if (configurable or not mandatory) and category == self.currCat:
                if configurable and instance is not None: icon = icons.prefsBtnIcon()
                else:                                     icon = None

                text = '<b>%s</b>\n<small>%s</small>' % (tools.htmlEscape(_(name)), tools.htmlEscape(data[modules.MOD_INFO][modules.MODINFO_DESC]))
                rows.append((instance is not None, text, icon, not mandatory, instance, data[modules.MOD_INFO]))

        rows.sort(key=lambda row: row[ROW_TEXT])
        self.list.replaceContent(rows)
Ejemplo n.º 5
0
    def fillList(self):
        """ Fill the list of modules """
        rows = []
        for (name, data) in modules.getModules():
            instance     = data[modules.MOD_INSTANCE]
            mandatory    = data[modules.MOD_INFO][modules.MODINFO_MANDATORY]
            configurable = data[modules.MOD_INFO][modules.MODINFO_CONFIGURABLE]

            if configurable or not mandatory:
                if configurable and instance is not None:
                    icon = tools.icons.prefsBtnIcon()
                else:
                    icon = None
                text = '<b>%s</b>\n<small>%s</small>' % (tools.htmlEscape(_(name)), tools.htmlEscape(data[modules.MOD_INFO][modules.MODINFO_DESC]))
                rows.append((instance is not None, text, icon, not mandatory, instance, data[modules.MOD_INFO]))

        rows.sort(key=lambda row: row[ROW_TEXT])
        self.list.store.clear()
        for row in rows:
            self.list.store.append(row)
Ejemplo n.º 6
0
    def fillList(self):
        """ Fill the list of modules """
        rows = []
        for (name, data) in modules.getModules():
            instance = data[modules.MOD_INSTANCE]
            mandatory = data[modules.MOD_INFO][modules.MODINFO_MANDATORY]
            configurable = data[modules.MOD_INFO][modules.MODINFO_CONFIGURABLE]

            if configurable or not mandatory:
                if configurable and instance is not None:
                    icon = tools.icons.prefsBtnIcon()
                else:
                    icon = None
                text = '<b>%s</b>\n<small>%s</small>' % (
                    tools.htmlEscape(_(name)),
                    tools.htmlEscape(
                        data[modules.MOD_INFO][modules.MODINFO_DESC]))
                rows.append((instance is not None, text, icon, not mandatory,
                             instance, data[modules.MOD_INFO]))

        rows.sort(key=lambda row: row[ROW_TEXT])
        self.list.store.clear()
        for row in rows:
            self.list.store.append(row)
Ejemplo n.º 7
0
import os
import config
import auth
import modules
import workbin


def setup():
    if not os.path.exists(config.credentialdir):
        os.makedirs(config.credentialdir)

    if not os.path.exists(config.authfile):
        with open(config.authfile, 'w') as fi:
            fi.write('{"Token": "NULL"}')  #init of empty token


if __name__ == '__main__':

    setup()
    token = auth.authenticate()
    modules = modules.getModules(token)
    workbin.getFiles(modules, token)
Ejemplo n.º 8
0
import os
import config
import auth
import modules
import workbin


def setup():
    if not os.path.exists(config.credentialdir):
        os.makedirs(config.credentialdir)

    if not os.path.exists(config.authfile):
        with open(config.authfile, 'w') as fi:
            fi.write('{"Token": "NULL"}') #init of empty token

if __name__ == '__main__':
    
    setup()
    token = auth.authenticate()
    modules = modules.getModules(token)
    workbin.getFiles(modules, token)
Ejemplo n.º 9
0
	def setChoices(self):
		self.select.choices = [(i[0],i[0]) for i in getModules(1)]
Ejemplo n.º 10
0
 def showModules():
     moduleList = modules.getModules()
     form = ModuleForm()
     form.source_code.data = form.source_code.data or defaultModuleCode
     return render_template('modules.html', modules=moduleList, form=form)