Introduction
Ok, so you want to make a telnet daemon. Why? Who cares, for fun if anything. All you need is a couple minutes of your time, a spare Windows NT Machine (I'm not sure how well this would work on '95, it's never been tested), and the right software. So, lets get right down to it.
This document is split into 2 parts. One part descibes how to set up the NT box, the other how to set up a linux box. If you are not using linux for a firewall or ipmasq server, you may skip it without any problems.
So without any further delays, lets get to it.
Section 1: NT Setup
Software Required
Netcat/NT v1.1 - Download Here
4NT v3.02 - Download Here
Optional: Editplus (or any other good text editor) - Download Here
Configuring the software
Ok. Lets get started.
1. Unzip NetCat into c:\netcat.
2. Unzip 4NT into c:\4nt.
3. Run c:\4nt\4nt.exe and go through the inital 4nt setup procedure.
Setting up the daemon
Now it's time to configure what happens when a user connects. This document describes the usage of a batch file. Here is a sample:
1. @ECHO OFF
2. ECHO Welcome to my Win32 Telnet Server.
3. ECHO Running 4NT %_4ver under %_dos %_dosver. This is PID %_pid
4. input /C Password: %%pwd
5. if "%pwd" EQ "abracadabra" cmd.exe
6. ECHO Thankyou for using the Win32TelnetD.
7. ECHO.
8. input Press ENTER to disconnect from Win32TelnetD: %%blah
9. EXIT
An explanation of what each line does follows:
1. Turn of echoing of commands.
2-3. Greet the user, show some stats.
4. Ask the user for a password
5. If password correct, launch cmd.exe, and give the user a full shell.
6-7. Show goodbye message.
8. Pause until user quits.
9. End the script, and close connection.
When you're finished making your batch file, or if copying the example, save it as c:\netcat\connect.bat
Section 2: Linux Setup
Please note that this section only applies to people like me who are using a linux box as their firewall, and need a way to break through it to allow incoming connections. If you have no linux machines on your LAN, or if you have no LAN, you don't need to worry about this.
Software Required
Redir 0.7 - Download Here
Configuring the software
Compile redir into a binary executable, by typing:
gcc redir.c -o redir
at the command prompt. You should now have an executable redir command in the current directory.
Setting up the re-direct
Since you have the little problem of a firewall, you need to get around it by using a port redirection. What a port re-direction does, is forwards any connections from "x" port of one computer, to "y" port of another computer. Simple.
For our purposes, redir.c will do nicely. To use it, log in under the root account of your machine (port binding cannot be done without root priviledges), go to the directory where you compiled it (above), and type:
./redir --debug 192.168.0.1 32 23
Where:
192.168.0.1 - IP of the WinNT Machine
32 - Incoming port, one not blocked by the firewall
23 - Target port on the NT Machine, usually 23
Section 3: Starting the Server
Assuming you used all the pathnames above, open a command prompt (Start -> RUN -> cmd.exe) and type:
nc -v -v -L -p 23 -e "c:\4nt\4nt.exe /c connect.btm"
in c:\netcat to start the server. This assumes connect.btm is in the same directory as netcat.
Section 4: Testing it out
DISABLE Local Echo in your telnet client, this has a tendancy of confusing the server, alot. Then simply connect to either port 23 of localhost (for a simple winnt setup) or port 32 (for a linux firewall bypassing setup) of your linux box. If all goes well, you should be greeted with the little login script you wrote. If strange things happen when you press enter, it's the local echo.