Re: [qubes-users] Re: Insert/Inject keyboard hits to a Qube from Dom0

2018-05-17 Thread 799
Hello Jo

 schrieb am Do., 17. Mai 2018, 15:22:

> Am Donnerstag, 17. Mai 2018 07:28:19 UTC+2 schrieb [ 799 ]:
> > (...)
> > my solution to run more complicated command in an AppVM:
> >
> > 1) "build" a script in dom0
> > 2) qvm-copy the script to the AppVM
> > 3) use qvm-run from dom0 to launch the script
> > 4) remove the script from the AppVM
> >
> > if you need I can look for an example in my script-collection.
>
> Yes please - I would appreciate. That might help me out.
>


An example can be found in my qvm-screenshot-to-clipboard-script.
It takes a screenshot from dom0 and copy it to the clipboard of an appvm

In the script I am setting up a simple "helper file" from dom0 which gets
moved to the AppVM and then executed there.

If you have further questions do not hesitate to contact me.


https://github.com/one7two99/my-qubes/blob/master/home/bin/qvm-screenshot-to-clipboard.sh

- - - 8< - - -

#!/bin/bash
# qvm-screenshot-to-clipboard
# Creates a dom0 screenshot and copy it to the Clipboard of an AppVM

# Define Variables
MyAppVM=$1
MyScreenshot=qvm-screenshot-to-clipboard.png

# Take screenshot in dom0 by selecting an area and adding border+shadow
gnome-screenshot --area --include-border --border-effect=shadow
--file=/tmp/$MyScreenshot

# Copy screenhot to AppVM
qvm-move-to-vm $MyAppVM /tmp/$MyScreenshot

# Create a helper-Script in the AppVM to copy screenshot file to clipboard
echo "xclip -selection clipboard -l 1 -t image/png
/home/user/QubesIncoming/dom0/$MyScreenshot" > /tmp/file2clipboard.sh
chmod +x /tmp/file2clipboard.sh
qvm-move-to-vm $MyAppVM /tmp/file2clipboard.sh

# Send notification for 5sec when Screenshot has been pasted into (!) AppVM
notify-send --urgency low --icon image --expire-time=5000
"qvm-screenshot-to-clipboard" "Screenshot available in $MyAppVM's clipboard"

# Run the helper script in the AppVM
qvm-run $MyAppVM /home/user/QubesIncoming/dom0/file2clipboard.sh

### The last command will remain active until the pasting has been done in
the AppVM

# Send notification for 5sec after Screenshot has been pasted from (!) AppVM
notify-send --urgency low --icon image --expire-time=5000
"qvm-screenshot-to-clipboard" "Screenshot pasted from $MyAppVM's clipboard"

# Remove helper script and screenshot file in AppVM
qvm-run $MyAppVM "rm -f /home/user/QubesIncoming/dom0/file2clipboard.sh
/home/user/QubesIncoming/dom0/$MyScreenshot"
 Desktop version

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/CAJ3yz2tOj%2BeLoS_4d7fbxA0iOK7rRM6Svt8V1G2XL%3D5JHAjOUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Insert/Inject keyboard hits to a Qube from Dom0

2018-05-17 Thread cr33dc0d3r
Am Donnerstag, 17. Mai 2018 07:28:19 UTC+2 schrieb [ 799 ]:
> On 05/13 04:40, cr33dc0d3r wrote:
> 
> > what i try to accomplish is a process executed on dom0 that downloads an 
> > data package from the server onto AppVM1 - then forward it over to another 
> > AppVM - then execute (read) it. Currently i have scripted the transfer 
> > between dom1 and 2 and the download from the server with a script inside 
> > dom1. However, i want to try to initiate & control the download from dom0 
> > that the script does not have to be placed in the AppVM.
> > 
> > - it would be ok to enter login data from dom0 (that login information 
> > would be stored on dom0)
> > - in that case i will always connect to the same ftp server
> > - i will always execute the same ftp command differ by data-name:
> >   - like: ftp get /path/to/fileX.txt
> > - would not need to be that flexible - here what i have got for dom1:
> > #--#
> > #!/bin/bash
> > 
> > HOST='x.x.x.x'
> > USER='AppVM1'
> > PASSWD=''
> > 
> > FILE=$1
> > ftp -n -v $HOST < > ascii
> > user $USER $ PASSWD
> > prompt
> > ls
> > lcd /path/to/
> > get $FILE
> > bye
> > EOT
> > #--#
> > 
> > This can be just 'triggered' by dom0 using qvm-run.
> 
> my solution to run more complicated command in an AppVM:
> 
> 1) "build" a script in dom0
> 2) qvm-copy the script to the AppVM
> 3) use qvm-run from dom0 to launch the script
> 4) remove the script from the AppVM
> 
> if you need I can look for an example in my script-collection.

Yes please - I would appreciate. That might help me out.

Thanks,
Jonny
> 
> [799]

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/cbdfce3b-4ccb-4a60-bb2e-d094df8cf993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Insert/Inject keyboard hits to a Qube from Dom0

2018-05-16 Thread [799]
On 05/13 04:40, cr33dc0...@gmail.com wrote:

> what i try to accomplish is a process executed on dom0 that downloads an data 
> package from the server onto AppVM1 - then forward it over to another AppVM - 
> then execute (read) it. Currently i have scripted the transfer between dom1 
> and 2 and the download from the server with a script inside dom1. However, i 
> want to try to initiate & control the download from dom0 that the script does 
> not have to be placed in the AppVM.
> 
> - it would be ok to enter login data from dom0 (that login information would 
> be stored on dom0)
> - in that case i will always connect to the same ftp server
> - i will always execute the same ftp command differ by data-name:
>   - like: ftp get /path/to/fileX.txt
> - would not need to be that flexible - here what i have got for dom1:
> #--#
> #!/bin/bash
> 
> HOST='x.x.x.x'
> USER='AppVM1'
> PASSWD=''
> 
> FILE=$1
> ftp -n -v $HOST < ascii
> user $USER $ PASSWD
> prompt
> ls
> lcd /path/to/
> get $FILE
> bye
> EOT
> #--#
> 
> This can be just 'triggered' by dom0 using qvm-run.

my solution to run more complicated command in an AppVM:

1) "build" a script in dom0
2) qvm-copy the script to the AppVM
3) use qvm-run from dom0 to launch the script
4) remove the script from the AppVM

if you need I can look for an example in my script-collection.

[799]

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20180517052809.g3ybx4iufwjvnp2r%40my-privmail.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Insert/Inject keyboard hits to a Qube from Dom0

2018-05-13 Thread cr33dc0d3r
Am Samstag, 12. Mai 2018 00:00:42 UTC+2 schrieb [ 799 ]:
> Hello Jonny,
> 
> 
> 
>   schrieb am Fr., 11. Mai 2018, 15:18:
> Am Freitag, 11. Mai 2018 13:52:23 UTC+2 schrieb cr33d...@gmail.com:
> 
> > Hey Everyone!, 
> 
> > 
> 
> > currently working on several automation processes using bash scripts 
> > executed in dom0 to do certain actions. 
> 
> > 
> 
> > To execute an specific command, normally we are using s.th. like:
> 
> > 
> 
> > qvm-run  [VMname] 
> 
> > 
> 
> > E.g.: qvm-run personal "cp /home/user/Desktop/test.txt 
> > /home/user/Documents/test.txt
> 
> > 
> 
> > Now my situation:
> 
> > 
> 
> > When connecting to an ftp-server via: ftp , i had to enter an 
> > username and password. 
> 
> > 
> 
> > How to execute this using qvm-run? I suggest to write a little script like:
> 
> > 
> 
> > #!/bin/bash
> 
> > 
> 
> > qvm-run personal "ftp " | qvm-run personal "user /n" |qvm-run 
> > personal "pw \n" 
> 
> > 
> 
> > Unfortunately this one does not work since last two aren't commands. 
> > However, is it possible to insert such keyboard entries in an VM's console 
> > to get this work?
> 
> > 
> 
> > Thanks,
> 
> > Jonny
> 
> 
> 
> Hey All, an alternative is to write an executable bash script in the qube 
> that to the ftp stuff, bind it to PATH and execute it with qvm-run. 
> 
> 
> 
> But, if there is an alternative, not to use a script located on that vm and 
> do all remotely, i would be pleased to hear your ideas :) 
> 
> 
> 
> if possible I would try to look for a way to replace ftp by something that is 
> more secure like sftp/scp.
> Then you can drop the login/password part and use certificates to 
> authenticate.
> If you really want to use login/password I would use split-gpg so that you 
> can keep the password on an offline "vault-vm" and the password will be 
> decrypted and used in the AppVM.
> 
> 
> Question if you keep using ftp
> Would it be ok, if you enter login and password in dom0 ?
> Are you always connecting to the same ftp server from the AppVM?
> And are you always executing the same ftp command ?
> Or do you need a more flexible approach like:
> 
> 
> don0script 
> 
> 
> If you are more specific what you want to accomplish I can write you a draft.
> 
> 
> Regards
> 
> 
> [799]

Hey [799],

what i try to accomplish is a process executed on dom0 that downloads an data 
package from the server onto AppVM1 - then forward it over to another AppVM - 
then execute (read) it. Currently i have scripted the transfer between dom1 and 
2 and the download from the server with a script inside dom1. However, i want 
to try to initiate & control the download from dom0 that the script does not 
have to be placed in the AppVM.

- it would be ok to enter login data from dom0 (that login information would be 
stored on dom0)
- in that case i will always connect to the same ftp server
- i will always execute the same ftp command differ by data-name:
  - like: ftp get /path/to/fileX.txt
- would not need to be that flexible - here what i have got for dom1:
#--#
#!/bin/bash

HOST='x.x.x.x'
USER='AppVM1'
PASSWD=''

FILE=$1
ftp -n -v $HOST 

Re: [qubes-users] Re: Insert/Inject keyboard hits to a Qube from Dom0

2018-05-11 Thread 799
Hello Jonny,

 schrieb am Fr., 11. Mai 2018, 15:18:

> Am Freitag, 11. Mai 2018 13:52:23 UTC+2 schrieb cr33d...@gmail.com:
> > Hey Everyone!,
> >
> > currently working on several automation processes using bash scripts
> executed in dom0 to do certain actions.
> >
> > To execute an specific command, normally we are using s.th. like:
> >
> > qvm-run  [VMname] 
> >
> > E.g.: qvm-run personal "cp /home/user/Desktop/test.txt
> /home/user/Documents/test.txt
> >
> > Now my situation:
> >
> > When connecting to an ftp-server via: ftp , i had to enter an
> username and password.
> >
> > How to execute this using qvm-run? I suggest to write a little script
> like:
> >
> > #!/bin/bash
> >
> > qvm-run personal "ftp " | qvm-run personal "user /n" |qvm-run
> personal "pw \n"
> >
> > Unfortunately this one does not work since last two aren't commands.
> However, is it possible to insert such keyboard entries in an VM's console
> to get this work?
> >
> > Thanks,
> > Jonny
>
> Hey All, an alternative is to write an executable bash script in the qube
> that to the ftp stuff, bind it to PATH and execute it with qvm-run.
>
> But, if there is an alternative, not to use a script located on that vm
> and do all remotely, i would be pleased to hear your ideas :)
>

if possible I would try to look for a way to replace ftp by something that
is more secure like sftp/scp.
Then you can drop the login/password part and use certificates to
authenticate.
If you really want to use login/password I would use split-gpg so that you
can keep the password on an offline "vault-vm" and the password will be
decrypted and used in the AppVM.

Question if you keep using ftp
Would it be ok, if you enter login and password in dom0 ?
Are you always connecting to the same ftp server from the AppVM?
And are you always executing the same ftp command ?
Or do you need a more flexible approach like:

don0script 

If you are more specific what you want to accomplish I can write you a
draft.

Regards

[799]

>

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/CAJ3yz2ub5BhfkiiZYPR%3Dkzqar7Ldfq%2BxfSFgnCZrvA6FqZfixA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[qubes-users] Re: Insert/Inject keyboard hits to a Qube from Dom0

2018-05-11 Thread cr33dc0d3r
Am Freitag, 11. Mai 2018 13:52:23 UTC+2 schrieb cr33d...@gmail.com:
> Hey Everyone!, 
> 
> currently working on several automation processes using bash scripts executed 
> in dom0 to do certain actions. 
> 
> To execute an specific command, normally we are using s.th. like:
> 
> qvm-run  [VMname] 
> 
> E.g.: qvm-run personal "cp /home/user/Desktop/test.txt 
> /home/user/Documents/test.txt
> 
> Now my situation:
> 
> When connecting to an ftp-server via: ftp , i had to enter an 
> username and password. 
> 
> How to execute this using qvm-run? I suggest to write a little script like:
> 
> #!/bin/bash
> 
> qvm-run personal "ftp " | qvm-run personal "user /n" |qvm-run 
> personal "pw \n" 
> 
> Unfortunately this one does not work since last two aren't commands. However, 
> is it possible to insert such keyboard entries in an VM's console to get this 
> work?
> 
> Thanks,
> Jonny

Hey All, an alternative is to write an executable bash script in the qube that 
to the ftp stuff, bind it to PATH and execute it with qvm-run. 

But, if there is an alternative, not to use a script located on that vm and do 
all remotely, i would be pleased to hear your ideas :) 

Thanks,
Jonny

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/7d1acab8-ba4b-4512-b048-8cdeac6f88d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.