Exemplo n.º 1
0
def targets_add():

    if request.method == "OPTIONS":  # CORS preflight
        return _build_cors_prelight_response()

    name = request.json["name"]
    category = request.json["category"]
    domain = request.json["domain"]

    result = DB.save_target(name, category)
    if not result or result >= 400:
        # Error handling
        json.dumps({'success': False}), 500, {
            'ContentType': 'application/json'
        }

    if domain:
        data = SubdomainForm("manual", [domain])

        result = DB.save_target_subdomain(name, category, data)
        if not result or result >= 400:
            # Error handling
            return json.dumps({'success': False}), 500, {
                'ContentType': 'application/json'
            }

    return json.dumps({'success': True}), 200, {
        'ContentType': 'application/json'
    }
Exemplo n.º 2
0
def save_conf():
    if request.method == "OPTIONS":  # CORS preflight
        return _build_cors_prelight_response()

    name = request.json["name"]
    category = request.json["category"]
    conf = request.json["conf"]

    data = ConfForm.from_dict(conf)
    print(data)
    result = DB.save_target_conf(name, category, data)
    if not result or result >= 400:
        # Error handling
        return json.dumps({'success': False}), 500, {
            'ContentType': 'application/json'
        }

    return json.dumps({'success': True}), 200, {
        'ContentType': 'application/json'
    }
    if not result or result >= 400:
        # Error handling
        return json.dumps({'success': False}), 500, {
            'ContentType': 'application/json'
        }

    return json.dumps({'success': True}), 200, {
        'ContentType': 'application/json'
    }
Exemplo n.º 3
0
def targets():

    if request.method == "OPTIONS":  # CORS preflight
        return _build_cors_prelight_response()

    target_list = DB.get_all_target_dev()
    # return render_template('targets.html', target_list=target_list)
    return json.dumps(target_list), 200, {'ContentType': 'application/json'}
Exemplo n.º 4
0
def get_rootdomains(category, name):
    if request.method == "OPTIONS":  # CORS preflight
        return _build_cors_prelight_response()
    result = DB.get_target_rootdomain(name, category)

    if not result:
        # Error handling
        return json.dumps({'success': False}), 500, {
            'ContentType': 'application/json'
        }
    print(result)
    return result, 200, {'ContentType': 'application/json'}
Exemplo n.º 5
0
def get_conf(category, name):
    if request.method == "OPTIONS":  # CORS preflight
        return _build_cors_prelight_response()

    result = DB.get_target_configuration(name, category)

    if not result:
        # Error handling
        return json.dumps({'success': False}), 500, {
            'ContentType': 'application/json'
        }

    return {'conf': result.asdict()}, 200, {'ContentType': 'application/json'}
Exemplo n.º 6
0
def get_itinfo(category, name):
    if request.method == "OPTIONS":  # CORS preflight
        return _build_cors_prelight_response()

    result = ItinfoForm(name, category)

    roots = DB.get_target_rootdomain(name, category)
    subdomains = DB.get_target_subdomain(name, category)

    for subdomain in subdomains.subdomains:
        for root in roots["rootdomains"]:
            if subdomain.endswith(root):
                result.append_domains(root, subdomain)
                break

    repo = DB.get_target_repository(name, category)
    result.repos = repo

    if not result:
        # Error handling
        return json.dumps({'success': False}), 500, {
            'ContentType': 'application/json'
        }
    return result.asdict(), 200, {'ContentType': 'application/json'}
Exemplo n.º 7
0
def targets_delete():

    if request.method == "OPTIONS":  # CORS preflight
        return _build_cors_prelight_response()

    name = request.json["name"]
    category = request.json["category"]

    result = DB.delete_target(name, category)
    if not result or result >= 400:
        # Error handling
        return json.dumps({'success': False}), 500, {
            'ContentType': 'application/json'
        }

    return json.dumps({'success': True}), 200, {
        'ContentType': 'application/json'
    }
Exemplo n.º 8
0
from utility import DB, SubdomainTakeoverForm, RepositoryForm, SubdomainForm_dev, SecretForm, CommandForm, CommandInfo, RepositoryInfo, StatusForm, StatusInfo
from utility import PathForm

# DB.delete_target("test1", "company")
# DB.delete_target("test2", "company")

DB.save_target("test1", "company")

s = SubdomainForm_dev()
s.append("www.test2.com", ["bruteforce", "crawl"])
# s.append("www.test2.com", ["bruteforce", "crawl"])
DB.save_target_subdomain("test1", "company", s)

f = StatusForm("www.test2.com")
i = StatusInfo(
    80, "web", {
        "headers": {
            "Cache-Control": "private",
            "Connection": "close",
            "Content-Length": "231",
            "Content-Type": "text/html; charset=UTF-8"
        },
        "status_code": 501
    })
f.append(i)
i = StatusInfo(443, "web", {
    "headers": {
        "test": "private",
    },
    "status_code": 500
})