Skip to content

Commit

Permalink
bugfixes on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
SharonBrizinov committed Jan 8, 2021
1 parent aea40e7 commit 8acaf0f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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**

Expand Down
Binary file added packaging/icons/icon_3s.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 21 additions & 14 deletions src/s3viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
import tempfile
import urllib.request
import shutil
from distutils.spawn import find_executable

from FSNode import *
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 8acaf0f

Please sign in to comment.