|
| 1 | +#!/usr/bin/perl |
| 2 | +use strict; |
| 3 | +use warnings; |
| 4 | +use FindBin '$Bin'; |
| 5 | +use File::Copy qw(copy); |
| 6 | +## Copy@right Alisam Technology see License.txt |
| 7 | + |
| 8 | +## USER CONFIGURATION SETTING |
| 9 | +our($config, $userSetting, $script_bac, @AUTH, @c); |
| 10 | +my @res=("proxy", "proxy-random", "show", "payload", "config", "m-random", "b-random", "zone", "timeout", "update", "engine", "nobanner", |
| 11 | + "noinfo", "beep", "ifend", "unique", "all", "config", "exit", "password", "freq", "level", "method", "interactive"); |
| 12 | +my $res1=join("|", @res); |
| 13 | +my $x1="/usr/share/applications/atscan.desktop"; |
| 14 | +my $x2="/usr/share/applications/atscan.desktop.back"; |
| 15 | +our ($deskIcon, @l22, @l22bak); |
| 16 | + |
| 17 | +sub ClientConfiguration { |
| 18 | + print $c[1]."[::] CONFIGURATION\n\n"; |
| 19 | + if (-e $userSetting) { |
| 20 | + print $c[10]; |
| 21 | + print " +---------------+-------------------------------------+--------------------+\n"; |
| 22 | + print " | SHOW | SET | RESET |\n"; |
| 23 | + print " +---------------+-------------------------------------+--------------------+\n"; |
| 24 | + print " | | set interactive on (installed tool) | reset interactive |\n"; |
| 25 | + print " | | set proxy <proxy> | reset proxy |\n"; |
| 26 | + print " | | set proxy-random <proxy> | reset proxy-random |\n"; |
| 27 | + print " | | set engine <option> | reset engine |\n"; |
| 28 | + print " | | set timeout <in s> Default 10 | reset timeout |\n"; |
| 29 | + print " | | set update <in days> Default 10 | reset update |\n"; |
| 30 | + print " | | set password <password> | reset password |\n"; |
| 31 | + print " | | set method <get/post> | reset method |\n"; |
| 32 | + print " | show config | set freq <time in s> | reset freq |\n"; |
| 33 | + print " | | set payload <payload> | reset payload |\n"; |
| 34 | + print " | | set zone <zone> | reset zone |\n"; |
| 35 | + print " | | set level <level> | reset level |\n"; |
| 36 | + print " | | set b-random on | reset b-random |\n"; |
| 37 | + print " | | set m-random on | reset m-random |\n"; |
| 38 | + print " | | set nobanner on | reset nobanner |\n"; |
| 39 | + print " | | set noinfo on | reset noinfo |\n"; |
| 40 | + print " | | set beep on | reset beep |\n"; |
| 41 | + print " | | set ifend on | reset ifend |\n"; |
| 42 | + print " | | set unique on | reset unique |\n"; |
| 43 | + print " | | | reset all |\n"; |
| 44 | + print " +---------------+-------------------------------------+--------------------+\n"; |
| 45 | + print "\n"; |
| 46 | + |
| 47 | + my $ps; |
| 48 | + my $finish = 0; |
| 49 | + while(!$finish) { |
| 50 | + my (@confReset, @confSet, @confShown)=(); |
| 51 | + print $c[10]." [!] $AUTH[16]: "; |
| 52 | + $ps=<STDIN>; |
| 53 | + chomp ($ps); |
| 54 | + my @askMes=split(" ", $ps); |
| 55 | + my $xa=scalar(grep { defined $_} @askMes); |
| 56 | + if (($ps!~/$res1/) || (($ps=~/^set\s(.*)/ && $xa!=3) || ($ps=~/^(reset|show)\s(.*)/ && $xa!=2))) { |
| 57 | + print $c[4]." [!] $AUTH[14]\n"; |
| 58 | + } |
| 59 | + #################################################################################################### |
| 60 | + if ($ps eq "exit") { |
| 61 | + $finish++; |
| 62 | + }elsif ($ps=~/^set\s(.*)/) { |
| 63 | + my @askMes=split(" ", $ps); |
| 64 | + my $a=$askMes[1]; |
| 65 | + my $b=$askMes[2]; |
| 66 | + $b=~s/^'(.*)'$/$1/; |
| 67 | + $b=~s/^"(.*)"$/$1/; |
| 68 | + @confSet=get_configuration(); |
| 69 | + for my $configuration(@confSet) { |
| 70 | + if ($configuration=~/$a\s(.*)/) { |
| 71 | + deletSetting($a); |
| 72 | + } |
| 73 | + } |
| 74 | + ################## |
| 75 | + if ($a eq "interactive") { |
| 76 | + if (-e $x1) { |
| 77 | + copy $x1, $x2; |
| 78 | + unlink $x1; |
| 79 | + open(F23, $x2); |
| 80 | + @l22=<F23>; |
| 81 | + close(F23); |
| 82 | + open(F24, '>>', $x1); |
| 83 | + for my $l22(@l22) { |
| 84 | + $l22=~s/\"atscan\;/\"atscan --interactive\;/ig; |
| 85 | + print F24 "$l22\n"; |
| 86 | + } |
| 87 | + close(F24); |
| 88 | + print $c[3]." [i] $a is Active!\n"; |
| 89 | + } |
| 90 | + } |
| 91 | + ################## |
| 92 | + if ($a eq "config") { |
| 93 | + if ($b eq "on") { |
| 94 | + printFile($userSetting, "config on config\n"); |
| 95 | + print $c[3]." [i] Configuration is on! \n"; |
| 96 | + }elsif ($b eq "off") { |
| 97 | + deletSetting("config"); |
| 98 | + print $c[3]." [i] Configuration is off! \n"; |
| 99 | + } |
| 100 | + ################## |
| 101 | + }elsif ($a eq "password") { |
| 102 | + $b=Digest::MD5->md5_hex($b); |
| 103 | + printFile($userSetting, "password $b password\n"); |
| 104 | + print $c[3]." [i] Password was set!\n"; |
| 105 | + }else{ |
| 106 | + if (-e $b) { |
| 107 | + open(F, $b); |
| 108 | + while (my $st=<F>) { |
| 109 | + unlink "$Bin/inc/conf/user/$a.txt" if -e "$Bin/inc/conf/user/$a.txt"; |
| 110 | + printFile("$Bin/inc/conf/user/$a.txt", "$st\n"); |
| 111 | + } |
| 112 | + close(F); |
| 113 | + printFile($userSetting, "$a $Bin/inc/conf/user/$a.txt $a"); |
| 114 | + print $c[3]." [i] $a => $Bin/inc/conf/user/$a.txt \n"; |
| 115 | + }else{ |
| 116 | + printFile($userSetting, "$a $b $a"); |
| 117 | + print $c[3]." [i] $a => $a \n"; |
| 118 | + } |
| 119 | + } |
| 120 | + #################################################################################################### |
| 121 | + }elsif ($ps=~/^reset\s(.*)/) { |
| 122 | + my @printConf2=split(" ", $ps); |
| 123 | + @confReset=get_configuration(); |
| 124 | + if ($printConf2[1] eq "all") { |
| 125 | + for my $y(@res) { |
| 126 | + system "rm $Bin/inc/conf/user/$y.txt" if -e "$Bin/inc/conf/user/$y.txt"; |
| 127 | + } |
| 128 | + unlink $userSetting; |
| 129 | + open FH, ">", $userSetting; |
| 130 | + for my $ln(@confReset) { |
| 131 | + if ($ln=~/^##/) { |
| 132 | + print FH "$ln"; |
| 133 | + } |
| 134 | + } |
| 135 | + close FH; |
| 136 | + print $c[3]." [i] All configuration was reset! \n"; |
| 137 | + }else{ |
| 138 | + my $userfile="$Bin/inc/conf/user/$printConf2[1].txt"; |
| 139 | + unlink $userfile if -e $userfile; |
| 140 | + deletSetting($printConf2[1]); |
| 141 | + |
| 142 | + if ($printConf2[1] eq "interactive") { |
| 143 | + if (-e $x2 && -e $x1) { |
| 144 | + unlink $x1; |
| 145 | + copy $x2, $x1; |
| 146 | + unlink $x2; |
| 147 | + } |
| 148 | + } |
| 149 | + print $c[3]." [i] $printConf2[1] was reset!\n"; |
| 150 | + } |
| 151 | + #################################################################################################### |
| 152 | + }elsif ($ps=~/^show\sconfig/) { |
| 153 | + @confShown=get_configuration(); |
| 154 | + my $a1=0; |
| 155 | + print $c[10]." +"."-" x 75 ."\n"; |
| 156 | + print $c[10]." | $c[11]OPTION $c[10] | $c[11]VALUE\n"; |
| 157 | + print $c[10]." +"."-" x 75 ."\n"; |
| 158 | + for my $lines2(@confShown) { |
| 159 | + if ($lines2!~/(##|config)/) { |
| 160 | + $a1++; |
| 161 | + my @printConf3=split(" ", $lines2) if (!($lines2=~/^$/)); |
| 162 | + my $length=length($printConf3[0]); |
| 163 | + my $addlength = 25 - $length; |
| 164 | + my $fname="$Bin/inc/conf/user/$printConf3[0].txt"; |
| 165 | + if (-e $fname) { |
| 166 | + open(F4, $fname); |
| 167 | + while (my $st=<F4>) { |
| 168 | + print $c[10]." | $c[5]$printConf3[0]"; |
| 169 | + print " " x $addlength; |
| 170 | + print $c[10]."| $st" if (!($st=~/^$/)); |
| 171 | + } |
| 172 | + close(F4); |
| 173 | + }else{ |
| 174 | + if ($printConf3[0] eq "password") { |
| 175 | + print $c[10]." | $c[5]$printConf3[0]"; |
| 176 | + print " " x $addlength; |
| 177 | + print $c[10]."|********\n"; |
| 178 | + }else{ |
| 179 | + print $c[10]." | $c[5]$printConf3[0]"; |
| 180 | + print " " x $addlength; |
| 181 | + print $c[10]."| $printConf3[1]\n"; |
| 182 | + } |
| 183 | + } |
| 184 | + } |
| 185 | + } |
| 186 | + print $c[10]." | $c[4]$AUTH[11]\n" if $a1<1; |
| 187 | + print $c[10]." +"."-" x 75 ."\n\n"; |
| 188 | + @confShown=(); |
| 189 | + } |
| 190 | + (@confReset, @confSet, @confShown)=(); |
| 191 | + } |
| 192 | + }else{ |
| 193 | + print $c[2]." [!] $AUTH[15]\n"; logoff(); |
| 194 | + } |
| 195 | +} |
| 196 | +#################################################################################################### |
| 197 | + |
| 198 | +1; |
0 commit comments