Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SaveFileAction tries to save pastes as given directory path #179

Closed
DaRuudii opened this issue Mar 1, 2020 · 0 comments
Closed

SaveFileAction tries to save pastes as given directory path #179

DaRuudii opened this issue Mar 1, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@DaRuudii
Copy link
Contributor

DaRuudii commented Mar 1, 2020

with open(os.path.join(self.path), "w") as file:

Description
The SaveFileAction uses the directory path for trying to save the paste there. Instead it should append the paste key as filename like in the SaveJSONAction.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Create SaveFileAction with path parameter
  2. Add analyzer with this action
  3. Matched pastes will be stored in given path
  4. Error as path is a directory

Config

file_action = SaveFileAction("/opt/pastepwn/data/file")
alwaystrue_analyzer = AlwaysTrueAnalyzer(file_action)

Log

Mar 01 14:24:27 piframe python3[18321]: 2020-03-01 14:24:27,804 - pastepwn.core.actionhandler - ERROR - While performing the action 'SaveFileAction' the following exception occurred: '[Errno 21] Is a directory: '/opt/pastepwn/data/file''

Expected behavior
Pastes are saved under their individual key.

System

  • OS: Raspbian 9.11
  • Python Version: 3.5.3
  • PastePwn Version: 1.2.0

Solution
Change line to

with open(os.path.join(self.path, "{0}".format(paste.key)), "w") as file:
@d-Rickyy-b d-Rickyy-b self-assigned this Mar 1, 2020
@d-Rickyy-b d-Rickyy-b added the bug Something isn't working label Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants