qubes-issues icon indicating copy to clipboard operation
qubes-issues copied to clipboard

[Contribution] qvm-screenshot-tool

Open marmarek opened this issue 10 years ago • 102 comments

Community Dev: @ben-grande (originally @evadogstar) Repo: https://github.com/ben-grande/qubes-qvm-screenshot-tool


Reported by axon on 16 Feb 2015 11:02 UTC The ability send dom0 screenshots directly to an AppVM/DispVM from the screenshot app is an oft-requested feature (see below). The ability to transfer saved screenshot files from dom0 to other VMs is already available, but it is neither obvious nor easy for most users to do this.

User requests/queries about this: https://groups.google.com/d/topic/qubes-devel/m8TfyvSqvf4/discussion https://groups.google.com/d/topic/qubes-devel/CwSPqtPYTRQ/discussion https://groups.google.com/d/topic/qubes-devel/_a7KxHbkSJo/discussion https://groups.google.com/d/topic/qubes-users/l6vOqhsd7ss/discussion https://groups.google.com/d/topic/qubes-users/etxwrc6rsIM/discussion https://groups.google.com/d/topic/qubes-users/_7FzKv6eJqA/discussion

Migrated-From: https://wiki.qubes-os.org/ticket/953

marmarek avatar Mar 08 '15 17:03 marmarek

Some details here: https://groups.google.com/d/msgid/qubes-devel/20150708022217.GH900%40mail-itl

marmarek avatar Jul 08 '15 02:07 marmarek

What about a tool in dom0 that scan changes in ~/QubesOutgoing/[VMname]/ folder and send it to the AppVM ~/QubesIncoming/dom0 when available ?

For instance, when you take screenshots, you just have to save it to the right folder.

ptitdoc avatar Oct 16 '15 13:10 ptitdoc

I think the best solution is to use #1324 (qvm-copy-to-vm tool for dom0) and make it a handler for screenshooting tool.

Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?

marmarek avatar Oct 16 '15 14:10 marmarek

fyi with KSnapshot (the current screenshot tool) one cannot screenshot a specific window, freehand region, etc., even when selected. Such functionality would be quite helpful for creating Qubes documentation.

mfc avatar Oct 28 '15 16:10 mfc

Are you sure? I've just tried and it seems to work well:

  1. Press Print Screen to start the tool
  2. Select capture mode
  3. Click "Take a New Snapshot"
  4. Select region/window/whatever
  5. Confirm with Enter (or double-click) - instructions are on the screen.

Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?

marmarek avatar Oct 28 '15 16:10 marmarek

never mind! worked great, thanks for the steps.

I misunderstood how it worked, I thought changing the settings would change the default of pressing Print Screen. Instead one has to select Take a New Snapshot.

mfc avatar Oct 28 '15 16:10 mfc

Ksnapshot is getting a new version for KDE 5 based on KScreenGenie. On which KDE version will Qubes R3.2 or 4.0 be based on?

Jeeppler avatar May 11 '16 02:05 Jeeppler

On which KDE version will Qubes R3.2 or 4.0 be based on?

The plan is to use KDE 5.

andrewdavidwong avatar May 11 '16 03:05 andrewdavidwong

Is there any usable Qubes R4.0 or R3.2 available to develop the screenshot tool?

Jeeppler avatar May 15 '16 01:05 Jeeppler

I'm going to upload some preliminary R3.2 image somehow today/tomorrow. Anyway this isn't much different than R3.1 - see: https://github.com/QubesOS/qubes-issues/issues/1324#issuecomment-155655636

marmarek avatar May 15 '16 09:05 marmarek

@marmarek I think the Desktop Entry solution, you mentioned in the comment, has several draw backs. First it does not work on all desktop environments and secondly you have to open the PNG file, as far as I understand it.

For my understanding it would be better to have a screen shoot tool which invokes the qvm-move-to-vm command. The tools should move the screenshot directly to a qube and only ask to start the destination qube if the destination qube is not running.

I think KSnapshot is a really nice tool to take snapshots with, but I don't know if it works reliable on XCFE or other desktop environments.

Jeeppler avatar May 15 '16 17:05 Jeeppler

It is simply available as one of applications to open screenshot with, see here: screenshot-save

This one is from Xfce4. In KDE it lands under "Open with" menu (or "Send to" in KDE4).

marmarek avatar May 15 '16 17:05 marmarek

Looks good, but what should be developed or created to be able to close this issue?

Jeeppler avatar May 15 '16 17:05 Jeeppler

A tool to ask for target VM name - qvm-move-to-vm-prompt

marmarek avatar May 15 '16 17:05 marmarek

What would be the preferred programming language and graphical toolkit to develop such a prompt? Should it look like the prompts Qubes OS already has to copy files from one VM to another?

Jeeppler avatar May 15 '16 20:05 Jeeppler

As usual - python. As for toolkit - currently it is mostly in Qt (especially the current qrexec confirmations). But since the long term goal is to implement new Qubes Manager in GTK and to add GNOME support, GTK is also ok. If it doesn't matter for you, I'd choose GTK.

marmarek avatar May 15 '16 21:05 marmarek

Is it possible to have access to the Qubes API via Python3?

Jeeppler avatar May 19 '16 08:05 Jeeppler

On Thu, May 19, 2016 at 01:57:54AM -0700, Jeppler wrote:

Is it possible to have access to the Qubes API via Python3?

Not yet, unfortunately...

Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?

marmarek avatar May 19 '16 20:05 marmarek

Unfortunately "send to" in KSnapshot does not currently work - it says "qvm-run: error: To many arguments" [sic]. Should I file another bug for that?

greenrd avatar May 20 '16 09:05 greenrd

@greenrd it isn't done yet - "Other application" option you see there is not what is meant to be used here.

marmarek avatar May 20 '16 12:05 marmarek

I think it would be a good idea to schedule this task till Qubes OS uses KDE 5 and Python 3.

Jeeppler avatar Jun 11 '16 13:06 Jeeppler

Jeppler:

I think it would be a good idea to schedule this task till Qubes OS uses KDE 5 and especially Python 3.

I would like to expand on this as propose an application for video capturing. This for future educational material for new users, and video is easier to digest than long pages of text with screenshots.

ghost avatar Jun 11 '16 18:06 ghost

@dumbl3d0re your idea should be in a new issue. In general the idea of having a video capture tool in Qubes OS is a good idea.

This issue is primarily talking about using KSnapshots 'send to' function. The question is which video capturing tool does KDE or linux in general provide for capturing videos?

Jeeppler avatar Jun 11 '16 19:06 Jeeppler

On 2016-07-02 13:57, Eva Star wrote:

Okey. I released tool that can automatically capture fullscreen/windows/regions and upload it to AppVM and imgurl automaticaly.

Now it is in beta state and tested only with Qubes 3.2rc1, but I think it will work with other Qubes starting from R3.0 or R3.1 (where qvm-run is available)

Full description and download you can find here:

https://github.com/evadogstar/qvm-screenshot-tool

Test it and I hope you will be happy with it as I am :) Because screenshots is one weak side of Qubes (before this tool done ;)

Plans:

  • add editor for images at AppVM to blur some arias on image... (suggest are welcome)
  • multiple selections -> one screenshots -> upload it
  • delayed screenshots
  • maybe uploading any existed image from dom0 to imgurl after selecting it on dialog

Enjoy but remember that is only beta

Other notes:

  • It is ready for GNOME and it's developed and tested under XFCE

andrewdavidwong avatar Jul 03 '16 06:07 andrewdavidwong

qvm-screenshot-tool updates and now support editing of image at dom0 before uploading it to AppVM and/or Imgurl

https://i.imgur.com/BZHFvJq.png

2016-07-04-204252

evadogstar avatar Jul 04 '16 17:07 evadogstar

@marmarek What is the right way to store some temp.config values? Create some file with value or keys? Or use something other? Thanks

evadogstar avatar Aug 31 '16 19:08 evadogstar

It depends on exact purpose and use case, but temp file seems to be a good solution.

marmarek avatar Sep 01 '16 16:09 marmarek

I'm not sure if I understand your question correctly, can you elaborate? @evadogstar

marmarek avatar Sep 01 '16 16:09 marmarek

@marmarek

  1. I want to store setting: i.e. last "VM name" from where image was uploaded to imgurl service. This need to reopen last closed dialog with results again by simply choose "Open last" from dom0 menu. I found that this will be useful feature. Estimated solution: file "~/.config/qvmscreenshot/lastvm.cfg" with content "personal" (to read it later)

  2. Maybe, I want to implement some log of all uploaded urls. Estimated solution: file "~/.config/qvmscreenshot/log.txt" with full log.

  3. "Config" for some script settings (available to change by user). Now, settings stored at the source. How to store/read them from separate file/QubesDB? What is better?

I do not want to reinvent the wheel with config)

evadogstar avatar Sep 02 '16 12:09 evadogstar

  1. I want to store setting: i.e. last "VM name" from where image was uploaded to imgurl service. This need to reopen last closed dialog with results again by simply choose "Open last" from dom0 menu. I found that this will be useful feature. Estimated solution: file "~/.config/qvmscreenshot/lastvm.cfg" with content "personal" (to read it later)

Yes, this seems like a good idea. Take a look here for more robust config handling from scripts (have one file, instead of one-per-value)

  1. Maybe, I want to implement some log of all uploaded urls. Estimated solution: file "~/.config/qvmscreenshot/log.txt" with full log.

I think logs belong to ~/.local/share/..., at least X server store its log in ~/.local/share/xorg/Xorg.0.log.

  1. "Config" for some script settings (available to change by user). Now, settings stored at the source. How to store/read them from separate file/QubesDB? What is better?

See "1". Maybe have two files - one with user changeable settings, the other with state from previous run?

marmarek avatar Sep 02 '16 12:09 marmarek

In my opinion, there are generally two concerns when you are considering adding a 3rd party SW to dom0:

  1. Do I trust it? (Do I trust there are no intentional backdoors?)
  2. Is it secure enough?

The first one is rather a matter of choice than a technical question.

The security concern is the interesting one. While level of acceptable risk is not a technical question, the risk itself (at least partially) is. I believe there are not-yet-known vulnerabilities related to complex formats processing in ffmpeg and some other software you are considering. Exposing dom0 to those vulnerabilities can be considered at least strongly against Qubes philosophy. (If it is acceptable or not, it is up to you.) However, the key question is: Are those potential vulnerabilities likely to be exploitable? I don't think so. I expect the screenshots (in a simple bitmap format) and potentially a sound (in similarly simple raw format) to be the only untrusted inputs.

In short, after rather brief review, it looks OK to me provided that you trust the software not to be intentionally malicious.

v6ak avatar Sep 25 '16 07:09 v6ak

Generally, if input is trusted, even complex tools are not a big problem. The question is whether screen content (as a bitmap) can be treated as trusted input. I find it very unlikely to crash/exploit some image/video processor by just a bitmap (without control over its metadata). So, should be safe.

Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?

marmarek avatar Sep 25 '16 11:09 marmarek

@marmarek: Is this feature slated for inclusion in 4.0?

andrewdavidwong avatar Nov 06 '16 01:11 andrewdavidwong