class Analyzer::Python::Django
- Analyzer::Python::Django
- Analyzer::Python::Python
- Analyzer
- Reference
- Object
Defined in:
analyzer/analyzers/python/django.crConstant Summary
-
REGEX_INCLUDE_URLS =
/include\s*\(\s*r?['"]([^'"\\]*)['"]/
-
REGEX_ROOT_URLCONF =
/\s*ROOT_URLCONF\s*=\s*r?['"]([^'"\\]*)['"]/
-
Regular expressions for extracting Django URL configurations
-
REGEX_ROUTE_MAPPING =
/(?:url|path|register)\s*\(\s*r?['"]([^"']*)['"][^,]*,\s*([^),]*)/
-
REQUEST_PARAM_FIELD_MAP =
{"GET" => {["GET"], "query"}, "POST" => {["POST"], "form"}, "COOKIES" => {nil, "cookie"}, "META" => {nil, "header"}, "data" => {["POST", "PUT", "PATCH"], "form"}}
-
Map request parameters to their respective fields
-
REQUEST_PARAM_TYPE_MAP =
{"query" => nil, "form" => ["GET", "POST", "PUT", "PATCH"], "cookie" => nil, "header" => nil}
-
Map request parameter types to HTTP methods
Instance Method Summary
- #analyze
-
#extract_endpoints(django_urls : DjangoUrls) : Array(Endpoint)
Extract endpoints from a Django URL configuration file
-
#extract_endpoints_from_file(url : String, filepath : String, function_or_class_name : String)
Extract endpoints from a given file
-
#extract_params_from_line(line : String, endpoint_methods : Array(String))
Extract parameters from a line of code
-
#filter_params(method : String, params : Array(Param))
Filter parameters based on HTTP method
-
#find_root_django_urls : Array(DjangoUrls)
Find all root Django URLs
Instance methods inherited from class Analyzer::Python::Python
find_imported_modules(app_base_path : String, file_path : String, content : String | Nil = nil) : Hash(String, Tuple(String, Int32))
find_imported_modules,
find_imported_package(package_path : String, dotted_as_names : String) : Array(Tuple(String, String, Int32))
find_imported_package,
find_json_params(codeblock_lines : Array(String), json_var_names : Array(String)) : Array(Param)
find_json_params,
parse_code_block(data : String | Array(String), after : Regex | Nil = nil) : String | Nil
parse_code_block,
parse_function_def(source_lines : Array(String), start_index : Int32) : FunctionDefinition | Nil
parse_function_def,
return_literal_value(data : String) : String
return_literal_value
Instance methods inherited from class Analyzer
analyze
analyze,
base_path : String
base_path,
logger : NoirLogger
logger,
result : Array(Endpoint)
result,
url : String
url
Constructor methods inherited from class Analyzer
new(options : Hash(String, YAML::Any))
new
Macros inherited from class Analyzer
define_getter_methods(names)
define_getter_methods
Instance Method Detail
Extract endpoints from a Django URL configuration file
Extract endpoints from a given file
Extract parameters from a line of code
Filter parameters based on HTTP method