all_paths = [] for js_url in js_urls: print(f'Extracting paths from {js_url}') paths = extract_api_paths(js_url) all_paths.extend(paths) ifnot all_paths: print("No API paths found.") return
withopen(output_file, 'w') as f: for path in all_paths: f.write(path + '\n') print(f'API paths have been saved to {output_file}')
if __name__ == '__main__': parser = argparse.ArgumentParser(description='Extract API paths from JS files on a given URL.') parser.add_argument('url', help='Target URL to scan for JS files.') parser.add_argument('output', help='Output file to save extracted API paths.') args = parser.parse_args() main(args.url, args.output)