示例#1
0
文件: eemtest.py 项目: 5l1v3r1/ease-1
 def run(self, **kwargs):  # {{{
     """
     Use to launch all attacks instances and all option verifications
     """
     t = time.time()
     self.filteriptables(**kwargs)
     EModule.run(self, **kwargs)
     self.unfilteriptables(**kwargs)
     kwargs['msg'] = 'Test realised in %s seconds' % str(time.time() - t)
示例#2
0
 def do(self, **kwargs):
     kwargs = EModule.do(self, **kwargs)
     kwargs['socket'] = self.initsocket(**kwargs)
     if not self._hasSocket(**kwargs):
         self.error(msg="Can't create a socket", **kwargs)
         raise
     return kwargs
示例#3
0
    def sendmessagesocket(self, **kwargs):  # {{{
        """
        Get a modbus response to an umas request

        @return: the modbus response
        """
        rp = EModule.sendmessagesocket(self, **kwargs)
        return ModbusADUResponse(rp)
示例#4
0
 def do(self, **kwargs):
     kwargs = EModule.do(self, **kwargs)
     try:
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         s.connect((kwargs['host'], self.options['PORT'][0]))
         kwargs['msg'] = '%s - modbus device' % kwargs['ip'],
         self.success(**kwargs)
         self.succeded = True
     except:
         pass
     return kwargs
示例#5
0
    def do(self, **kwargs):  # {{{
        """
        An instance attack

        @return: the main dictionary
        @raise: a exception if no socket are created
        """
        kwargs = EModule.do(self, **kwargs)
        kwargs['socket'] = self.initsocket(**kwargs)
        if not self._hasSocket(**kwargs):
            self.error(msg="Can't create a socket", **kwargs)
            raise
        return kwargs
示例#6
0
    def verify(self, **kwargs):  # {{{
        """
        Verify some element from module class

        @return: False if no error is raise, else True
        """
        error = EModule.verify(self, **kwargs)
        if 'PERIOD' in self.options:  # {{{
            p = self.options['PERIOD'][0]
            try:
                period = int(p)
            except:
                self.error(msg='"%s" is an invalid time' % p, **kwargs)
                error = True
            if period < 0:
                self.error(msg='"%s" is an invalid time' % p, **kwargs)
                error = True
        # }}}
        return error
示例#7
0
文件: eemtest.py 项目: 5l1v3r1/ease-1
    def do(self, **kwargs):  # {{{
        """
        An instance attack

        @return: the main dictionary
        """
        kwargs = EModule.do(self, **kwargs)
        kwargs['seq'] = random.randint(1000000, 16000000)
        kwargs['id'] = random.randint(1024, 65635)

        # begin play function
        kwargs['ack'] = self.sendSYN(**kwargs)
        if kwargs['ack'] == 0:
            kwargs['msg'] = 'failed to connect with %s' % kwargs['host']
            self.error(**kwargs)
            return kwargs
        kwargs['seq'] += 1
        kwargs['ack'] += 1
        kwargs['id'] += 1
        self.sendACK(**kwargs)
        kwargs['request'] = self.getRequest(**kwargs)
        send(kwargs['request'])
        return kwargs
示例#8
0
文件: eemtest.py 项目: 5l1v3r1/ease-1
    def verify(self, **kwargs):  # {{{
        """
        Verify some element from module class

        @return: False if no error is raise, else True
        """
        error = EModule.verify(self, **kwargs)
        print os.environ
        if 'SUDO_UID' not in os.environ:  # {{{
            kwargs['msg'] = 'You don\'t have administrator permissions.'
            self.warning(**kwargs)
            kwargs['msg'] = 'It\'s possible you encounter some issues to ' + \
                'use some parts of this script'
            self.warning(**kwargs)
            kwargs['msg'] = "We recommand you to use EASE program with 'sudo'."
            self.warning(**kwargs)
        # }}}
        if 'PAYLOAD' in self.options:  # {{{
            try:
                str(self.options['PAYLOAD'][0])
            except:
                error = True
        # }}}
        return error
示例#9
0
 def sendmessagesocket(self, **kwargs):
     kwargs['request'].messageSize = len(kwargs['request'])
     if self.__hasField(field='timestamp', **kwargs):
         kwargs['request'].timestamp = self.getTimestamp(**kwargs)
     rp = EModule.sendmessagesocket(self, **kwargs)
     return opcuaResponseDecoder(rp)
示例#10
0
 def verify(self, **kwargs):
     error = EModule.verify(self, **kwargs)
     return error
示例#11
0
 def run(self, **kwargs):
     EModule.run(self, **kwargs)
示例#12
0
 def __init__(self, **kwargs):
     EModule.__init__(self, **kwargs)
示例#13
0
 def run(self, **kwargs):  # {{{
     """
     Use to launch all attacks instances and all option verifications
     """
     EModule.run(self, **kwargs)