initial commit
This commit is contained in:
commit
ebd1524a27
32
.gitignore
vendored
Normal file
32
.gitignore
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/java
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=java
|
||||
|
||||
### Java ###
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/java
|
||||
|
||||
/.metadata/
|
||||
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# nst-0x04
|
||||
|
||||
this repo holds *sawce* for project `0x04` (evil telnet virus) of the NST lessons
|
||||
12
RemoteSystemsTempFiles/.project
Normal file
12
RemoteSystemsTempFiles/.project
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>RemoteSystemsTempFiles</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
10
nst-0x04/.classpath
Normal file
10
nst-0x04/.classpath
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
nst-0x04/.project
Normal file
17
nst-0x04/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>nst-0x04</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
14
nst-0x04/.settings/org.eclipse.jdt.core.prefs
Normal file
14
nst-0x04/.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,14 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
56
nst-0x04/src/nst_0x04/Main.java
Normal file
56
nst-0x04/src/nst_0x04/Main.java
Normal file
@ -0,0 +1,56 @@
|
||||
package nst_0x04;
|
||||
|
||||
import java.net.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
|
||||
class my_thread extends Thread{
|
||||
InputStream is;
|
||||
static ExecutorService executor = Executors.newCachedThreadPool();
|
||||
public my_thread(InputStream i){
|
||||
is = i;
|
||||
}
|
||||
public void run() {
|
||||
try {
|
||||
int ch;
|
||||
while((ch = is.read()) != -1)
|
||||
System.out.write(ch);
|
||||
System.out.println("* server said ktxbye");
|
||||
System.exit(0);
|
||||
} catch (Exception e) {
|
||||
if(e instanceof SocketException) {
|
||||
System.out.println("* we're at EOF -> the thread is dead");
|
||||
}
|
||||
else e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
String host = "localhost";
|
||||
int port = 1982;
|
||||
if(args.length > 0) {
|
||||
host = args[0];
|
||||
if(args.length >1) {
|
||||
port = Integer.parseInt(args[1]);
|
||||
}
|
||||
}
|
||||
try {
|
||||
Socket s = new Socket(host,port);
|
||||
InputStream is = s.getInputStream();
|
||||
OutputStream os = s.getOutputStream();
|
||||
my_thread mt = new my_thread(is);
|
||||
mt.start();
|
||||
int ch;
|
||||
while((ch = System.in.read())!=-1) {
|
||||
os.write(ch);
|
||||
}
|
||||
System.out.println("* we're at EOF");
|
||||
s.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
nst-0x04/src/nst_0x04/package-info.java
Normal file
1
nst-0x04/src/nst_0x04/package-info.java
Normal file
@ -0,0 +1 @@
|
||||
package nst_0x04;
|
||||
Loading…
Reference in New Issue
Block a user