0byt3m1n1
Path:
/
data
/
16
/
.snapshot
/
daily.2025-03-10_0010
/
inventory
/
ARCHIVE
/
[
Home
]
File: plcgi_scan.pl
#!/usr/local/bin/perl $file = $ARGV[0]; chomp($file); $filesection = $file; open LIST, "<${file}"; #@FILES = <LIST>; #close LIST; $file =~ s/-PLCGI\.txt//; @FILEPARTS = (split /\// ,$file); $file = pop(@FILEPARTS); open PLBAD, ">/data/16/inventory/done/HTScan/${file}-PLBAD.txt"; open PLSTAT, ">/data/16/inventory/done/HTScan/${file}-PLSTAT.txt"; #open SUSPECT, ">/data/16/inventory/done/HTScan/${file}-SUSPECT.txt"; while (<LIST>) { #1 #foreach(@FILES) { #1 $plcgifile = $_; chomp($plcgifile); $plcgi_cnt = 0; $suspect = "TRUE"; #open PLCGIFILE, "<${htfile}"; @PLCGI_FILE = `strings \"$plcgifile\"` if (-e $plcgifile); #close PLCGIFILE; $test = "MD5.pm"; $plcgi_lines = @PLCGI_FILE; $N = 0; $plcgi_cnt = scalar(grep /$test/, @PLCGI_FILE); print PLBAD "$plcgifile\n" if ($plcgi_cnt >= 1); $suspect = "NOTFALSE" if ($plcgi_cnt >= 1); while(($suspect eq 'FALSE') && ($N <= ($plcgi_lines - 3))) { #2 foreach(@PLCGI_FILE) { #3 $check_line = $_; chomp($check_line); $M = ($N + 3); $V = ($N + 10); while(($M <= $V) && ($suspect eq 'FALSE') && ($M <= $plcgi_lines)) { #4 $suspect = "TRUE" if (($PLCGI_FILE[$N] =~ /^\#([0-9a-zA-Z]){20,35}/) && ($PLCGI_FILE[$M] =~ /^\#([0-9a-zA-Z]){20,35}/)); $M++; } #4 $N++; } #3 } #2 #print SUSPECT "$plcgifile\n" if ($suspect eq 'TRUE'); print PLSTAT "Finished $plcgifile\n"; } #1 print PLSTAT "All done...\n"; close PLSTAT; close PLBAD; #close SUSPECT;