Skip to content

Commit 519a3e0

Browse files
author
NoteFox
committed
changed to sftp
ftp deprecated updated StaticVariables updated pom.xml updated Comments added SftpClient for tests updated standard init.txt
1 parent 3d9a33f commit 519a3e0

23 files changed

Lines changed: 1282 additions & 595 deletions

ftpserver.jks

Whitespace-only changes.

init.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
// '//' Comment
77

88
[init]
9-
doesFTPServiceLog = true
10-
doesWebServiceLog = true
11-
12-
logDefaultDir = ./log
13-
mapsDefaultDir = ./maps
14-
ftpDefaultDir = ./ftp
9+
logDefaultDir = log/
10+
mapsDefaultDir = maps/
11+
sftpDefaultDir = sftp/
1512

1613
webPort = 5001
17-
ftpPort = 5000
14+
sftpPort = 5002
1815

1916
standardUserName = ohdmOffViewer
2017
standardUserPassword = H!3r0glyph Sat3llite Era$er

pom.xml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
5+
56
<parent>
67
<groupId>org.springframework.boot</groupId>
78
<artifactId>spring-boot-starter-parent</artifactId>
89
<version>2.3.0.RELEASE</version>
9-
<relativePath/> <!-- lookup parent from repository -->
10+
<relativePath/>
1011
</parent>
12+
1113
<groupId>ohdm</groupId>
12-
<artifactId>mapDownloadService</artifactId>
13-
<version>0.5-SNAPSHOT</version>
14-
<name>mapDownloadService</name>
14+
<artifactId>runner</artifactId>
15+
<version>0.5.2-SNAPSHOT</version>
16+
<name>runner</name>
1517
<description>mapDownloadService for Android App</description>
18+
<!-- lookup parent from repository -->
1619

1720
<properties>
1821
<java.version>11</java.version>
@@ -53,9 +56,37 @@
5356
<artifactId>ftpserver-core</artifactId>
5457
<version>1.1.1</version>
5558
</dependency>
56-
</dependencies>
59+
<!-- sftp Server - ssh base apache -->
60+
61+
<dependency>
62+
<groupId>org.apache.sshd</groupId>
63+
<artifactId>sshd-core</artifactId>
64+
<version>1.7.0</version>
65+
</dependency>
66+
67+
<!-- sshClient -->
68+
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
69+
<dependency>
70+
<groupId>com.jcraft</groupId>
71+
<artifactId>jsch</artifactId>
72+
<version>0.1.55</version>
73+
</dependency>
74+
75+
76+
77+
</dependencies>
5778

5879
<build>
80+
<sourceDirectory>src/java</sourceDirectory>
81+
<resources>
82+
<resource>
83+
<directory>src/java</directory>
84+
<includes>
85+
<include>**/*.xml</include>
86+
<include>**/*.properties</include>
87+
</includes>
88+
</resource>
89+
</resources>
5990
<plugins>
6091
<plugin>
6192
<groupId>org.springframework.boot</groupId>

src/java/Playground.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/java/Server/FTPService/FTPCli/FTPCliTest.java renamed to src/java/Server/FileService/FTPService/FTPCli/FTPCliTest.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
package Server.FTPService.FTPCli;
2-
3-
import org.apache.commons.net.ftp.FTPFile;
4-
5-
import java.io.IOException;
6-
7-
public class FTPCliTest {
8-
9-
public static void main(String[] args) {
10-
FtpClient client = new FtpClient();
11-
client.connect("141.45.146.200", 5000, "ohdmOffViewer", "H!3r0glyph Sat3llite Era$er");
12-
FTPFile[] list = new FTPFile[0];
13-
try {
14-
list = client.getFileList("");
15-
} catch (IOException e) {
16-
e.printStackTrace();
17-
}
18-
19-
for (FTPFile f : list) {
20-
System.out.println(f.getName());
21-
}
22-
23-
try {
24-
client.downloadFile("sachsen.map", "sachsen.map");
25-
} catch (IOException e) {
26-
e.printStackTrace();
27-
}
28-
}
29-
}
1+
package Server.FileService.FTPService.FTPCli;
2+
3+
import org.apache.commons.net.ftp.FTPFile;
4+
5+
import java.io.IOException;
6+
7+
public class FTPCliTest {
8+
9+
public static void main(String[] args) {
10+
FtpClient client = new FtpClient();
11+
client.connect("141.45.146.200", 5000, "ohdmOffViewer", "H!3r0glyph Sat3llite Era$er");
12+
FTPFile[] list = new FTPFile[0];
13+
try {
14+
list = client.getFileList("");
15+
} catch (IOException e) {
16+
e.printStackTrace();
17+
}
18+
19+
for (FTPFile f : list) {
20+
System.out.println();
21+
}
22+
23+
/*try {
24+
client.downloadFile(list[1].getName(), list[1].getName());
25+
} catch (IOException e) {
26+
e.printStackTrace();
27+
}*/
28+
}
29+
}

src/java/Server/FTPService/FTPCli/FTPInterface.java renamed to src/java/Server/FileService/FTPService/FTPCli/FTPInterface.java

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
package Server.FTPService.FTPCli;
2-
3-
import org.apache.commons.net.ftp.FTPFile;
4-
5-
import java.io.IOException;
6-
7-
public interface FTPInterface {
8-
9-
/**
10-
* if called, connects to a server
11-
*
12-
* @param server server ip/hostname
13-
* @param port FTPServer port
14-
* @param user user to log in with
15-
* @param pass passwort used to log in
16-
* @return
17-
* 0 = successful connection,
18-
* 1 = FTP server refused connection,
19-
* 2 = Could not login to FTP Server (probably wrong password),
20-
* 3 = Socket exception thrown, Server not found,
21-
* 4 = IO Exception
22-
*/
23-
int connect(String server, int port, String user, String pass);
24-
25-
/**
26-
* checking if connected
27-
* @return
28-
*/
29-
boolean isConnected();
30-
31-
/**
32-
* gives back the File list, given in given path
33-
* @param path path where it lists everything
34-
* @return FTPFiles in path
35-
* @throws IOException couldn't read from path
36-
*/
37-
FTPFile[] getFileList(String path) throws IOException;
38-
39-
40-
/**
41-
* gives bcak the Dir list, in given path
42-
* @param path path where it lists everything
43-
* @return Dirs in path
44-
* @throws IOException couldn't read from path
45-
*/
46-
FTPFile[] getDirList(String path) throws IOException;
47-
48-
/**
49-
* call to download a File from current dir
50-
* @param remoteFileName file to download from Server
51-
* @param localFile file to write to
52-
* @throws IOException couldn't download from current dir
53-
*/
54-
void downloadFile(String remoteFileName, String localFile) throws IOException;
55-
56-
/**
57-
* closes connection
58-
* pls always use at the end !!!!
59-
*/
60-
void closeConnection();
61-
}
1+
package Server.FileService.FTPService.FTPCli;
2+
3+
import org.apache.commons.net.ftp.FTPFile;
4+
5+
import java.io.IOException;
6+
7+
public interface FTPInterface {
8+
9+
/**
10+
* if called, connects to a server
11+
*
12+
* @param server server ip/hostname
13+
* @param port FTPServer port
14+
* @param user user to log in with
15+
* @param pass passwort used to log in
16+
* @return
17+
* 0 = successful connection,
18+
* 1 = FTP server refused connection,
19+
* 2 = Could not login to FTP Server (probably wrong password),
20+
* 3 = Socket exception thrown, Server not found,
21+
* 4 = IO Exception
22+
*/
23+
int connect(String server, int port, String user, String pass);
24+
25+
/**
26+
* checking if connected
27+
* @return
28+
*/
29+
boolean isConnected();
30+
31+
/**
32+
* gives back the File list, given in given path
33+
* @param path path where it lists everything
34+
* @return FTPFiles in path
35+
* @throws IOException couldn't read from path
36+
*/
37+
FTPFile[] getFileList(String path) throws IOException;
38+
39+
40+
/**
41+
* gives bcak the Dir list, in given path
42+
* @param path path where it lists everything
43+
* @return Dirs in path
44+
* @throws IOException couldn't read from path
45+
*/
46+
FTPFile[] getDirList(String path) throws IOException;
47+
48+
/**
49+
* call to download a File from current dir
50+
* @param remoteFileName file to download from Server
51+
* @param localFile file to write to
52+
* @throws IOException couldn't download from current dir
53+
*/
54+
void downloadFile(String remoteFileName, String localFile) throws IOException;
55+
56+
/**
57+
* closes connection
58+
* pls always use at the end !!!!
59+
*/
60+
void closeConnection();
61+
}

0 commit comments

Comments
 (0)