-3
#!/usr/bin/perl

use Term::ANSIColor;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request;
use HTTP::Request::Common qw(POST);
$ua = LWP::UserAgent->new(keep_alive => 1);
$ua->agent("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)");
$ua->timeout (10);

print "scan\n";
$site="http://aubergelasolas.com\n";

$sorm = $ua->get($site);
$karza = $sorm->content;
while($karza =~m/\/wp-content\/plugins\/(.*?)\/(.*?)' type='text\/css' media='all'/g)
{ 
$id=$1;
print "[*] Plugins: $id \n";

}

if run scrip font this rzlt i need to delete or hide duplication

perl k.pl
scan
[*] Plugins: google-language-translator
[*] Plugins: jetpack
[*] Plugins: our-team-enhanced
[*] Plugins: wc-gallery
[*] Plugins: wc-gallery
[*] Plugins: wc-gallery
[*] Plugins: wc-gallery
[*] Plugins: wc-gallery
[*] Plugins: tablepress

i need to remove only duplicate lines i need to delete or hide duplication and thnx

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • 1
    Stackoverflow is no code writing service. It makes no sense to show the code which generates the problem you are trying to solve. Instead you should show what you've tried to solve the problem, i.e.to detect a duplicate line. See for example https://stackoverflow.com/questions/5884401/perl-find-duplicate-lines-in-file-or-array or just search for [perl find duplicate line](https://www.google.com/search?q=perl+find+duplicate+lines) for hints. – Steffen Ullrich May 14 '17 at 10:06

1 Answers1

0
my %seen; # Hash for counting number of occurrences
while($karza =~m/\/wp-content\/plugins\/(.*?)\/(.*?)' type='text\/css' media='all'/g)
{ 
  $id=$1;
  next if $seen{$id}++; # skip already seen ids
  print "[*] Plugins: $id \n";
}
AnFi
  • 10,493
  • 3
  • 23
  • 47