there we go

master
Bel LaPointe 2019-04-14 17:46:16 -06:00
parent 47413f618d
commit ecb2c7dd2f
3 changed files with 17 additions and 8 deletions

View File

@ -10,6 +10,7 @@ import (
"flag"
"log"
"os/exec"
"time"
filedriver "github.com/goftp/file-driver"
"github.com/goftp/server"
@ -21,7 +22,7 @@ func main() {
user = flag.String("user", "admin", "Username for login")
pass = flag.String("pass", "123456", "Password for login")
port = flag.Int("port", 2121, "Port")
host = flag.String("host", "localhost", "Port")
host = flag.String("host", "", "Host")
)
flag.Parse()
if *root == "" {
@ -43,7 +44,10 @@ func main() {
Password: *pass,
},
callback: func() {
log.Printf("callback: %v", exec.Command("sh", "-c", "cd /wiki; git add -A :/; git commit -m \"ftp upload\"").Run())
go func() {
time.Sleep(time.Second * 5)
log.Printf("callback: %v", exec.Command("sh", "-c", "cd /wiki; git add -A :/; git commit -m \"ftp upload\"").Run())
}()
},
},
}

11
test.py Normal file
View File

@ -0,0 +1,11 @@
#! /bin/python3
import ftplib
import io
import random
ftp = ftplib.FTP()
ftp.connect("localhost", 38081)
ftp.login("admin", "123456")
s = "".join(random.choices([chr(i) for i in range(ord('a'), ord('z'))], k=5))
ftp.storlines('STOR test.py', io.BytesIO(s.encode()))

View File

@ -1,6 +0,0 @@
echo "
user admin 123456
ascii
put Dockerfile
bye
" | ftp -n 127.0.0.1 2121