Esempio n. 1
0
class PostDayView(viewsets.ViewSet):
    def retrieve(self, request, pk=None, date=None):
        self.widgets = Widgets(date=date, timespan='day', pk=pk, level='post')
        error, message = self.widgets.check_object_exists()
        if error:
            return Response(message, status=status.HTTP_400_BAD_REQUEST)
        else:
            return Response({'report': self.widgets.get_intrusion_report()})
Esempio n. 2
0
class BattalionRecentView(viewsets.ViewSet):
    def retrieve(self, request, pk=None):
        self.widgets = Widgets(timespan='recent', level='battalion', pk=pk)
        error, message = self.widgets.check_object_exists()
        if error:
            return Response(message, status=status.HTTP_400_BAD_REQUEST)
        else:
            return Response({
                'vulnerable': self.widgets.get_vulnerable_post(),
                'recent': self.widgets.get_intrusion_report()
            })
Esempio n. 3
0
class PostRecentView(viewsets.ViewSet):
    def retrieve(self, request, pk=None):
        self.widgets = Widgets(timespan='recent', level='post', pk=pk)
        error, message = self.widgets.check_object_exists()
        if error:
            return Response(message, status=status.HTTP_400_BAD_REQUEST)
        else:
            return Response({
                'recent': self.widgets.get_intrusion_report(),
                'vulnerable': self.widgets.get_vulnerable_morcha(),
                'hour': self.widgets.get_hypersensitive_hour()
            })
Esempio n. 4
0
class PostWeekView(viewsets.ViewSet):
    def retrieve(self, request, pk=None, date=None):
        self.widgets = Widgets(date=date, timespan='week', level='post', pk=pk)
        error, message = self.widgets.check_object_exists()
        if error:
            return Response(message, status=status.HTTP_400_BAD_REQUEST)
        else:
            return Response({
                'count': self.widgets.total_count(),
                'longest': self.widgets.longest_intrusion(),
                'vulnerable': self.widgets.get_vulnerable_morcha(),
                'report': self.widgets.get_intrusion_report()
            })
Esempio n. 5
0
class MorchaDayView(viewsets.ViewSet):
    def retrieve(self, request, pk=None, date=None):
        self.widgets = Widgets(date=date,
                               timespan='day',
                               pk=pk,
                               level='morcha')
        error, message = self.widgets.check_object_exists()
        if error:
            return Response(message, status=status.HTTP_400_BAD_REQUEST)
        else:
            return Response({
                'count': self.widgets.total_count(),
                'intrusions': self.widgets.get_intrusion_report(),
                'area_secure': self.widgets.get_security_update()
            })
Esempio n. 6
0
class MorchaMonthView(viewsets.ViewSet):
    def retrieve(self, request, pk=None, date=None):
        self.widgets = Widgets(date=date,
                               timespan='month',
                               pk=pk,
                               level='morcha')
        error, message = self.widgets.check_object_exists()
        if error:
            return Response(message, status=status.HTTP_400_BAD_REQUEST)
        else:
            return Response({
                'longest_intrusion':
                self.widgets.longest_intrusion(),
                'count':
                self.widgets.total_count(),
                'report':
                self.widgets.get_intrusion_report(),
            })