Skip to content

Commit b4c977b

Browse files
committed
first upload ALPHA STATUS !
1 parent 3fb30d3 commit b4c977b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1847
-0
lines changed
1.16 KB
Binary file not shown.

bin/debugging/Debug.class

310 Bytes
Binary file not shown.

bin/documentation/milestones

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
14.3.2009 - status
2+
- anonymous login possible to any server
3+
- passiv mode supported
4+
- userinterface implements (rfc)
5+
- download to application root
6+
- list
7+
- change directory

bin/documentation/roadmap

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1. time to set

bin/fileSystem/CreateFile.class

277 Bytes
Binary file not shown.

bin/fileSystem/DeleteFile.class

277 Bytes
Binary file not shown.

bin/ftpClient/AnonymousSession.class

3.29 KB
Binary file not shown.

bin/ftpClient/ThreadControll.class

982 Bytes
Binary file not shown.
2.93 KB
Binary file not shown.

bin/ftpClient/documentation

Whitespace-only changes.
2.84 KB
Binary file not shown.
2.9 KB
Binary file not shown.
4.26 KB
Binary file not shown.
1.76 KB
Binary file not shown.

bin/inputAndOutput/documentation

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
rfc-modell: http://www.ietf.org/rfc/rfc959.txt
2+
3+
RFC 959 October 1985
4+
File Transfer Protocol
5+
6+
7+
2.3. THE FTP MODEL
8+
9+
10+
11+
-------------
12+
|/---------\|
13+
|| User || --------
14+
||Interface|<--->| User |
15+
|\----^----/| --------
16+
---------- | | |
17+
|/------\| FTP Commands |/----V----\|
18+
||Server|<---------------->| User ||
19+
|| PI || FTP Replies || PI ||
20+
|\--^---/| |\----^----/|
21+
| | | | | |
22+
-------- |/--V---\| Data |/----V----\| --------
23+
| File |<--->|Server|<---------------->| User |<--->| File |
24+
|System| || DTP || Connection || DTP || |System|
25+
-------- |\------/| |\---------/| --------
26+
---------- -------------
27+
28+
Server-FTP USER-FTP
29+
30+
NOTES: 1. The data connection may be used in either direction.
31+
2. The data connection need not exist all of the time.
32+
33+
Figure 1 Model for FTP Use
34+
35+
PI: The protocol interpreter. The user and server sides of the
36+
protocol have distinct roles implemented in a user-PI and a
37+
server-PI.
38+
39+
DTP: The data transfer process establishes and manages the data
40+
connection. The DTP can be passive or active.
41+
42+
43+
44+
45+
Postel & Reynolds [Page 8]
46+
47+
48+
Tobias Letschka: Interpretation and implementation
49+
50+
51+
52+
-------------
53+
|/---------\|
54+
|| User || --------
55+
||Interface|<--->| User |
56+
|\----^----/| --------
57+
---------- | | |
58+
|/------\| FTP Commands |/----V----\|
59+
||Server|<---------------->| Ftp ||
60+
|| Message ||
61+
|| PI || FTP Replies || Socket ||
62+
|\--^---/| |\----^----/|
63+
| | | | | |
64+
-------- |/--V---\| Data |/----V----\| --------
65+
| File |<--->|Server|<---------------->| FtpData |<--->| File |
66+
|System| || DTP || Connection || Socket || |System|
67+
-------- |\------/| |\---------/| --------
68+
---------- -------------
69+
70+
Server-FTP USER-FTP

bin/rfc/AccessControlCommands.class

2.34 KB
Binary file not shown.

bin/rfc/FtpServiceCommands.class

3.83 KB
Binary file not shown.

bin/rfc/OptionalCommands.class

1005 Bytes
Binary file not shown.
1.45 KB
Binary file not shown.

bin/trash/FG_FtpServer.class

1.85 KB
Binary file not shown.

bin/trash/trash.class

1.27 KB
Binary file not shown.
313 Bytes
Binary file not shown.
3.2 KB
Binary file not shown.

bin/userInterface/RfcMode.class

274 Bytes
Binary file not shown.

bin/userInterface/ShellMode.class

280 Bytes
Binary file not shown.

bin/userInterface/UserInterface.class

4.05 KB
Binary file not shown.

robots.txt

42.7 KB
Binary file not shown.
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package application;
2+
3+
import inputAndOutput.FtpServerAnswerMessages;
4+
import ftpClient.AnonymousSession;
5+
import ftpClient.UserPasswordSession;
6+
7+
public class ApplicationFtpClient {
8+
9+
10+
static UserPasswordSession userpass = new UserPasswordSession();
11+
static Thread userpassThread = new Thread(userpass);
12+
13+
public static FtpServerAnswerMessages ftpAnswere = new FtpServerAnswerMessages();
14+
public static Thread ftpAnswereThread = new Thread(ftpAnswere);
15+
16+
17+
18+
19+
public static void main(String[] args) {
20+
21+
22+
userpassThread.start();
23+
24+
// client.killClientThread(false);
25+
26+
// ftpClientThread.join(); // auf ende warten
27+
28+
29+
}
30+
void testForServerWithAnonyoumsAccount() {
31+
AnonymousSession anonymous = new AnonymousSession(); // get Socket
32+
Thread anonymousThread = new Thread(anonymous); // establish a server connection
33+
//anonymousThread.start(); // start Thread
34+
}
35+
36+
}

src/debugging/Debug.java

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Variables to set Debugging-Mode into Application
3+
*/
4+
package debugging;
5+
6+
/**
7+
* @author iron
8+
*
9+
*/
10+
11+
12+
public final class Debug {
13+
14+
// if it true all debugging routines will be announced
15+
public static final boolean global = false;
16+
17+
}

src/documentation/milestones

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
14.3.2009 - status
2+
- anonymous login possible to any server
3+
- passiv mode supported
4+
- userinterface implements (rfc)
5+
- download to application root
6+
- list
7+
- change directory

src/documentation/roadmap

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1. time to set

src/fileSystem/CreateFile.java

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package fileSystem;
2+
3+
public class CreateFile {
4+
5+
}

src/fileSystem/DeleteFile.java

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package fileSystem;
2+
3+
public class DeleteFile {
4+
5+
}

src/ftpClient/AnonymousSession.java

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package ftpClient;
2+
3+
import inputAndOutput.FtpDataSocket;
4+
import inputAndOutput.FtpMessageSocket;
5+
import inputAndOutput.FtpServerAnswerMessages;
6+
import inputAndOutput.FtpServerDataMessages;
7+
8+
import java.io.*;
9+
import java.net.*;
10+
import java.nio.channels.SocketChannel;
11+
12+
13+
14+
import rfc.AccessControlCommands;
15+
import rfc.FtpServiceCommands;
16+
import rfc.OptionalCommands;
17+
import rfc.TransferParameterCommands;
18+
import trash.FG_FtpServer;
19+
import userInterface.UserInterface;
20+
21+
// FuckingGeniusFtpClient; FGFtpClient
22+
23+
public class AnonymousSession implements Runnable {
24+
25+
26+
// Class variable
27+
public final static int DEFAULT_DATA_PORT = 20; // for active mode
28+
public final static int DEFAULT_PORT = 21;
29+
public final static String DEFAULT_ADDRESS = "ftp2.de.debian.org";
30+
public final static String DEFAULT_PATH = "/debian";
31+
public final static String DEFAULT_USER = "anonymous";
32+
public final static String DEFAULT_PASSWORD = "anonymous@anonymous.de";
33+
34+
private static FtpServerAnswerMessages messages = new FtpServerAnswerMessages();
35+
private static Thread ftpServerMSGThread = new Thread(messages);
36+
private static FtpMessageSocket client = new FtpMessageSocket();
37+
private static FtpDataSocket data = new FtpDataSocket();
38+
private ThreadControll controll = new ThreadControll(); // Semaphore
39+
private static boolean threadRunning = true;
40+
41+
42+
43+
44+
45+
46+
// MasterThread
47+
public void run () {
48+
49+
anonymousSession();
50+
51+
}
52+
private static void anonymousSession() {
53+
54+
UserInterface userInterface = new UserInterface();
55+
AccessControlCommands access = new AccessControlCommands();
56+
TransferParameterCommands transfer = new TransferParameterCommands();
57+
OptionalCommands optional = new OptionalCommands();
58+
FtpServiceCommands service = new FtpServiceCommands();
59+
client.startMessageSocket(DEFAULT_ADDRESS, DEFAULT_PORT);
60+
//SocketChannel neu = client.startMessageSocket().getChannel();
61+
62+
access.sendUserName();
63+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
64+
access.sendPassword();
65+
try {
66+
Thread.sleep(1000); // wait for server answere
67+
} catch (InterruptedException e1) {
68+
// TODO Auto-generated catch block
69+
e1.printStackTrace();
70+
}
71+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
72+
service.sendSystem();
73+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
74+
FtpServiceCommands.sendFEAT();
75+
try {
76+
Thread.sleep(1000); // wait for server answere
77+
} catch (InterruptedException e1) {
78+
// TODO Auto-generated catch block
79+
e1.printStackTrace();
80+
}
81+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
82+
service.sendPrintWorkingdirectory();
83+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
84+
transfer.sendPASV();
85+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
86+
FtpDataSocket data = new FtpDataSocket();
87+
data.startDataSocket(FtpServerAnswerMessages.getRETURN_IP(),
88+
FtpServerAnswerMessages.getRETURN_PORT());
89+
90+
service.sendLIST(); // server sends a port
91+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
92+
FtpServerDataMessages dataMsg = new FtpServerDataMessages();
93+
dataMsg.awaitsLISTanswer();
94+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
95+
data.closeDataSocket();
96+
userInterface.Interface();
97+
System.out.println("Client: Closing Connection");
98+
AnonymousSession.killClientThread();
99+
FtpMessageSocket.closeMessageSocket();
100+
101+
}
102+
103+
public static void killClientThread() { // stopping thread
104+
threadRunning = false;
105+
}
106+
107+
108+
109+
}
110+

src/ftpClient/ThreadControll.java

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package ftpClient;
2+
3+
import java.util.concurrent.Semaphore;
4+
5+
public class ThreadControll {
6+
7+
8+
private static final int MAX_AVAILABLE_PERMITS = 1;
9+
private Semaphore sem1 = new Semaphore(MAX_AVAILABLE_PERMITS); // default: semaphore = 1
10+
11+
public boolean running() {
12+
13+
// reducing the number of available permits by one
14+
try {
15+
sem1.acquire();
16+
} catch (InterruptedException e) {
17+
// TODO Auto-generated catch block
18+
e.printStackTrace();
19+
}
20+
int counter;
21+
if((counter = sem1.availablePermits()) == 0) {
22+
return true;
23+
}
24+
else {
25+
return false;
26+
}
27+
}
28+
public boolean waiting() {
29+
30+
// increasing Semaphore -> sem1+1
31+
sem1.release(1);
32+
33+
int counter;
34+
if((counter = sem1.availablePermits()) != 1) {
35+
return true;
36+
}
37+
else {
38+
return false;
39+
}
40+
}
41+
42+
43+
44+
}
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package ftpClient;
2+
3+
import inputAndOutput.FtpDataSocket;
4+
import inputAndOutput.FtpMessageSocket;
5+
import inputAndOutput.FtpServerAnswerMessages;
6+
import inputAndOutput.FtpServerDataMessages;
7+
import rfc.AccessControlCommands;
8+
import rfc.FtpServiceCommands;
9+
import rfc.OptionalCommands;
10+
import rfc.TransferParameterCommands;
11+
import userInterface.UserInterface;
12+
13+
public class UserPasswordSession implements Runnable {
14+
private static boolean threadRunning = true;
15+
private static FtpMessageSocket message = new FtpMessageSocket();
16+
17+
@Override
18+
public void run() {
19+
loginSession("pr0-talk.de",21,"web16","XGT3GEmY");
20+
21+
22+
}
23+
private static void loginSession(String address, int port, String username, String password) {
24+
25+
UserInterface userInterface = new UserInterface();
26+
AccessControlCommands access = new AccessControlCommands();
27+
TransferParameterCommands transfer = new TransferParameterCommands();
28+
OptionalCommands optional = new OptionalCommands();
29+
FtpServiceCommands service = new FtpServiceCommands();
30+
message.startMessageSocket(address, port);
31+
32+
33+
access.sendUserName(username);
34+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
35+
access.sendPassword(password);
36+
try {
37+
Thread.sleep(1000); // wait for server answere
38+
} catch (InterruptedException e1) {
39+
// TODO Auto-generated catch block
40+
e1.printStackTrace();
41+
}
42+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
43+
service.sendSystem();
44+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
45+
FtpServiceCommands.sendFEAT();
46+
try {
47+
Thread.sleep(1000); // wait for server answere
48+
} catch (InterruptedException e1) {
49+
// TODO Auto-generated catch block
50+
e1.printStackTrace();
51+
}
52+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
53+
service.sendPrintWorkingdirectory();
54+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
55+
transfer.sendPASV();
56+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
57+
FtpDataSocket data = new FtpDataSocket();
58+
data.startDataSocket(FtpServerAnswerMessages.getRETURN_IP(),
59+
FtpServerAnswerMessages.getRETURN_PORT());
60+
61+
service.sendLIST(); // server sends a port
62+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
63+
FtpServerDataMessages dataMsg = new FtpServerDataMessages();
64+
dataMsg.awaitsLISTanswer();
65+
inputAndOutput.FtpServerAnswerMessages.readInputStream();
66+
data.closeDataSocket();
67+
userInterface.Interface();
68+
System.out.println("Client: Closing Connection");
69+
AnonymousSession.killClientThread();
70+
FtpMessageSocket.closeMessageSocket();
71+
killClientThread();
72+
73+
}
74+
public static void killClientThread() { // stopping thread
75+
threadRunning = false;
76+
}
77+
78+
79+
}

src/ftpClient/documentation

Whitespace-only changes.

0 commit comments

Comments
 (0)