|
20 | 20 | ) |
21 | 21 | from .github_search import scan_github, set_github_api_token |
22 | 22 | from .interprocedural_cfg import interprocedural |
23 | | -from .intraprocedural_cfg import intraprocedural |
24 | 23 | from .lattice import print_lattice |
25 | 24 | from .liveness import LivenessAnalysis |
26 | 25 | from .project_handler import get_directory_modules, get_modules |
@@ -106,8 +105,6 @@ def parse_args(args): |
106 | 105 | ' reaching definitions tainted version.', |
107 | 106 | action='store_true') |
108 | 107 |
|
109 | | - parser.add_argument('-intra', '--intraprocedural-analysis', |
110 | | - help='Run intraprocedural analysis.', action='store_true') |
111 | 108 | parser.add_argument('-ppm', '--print-project-modules', |
112 | 109 | help='Print project modules.', action='store_true') |
113 | 110 |
|
@@ -159,8 +156,18 @@ def parse_args(args): |
159 | 156 |
|
160 | 157 | def analyse_repo(github_repo, analysis_type): |
161 | 158 | cfg_list = list() |
162 | | - project_modules = get_modules(os.path.dirname(github_repo.path)) |
163 | | - intraprocedural(project_modules, cfg_list) |
| 159 | + directory = os.path.dirname(github_repo.path) |
| 160 | + project_modules = get_modules(directory) |
| 161 | + local_modules = get_directory_modules(directory) |
| 162 | + tree = generate_ast(github_repo.path, python_2=args.python_2) |
| 163 | + interprocedural_cfg = interprocedural( |
| 164 | + tree, |
| 165 | + project_modules, |
| 166 | + local_modules, |
| 167 | + github_repo.path |
| 168 | + ) |
| 169 | + cfg_list.append(interprocedural_cfg) |
| 170 | + |
164 | 171 | initialize_constraint_table(cfg_list) |
165 | 172 | analyse(cfg_list, analysis_type=analysis_type) |
166 | 173 | vulnerability_log = find_vulnerabilities(cfg_list, analysis_type) |
@@ -214,25 +221,23 @@ def main(command_line_args=sys.argv[1:]): |
214 | 221 | tree = generate_ast(path, python_2=args.python_2) |
215 | 222 |
|
216 | 223 | cfg_list = list() |
217 | | - |
218 | | - if args.intraprocedural_analysis: |
219 | | - intraprocedural(project_modules, cfg_list) |
220 | | - else: |
221 | | - interprocedural_cfg = interprocedural(tree, |
222 | | - project_modules, |
223 | | - local_modules, |
224 | | - path) |
225 | | - cfg_list.append(interprocedural_cfg) |
226 | | - framework_route_criteria = is_flask_route_function |
227 | | - if args.adaptor: |
228 | | - if args.adaptor.lower().startswith('e'): |
229 | | - framework_route_criteria = is_function |
230 | | - elif args.adaptor.lower().startswith('p'): |
231 | | - framework_route_criteria = is_function_without_leading_ |
232 | | - elif args.adaptor.lower().startswith('d'): |
233 | | - framework_route_criteria = is_django_view_function |
234 | | - # Add all the route functions to the cfg_list |
235 | | - FrameworkAdaptor(cfg_list, project_modules, local_modules, framework_route_criteria) |
| 224 | + interprocedural_cfg = interprocedural( |
| 225 | + tree, |
| 226 | + project_modules, |
| 227 | + local_modules, |
| 228 | + path |
| 229 | + ) |
| 230 | + cfg_list.append(interprocedural_cfg) |
| 231 | + framework_route_criteria = is_flask_route_function |
| 232 | + if args.adaptor: |
| 233 | + if args.adaptor.lower().startswith('e'): |
| 234 | + framework_route_criteria = is_function |
| 235 | + elif args.adaptor.lower().startswith('p'): |
| 236 | + framework_route_criteria = is_function_without_leading_ |
| 237 | + elif args.adaptor.lower().startswith('d'): |
| 238 | + framework_route_criteria = is_django_view_function |
| 239 | + # Add all the route functions to the cfg_list |
| 240 | + FrameworkAdaptor(cfg_list, project_modules, local_modules, framework_route_criteria) |
236 | 241 |
|
237 | 242 | initialize_constraint_table(cfg_list) |
238 | 243 |
|
|
0 commit comments