Results 1 to 3 of 3

Thread: NetCat tutorial: Day2

  1. #1
    Senior Member
    Join Date
    Nov 2001

    NetCat tutorial: Day2

    In this installment im going to show you a way to keep an eye on your computer while your away, using NetCat. Assuming you've gotten all the basics commands for NetCat from "day 1", so im not going to explain them.

    NetCat tutorial: Day1


    Here we'll use NetCat to run a Batch file which generates a web page when it's connected to, that

    you can access from the internet. Although their are more efficient ways of doing this with perl or asp, this is meant to show you ways of using NC. you can adapt this to run or do anything on connect like run a .pl file.

    The log file used here is from ZoneAlarm Pro but the batch file used can be altered for the FW

    you're using.

    Write a batch file containing a NC initialization line and put it in your start up folder:

    nc -L -d -p2500 -e c:\inform.bat

    Any time a connection is established to port 1234 (or whatever port you chose) inform.bat will be


    you need to decide what you want to keep an eye on so this can copy those lines to a HTM file so you can view them


    @echo off

    type c:\Preform.txt |more >>c:\inetpub\wwwroot\inform.htm

    type c:\winnt\Interne~1\ZALog.txt |more >>c:\inetpub\wwwroot\inform.htm

    type c:\Postform.txt |more >>c:\inetpub\wwwroot\inform.htm


    The pre and porform text files must exist before this will work or you can just save the output as a txt file without them


    you could keep an eye on only certain things by using:

    find /I "ICMP" c:\winnt\Intern~1\filter.log |more >>c:\inetpub\wwwroot\inform.htm

    instead of:

    type c:\winnt\Interne~1\ZALog.txt |more >>c:\inetpub\wwwroot\inform.htm

    substituting "icmp" with any string from the logfile making a new "find" line for each thing you want to look for









    Before you can view the created Web-page the batch files must run. You can make this happen by

    telneting to port 2500 (telnet xxx.xxx.xxx.xxx 2500).

    Now point your browser to your computer: http:www.yoursite.com/inform.htm

    for testing purposes on your own computer use
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  2. #2
    Senior Member
    Join Date
    Aug 2002
    Another great post Ted...I thought about setting something up like this at work, but I think it got rejected by Director. I thought it would be funny to see who tried connecting and got my "dummy" page. Netcat is a great tool. I look forward to many more tuts from you.

    Opinions are like holes - everybody\'s got\'em.


  3. #3
    Junior Member
    Join Date
    May 2005


    Great tutorials, they are very inciteful, and they showed me a couple things i didn't know about netcat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts