Git Product home page Git Product logo

greenshot-sftp's Introduction

Greenshot-SFTP

A SFTP Script for Greenshot

Setup

Download both ftp.bat & ftp.txt and modify to your needs, place them in the same folder.

Right click on greenshot and press on Configure External Commands

Image

Click "New" and call it.. say "SFTP"

For the "Command", you want to navigate to your .bat file that you downloaded, not your .txt file.

For the "Argument", you want to set it to: "{0}" [With the quotes!]

In the end, it should look something like

Image

Hit "OK", and you're all done, if the "Command" box is red (https://i.imgur.com/BPHet8P.png) that means the filepath is invalid.

To now enable this, you want to right click on your greenshot icon and hit on Preferences, then go to the "Destination" tab and untick "Select destination dynamically" and tick "SFTP" or whatever you called it.

Getting your host key

To get your host key, you want to run ssh-keygen -l -E md5 -f /etc/ssh/ssh_host_rsa_key.pub

It should output something like 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx root@XXXXXX (RSA)

You want to copy the xx:xx:xx:xx part and paste it in your ftp.txt, just like this;

open sftp://username:[email protected] -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx"

IMPORTANT: Leave the "ssh-rsa" and "2048" part

Editing ftp.txt

Editing ftp.txt is pretty simple, but I'll go through it one by one.

option batch abort

option confirm off

Leave these two as they are and don't modify them.

open sftp://username:[email protected] -hostkey="ssh-rsa 2048 yo:ur:ho:st:ke:y:he:re"

This is the main part you want to focus on. It's pretty self explanitory. Replace username with your ssh username, password with your ssh password, host.name with your box ip/hostname. You want to replace yo:ur:ho:st:ke:y:he:re with your host key, which is explained above.

cd /var/www/html/i

You want to change this to where you are uploading your screenshot. I have mine in a i directory in /var/www/html

put %1%

Leave this as it is.

close

This closes the sFTP connection, and exit exits WinSCP.

Editing ftp.bat

There's not alot to edit in ftp.bat, but there is a few things.

cd /D C:/Program Files (x86)/WinSCP

You want to change this to the directory where your WinSCP.com is located.

start /B WinSCP.com /script="C:/location/to/your/ftp.txt" /parameter // %1

You want to change this to where your ftp.txt is located.

echo http://example.com/i/%Name%.png | clip

This is the important part. You want to change http://example.com/i/ to the web directory where it has been uploaded. Do not change the %Name%.png part.

Contact me

That's pretty much it. If you have any problems or anything you can create an issue thread.

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.