From: max@underg.UUCP (Max Cray)
Newsgroups: alt.security
Subject: Re: Modem detection software
Keywords: Security, dial, modem
Date: Sun, 13 Sep 92 02:52:47 EDT
Organization: Underground Computing Foundation

Ron Beach <sandy@halcyon.com> writes:

> Does anyone know of an available PC or Mac based software package
> that will automatically out-dial a predefined range of telephone
> numbers, detect modem carrier tone, record hits and any dialog
> issuing from the receiving modem? I know, I know. This request
> will probably put me on the security watch list- but it is
> real business security need.

For PC from Digital Free Press #1:

--

/*
    scanner.c
    by GodNet Raider
    
        It is assumed that the serial port and modem have already been setup.
        Com 1 & 2 only supported.
*/

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define FALSE 0
#define TRUE 1
#define DTR_ON(x) outp(anBCom[x]+4,0x03)
#define DTR_OFF(x) outp(anBCom[x]+4,0x00)
#define CTS(x) inp(anBCom[nPort]+5)&0x0020
#define DATA_READY(x) inp(anBCom[x]+5)&0x0001

char
    *aszError [] =
        {
         "\nUsage: SCANNER <Port #> <PreFix> <Start #> <Count>\n"
         "\tPort #  - Serial port number to use.\n"
         "\tPreFix  - Static part of phone number(ie. 1-800-555-, 846-, etc..).
\n"
         "\tStart # - last 4 digits of phone number (ie. 1212, 0065, etc..).\n"

         "\tCount   - Number of instances (single stepped) to scan.\n",
         "\nNumbers are out of range.",
         "\nModem error."
        },
    *aszTarget [] = 
        {
         "connect",
         "busy"
        };

unsigned int
    anBCom [] = 
        {
         0x3f8,
         0x2f8
        };

unsigned int
    Call (unsigned char, char*),
    receive_chr (unsigned long, unsigned char),
    send_chr (unsigned char, unsigned char);

void
    FatalError (int),
    main (int, char**),
    Wait (unsigned long);

void main (argc, argv)
int
    argc;
char
    *argv [];

{
    char
        szWork [128];
    unsigned char
        nPort;
    unsigned int
        nPrsNum,
        nEndNum;
    
    if (argc < 5)
        FatalError (1);
    nPort = (unsigned char) atoi (argv [1]) - 1;
    nEndNum = (nPrsNum = atoi (argv [3])) + atoi (argv [4]);
    if (nPrsNum > 9999 || nEndNum > 9999 || nEndNum <= nPrsNum || nPort > 1)
        FatalError (2);
    while (nPrsNum != nEndNum)
        {
         printf ("%s%04i : ", argv [2], nPrsNum);
         sprintf (szWork, "ATX4Q0V1DT%s%04i\r", argv [2], nPrsNum++);
         printf ("%sCarrier Found\n", (Call (nPort, szWork) ? "" : "No "));
        }
    exit (0);
}

unsigned int Call (nPort, ptDialStr)
unsigned char
    nPort;
char
    *ptDialStr;
{
    unsigned long
        nWait;
    unsigned int
        nTmpCnt,
        nResChr,
        nRetCode = FALSE;
    char
        fCont = TRUE,
        szWork [256] = "",
        *ptWork;

    DTR_ON (nPort);
    Wait (5);
    while (*ptDialStr)
        if (send_chr (*ptDialStr, nPort))
            ptDialStr++;
        else
            if (!(receive_chr (1l, nPort) & 0xff00))
                {
                 outp (anBCom [nPort] + 4, 0x00);
                 FatalError (3);
                }
    ptWork = szWork;
    nWait = time (NULL) + 30;
    while (time (NULL) < nWait && fCont)
        {
         if ((nResChr = receive_chr (1l, nPort)) & 0xff00)
            {
             *(ptWork++) = (char) tolower (nResChr & 0x00ff);
             *ptWork = 0x00;
             for (nTmpCnt = 2; nTmpCnt && fCont; nTmpCnt--)
                if (strstr (szWork, aszTarget [nTmpCnt - 1]))
                    {
                     if (--nTmpCnt)
                        printf ("[%s] ", aszTarget [nTmpCnt]);
                     nRetCode = !nTmpCnt;
                     fCont = FALSE;
                    }
            }
        }
    DTR_OFF (nPort);
    Wait (5);
    return nRetCode;
}

unsigned int send_chr (cCh, nPort)
unsigned char
    cCh,
    nPort;

{
    if (CTS (nPort))
        {
         outp (anBCom [nPort], (int) cCh);
         return TRUE;
        }
    return FALSE;
}

unsigned int receive_chr (nWait, nPort)
unsigned long
    nWait;
unsigned char
    nPort;
{
    nWait += time (NULL);
    while (time (NULL) < nWait)
        if (DATA_READY (nPort))
            return ((inp (anBCom [nPort]) & 0x00ff) + 0x0100);
    return FALSE;
}

void Wait (nWait)
unsigned long
    nWait;
{
    nWait += time (NULL);
    while (time (NULL) < nWait);
}

void FatalError (nErrorNum)
int
    nErrorNum;
{
    printf (aszError [nErrorNum - 1]);
    exit (nErrorNum);
}

--


                                          -= Max =-
...!uunet!underg!max
...!cactus.org!underg!max
Xref: sparky alt.security.pgp:1 comp.sys.next.misc:19622