CAPE-Utils

 view release on metacpan or  search on metacpan

src_bin/suricata_extract_submit  view on Meta::CPAN

			. $file_json->{proto} . '-'
			. $extUID . '-'
			. $slug . '-'
			. $t->epoch . '-'
			. $mime;

		# only add it if it is not white listed
		if ($add_it) {
			log_something( 'info', 'Name: ' . $name );

			# skip uploading it if it is zero sized
			if ( $data_size > 0 ) {

				# don't need to copy it if it is zero sized
				copy( $data_file, $name )
					or die 'Copy failed(' . $data_file . ' -> ' . $tempdir . '/' . $name . '): ' . $!;

				$file_json->{suricata_extract_submit} = {
					filename => $name,
					apikey   => $apikey,
					host     => hostname,

src_bin/suricata_extract_submit  view on Meta::CPAN

						log_something( 'info', 'Uplodated Response Status: ' . $res->status_line );
					} else {
						$new_stats->{sub_fail}++;
						my $error = "Failed to post... " . $res->status_line;
						push( @{ $new_stats->{last_errors} }, $error );
						die($error);
					}
				} ## end else [ if ($sub_error) ]
			} else {
				$new_stats->{zero_sized}++;
				log_something( 'info', 'Not uploading as the sample is zero sized' );
			}
		} ## end if ($add_it)

		# rename the JSON file so we don't process it again
		move( $file, $file . '-processed' ) or die 'Appending "-processed" to the name of the JSON file...' . $!;
		if ($@) {
			my $error = 'Failed to rename ' . $file . ' ... ' . $@;
			$new_stats->{errors}++;
			push( @{ $new_stats->{last_errors} }, $error );
			log_something( 'err', $error );



( run in 2.333 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )