1 --- osiris-4.1.8-orig/src/osirisd/modules/mod_nvram/Makefile 1970-01-01 01:00:00.000000000 +0100
2 +++ osiris-4.1.8-1/src/osirisd/modules/mod_nvram/Makefile 2005-04-22 23:11:32.000000000 +0200
10 +module: ${SRCS} ${OBJS}
12 +INCS=-I../.. -I../../../libosiris -I../../../libfileapi -I../../../..
14 +# meta-rule for compiling any "C" source file.
16 + $(CC) $(DEFS) $(DEFAULT_INCLUDES) ${INCLUDES} ${INCS} $(AM_CPPFLAGS) \
17 + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $(SRCS)
20 --- osiris-4.1.8-orig/src/osirisd/modules/mod_nvram/README 1970-01-01 01:00:00.000000000 +0100
21 +++ osiris-4.1.8-1/src/osirisd/modules/mod_nvram/README 2005-04-22 23:11:32.000000000 +0200
25 +Author: Brian Wotring (brian@shmoo.com)
31 +The mod_nvram module reads the key=value pairs stored in nvram. This
32 +is primarily for Linksys routers, but could be modified to run on
33 +other systems if necessary. On the routers like the WRT54G, the
34 +nvram settings hold sensitive information that needs to be monitored.
35 +The format for the record structure is as follows:
41 +To use this module, all that is needed is to include it in the System
42 +block of a scan configuration, e.g.:
53 +There are no parameters for this module.
57 +Currently, only for the Linksys WRT54G and WRT54GS devices.
63 --- osiris-4.1.8-orig/src/osirisd/modules/mod_nvram/mod_nvram.c 1970-01-01 01:00:00.000000000 +0100
64 +++ osiris-4.1.8-1/src/osirisd/modules/mod_nvram/mod_nvram.c 2005-04-22 23:11:32.000000000 +0200
67 +/******************************************************************************
69 +** This program is free software; you can redistribute it and/or
70 +** modify it, however, you cannot sell it.
72 +** This program is distributed in the hope that it will be useful,
73 +** but WITHOUT ANY WARRANTY; without even the implied warranty of
74 +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
76 +** You should have received a copy of the license attached to the
77 +** use of this software. If not, visit www.shmoo.com/osiris for
80 +******************************************************************************/
82 +/*****************************************************************************
85 +** Date: January 1, 2004
87 +** Author: Brian Wotring
88 +** Purpose: platform specific methods for reading user file information.
90 +******************************************************************************/
92 +#include "libosiris.h"
93 +#include "libfileapi.h"
94 +#include "rootpriv.h"
102 +#define NVRAM_PATH "/usr/sbin/nvram"
103 +#define NVRAM_ARG "show"
105 +static const char *MODULE_NAME = "mod_nvram";
108 +void mod_nvram( SCANNER *scanner )
113 + char temp_line[4096];
115 + SCAN_RECORD_TEXT_1 record;
119 + log_error( "mod_nvram: error creating pipe!" );
125 + log_error( "mod_nvram: error creating pipe!" );
129 + /* Create a child to run nvram command. */
131 + switch( pid = fork() )
134 + log_error( "nvram: fork error!" );
146 + execl( NVRAM_PATH, NVRAM_PATH, NVRAM_ARG, NULL );
156 + file = fdopen( cp[0], "r" );
163 + line = fgets( temp_line, sizeof( temp_line ), file );
170 + line = trim_white_space( line );
172 + /* skip commented and empty lines. */
174 + if( ( line == NULL ) || ( line[0] == '#' ) )
179 + /* locate the username, this is the first item in the colon list. */
181 + if( ( key_end = strchr( line, '=' ) ) == NULL )
186 + initialize_scan_record( (SCAN_RECORD *)&record,
187 + SCAN_RECORD_TYPE_TEXT_1 );
189 + osi_strlcpy( record.module_name, MODULE_NAME,
190 + sizeof( record.module_name ) );
192 + /* user the key as a key/path for this record. */
196 + osi_strlcpy( record.name, "nvram:", sizeof( record.name ) );
197 + osi_strlcat( record.name, line, sizeof( record.name ) );
199 + /* now copy in the value into the data portion. */
200 + /* and send this record on its way. */
202 + osi_strlcpy( record.data, key_end, sizeof( record.data ) );
203 + send_scan_data( scanner, (SCAN_RECORD *)&record );