Esempio n. 1
0
    def __gen_numbers(self):
        n = {
            '!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]': '9',
            '!+[]+!![]+!![]+!![]+!![]': '5',
            '!+[]+!![]+!![]+!![]': '4',
            '!+[]+!![]+!![]+!![]+!![]+!![]': '6',
            '!+[]+!![]': '2',
            '!+[]+!![]+!![]': '3',
            '(+![]+([]+[]))': '0',
            '(+[]+[])': '0',
            '+[]': '0',
            '(+!![]+[])': '1',
            '!+[]+!![]+!![]+!![]+!![]+!![]+!![]': '7',
            '!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]': '8',
            '+!![]': '1',
            '[+[]]': '[0]',
            '!+[]+!+[]': '2',
            '[+!+[]]': '[1]',
            '(+20)': '20',
            '[+!![]]': '[1]',
            '[+!+[]+[+[]]]': '[10]',
            '+(1+1)': '11'
        }

        for i in x_range(2, 20):
            key = '+!![]' * (i - 1)
            key = '!+[]' + key
            n['(' + key + ')'] = str(i)
            key += '+[]'
            n['(' + key + ')'] = str(i)
            n['[' + key + ']'] = '[' + str(i) + ']'

        for i in x_range(2, 10):
            key = '!+[]+' * (i - 1) + '!+[]'
            n['(' + key + ')'] = str(i)
            n['[' + key + ']'] = '[' + str(i) + ']'

            key = '!+[]' + '+!![]' * (i - 1)
            n['[' + key + ']'] = '[' + str(i) + ']'

        for i in x_range(0, 10):
            key = '(+(+!+[]+[%d]))' % (i)
            n[key] = str(i + 10)
            key = '[+!+[]+[%s]]' % (i)
            n[key] = '[' + str(i + 10) + ']'

        for tens in x_range(2, 10):
            for ones in x_range(0, 10):
                key = '!+[]+' * (tens) + '[%d]' % (ones)
                n['(' + key + ')'] = str(tens * 10 + ones)
                n['[' + key + ']'] = '[' + str(tens * 10 + ones) + ']'

        for hundreds in x_range(1, 10):
            for tens in x_range(0, 10):
                for ones in x_range(0, 10):
                    key = '+!+[]' * hundreds + '+[%d]+[%d]))' % (tens, ones)
                    if hundreds > 1: key = key[1:]
                    key = '(+(' + key
                    n[key] = str(hundreds * 100 + tens * 10 + ones)
        return n
Esempio n. 2
0
def randomagent():
    BR_VERS = [
        ['%s.0' % i for i in x_range(18, 50)],
        [
            '37.0.2062.103', '37.0.2062.120', '37.0.2062.124', '38.0.2125.101',
            '38.0.2125.104', '38.0.2125.111', '39.0.2171.71', '39.0.2171.95',
            '39.0.2171.99', '40.0.2214.93', '40.0.2214.111', '40.0.2214.115',
            '42.0.2311.90', '42.0.2311.135', '42.0.2311.152', '43.0.2357.81',
            '43.0.2357.124', '44.0.2403.155', '44.0.2403.157', '45.0.2454.101',
            '45.0.2454.85', '46.0.2490.71', '46.0.2490.80', '46.0.2490.86',
            '47.0.2526.73', '47.0.2526.80', '48.0.2564.116', '49.0.2623.112',
            '50.0.2661.86', '51.0.2704.103', '52.0.2743.116', '53.0.2785.143',
            '54.0.2840.71', '61.0.3163.100'
        ], ['11.0'], ['8.0', '9.0', '10.0', '10.6']
    ]
    WIN_VERS = [
        'Windows NT 10.0', 'Windows NT 7.0', 'Windows NT 6.3',
        'Windows NT 6.2', 'Windows NT 6.1', 'Windows NT 6.0', 'Windows NT 5.1',
        'Windows NT 5.0'
    ]
    FEATURES = ['; WOW64', '; Win64; IA64', '; Win64; x64', '']
    RAND_UAS = [
        'Mozilla/5.0 ({win_ver}{feature}; rv:{br_ver}) Gecko/20100101 Firefox/{br_ver}',
        'Mozilla/5.0 ({win_ver}{feature}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{br_ver} Safari/537.36',
        'Mozilla/5.0 ({win_ver}{feature}; Trident/7.0; rv:{br_ver}) like Gecko',
        'Mozilla/5.0 (compatible; MSIE {br_ver}; {win_ver}{feature}; Trident/6.0)'
    ]
    index = random.randrange(len(RAND_UAS))
    return RAND_UAS[index].format(win_ver=random.choice(WIN_VERS),
                                  feature=random.choice(FEATURES),
                                  br_ver=random.choice(BR_VERS[index]))
Esempio n. 3
0
 def repl_arrays(self, words):
     for word in sorted(words.values(), key=lambda x: len(x), reverse=True):
         for index in x_range(0, 100):
             try:
                 repl = word[index]
                 self.js = self.js.replace('%s[%d]' % (word, index), repl)
             except:
                 pass
Esempio n. 4
0
    def __onActionReceived__(self, action, phase):
        super(OQWidgetList, self).__onActionReceived__(action, phase)

        if action.sender is self.__model.obj() and phase is POST:

            # Wait for the model to receive it first.
            self.__model.objToken().wait()

            # Open persistent editors when items are inserted.
            if isinstance(action.change, ListInsert):
                self.clearSelection()
                indexes = []
                for i in x_range(action.change.index,
                                 action.change.last_index + 1):
                    index = self.__model.index(i, 0, QtCore.QModelIndex())
                    self.openPersistentEditor(index)
                    indexes.append(index)

                if indexes:
                    if len(indexes) > 1:
                        self.select(
                            QtCore.QItemSelection(indexes[0], indexes[-1]),
                            QtCore.QItemSelectionModel.Select,
                            indexes[-1],
                        )
                    else:
                        self.select(indexes[0],
                                    QtCore.QItemSelectionModel.Select,
                                    indexes[0])

            # Select moved items.
            elif isinstance(action.change, ListMove):
                first = self.__model.index(action.change.post_index, 0,
                                           QtCore.QModelIndex())
                if action.change.post_index != action.change.post_last_index:
                    last = self.__model.index(action.change.post_last_index, 0,
                                              QtCore.QModelIndex())
                    selection = QtCore.QItemSelection(first, last)
                    current = last
                else:
                    selection = first
                    current = first
                self.select(selection,
                            QtCore.QItemSelectionModel.ClearAndSelect, current)

            # Update layout.
            self.__updateLayout__()