Giter VIP home page Giter VIP logo

pypeek's Issues

Popen([..], shell=True, [..]) can be avoided and may be exploitable (command injection)

Hi!

I found this code:

pypeek/src/pypeek/main.py

Lines 1049 to 1058 in ac94d6a

systemcall = str(self.ffmpeg_bin)+" -r " + str(self.true_fps) + " -y"
systemcall += " -start_number " + str(start_number)
systemcall += " -i " + str(fprefix)+"%"+str(self.fmt)+".jpg"
systemcall += " -vframes " + str(vframes)
systemcall += " "+self.ffmpeg_flags[self.v_ext + self.quality]
systemcall += " "+str(vidfile)
systemcall += " -progress pipe:1"
try:
process = subprocess.Popen(systemcall, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8', errors='replace')

If any of the variables going systemcall can be controlled by an attacker, then this is a command injection vulnerability.
Either way, I would resolve needless(?) shell=True here and build a list to call that command, not a flat string.

Thanks, Sebastian

Feature Request: Annotations on selected frames

I love this app!

Would it be possible to put annotations elements on only select frames? For example, sometimes I want to record my web browser app and I have to move from one tab to another in the web app. When on the first tab I may circle something in red I don't want that circle to show up through out the recording because I will show things on the second tab and the thing I circle is no longer visible making the red circle out of place.

Atribute error when saving

My environment:
Python 3.12.1

I can reliably reproduce this error. First, record something in mp4 format, finish the recording, then press save, the GUI will freeze and this error is displayed:

$ pypeek
Traceback (most recent call last):
  File "/home/woynert/.local/share/pipx/venvs/pypeek/lib/python3.12/site-packages/pypeek/main.py", line 684, in encoding_done
    number = int(number if number.isdigit() else 1)
                           ^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'isdigit'

pypeek --shortcut generates invalid shortcut on Windows

When running pypeek --shortcut, the resulting shortcut's target is C:\Users\<username>\Desktop\peek-gui, which does not work. It must be manually updated to C:\Users\<username>\AppData\Local\Programs\Python\Python310\Scripts\pypeek-gui.exe.

[Feature request] filename template

Hi, thanks for this great app!

It would be nice to be able to define the template for the result file. Allowing some variables, at least date and time.

Support Wayland display server for Linux users

Looking at the requirements, they state that only Xorg is supported currently: https://github.com/firatkiral/pypeek#requirements
That is unfortunate, since various Linux distros move from Xorg to Wayland as default, so it would make sense to support it if a broad user base is desired.

I was able to start the application and tried to record on Wayland, but after stopping the recording there are no videos rendered, and I see various error stack traces in the CLI output.

List index out of range QPixmap[self.image_filenames[0]] + other issues

Found this project on peek repo. Nice initiative to build this very useful!

Unfortunately, I got this error:

Traceback (most recent call last):
  File "/home/username/.local/pipx/venvs/pypeek/lib/python3.11/site-packages/pypeek/main.py", line 668, in recording_done
    drawover = DrawOver(cache_folder, self.drawover_options, self.capture.true_fps, self)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/climentea/.local/pipx/venvs/pypeek/lib/python3.11/site-packages/pypeek/drawover.py", line 37, in __init__
    self.bg_pixmap = QPixmap(os.path.join(image_path, self.image_filenames[0]))
                                                      ~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Other issues:

  • when run from terminal keyboard Ctrl+C doesn't stop the program;
  • can't select area to record on screen;
  • installation process is a bit hard for a non-tehnical person;

Setup:

  • Ubuntu 23.04
  • Wayland

File naming pattern

Peek rather conveniently names files as Peek 2024-02-13 15-27.gif. I find that pretty good and useful. pypeek instead names them like peek_1.gif.

I think the best option is to allow the user to specify the pattern by themselves.

Area selection does not work in i3

When running in i3, the area selection does not seem to work at all. pypeek simply records the full screen at all times.

Peek 2024-02-13 15-27

It seems that unlike peek, pypeek starts as a normal window. In i3 that means that the area of the screen is split and some place and size is given to pypeek. Instead, it should be a floating window that is resizable by itself. Now, I made it floating myself by using a shortcut, but that forced the pypeek window to be of a minimum size. So, in general, in i3 it seems that pypeek can only record the full screen (which honestly defeats the purpose).

Hello friend, framerate bug

Hello friend, in the recording there is a BUG in the FrameRate it does not record above 11 to 15 frames, it gets very locked, and if you change the settings, it stays the same, could you please solve it, I found your program very good and beautiful, can I bring a video of it on my channel?

Re-introduction of "shell=True" broke support for Linux

Hi @firatkiral,

I saw the re-addition of shell=True in 1e218f9 which breaks support for Linux, e.g. when drawing on the video and then saving. For a minimal demo of the problem, here's what it looks like in IPython:

In [1]: import subprocess

In [2]: subprocess.Popen(['echo 1  2  3', '4', '4'], shell=True)
1 2 3

I'm not sure of the Windows affects of shell=True as of yet, but for a start maybe a patch like this helps both Windows and Linux before a real solution for Windows:

diff --git a/src/pypeek/main.py b/src/pypeek/main.py
index a41be0d..6e3ca79 100644
--- a/src/pypeek/main.py
+++ b/src/pypeek/main.py
@@ -1078,10 +1078,13 @@ class Capture(QThread):
 
         try:
             # Shell = True, otherwise the terminal window pops up on Windows app
-            process = subprocess.Popen(systemcall, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8', errors='replace')
+            shell = (os.name == 'nt')
+            process = subprocess.Popen(systemcall, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8', errors='replace')
             while True:
                 realtime_output = process.stdout.readline()
                 if realtime_output == '' and process.poll() is not None:
+                    if process.returncode != 0:
+                        vidfile = None
                     break
                 if realtime_output:
                     if "frame=" in realtime_output:

What do you think?

Best, Sebastian

CC #2

Versioning Too Strict (doesn't work with python 3.12)

The installation instructions say it works with Python 3.10 or later. However, Python 3.12 gives:

ERROR: Cannot install pypeek==2.7.10, pypeek==2.7.11, pypeek==2.7.12, pypeek==2.7.13, pypeek==2.7.14, pypeek==2.8.0, pypeek==2.8.2, pypeek==2.8.5, pypeek==2.8.6, pypeek==2.8.7, pypeek==2.8.8, pypeek==2.8.9, pypeek==2.9.0, pypeek==2.9.1, pypeek==2.9.2, pypeek==2.9.3, pypeek==2.9.4, pypeek==2.9.5, pypeek==2.9.6 and pypeek==2.9.7 because these package versions have conflicting dependencies.

The conflict is caused by:
    pypeek 2.9.7 depends on pyside6~=6.4.0
    pypeek 2.9.6 depends on pyside6~=6.4.0
    pypeek 2.9.5 depends on pyside6~=6.4.0
    pypeek 2.9.4 depends on pyside6~=6.4.0
    pypeek 2.9.3 depends on pyside6~=6.4.0
    pypeek 2.9.2 depends on pyside6~=6.4.0
    pypeek 2.9.1 depends on pyside6~=6.4.0
    pypeek 2.9.0 depends on pyside6~=6.4.0
    pypeek 2.8.9 depends on pyside6~=6.4.0
    pypeek 2.8.8 depends on pyside6~=6.4.0
    pypeek 2.8.7 depends on pyside6~=6.4.0
    pypeek 2.8.6 depends on pyside6~=6.4.0
    pypeek 2.8.5 depends on pyside6~=6.4.0
    pypeek 2.8.2 depends on pyside6~=6.4.0
    pypeek 2.8.0 depends on pyside6~=6.4.0
    pypeek 2.7.14 depends on pyside6~=6.4.0
    pypeek 2.7.13 depends on pyside6~=6.4.0
    pypeek 2.7.12 depends on pyside6~=6.4.0
    pypeek 2.7.11 depends on pyside6~=6.4.0
    pypeek 2.7.10 depends on pyside6~=6.4.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

The current version of pyside6 is 6.6.0. If I try to manually pip install pyside6==6.4.0, I get

ERROR: Ignored the following versions that require a different python version: 6.3.0 Requires-Python <3.11,>=3.6; 6.3.1 Requires-Python <3.11,>=3.6; 6.3.2 Requires-Python <3.11,>=3.6; 6.4.0 Requires-Python <3.11,>=3.6; 6.4.0.1 Requires-Python <3.12,>=3.7; 6.4.1 Requires-Python <3.12,>=3.7; 6.4.2 Requires-Python <3.12,>=3.7; 6.4.3 Requires-Python <3.12,>=3.7; 6.5.0 Requires-Python <3.12,>=3.7; 6.5.1 Requires-Python <3.12,>=3.7; 6.5.1.1 Requires-Python <3.12,>=3.7; 6.5.2 Requires-Python <3.12,>=3.7; 6.5.3 Requires-Python <3.12,>=3.7
ERROR: Could not find a version that satisfies the requirement pyside6==6.4.0 (from versions: 6.6.0)
ERROR: No matching distribution found for pyside6==6.4.0

So it seems like pypeek will only work with exactly Python 3.10 (and not any other version).

Running "pypeek --help" starts downloading precompiled ffmpeg binaries?!

Hi @firatkiral ,

when I run pypeek --help it starts to download pre-compiled ffmpeg binaries:

# pypeek --help
Installing ffmpeg to /tmp/tmp.PqUazPhkz1/pypeek/venv/lib/python3.11/site-packages/pypeek/bin/linux
Downloading https://github.com/zackees/ffmpeg_bins/raw/main/v5.0/linux.zip -> /tmp/tmp.PqUazPhkz1/pypeek/venv/lib/python3.11/site-packages/pypeek/bin/linux.zip
..........................................^CTraceback (most recent call last):
  [..]
  File "/tmp/tmp.PqUazPhkz1/pypeek/venv/lib/python3.11/site-packages/pypeek/main.py", line 15, in <module>
    get_ffmpeg()
  File "/tmp/tmp.PqUazPhkz1/pypeek/venv/lib/python3.11/site-packages/pypeek/ffmpeg.py", line 92, in get_ffmpeg
    ffmpeg, _ = get_or_fetch_platform_executables_else_raise()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmp.PqUazPhkz1/pypeek/venv/lib/python3.11/site-packages/pypeek/ffmpeg.py", line 61, in get_or_fetch_platform_executables_else_raise
    download_file(url, local_zip)
  [..]
KeyboardInterrupt

That is unexpected, unfortunate and scary in my world:

  • --help should never do things like that, display some help quick, and get out of the way.
  • I'm on a source-based Linux distro and don't trust most people's binaries, so downloading binaries by a third party unknown to me is not nice.
  • With a package manager around, why would I want ffmpeg binaries that are not provided by my distro? That's what I have a package manager for.
  • PS: ffmpeg 5.0(.0) and these binaries are ~12 months old

Please re-consider these choices, these are by no means sane defaults. Thank you!

Best, Sebastian

Use of name "pypeek" versus "peek"

Hi!

Just a quick note that the app uses both "pypeek" and "peek" for a name at different places. I would like to suggest to use "pypeek" only and consistently. Just an idea.

Best, Sebastian

Feature request: remove certain frames

Hi, thanks for the awesome tool.

I'd like to request a feature for removing certain frames. This could just leverage the same slider functionality that already exists (see illustration below).

image

This feature will be useful for speeding up the animation which could get quite long when it is showing a page being loaded etc.

Thanks

Feature request: Add copy button

Hi ! ๐Ÿ˜„
Can you please add a COPY buton like the Windows screensaver tools ?

It's really usefull for quick share ๐Ÿ‘

peek

Thanks for your attention !

Some thoughts regarding packaging and about this application

I have created an initial package for Arch Linux on the AUR

Some things that came to my mind:

  • I saw that you're already versioning the app on PyPI. It would be nice if you could also create git tags for each release. I can make a versioned package too โ€“ downloading the source from PyPI, but I'd prefer it to be fetched directly from the source repository.
  • I'm currently generating a desktop entry for the app inside the package. It would be nice if you could include a .desktop file for Linux somewhere.
    • Here is what's generated by that command for reference
pypeek.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Pypeek
Comment=Simple animated GIF screen recorder with an easy to use interface
Exec=pypeek
Icon=pypeek
Terminal=false
StartupNotify=false
Categories=Utility;
  • I saw inside src/pypeek/ffmpeg.py that you're downloading FFMPEG binaries from ZIP files inside this repo. I think you should prefer using the system's ffmpeg if it's in the $PATH and only download if it's not available/compatible. โ†’ Never mind, it seems to use system ffmpeg already
  • The config and log file is created inside the user's home directory. I think this should reside
    • For Linux in $XDG_CONFIG_HOME/pypeek if set, otherwise $HOME/.config/pypeek
    • For Windows in %appdata%\pypeek
    • For macOS in ~/Library/Preferences/com.github.pypeek (not entirely sure about that)
  • I think it would be nice if the default file name when saving could include a timestamp so that when you create multiple GIFs in a row you don't have to change it manually
  • Why is this repo a fork of the other Peek? It doesn't share any code. I think it should be its own repo, especially because currently every time you clone this repo you also automatically get the history from Peek.
  • The UI doesn't honor system preferences for window decorations. For example, I have my window buttons all on the left (like on macOS) but pypeek shows the close button on the right

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.