LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Java with Shell Scripts (https://www.linuxquestions.org/questions/programming-9/java-with-shell-scripts-211594/)

lazkyr 07-30-2004 04:08 PM

Java with Shell Scripts
 
I have a file of this format(it is from a packet sniffer-the packets are sent from a host to another):

YY-MM-DD:protocol(tcp,udp,icmp):SRC IP:SRC PORT:DEST IP:DEST PORT

It is a file with 16000 lines and i want to create a GUI,so that i can analyze the data that i have in that file.I want to use Java to create the GUI,but i think that it is better if i use a script instead.Is there a way that i can use a shell script(eg.if i want to see only the tcp connections or if i want to see the traffic that is created from a specific host) and then with the results of that process,using Java to create a nice graffical interface?You can tell that i want the script to do the 'dirty job' and Java the 'nice one'.I am asking if i can do that and how....
I am looking forward to your answers.

Lazaros
Greece


PS.Visit Greece for the Olympic Games :)

johnMG 07-30-2004 04:30 PM

Un-tested code:
Code:

try
{
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec( "/usr/bin/frobnicate" );
    BufferedReader buf = new BufferedReader(
        InputStreamReader( proc.getInputStream() ) );
    String line;
    while ( ( line = buf.readLine() ) != null )
    {
        System.out.println( "Output from frobnicate: " + line );
    }
}
catch ( IOException e )
{
    System.out.println( "We're boned. " + e.getMessage() );
}



All times are GMT -5. The time now is 06:33 PM.