--- /dev/null
+//////////////////////////////////////////////////////////
+// //
+// Chater 1.4 //
+// Thomas Harvie Mudrunka (C) 2006 //
+// //
+// > Czech Republic //
+// > ICQ 283-782-978 //
+// //
+//////////////////////////////////////////////////////////
+
+
+// Importy
+import java.lang.*;
+import java.io.*;
+import java.net.*;
+import javax.swing.JOptionPane;
+
+
+//Veøejná tøída
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+public class Chater {
+
+//Metoda main
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ public static void main(String[] args) throws java.io.IOException {
+ System.out.println("Chater 1.4\nby: Thomas Mudrunka (C) 2006 - Czech Rep.\nICQ: 283782978\n\nProgram Started!\nInitializing...\n");
+ int port = 12345;
+ String line, pass, goodpass, popup;
+ popup = "false";
+ goodpass = "false";
+ //InetAddress add = getLocalhost(); //Adresa localhosta
+ Runtime runtime = Runtime.getRuntime();
+ if(args[0].equals("help")){
+ System.out.println("You need help ha?!");
+ System.exit(0);
+ }
+
+ try {port = Integer.parseInt(args[0]);} catch (java.lang.ArrayIndexOutOfBoundsException ex) {System.out.println("- ERROR, YOU MUST SPECIFY PORT !!!\nSyntax: java Chater {port, popup, pass}\njava Chater help - for detail help"); System.exit(1);}
+ if(args.length > 1){popup = args[1];}
+
+ ServerSocket ss = new ServerSocket(port); //Vytvoøit serverový soket
+ System.out.println("Server started on: localhost:" + port + "\nPopups enabled: " + popup + "\nNow waiting for incoming connection!");
+
+//Pøijetí pøíchozího spojení
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ while(true){
+ Socket sckt = ss.accept();
+ System.out.println("Connected!");
+ BufferedReader br = new BufferedReader (new InputStreamReader(sckt.getInputStream())); //BufferedReader vytvoøíme z InputStreamReaderu vytvoøeného z InputStreamu vráceného metodou soketu vráceného pøijmutím spojení serverovým soketem.
+
+
+/*
+//Ovìøení hesla
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ line = br.readLine(); //Pøeèíst dal\9aí øádek z telnetu
+
+ System.out.println("Waiting for password.");
+
+ if(args.length > 2){
+
+ line = "ahoj";//debug
+ if(args[2].equals(line)) {goodpass = "true";}
+ line = br.readLine(); //Pøeèíst dal\9aí øádek z telnetu
+ line = "ahoj";//debug
+
+ while((line != null) || (goodpass.equals("false"))){
+ if(args[2].equals(line)){goodpass = "true"; System.out.println("GOOD"}
+ System.out.println("Invalid Password! Valid=" + args[2]);
+ //if(args[2] == line){System.out.println("Good Password!");}
+ line = br.readLine();
+ line = "ahoj";//debug
+ }
+ }
+*/
+//Zpracování pøíkazù
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ System.out.println("Incoming data:");
+ line = br.readLine(); //Pøeèíst dal\9aí øádek z telnetu
+
+ while(line != null){
+ if(line.equals("|exit") || line.equals("|exit1") || line.equals("|cmd") || line.equals("|popup") || line.equals("|plain")){
+ System.out.println("! Incoming command:");
+ if(line.equals("|popup"))
+ {
+ popup = "true";
+ System.out.println("- Enabling popups!");
+ }
+ if(line.equals("|plain"))
+ {
+ popup = "false";
+ System.out.println("- Disabling popups!");
+ }
+ if(line.equals("|exit"))
+ {
+ System.out.println("- Remote daemon shutdown request...\n- Exit code: 0");
+ System.exit(0);
+ }
+ if(line.equals("|exit1"))
+ {
+ System.out.println("- Remote daemon shutdown request (because of error)...\n- Exit code: 1");
+ System.exit(1);
+ }
+ if(line.equals("|cmd"))
+ {
+ try {
+ System.out.println("- Waiting for remote command line...");
+ line = br.readLine();
+ System.out.println("- Executing...");
+ runtime.exec(line);
+ System.out.println("- Done!");
+ } catch (Exception ex) {}
+ }
+
+ }
+
+//Tisk zpráv do konzole a otevírání popapek
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ else {
+ System.out.println(line);
+ if(popup.equals("true")){
+ JOptionPane.showMessageDialog(null, line);
+ }
+ }
+ line = br.readLine();//Pøeèíst dal\9aí øádek z telnetu
+
+ }
+ System.out.print("Connection closed by client!\nNow waiting for incoming connection!");
+ }
+ }
+
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ public static void slow() { //Metoda pro zahlcení CPU.
+ int a, b, c;
+ a=1; b=1; c=0;
+
+ while(true) {
+ if ((a < 2147438648) && (b < 2147438648) && (c < 2147438648)) {
+ c = a + b; b = c - a;
+ }
+ else {
+ a=1; b=1; c=0;
+ }
+ }
+ }
+
+//Konec tøídy
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ }
\ No newline at end of file
--- /dev/null
+|popup Show messages also like popups.
+|plain Show mesages just on command line.
+|close Close connection.
+|exit Shutdown the server.
+|exit1 Shutdown the server with exit code 1.
+|cmd Execute the command from next line.
+|cmdl Read commands from telnet until cmdl is closed. // Not implemented yet! - Why not?
+|cmdc Close cmdl. // Not implemented yet!
+|slow Eat some CPU speed :). // Not implemented yet! - May be it will never
+|rnd Show random error message :). // Not implemented yet! - ???
+|hot Show some error messages :). // Not implemented yet! - !!!
+|sound Play sound once. // Not implemented yet! - too slow
+|alert Play sound repeatedly. // Not implemented yet! - May be it wil never
\ No newline at end of file
--- /dev/null
+<=======JChater==============================================================================>
+<===================================================================================Harvie===>
+
+- Program měl původně sloužit k chatu přes příkazový řádek, přidělal jsem
+popup zprávy,
+ovládání vzdáleného pc pomocí posílání příkazů,
+
+ještě dodělám,
+heslo, celý vzdálený příkazový řádek, a další...
+
+Program zapnete pomocí příkazu java Chater [int port][bool popupsEnabled][String pass-zatímne]
+Pokud nevíte, jaký port, doporučuji port 23,
+
+program totiž používá telnet protokol, nic neposílá zpět, jen příjmá a vypisuje, případně
+otevírá popupy a rozpoznává příkazy
+
+pro zakázání a povolení popupů,
+spuštění příkazu
+a ukončení služby (Exit code 0 nebo 1).
+
+Pro více: Commands.txt
+
+<==o=========================================================================================>
+<===o========================================================================================>
+<=ooo========================================================================================>
+<==================================================================================THE=END===>
\ No newline at end of file