> Does anyone know or have a small password routine written in C for Unix
> that could be bolted onto a front of a system.
Elliot this might be the code you're looking for. It was written by
Hobbit, a fellow respected hacker.
Hope this helps
Emmanuel
Here comes dpass.c :
/* Obscurity layer: a "password" for incoming connections. Use any
algorithm you want to generate the password. The example given here
doubles the current day-of-month and adds to a base constant.
Don't rely on this alone, of course. Back it up with something strong
like an s/keyed login. This just confuses casual cruisers so they
don't
see your login prompt right away.
If TELNET is defined, do the turn-off-echo telnet options; otherwise,
issue a phoney "220" prompt to coerce the client into proceeding.
Your
FTP client might get slightly out of sync; deal.
This'll be running as root, so read before you build.
_H*/
/* Preferably define all these at compile time, depending on your system
*/
#ifndef _PATH_DAEMON
#define _PATH_DAEMON "/usr/sbin/in.telnetd" /* linux telnetd*/
#endif
#ifndef PASS
#define PASS 2600 /* snuk snuk */
#endif
#include <syslog.h>
#include <stdio.h>
#include <time.h>
main()
{
unsigned char buf [42];
static char prog[] = _PATH_DAEMON;
unsigned char * bufp;
unsigned int o_day = 0;
unsigned int o_hour = 0;
struct tm * now;
time_t tnow;
char *strrchr();
#ifdef TELNET
/* Tells client telnet to NOT do local echo */
static char prod[] = { 255, 251, 1}; /* IAC WILL ECHO */
write (0, prod, 3);
#else
/* looks like a generic server thingie */
static char prod[] = "220\r\n";
write (0, prod, 5);
#endif /* TELNET */
time (&tnow);
now = localtime(&tnow);
o_day = now->tm_mday;
if (fgets (buf, 40, stdin) > 0) {
bufp = buf;
while ((*bufp != '\0') && (!isdigit (*bufp & 0x7F)))
bufp++;
/* put your algorithm here */
if (atoi (bufp) != PASS + (o_day * 2)) {
syslog (LOG_AUTH|LOG_ERR, "refused \"%s\"", buf);
sleep (20);
exit (0);
}
bufp = strrchr (prog, '/');
execl (prog, bufp ? bufp : prog, 0);
exit (0);
} /* fgets */
Quote:}