diff --git a/README.md b/README.md index aca18e7..23b93fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# S3Viewer - Publicly Open Amazon AWS S3 Bucket Viewer +# S3Viewer [![Build Status](https://travis-ci.com/SharonBrizinov/s3viewer.svg?branch=main)](https://travis-ci.com/SharonBrizinov/s3viewer) +## Publicly Open Amazon AWS S3 Bucket Viewer -[![Build Status](https://travis-ci.com/SharonBrizinov/s3viewer.svg?branch=main)](https://travis-ci.com/SharonBrizinov/s3viewer) +![Icon](packaging/icons/icon_3s.jpg) `s3viewer` is a free tool for security researchers that lists the content of a publicly open s3 bucket and helps to identify leaking data. The tool allows you to view all the files on a given aws s3 bucket and download selected files and directories. The goal is to identify the owner of the bucket as quickly as possible in order to report that data is leaking from it. @@ -17,9 +18,10 @@ The tool uses the Amazon S3 CLI to list directory contents and display them in a ## Setup **Prerequisites** -- python3 + PyQT5 +- python3 + PyQt5 - `python3 -m pip install PyQt5` - [aws cli](https://aws.amazon.com/cli/) + - `python3 -m pip install awscli` **Configurations** diff --git a/packaging/icons/icon_3s.jpg b/packaging/icons/icon_3s.jpg new file mode 100644 index 0000000..23dd14e Binary files /dev/null and b/packaging/icons/icon_3s.jpg differ diff --git a/src/s3viewer.py b/src/s3viewer.py index 93e6ab9..048a2b0 100644 --- a/src/s3viewer.py +++ b/src/s3viewer.py @@ -5,6 +5,7 @@ import subprocess import tempfile import urllib.request +import shutil from distutils.spawn import find_executable from FSNode import * @@ -21,20 +22,26 @@ RUNNING_DIR = sys._MEIPASS def open_dir(path): - if sys.platform == 'darwin': - subprocess.check_call(['open', '--', path]) - elif sys.platform == 'linux2': - subprocess.check_call(['xdg-open', '--', path]) - elif sys.platform == 'win32': - subprocess.check_call(['explorer', path]) + try: + if sys.platform == 'darwin': + subprocess.check_call(['open', '--', path]) + elif sys.platform == 'linux2': + subprocess.check_call(['xdg-open', '--', path]) + elif sys.platform == 'win32': + subprocess.check_call(['explorer', path]) + except subprocess.CalledProcessError as e: + pass def open_file(path): - if sys.platform == 'darwin': - subprocess.check_call(['open', path]) - elif sys.platform == 'linux2': - subprocess.check_call(['xdg-open', path]) - elif sys.platform == 'win32': - os.startfile(path) + try: + if sys.platform == 'darwin': + subprocess.check_call(['open', path]) + elif sys.platform == 'linux2': + subprocess.check_call(['xdg-open', path]) + elif sys.platform == 'win32': + os.startfile(path) + except subprocess.CalledProcessError as e: + pass class Ui_MainWindow(QObject): @@ -332,7 +339,7 @@ def button_click_download_and_process_bucket_dirlist(self): if not self.check_input_details(): return # Check that aws cli works - if not find_executable("aws"): + if not find_executable("aws") and not shutil.which("aws"): self.show_message_box("aws cli was not found. Please make sure you have aws cli installed and configured in the PATH environment variable\nhttps://aws.amazon.com/cli/") return # Create temp dir @@ -343,7 +350,7 @@ def button_click_download_and_process_bucket_dirlist(self): command_line = "aws --no-sign-request s3 ls s3://{} --recursive > {}".format(self.current_bucket_name, self.dirlist_path) res = os.system(command_line) if res != 0: - self.show_message_box("Error downloading dirlist from S3 bucket. Did you run 'aws configure'? you can use 'us-east-1' as the default region") + self.show_message_box("Error in generating dirlist from {}. Is the name of the bucket correct? Did you run 'aws configure'?".format(self.current_bucket_name)) return # Update UI self.populate_tree_view_with_gui(self.dirlist_path)