Version 1.0.1

This commit is contained in:
Erik C. Thauvin 2002-07-25 05:31:57 +00:00
parent 4cd29f3eb0
commit fa7c5ec73d
6 changed files with 54 additions and 42 deletions

View file

@ -1,7 +1,7 @@
README README
GeekTools Whois Java Client GeekTools Whois Java Client
Version 1.0 Version 1.0.1
GeekTools Whois Java Client is a finger-style whois which uses the GeekTools GeekTools Whois Java Client is a finger-style whois which uses the GeekTools
Whois Proxy server (<whois.geektools.com>) provided by CenterGate Research Whois Proxy server (<whois.geektools.com>) provided by CenterGate Research
@ -126,4 +126,4 @@ Similarly, to change the default port from 43 to 46:
Copyright (C) 2000 by SkyTouch Communications. All Rights Reserved. Copyright (C) 2000-2001 by SkyTouch Communications. All Rights Reserved.

View file

@ -1,17 +1,17 @@
/* /*
Package: GeekTools Whois Java Client 1.0 Package: GeekTools Whois Java Client 1.0.1
File: Whois.java (Java source file) File: Whois.java (Java source file)
Author: Erik C. Thauvin <erik@skytouch.com> Author: Erik C. Thauvin <erik@skytouch.com>
Comments: Part of the GeekTools Whois Java Client package. Comments: Part of the GeekTools Whois Java Client package.
See the README.TXT file for more information. See the README.TXT file for more information.
Copyright (C) 2000 SkyTouch Communications. All Rights Reserved. Copyright (C) 2000-2001 SkyTouch Communications. All Rights Reserved.
This program is distributed under the terms of the GNU General This program is distributed under the terms of the GNU General
Public License as published by the Free Software Foundation. Public License as published by the Free Software Foundation.
See the COPYING.TXT file for more information. See the COPYING.TXT file for more information.
$Id$ $Id$
*/ */
@ -21,16 +21,28 @@ import java.io.*;
import java.util.Properties; import java.util.Properties;
/**
* Class Whois
*
*
* @author Erik C. Thauvin (erik@skytouch.com)
* @version 1.0.1
*/
public class Whois public class Whois
{ {
// The truth is out there! /**
* Method main
*
* The Truth is Out There!
*
* @param args Command line arguments
*/
public static void main(String[] args) public static void main(String[] args)
{ {
// Display usage if there are no command line arguments // Display usage if there are no command line arguments
if (args.length < 1) if (args.length < 1)
{ {
System.out.println( System.out.println("Usage: java Whois query[@<whois.server>]");
"Usage: java Whois query[@<whois.server>]");
return; return;
} }
@ -43,8 +55,7 @@ public class Whois
// Load the properties file. // Load the properties file.
try try
{ {
FileInputStream in = FileInputStream in = new FileInputStream("Whois.properties");
new FileInputStream("Whois.properties");
Properties app = new Properties(); Properties app = new Properties();
app.load(in); app.load(in);
@ -53,11 +64,9 @@ public class Whois
server = (app.getProperty("server", server)); server = (app.getProperty("server", server));
// Get the port property // Get the port property
String tmp = app.getProperty("port");
try try
{ {
port = Integer.parseInt(tmp); port = Integer.parseInt(app.getProperty("port"));
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
@ -72,19 +81,20 @@ public class Whois
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println( System.err.println("Whois: an error occurred while loading the properties file: " + e);
"Whois: an error occurred while loading the properties file: "
+ e);
} }
// Build the whois query using command line arguments // Build the whois query using command line arguments
String query = args[0]; StringBuffer buff = new StringBuffer(args[0]);
for (int i = 1; i < args.length; i++) for (int i = 1; i < args.length; i++)
{ {
query += (" " + args[i]); buff.append(" " + args[i]);
} }
// Convert string buffer to string
String query = buff.toString();
// The whois server can be specified after "@" // The whois server can be specified after "@"
// e.g.: query@whois.networksolutions.com // e.g.: query@whois.networksolutions.com
int at = query.lastIndexOf("@"); int at = query.lastIndexOf("@");
@ -111,11 +121,8 @@ public class Whois
{ {
// Establish connection to whois server & port // Establish connection to whois server & port
Socket connection = new Socket(server, port); Socket connection = new Socket(server, port);
PrintStream out = PrintStream out = new PrintStream(connection.getOutputStream());
new PrintStream(connection.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String line = ""; String line = "";
// Send the whois query // Send the whois query

Binary file not shown.

Binary file not shown.

39
whois
View file

@ -1,12 +1,12 @@
#!/bin/sh #!/bin/sh
# Package: GeekTools Whois Java Client 1.0 # Package: GeekTools Whois Java Client 1.0.1
# File: whois (Bourne shell script) # File: whois (Bourne shell script)
# Author: Erik C. Thauvin <erik@skytouch.com> # Author: Erik C. Thauvin <erik@skytouch.com>
# Comments: Part of the GeekTools Whois Java Client package. See # Comments: Part of the GeekTools Whois Java Client package. See
# the README.TXT file for more information. # the README.TXT file for more information.
# #
# Copyright (C) 2000 SkyTouch Communications - All Rights Reserved # Copyright (C) 2000-2001 SkyTouch Communications - All Rights Reserved
# #
# This program is distributed under the terms of the GNU General # This program is distributed under the terms of the GNU General
# Public License as published by the Free Software Foundation. # Public License as published by the Free Software Foundation.
@ -26,31 +26,36 @@ then
JAVA_EXE=/bin/java JAVA_EXE=/bin/java
if [ "$JAVA_PATH" = "" ] if [ "$JAVA_PATH" = "" ]
then then
# Linux JDK # Linux JDK 1.3.0_01
JAVA_PATH=/usr/java/jdk1.3 JAVA_PATH=/usr/java/jdk1.3.0_01
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ] if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then then
# Linux JRE # Linux JDK 1.3
JAVA_PATH=/usr/java/jre1.3 JAVA_PATH=/usr/java/jdk1.3
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ] if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then then
# Solaris JDK # Linux JRE
JAVA_PATH=/usr/j2se JAVA_PATH=/usr/java/jre1.3
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ] if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then then
# Solaris JRE # Solaris JDK
JAVA_PATH=/usr/j2se/jre JAVA_PATH=/usr/j2se
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ] if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then then
# Mac OS X # Solaris JRE
JAVA_PATH= JAVA_PATH=/usr/j2se/jre
JAVA_EXE=/System/Library/Frameworks/JavaVM.framework/Versions/1.2/Commands/java if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
if [ ! -x ${JAVA_EXE} ]
then then
JAVA_EXE=`which java` # Mac OS X
if [ ! -x $JAVA_EXE ] JAVA_PATH=
JAVA_EXE=/System/Library/Frameworks/JavaVM.framework/Versions/1.2/Commands/java
if [ ! -x ${JAVA_EXE} ]
then then
JAVA_EXE=java JAVA_EXE=`which java`
if [ ! -x $JAVA_EXE ]
then
JAVA_EXE=java
fi
fi fi
fi fi
fi fi

View file

@ -1,12 +1,12 @@
@echo off @echo off
rem Package: GeekTools Whois Java Client 1.0 rem Package: GeekTools Whois Java Client 1.0.1
rem File: whois.bat (Batch file) rem File: whois.bat (Batch file)
rem Author: Erik C. Thauvin <erik@skytouch.com> rem Author: Erik C. Thauvin <erik@skytouch.com>
rem Comments: Part of the GeekTools Whois Java Client package. rem Comments: Part of the GeekTools Whois Java Client package.
rem See the README.TXT file for more information. rem See the README.TXT file for more information.
rem rem
rem Copyright (C) 2000 SkyTouch Communications - All Rights Reserved rem Copyright (C) 2000-2001 SkyTouch Communications - All Rights Reserved
rem rem
rem This program is distributed under the terms of the GNU General rem This program is distributed under the terms of the GNU General
rem Public License as published by the Free Software Foundation. rem Public License as published by the Free Software Foundation.