{"id":4002,"date":"2024-07-29T15:49:07","date_gmt":"2024-07-29T13:49:07","guid":{"rendered":"https:\/\/andreas-klingler.de\/infosec\/?p=4002"},"modified":"2024-07-29T15:49:07","modified_gmt":"2024-07-29T13:49:07","slug":"javascript","status":"publish","type":"post","link":"https:\/\/infosec.andreas-klingler.de\/?p=4002","title":{"rendered":"JavaScript"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Get infor\u00adma\u00adtion from a (mini\u00adfied) <span class=\"caps\">JS<\/span> (e.g. from Angular):<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme data-enlighter-highlight data-enlighter-linenumbers data-enlighter-lineoffset data-enlighter-title data-enlighter-group>import re\n\ndef extract_info(file_path):\n    with open(file_path, 'r') as file:\n        content = file.read()\n\n    # Regular expressions to find URLs and potential sensitive info\n    url_pattern = re.compile(r'https?:\/\/[^\\s]+')\n    route_pattern = re.compile(r'\\\/[a-zA-Z0-9\\\/_-]+')\n    api_key_pattern = re.compile(r'apiKey\\s*:\\s*[\"\\']([a-zA-Z0-9-_]+)[\"\\']')\n    token_pattern = re.compile(r'token\\s*:\\s*[\"\\']([a-zA-Z0-9-_]+)[\"\\']')\n\n    urls = url_pattern.findall(content)\n    routes = route_pattern.findall(content)\n    api_keys = api_key_pattern.findall(content)\n    tokens = token_pattern.findall(content)\n\n    return {\n        'urls': urls,\n        'routes': routes,\n        'api_keys': api_keys,\n        'tokens': tokens,\n    }\n\n# Path to your minified JavaScript file\nfile_path = 'path_to_your_minified_file.js'\n\ninfo = extract_info(file_path)\nprint('URLs:', info['urls'])\nprint('Routes:', info['routes'])\nprint('API Keys:', info['api_keys'])\nprint('Tokens:', info['tokens'])\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Get infor\u00adma\u00adtion from a (mini\u00adfied) <span class=\"caps\">JS<\/span> (e.g. from Angular):<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wp_typography_post_enhancements_disabled":false,"footnotes":""},"categories":[468],"tags":[494,492,495,493],"class_list":["post-4002","post","type-post","status-publish","format-standard","hentry","category-general","tag-angular","tag-javascript","tag-min-js","tag-minified"],"_links":{"self":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/4002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4002"}],"version-history":[{"count":1,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/4002\/revisions"}],"predecessor-version":[{"id":4003,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/4002\/revisions\/4003"}],"wp:attachment":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}