#!/usr/bin/perl -w use strict; my $seculert_qradar_list = "$seculert_dir/seculert.csv"; my $qradar_console = '10.10.1.22'; my $qradar_ssh_key = "$seculert_dir/qr-id_dsa"; my $qradar_ssh_knownhosts = "$seculert_dir/known_hosts"; my $source = 'BAD-IP-Addresses-LABEL'; my $type_description = 'honeypots-for-examnple'; open(FP, ">>$seculert_qradar_list"); for my $line (<FP>) { my ($hostname, $ip, $something1, $something2) = split(/,/, $li +ne); print OUT "$source $type_description $ip #FF0000 0 90 29\n"; } close(FP); print "Sending to QRadar...\n"; # SSH To QRadar's Console and push out file + trigger update `scp -i $qradar_ssh_key -o UserKnownHostsFile=$qradar_ssh_knownhos +ts -o StrictHostKeyChecking=no root\@$qradar_console:/store/configser +vices/staging/globalconfig/remotenet.conf .`; `sed -i -e '/^SECULERT/d' remotenet.conf`; `cat $seculert_qradar_list >> remotenet.conf`; `scp -i $qradar_ssh_key -o UserKnownHostsFile=$qradar_ssh_knownhos +ts -o StrictHostKeyChecking=no remotenet.conf root\@$qradar_console:/ +store/configservices/staging/globalconfig/remotenet.conf`; print "Cleaning up...\n"; # Remove our SECULERT list and the newly pushed out qradar conf unlink($seculert_qradar_list); unlink ('remotenet.conf'); print "Deploying in QRadar...(takes time to complete)\n"; # QRadar magic `ssh -i $qradar_ssh_key -o UserKnownHostsFile=$qradar_ssh_knownhos +ts -o StrictHostKeyChecking=no root\@$qradar_console /opt/qradar/upgr +ade/util/setup/upgrades/do_deploy.pl`; print "Complete!\n\n";
What I'm interested to know and perhaps get some help from perl programmer that using one file handle can I open multiple files e.g In my case I have something like this 1. virus.csv 2. bot.csv 3. malware.csv
Do i need to re-copy for loop code for each csv file with a different handle? The destination file remotenet.conf remains the same.After correct rendering of for e.g one csv file the remotenet.conf on web-ui would look something like Virus 10.10.2.1 ....... Bot 10.10.4.1 ...... It would be great that multiple changes happen in one-go, with just one auto-deploy(see code at end). I hope I'm able to understand the problem. Please let me know if more clarification is required. thanks **UPDATE** Based upon content of csv rendering would change $source and $type_description varies with csv. for e.g malware.csv would have $source ='malware' and $type_description='top 10' and etc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |