This is comment for paste
ADMIN FINDER
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i see what youre doing here, its alright..though it should be cleaned up/refactored i think this is a bit more clear:
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature 'say';
- use LWP::UserAgent;
- use HTTP::Request;
- # --- Configuration ---
- # All results save to one consistent file.
- my $output_file = 'found_admin_panels.txt';
- # A single, case-insensitive regex for matching keywords. Much cleaner!
- my $login_keywords_regex = qr/user|login|password|clave|senha|usager|admin|sign in/i;
- # A single, master list of paths to check. No more repetition.
- my @base_paths = (
- 'admin/', 'administrator/', 'admin1/', 'admin2/', 'admin3/', 'admin4/', 'admin5/',
- 'moderator/', 'webadmin/', 'adminarea/', 'bb-admin/', 'adminLogin/', 'admin_area/',
- 'panel-administracion/', 'instadmin/', 'memberadmin/', 'administratorlogin/', 'adm/',
- 'admin/account', 'admin/index', 'admin/login', 'admin/admin', 'admin_area/admin',
- 'admin_area/login', 'admin_area/index', 'bb-admin/index', 'bb-admin/login',
- 'bb-admin/admin', 'admin/home', 'admin/controlpanel', 'admin/cp', 'cp',
- 'administrator/index', 'administrator/login', 'administrator/account', 'login',
- 'modelsearch/login', 'moderator', 'moderator/login', 'moderator/admin',
- 'account', 'controlpanel', 'admincontrol', 'admin_login', 'panel-administracion/login',
- 'adminLogin', 'admin/adminLogin', 'home', 'adminarea/index', 'adminarea/admin',
- 'adminarea/login', 'panel-administracion/index', 'panel-administracion/admin',
- 'modelsearch/index', 'modelsearch/admin', 'admincontrol/login', 'adm/index',
- 'adm/admloginuser', 'admin2', 'admin2/login', 'admin2/index', 'siteadmin/login',
- 'siteadmin/index', 'wp-login', 'wp-admin/'
- );
- # Map user's choice to a file extension. Easy to add more later.
- my %tech_map = (
- '1' => ['php'],
- '2' => ['asp'],
- '3' => ['aspx'],
- '4' => ['cfm'],
- '5' => ['js'],
- '6' => ['cgi'],
- '7' => ['brf'],
- '8' => ['php', 'html', 'htm', 'asp'] # "Intense" scans for multiple types
- );
- # --- End Configuration ---
- # --- Main Program ---
- # Get user input
- print "Enter Target (e.g., www.example.com): ";
- my $site = <STDIN>;
- chomp $site;
- print "Save Results? (y/n): ";
- my $save_choice = <STDIN>;
- chomp $save_choice;
- print "Target source:\n [1] php [2] asp [3] aspx [4] cfm [5] js [6] cgi [7] brf [8] Intense\n: ";
- my $code = <STDIN>;
- chomp $code;
- # Validate user's choice for technology
- unless (exists $tech_map{$code}) {
- die("Invalid selection. Exiting.");
- }
- # Normalize the URL
- $site = 'http://' . $site if $site !~ /^http:/;
- $site = $site . '/' if $site !~ /\/$/;
- say "\n-> Target: $site";
- say "-> Searching for admin panel...";
- # Generate the final list of URLs to test
- my @urls_to_scan;
- foreach my $ext (@{$tech_map{$code}}) {
- foreach my $path (@base_paths) {
- # Don't add an extension if the path already ends in one or is a directory
- if ($path =~ /\/$/ || $path =~ /\./) {
- push @urls_to_scan, $site . $path;
- } else {
- push @urls_to_scan, $site . $path . '.' . $ext;
- }
- }
- }
- # Remove duplicate URLs that might have been generated
- my %seen;
- @urls_to_scan = grep { !$seen{$_}++ } @urls_to_scan;
- # Create a UserAgent object
- my $ua = LWP::UserAgent->new;
- $ua->timeout(10); # Set a reasonable timeout
- $ua->agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");
- # Loop through and scan each URL
- foreach my $url (@urls_to_scan) {
- my $request = HTTP::Request->new(GET => $url);
- my $response = $ua->request($request);
- # Check the response
- if ($response->is_success && $response->decoded_content =~ $login_keywords_regex) {
- say "[+] Found -> $url";
- if ($save_choice eq 'y') {
- save_result($url);
- }
- } else {
- print "[-] Not Found <- $url\n";
- }
- }
- say "\nScan complete.";
- # --- End Main Program ---
- # --- Subroutines ---
- sub save_result {
- my ($found_url) = @_;
- # Use modern, 3-argument open with a lexical filehandle. Safer!
- open(my $fh, '>>', $output_file) or warn "Could not open file '$output_file': $!";
- say $fh $found_url;
- close $fh;
- print " (Result saved to $output_file)\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment