
ineya
By: a guest on Jul 17th, 2008 | syntax:
Java | size: 1.77 KB | hits: 111 | expires: Never
// dsh - Data shell
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DataShell {
public static class F
extends Thread {
public void run() {
try {
sleep(100);
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
int c=0;
while ((c=fis.read()) != -1) {
o.write(c);
}
fis.close();
}
/**
* @param args
*/
public static void main
(String[] args
) {
try {
new F().start();
while ((line = br.readLine()) != null) {
if (line.startsWith("q")) {
break;
} else if (line.startsWith("a")) {
line = line.substring(1);
System.
out.
write(line.
getBytes());
} else if (line.startsWith("h")) {
Pattern p = Pattern.compile("0x([0-9a-fA-F]{1,2})");
Matcher m = p.matcher(line);
while (m.find()) {
String hexNumber
= m.
group(1
);
byte b
=Byte.
parseByte(hexNumber, 16
);
}
} else if (line.startsWith("f")) {
line = line.substring(1);
copyFileToStream
(line,
System.
out);
}
//System.out.write(line.getBytes());
}
e.printStackTrace();
}
}
}