Exemple #1
0
def api_scan(request):
    """POST - Scan API."""
    params = ['scan_type', 'hash', 'file_name']
    if set(request.POST) >= set(params):
        scan_type = request.POST['scan_type']
        # APK, Android ZIP and iOS ZIP
        if scan_type in ['apk', 'zip']:
            resp = static_analyzer(request, True)
            if 'type' in resp:
                # For now it's only ios_zip
                request.POST._mutable = True
                request.POST['scan_type'] = 'ios'
                resp = static_analyzer_ios(request, True)
            if 'error' in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
        # IPA
        elif scan_type == 'ipa':
            resp = static_analyzer_ios(request, True)
            if 'error' in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
        # APPX
        elif scan_type == 'appx':
            resp = staticanalyzer_windows(request, True)
            if 'error' in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
    else:
        response = make_api_response({'error': 'Missing Parameters'}, 422)
    return response
Exemple #2
0
def api_scan(request):
    """POST - Scan API"""
    params = ['scan_type', 'hash', 'file_name']
    if set(request.POST) >= set(params):
        scan_type = request.POST['scan_type']
        # APK, Android ZIP and iOS ZIP
        if scan_type in ["apk", "zip"]:
            resp = static_analyzer(request, True)
            if "type" in resp:
                # For now it's only ios_zip
                request.POST._mutable = True
                request.POST['scan_type'] = "ios"
                resp = static_analyzer_ios(request, True)
            if "error" in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
        # IPA
        elif scan_type == "ipa":
            resp = static_analyzer_ios(request, True)
            if "error" in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
        # APPX
        elif scan_type == "appx":
            resp = staticanalyzer_windows(request, True)
            if "error" in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
    else:
        response = make_api_response({"error": "Missing Parameters"}, 422)
    return response
def api_scan(request):
    """POST - Scan API"""
    params = ['scan_type', 'hash', 'file_name']
    if set(request.POST) >= set(params):
        scan_type = request.POST['scan_type']
        # APK, Android ZIP and iOS ZIP
        if scan_type in ["apk", "zip"]:
            resp = static_analyzer(request, True)
            if "type" in resp:
                # For now it's only ios_zip
                request.POST._mutable = True
                request.POST['scan_type'] = "ios"
                resp = static_analyzer_ios(request, True)
            if "error" in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
        # IPA
        elif scan_type == "ipa":
            resp = static_analyzer_ios(request, True)
            if "error" in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
        # APPX
        elif scan_type == "appx":
            resp = staticanalyzer_windows(request, True)
            if "error" in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
    else:
        response = make_api_response(
            {"error": "Missing Parameters"}, 422)
    return response
def api_scan(request):
    """POST - Scan API"""
    if api_auth(request.META):
        if request.method == 'POST':
            params = ['scan_type', 'hash', 'file_name']
            if set(request.POST) >= set(params):
                scan_type = request.POST['scan_type']
                # APK, Android ZIP and iOS ZIP
                if scan_type in ["apk", "zip"]:
                    resp = static_analyzer(request, True)
                    if "type" in resp:
                        # For now it's only ios_zip
                        request.POST._mutable = True
                        request.POST['scan_type'] = "ios"
                        resp = static_analyzer_ios(request, True)
                    if "error" in resp:
                        response = make_api_response(resp, 500)
                    else:
                        response = make_api_response(resp, 200)
                # IPA
                elif scan_type == "ipa":
                    resp = static_analyzer_ios(request, True)
                    if "error" in resp:
                        response = make_api_response(resp, 500)
                    else:
                        response = make_api_response(resp, 200)
                # APPX
                elif scan_type == "appx":
                    resp = staticanalyzer_windows(request, True)
                    if "error" in resp:
                        response = make_api_response(resp, 500)
                    else:
                        response = make_api_response(resp, 200)
            else:
                response = make_api_response(
                    {"error": "Missing Parameters"}, 422)
        else:
            response = make_api_response({"error": "Method Not Allowed"}, 405)
    else:
        response = make_api_response(
            {"error": "You are unauthorized to make this request."}, 401)
    return response
Exemple #5
0
def api_scan(request):
    """POST - Scan API"""
    if api_auth(request.META):
        if request.method == 'POST':
            params = ['scan_type', 'hash', 'file_name']
            if set(request.POST) >= set(params):
                scan_type = request.POST['scan_type']
                # APK, Android ZIP and iOS ZIP
                if scan_type in ["apk", "zip"]:
                    resp = static_analyzer(request, True)
                    if "type" in resp:
                        # For now it's only ios_zip
                        request.POST._mutable = True
                        request.POST['scan_type'] = "ios"
                        resp = static_analyzer_ios(request, True)
                    if "error" in resp:
                        response = make_api_response(resp, 500)
                    else:
                        response = make_api_response(resp, 200)
                # IPA
                elif scan_type == "ipa":
                    resp = static_analyzer_ios(request, True)
                    if "error" in resp:
                        response = make_api_response(resp, 500)
                    else:
                        response = make_api_response(resp, 200)
                # APPX
                elif scan_type == "appx":
                    resp = staticanalyzer_windows(request, True)
                    if "error" in resp:
                        response = make_api_response(resp, 500)
                    else:
                        response = make_api_response(resp, 200)
            else:
                response = make_api_response({"error": "Missing Parameters"},
                                             422)
        else:
            response = make_api_response({"error": "Method Not Allowed"}, 405)
    else:
        response = make_api_response(
            {"error": "You are unauthorized to make this request."}, 401)
    return response