Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- ##########################################################################################
- # Coded by B47CHGURU on 24-07-2011 For Kishan Bhai..!! #
- # Updated on 11-08-2011 #
- #if any bugs are found ...plz do inform me at [email protected] #
- #----------------------------------------------------------------------------------------#
- #To all script kiddies..... changing the "made by" headers wont make you the coder...!! #
- #Respect the coderz..!!! #
- ##########################################################################################
- print ("#######################################################\n");
- print (" Welcome to B47CH GURU's Text Adder or Replacer!\n");
- print ("########################################################\n\n");
- print " Do you want to remove blank lines in the process? (y/n)";
- my $remline=<STDIN>;
- chomp($remline);
- if ($remline =~ /y/){
- $linerem = 'y';
- } else {
- $linerem = 'n';
- }
- print " Do you want to add or replace\(a or r\)";
- my $option=<STDIN>;
- chomp($option);
- if ($option =~ /a/){
- adding();
- }
- if ($option =~ /r/){
- replace();
- }
- sub adding{
- print ' The path to your source file eg: list.txt> ';
- $list =<STDIN>;
- chomp($list);
- print " The path to the processed file> ";
- $loged =<STDIN>;
- chomp($loged);
- print " where you want to add, beginning or last \( b or l\)> ";
- $insert =<STDIN>;
- chomp($insert);
- print " the phrase you want to add> ";
- $adder =<STDIN>;
- chomp($adder);
- open FILE, "+>$loged" or die $!;
- open (SOURCE, "<$list") || die "[-] Can't open the list !";
- @PASSWORDS = <SOURCE>;
- close SOURCE;
- loop: foreach $P(@PASSWORDS) {
- chomp($P);
- $P = trim($P);
- if ($linerem =~ /y/){
- if ($P =~ m/^$/){
- next loop;
- }
- }
- if ($insert =~ /b/){
- $P = $adder . $P;
- print FILE "$P\n";
- print ("$P \n");
- }
- if ($insert =~ /l/){
- $P = $P . $adder;
- print FILE "$P\n";
- print ("$P \n");
- }
- }
- close FILE;
- }
- sub replace{
- print ' The path to your source file eg: list.txt> ';
- $list =<STDIN>;
- chomp($list);
- print " The path to the processed file> ";
- $loged =<STDIN>;
- chomp($loged);
- print " The phrase you want to find> ";
- $find =<STDIN>;
- chomp($find);
- print " The phrase to be replaced with the found> ";
- $replace =<STDIN>;
- chomp($replace);
- open FILE, "+>$loged" or die $!;
- open (SOURCE, "<$list") || die "[-] Can't open the list !";
- @PASSWORDS = <SOURCE>;
- close SOURCE;
- loop2: foreach $P(@PASSWORDS) {
- chomp($P);
- $P = trim($P);
- if ($linerem =~ /y/){
- if ($P =~ m/^$/){
- next loop2;
- }
- }
- if ($P =~ m/$find/sim) {
- $P =~ s/$find/$replace/g;
- print FILE "$P\n";
- print ("$P \n");
- } else {
- print FILE "$P\n";
- print ("$P \n");
- next loop2;
- }
- }
- close FILE;
- }
- sub trim{
- $string = shift;
- $string =~ s/^\s+//;
- $string =~ s/\s+$//;
- return $string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement