[Sguil-cvs] sguil/server/lib SguildClientCmdRcvd.tcl,1.11,1.12 SguildLoaderd.tcl,1.14,1.15
Status: Beta
Brought to you by:
bamm
From: Bamm V. <ba...@us...> - 2005-05-19 16:28:05
|
Update of /cvsroot/sguil/sguil/server/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25331/lib Modified Files: SguildClientCmdRcvd.tcl SguildLoaderd.tcl Log Message: Unbroke the nessus file loading. Index: SguildClientCmdRcvd.tcl =================================================================== RCS file: /cvsroot/sguil/sguil/server/lib/SguildClientCmdRcvd.tcl,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SguildClientCmdRcvd.tcl 10 Mar 2005 15:47:10 -0000 1.11 --- SguildClientCmdRcvd.tcl 19 May 2005 16:27:56 -0000 1.12 *************** *** 371,375 **** proc LoadNessusReports { socketID filename table bytes} { ! global TMPDATADIR DBHOST DBPORT DBNAME DBUSER DBPASS loaderWritePipe userIDArray InfoMessage "Recieving nessus file $filename." set NESSUS_OUTFILE $TMPDATADIR/$filename --- 371,375 ---- proc LoadNessusReports { socketID filename table bytes} { ! global TMPDATADIR loaderWritePipe userIDArray InfoMessage "Recieving nessus file $filename." set NESSUS_OUTFILE $TMPDATADIR/$filename *************** *** 395,422 **** file copy -force $NESSUS_OUTFILE2 $NESSUS_OUTFILE ! if {$DBPASS != "" } { ! set cmd "mysql --local-infile -D $DBNAME -h $DBHOST -P $DBPORT -u $DBUSER --password=$DBPASS\ ! -e \"LOAD DATA LOCAL INFILE '$NESSUS_OUTFILE' INTO TABLE nessus FIELDS TERMINATED\ ! BY '|' LINES TERMINATED BY '||' STARTING BY '||'\"" ! } else { ! set cmd "mysql --local-infile -D $DBNAME -h $DBHOST -P $DBPORT -u $DBUSER\ ! -e \"LOAD DATA LOCAL INFILE '$NESSUS_OUTFILE' INTO TABLE nessus FIELDS TERMINATED\ ! BY '|' LINES TERMINATED BY '||' STARTING BY '||'\"" ! } } else { ! if {$DBPASS != "" } { ! set cmd "mysql --local-infile -D $DBNAME -h $DBHOST -P $DBPORT -u $DBUSER --password=$DBPASS\ ! -e \"LOAD DATA LOCAL INFILE '$NESSUS_OUTFILE' INTO TABLE nessus_data FIELDS TERMINATED\ ! BY '|' LINES TERMINATED BY '||'STARTING BY '||' \"" ! } else { ! set cmd "mysql --local-infile -D $DBNAME -h $DBHOST -P $DBPORT -u $DBUSER\ ! -e \"LOAD DATA LOCAL INFILE '$NESSUS_OUTFILE' INTO TABLE nessus_data FIELDS TERMINATED\ ! BY '|' LINES TERMINATED BY '||' STARTING BY '||'\"" ! } } # The loader child proc does the LOAD for us. ! puts $loaderWritePipe [list $NESSUS_OUTFILE $cmd] flush $loaderWritePipe puts $socketID "InfoMessage Nessus Data sent to loader. Check server debug for any loading errors." } --- 395,410 ---- file copy -force $NESSUS_OUTFILE2 $NESSUS_OUTFILE ! set cmd "LOAD DATA LOCAL INFILE '$NESSUS_OUTFILE' INTO TABLE nessus FIELDS TERMINATED\ ! BY '|' LINES TERMINATED BY '||' STARTING BY '||'" } else { ! set cmd "LOAD DATA LOCAL INFILE '$NESSUS_OUTFILE' INTO TABLE nessus_data FIELDS TERMINATED\ ! BY '|' LINES TERMINATED BY '||'STARTING BY '||'" } + # The loader child proc does the LOAD for us. ! puts $loaderWritePipe [list LoadNessusData $NESSUS_OUTFILE $cmd] flush $loaderWritePipe puts $socketID "InfoMessage Nessus Data sent to loader. Check server debug for any loading errors." + } Index: SguildLoaderd.tcl =================================================================== RCS file: /cvsroot/sguil/sguil/server/lib/SguildLoaderd.tcl,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SguildLoaderd.tcl 20 Apr 2005 13:38:58 -0000 1.14 --- SguildLoaderd.tcl 19 May 2005 16:27:56 -0000 1.15 *************** *** 36,39 **** --- 36,40 ---- LoadSsnFile { LoadSsnFile [lindex $data 1] [lindex $data 2] } LoadSancpFile { LoadSancpFile [lindex $data 1] [lindex $data 2] [lindex $data 3] } + LoadNessusData { LoadNessusData [lindex $data 1] [lindex $data 2] } default { LogMessage "Unknown command recieved from sguild: $cmd" } *************** *** 165,169 **** } } else { ! # Make sure its a MERGE table and not the old monser set tableStatus [mysqlsel $LOADERD_DB_ID {SHOW TABLE STATUS LIKE 'sancp'} -flatlist] if { [lindex $tableStatus 1] != "MRG_MyISAM" } { --- 166,170 ---- } } else { ! # Make sure its a MERGE table and not the old monster set tableStatus [mysqlsel $LOADERD_DB_ID {SHOW TABLE STATUS LIKE 'sancp'} -flatlist] if { [lindex $tableStatus 1] != "MRG_MyISAM" } { *************** *** 197,200 **** --- 198,218 ---- } + proc LoadNessusData { fileName loadCmd } { + + global LOADERD_DB_ID + + if [catch {mysqlexec $LOADERD_DB_ID $loadCmd} execResults] { + ErrorMessage "ERROR: loaderd: $execResults" + } + + # Delete the tmpfile + if [catch {file delete $fileName} tmpError] { + ErrorMessage "ERROR: loaderd: $tmpError" + } + + InfoMessage "loaderd: Loaded $fileName into the table $table." + + } + proc LoadSsnFile { filename date } { |