Giter Site home page Giter Site logo

sftp pull about prey-bash-client HOT 2 CLOSED

prey avatar prey commented on July 16, 2024
sftp pull

from prey-bash-client.

Comments (2)

birdtori avatar birdtori commented on July 16, 2024
diff -ru tomas-prey-644c942/config tomas-prey-644c942-sftp/config
--- tomas-prey-644c942/config   2010-03-30 22:11:33.000000000 +0200
+++ tomas-prey-644c942-sftp/config  2010-05-03 03:06:05.000000000 +0200
@@ -23,7 +23,7 @@
 missing_status_code='404'
 
 # you can use send the report via email or to the web service
-# valid values: http, email or scp
+# valid values: http, email, scp or sftp
 post_method='http'
 
 ####################################################################
@@ -62,3 +62,14 @@
 scp_user='username'
 scp_server='my.server.com'
 scp_path='~'
+
+####################################################################
+# sft posting configuration -- EXPERIMENTAL!
+# we dont use user/pass but RSA keys
+# for more info check http://tinyurl.com/sshtip
+####################################################################
+sftp_user='username'
+sftp_server='my.server.com'
+sftp_path='.'
+sftp_options='-oStrictHostKeyChecking=no'
+
diff -ru tomas-prey-644c942/core/push tomas-prey-644c942-sftp/core/push
--- tomas-prey-644c942/core/push    2010-03-30 22:11:33.000000000 +0200
+++ tomas-prey-644c942-sftp/core/push   2010-05-03 03:04:27.000000000 +0200
@@ -68,8 +68,24 @@
        echo -e " -- Uploading the stuff to $scp_path in $scp_server..."
        local new_folder="prey_data_`echo $start_time | sed 'y/ :/_-/'`"
        ssh $scp_user@$scp_server mkdir $scp_path/$new_folder
-       response=`scp $trace_file $file_list $scp_user@$scp_server:$scp_path/$new_folder`
+       response=`scp $scp_options $trace_file $file_list $scp_user@$scp_server:$scp_path/$new_folder`
    else
        echo ' !! You need to set up a server in order to send the report via SCP!'
    fi
 }
+
+send_via_sftp(){
+   if [[ -n "$sftp_server" && -n "$sftp_path" ]]; then
+       local new_folder="prey_data_`echo $start_time | sed 'y/ :/_-/'`"
+       echo -e " -- Uploading the stuff to $sftp_path/$new_folder in $sftp_server..."
+       local batch=$tmpdir/sftp.script
+       echo "mkdir $sftp_path/$new_folder"                           >  $batch
+       echo "put $trace_file $sftp_path/$new_folder/"                >> $batch
+       for f in $file_list; do echo "put $f $sftp_path/$new_folder/" >> $batch; done
+       echo "bye"                                                    >> $batch
+       response=`sftp $sftp_options -b $batch $sftp_user@$sftp_server`
+   else
+       echo ' !! You need to set up a server in order to send the report via SFTP!'
+   fi
+}
+

from prey-bash-client.

tomas avatar tomas commented on July 16, 2024

Excellent!!

Thanks man, will check out and test now.

from prey-bash-client.

Related Issues (20)

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.