Пример #1
0
def crash(request):
    """ Register crash data with the server
    """

    if request.method != 'POST':
        return HttpResponse('Invalid GET')

    node = vu._validate_node(request)
    if not node:
        return HttpResponse("Invalid node")

    #
    # checks out; with this we generate a new crash object,
    # tie it to the node ID, and write the crash data to
    # its respective file
    #

    try:
        data = json.loads(request.body)
        node.faults += + 1
        crash = Crash.objects.create(
            fault_index=data['crash_idx'],
            node_index=node,
            crash_time=utility.timestamp(),
            exception_type=vu.parse_key("EXCEPTION_TYPE", data['crash']),
            classification=vu.parse_key("CLASSIFICATION", data['crash'])
        )

        crash.save()
        node.save()
        vu._write_crash(data, node)
    except Exception, e:
        utility.msg("Failed to log crash: %s" % e, ERROR)
        return HttpResponse("Failed")
Пример #2
0
def register(request):
    """ Register a new node
    """

    if request.method != 'POST':
        return HttpResponse("Invalid GET")

    #
    # Registration requires only the exchange of a PSK.
    #

    # hash
    skey = request.POST.get('skey')
    node_id = None
    if 'node_id' in request.POST:
        node_id = request.POST.get('node_id')

    # compare
    if sha256(settings.SECRET_KEY).hexdigest() != skey:
        return HttpResponse("Invalid Key")

    try:
        node = Node.objects.get(id=node_id)
    except Node.DoesNotExist:

        # new node
        node = Node.objects.create(
            ip=request.META.get('REMOTE_ADDR'),
            active=True,
            start_time=utility.timestamp()
        )

        node.save()

    return HttpResponse("Node %d Active" % node.id)
Пример #3
0
def register(request):
    """ Register a new node
    """

    if request.method != 'POST':
        return HttpResponse("Invalid GET")

    #
    # Registration requires only the exchange of a PSK.
    #

    # hash
    skey = request.POST.get('skey')
    node_id = None
    if 'node_id' in request.POST:
        node_id = request.POST.get('node_id')

    # compare
    if sha256(settings.SECRET_KEY).hexdigest() != skey:
        return HttpResponse("Invalid Key")

    try:
        node = Node.objects.get(id=node_id)
    except Node.DoesNotExist:

        # new node
        node = Node.objects.create(
            ip=request.META.get('REMOTE_ADDR'),
            active=True,
            start_time=utility.timestamp(),
            session_name=request.POST.get("session"),
            session_fuzzer=request.POST.get("fuzzer")
        )

        node.save()

    return HttpResponse("Node %d Active" % node.id)