java - Print argument from Console -
i'm tring run argument ubuntu console.
./mytool -h
and print of "1".
someone can please ?
thanks !
public static void main(string[] argv) throws exception { system.out.println("1"); for(int i=0;i<argv.length;i++) { if (argv.equals("-h")) { system.out.println("-ip target ip address\n"); system.out.println("-t time interval between each scan in milliseconds\n"); system.out.println("-p protocol type [udp/tcp/icmp]\n"); system.out.println("-type scan type [full,stealth,fin,ack]\n"); system.out.println("-b bannergrabber status\n"); }
}
argv
entire array. trying match, entire content of array string -h
. try doing this:
public static void main(string[] argv) throws exception { system.out.println("1"); for(int i=0;i<argv.length;i++) { if (argv[i].equals("-h")) { system.out.println("-ip target ip address\n"); system.out.println("-t time interval between each scan in milliseconds\n"); system.out.println("-p protocol type [udp/tcp/icmp]\n"); system.out.println("-type scan type [full,stealth,fin,ack]\n"); system.out.println("-b bannergrabber status\n"); } } }
side note: this previous post might worth going through.
Comments
Post a Comment