Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #All Copyrights reserved by gh0st and BlackBuntu community 2012.
- #Program has been written by gh0st for BlackBuntu users only !!
- #Eventualy program will run on other OS's such as BackTrack or Pentoo.
- #License: GNU GPL
- use warnings;
- use strict;
- use Data::Dumper;
- use Term::ANSIColor;
- use Gtk2;
- use IO::Handle;
- use constant TRUE => 1;
- use constant FALSE => 0;
- use constant WEEK => 9;
- use constant TWODAYS => 8;
- use constant DEFAULT => 7;
- my $program_name = "cobra-installer";
- my $clear = 'clear';
- my @pen_dirs = ('backdoors', 'database', 'forensics', 'passwords', 'scanners', 'tunneling', 'windows-binaries', 'bluetooth', 'enumeration', 'fuzzer', 're', 'sniffers', 'voip', 'wireless', 'cisco', 'exploits', 'misc', 'rfid', 'spoofing', 'web');
- my $pentest_dir = '/pentest/';
- my $rand_dir;
- my @perl_dir = ('/usr/lib/perl5/','/usr/lib/perl5/Gtk2/');
- my @check = `ls`;
- my $check;
- my $option;
- #-----------------------------------------------------------------------
- #-----------------------Important Parameters----------------------------
- #-----------------------------------------------------------------------
- my $auto_update;
- my $update_time;
- my $reboot;
- my $launch;
- #-----------------------------------------------------------------------
- #-----------------------------------------------------------------------
- my $sl = 'sleep 1.5';
- my $content;
- my $copyright_header = q {-----------*COPYRIGHTS*-----------};
- my $copyright = q {
- Do not attempt to install this product
- on software which was not created
- for pentration purpose, failure to
- comply those agrements will result
- in messing your computer up.
- };
- my $cobra = q {
- __
- ---_ ...... _/_ -
- / . ./ .'*\ \
- : ' /__-' \.
- / )
- _/ > .'
- / . . _.-" / .'
- \ __/" /.'/|
- \ '-- .-" / //' |\|
- \| \ | / //_ _ |/|
- `. \: //|_ _ _|\|
- | \/. // | _ _ |/|
- \_ | \/ / \ _ _ \\\
- \__/ \ _ _ \|\
- };
- system($clear);
- #-----------------------------------------------------------------------
- #This bit needs to be trashed after completing gtk 2 step
- #&popout;
- #exit;
- #&installation;
- # call to popout was created for debug purpose
- #-----------------------------------------------------------------------
- my $login = (getpwuid $>);
- die "Please run this application as root" if $login ne 'root';
- sub install {
- system ('sleep 7');
- system ($clear);
- print color 'bold black';
- print "First let's check your distro ... \n \n";
- print "Checking pentest dir avaiblity";
- system($sl);
- opendir(IMD, $pentest_dir) or die ("Error1: The pentest folder do not exist, aborting ...");
- print colored (' [done]'."\n" => 'bold green');
- print color 'bold black';
- print "Selecting random folder";
- system($sl);
- my $rand_dir = int(rand(20)) or die ("Error2: Cannot randomize folders, aborting ...");
- print colored (' [done]'."\n" => 'bold green');
- print color 'bold black';
- print "Accesing chosen folder";
- system($sl);
- opendir(IMD, $pentest_dir.$pen_dirs[$rand_dir]) or die ("Error3: Folder not found, aborting ...");
- print colored (' [done]'."\n" => 'bold green');
- print color 'bold black';
- print 'Alright, you have got a pentest distro, lets continue ...'."\n \n";
- system ('sleep 5');
- print 'Initializing Gtk2 Api for Perl 5 detection system ...'."\n";
- system($sl);
- print 'Checkig for Perl 5 enviroment';
- system($sl);
- opendir(IMD, $perl_dir[0]) or die ("Error 4: Missing perl 5 folder, aborting ...");
- print colored (' [done]'."\n" => 'bold green');
- print color 'bold black';
- print 'Searching for Gtk2 libraries';
- system($sl);
- opendir(IMD, $perl_dir[1] || &installation);
- print colored (' [done]'."\n" => 'bold green');
- system($sl);
- system($sl);
- system($clear);
- print color 'reset';
- &popout;
- #If want to use that one below just change $perl_dir value into 0 above :D
- #U may ask why have a done this fancy piece of code below.
- #Well, I didn't know that 'or' operator can be used in this situation yeah i know fail ...
- #foreach(@check) {
- # $check = @check;
- # if ($check =~ m/^.G?(g)tk2.$/) {
- # print ' [done]'."\n";
- # print 'Aye, Aye we can move on into installtion i guess';
- # &popout;
- # } else {
- # print ' [failure]'."\n";
- # system($clear);
- # print 'Switching to Gtk2 installation module, please wait'."\n";
- # system('sleep 3');
- # &installation;
- # }
- #}
- }
- sub welcome {
- if ($_[0] == '1') {
- system($clear);
- print color 'bold green';
- print 'Hey, thanks for installing me but before we start i need to check'."\n";
- print 'Have you really got Blackbuntu or other pentesting distro, so lets go ...'."\n";
- print color 'reset';
- }
- if ($_[0] == '2') {
- system ($clear);
- system ($sl);
- print color 'bold green';
- print "Program $program_name was created specially for BlackBuntu linux community, by gh0st.\n";
- print "Just to keep tools, patches etc. up to date \n";
- print "For more info please visit blackbuntu.com or gh0st-community.webuda.com. \n";
- print color 'reset';
- }
- if ($_[0] == '3') {
- print color 'bold green on_black';
- print $cobra;
- print color 'reset';
- print color 'bold black on_cyan';
- print "Hello and welcome in $program_name . \n";
- print "What would you like to do now ? \n";
- print color 'reset'."\n";
- print colored ('[1]' => 'bold green on_black').colored ('Install program on my hard drive'."\n" => 'bold cyan on_black');
- print colored ('[2]' => 'bold green on_black').colored ('See the credits, and something about us'."\n" => 'bold cyan on_black');
- print colored ('[3]' => 'bold green on_black').colored ('Just go out '."\n" => 'bold cyan on_black');
- print color 'bold cyan';
- print "Pick a corresponding number to a choosen option \n";
- print "And insert it, here --> ";
- }
- }
- sub popout {
- # This Function needs to be rewritten soon after installer release and inserted
- #into loop
- sub delete_event
- {
- my $window = shift;
- Gtk2->main_quit;
- print Dumper (@_);
- return TRUE;
- }
- sub save_options {
- no warnings;
- my @settings;
- for (my @settings=undef; @settings=($_[0], $_[1]); @settings==($_[0], $_[1])) {
- print;
- }
- return TRUE;
- use warnings "all";
- }
- Gtk2->init || die ('Error 5:'."$!");
- # Declaring important variables
- my $window = Gtk2::Window->new('toplevel');
- my $box = Gtk2::VBox->new (FALSE, 0); # Change Vbox with H to get it horizantally
- my $label = Gtk2::Label->new ($copyright_header.$cobra.$copyright);
- my $table = Gtk2::Table->new (1, 2, TRUE);
- my $button1 = Gtk2::Button->new ('Agree');
- my $button = Gtk2::Button->new ('Disagree');
- #$box = Gtk2::Pack::add($table);
- #-------------------------------------------------------------------
- #calling functions for already declared variables
- $window->set_title ('BlackBuntu Cobra Update Installer Terms and Agreements ...');
- $window->set_border_width(20);
- $window->set_resizable(TRUE);
- $box->pack_start($label, TRUE, TRUE, 0);
- $box->pack_start($table, TRUE, TRUE, 0);
- #Gtk2::Box::pack_start(box, child, expand, fill, padding)
- $window->signal_connect (destroy => \&delete_event);
- $button->signal_connect (clicked => \&delete_event);
- $button1->signal_connect (clicked => sub {$window->destroy; &pw2;});
- $table->attach_defaults($button, FALSE, TRUE, FALSE, TRUE);
- $table->attach_defaults($button1, TRUE, 2, FALSE, TRUE);
- #GTK2 main quit above needs to be replaced with call to function what
- #leads to proper installer
- #Cancel button needs to be added
- #-------------------------------------------------------------------
- #Putting shit together and start displaying it
- $window->add($box);
- $box->show;
- $label->show;
- $button->show;
- $button1->show;
- $table->show;
- $window->show_all;
- Gtk2->main;
- #-------------------------------------------------------------------
- #-------------------------------------------------------------------
- # The xpm_label_box() function could be used to pack
- # images and labels into any widget that can be a container.
- #The Gtk2::Button widget has the following signals:
- #pressed - emitted when pointer button is pressed within Gtk2::Button widget
- #released - emitted when pointer button is released within Gtk2::Button widget
- #clicked - emitted when pointer button is pressed and then released within Gtk2::Button widget
- #enter - emitted when pointer enters Gtk2::Button widget
- #leave - emitted when pointer leaves Gtk2::Button widget
- #http://gtk2-perl.sourceforge.net/doc/gtk2-perl-tut/ch-ButtonWidget.html
- sub pw2 {
- #killing window above needs more attetnion
- #Gtk2->init || die ('Error 5:'."$!");
- #Gtk2::Widget->destroy;
- &delete_event;
- my $window = Gtk2::Window->new('toplevel');
- my $box = Gtk2::VBox->new(FALSE, 0);
- my $content = "Program $program_name will now attempt to install \n itself on your hard drive. \n If you have got any concerns about it please contact \n us on our offcial website \n And for more info please make sure that you checked \n out our documentation \n";
- my $label = Gtk2::Label->new($cobra.$content);
- my $table = Gtk2::Table->new(1, 2, TRUE);
- my $button = Gtk2::Button->new('Cancel');
- my $button1 = Gtk2::Button->new('Install');
- my $label1 = 'Would you like to update this program automaticly';
- my $checkbutton = Gtk2::CheckButton->new_with_label($label1);
- my $radiob1 = Gtk2::RadioButton->new (undef, "Every Login ".q{[recomended]});
- my $radiob2 = Gtk2::RadioButton->new_with_label($radiob1->get_group, "Every 2 days");
- my $radiob3 = Gtk2::RadioButton->new_with_label_from_widget($radiob2, "Every week");
- my $ad = q{How often would you like receive our updates ?}."\n";
- my $additional_note = Gtk2::Label->new($ad);
- my $separator = Gtk2::HSeparator->new;
- #---------------------------------------------------------------
- #Calling and placing functions up
- #---------------------------------------------------------------
- $window->set_title('Install preparation');
- $window->set_border_width(20);
- $window->set_resizable(TRUE);
- #Gtk2::Box::pack_start(box, child, expand, fill, padding)
- $box->pack_start($label, 1, 1, 0);
- $box->pack_start($checkbutton, 1, 1, 0);
- $box->pack_start($separator, FALSE, TRUE, 0);
- $box->pack_start($additional_note, 1, 1, 0);
- $box->pack_start($radiob1, 1, 1, 0);
- $box->pack_start($radiob2, 1, 1, 0);
- $box->pack_start($radiob3, 1, 1, 0);
- $box->pack_start($table, 1, 1, 0);
- $window->signal_connect(destroy => \&delete_event);
- $button->signal_connect(clicked => \&delete_event);
- $button1->signal_connect(clicked => sub {$window->destroy; >k_install;});
- $checkbutton->signal_connect(clicked => sub {
- $auto_update = TRUE
- });
- $radiob1->signal_connect(clicked => sub { $update_time = DEFAULT;});
- $radiob2->signal_connect(clicked => sub { $update_time = TWODAYS;});
- $radiob3->signal_connect(clicked => sub { $update_time = WEEK;});
- #$radiob1->set_active(TRUE);
- Gtk2::ToggleButton::set_active($radiob3, TRUE);
- Gtk2::ToggleButton::set_active($radiob2, TRUE);
- Gtk2::ToggleButton::set_active($radiob1, TRUE);
- $radiob1->can_default(TRUE);
- $radiob1->grab_default;
- $table->attach_defaults($button, FALSE, TRUE, FALSE, TRUE);
- $table->attach_defaults($button1, TRUE, 2, FALSE, TRUE);
- #---------------------------------------------------------------
- #Adding funtions together and displaying them
- #---------------------------------------------------------------
- $window->add($box);
- $box->show;
- $label->show;
- $checkbutton->show;
- $additional_note->show;
- $radiob1->show;
- $radiob2->show;
- $radiob3->show;
- $button->show;
- $button1->show;
- $table->show;
- $window->show_all;
- Gtk2->main;
- #---------------------------------------------------------------
- #End of window
- #---------------------------------------------------------------
- return FALSE;
- sub gtk_install {
- sub destroy_progress {
- my $window = shift;
- Gtk2->main_quit;
- }
- #Glib::Source->remove($window);
- my $checklabel = "Would you like to restart your computer afterwards ?";
- my $checklabel1 = "Would you like to launch this program after this reboot";
- my $window = Gtk2::Window->new('toplevel');
- my $box = Gtk2::VBox->new(FALSE, 0);
- my $label = Gtk2::Label->new($cobra);
- my $table = Gtk2::Table->new(1, 2, TRUE);
- my $button = Gtk2::Button->new("Cancel");
- my $button1 = Gtk2::Button->new("Finish");
- my $separator = Gtk2::HSeparator->new;
- my $checkbox = Gtk2::CheckButton->new_with_label($checklabel);
- my $checkbox1 = Gtk2::CheckButton->new_with_label($checklabel1);
- my $progressbar = Gtk2::ProgressBar->new;
- #-----------------------------------------------------------
- # Listing operations while installing
- # 1.) Opening /etc/init.d
- # 2.) Dumping Payload to directory
- # 3.) Opening /usr/bin/
- # 4.) Putting payload into current directory
- # 5.) Passing parameters to programs
- #-----------------------------------------------------------
- $progressbar->set_text("installing $program_name");
- #Gtk2::ProgressBar->set_orientation($progressbar, 'GTK_PROGRESS_RIGHT_TO_LEFT');
- $window->set_title('Installing ...');
- $window->set_border_width(20);
- $window->set_resizable(TRUE);
- #Gtk2::Box::pack_start(box, child, expand, fill, padding)
- $box->pack_start($label, 1, 1, 0);
- $box->pack_start($separator, FALSE, TRUE, 0);
- $box->pack_start($progressbar, 1, 1, 0);
- $box->pack_start($checkbox, 1, 1, 0);
- $box->pack_start($checkbox1, 1, 1, 0);
- $box->pack_start($table, 1, 1, 0);
- $window->signal_connect(destroy => \&delete_event);
- $button->signal_connect(clicked => \&destroy_progress);
- $button1->signal_connect(clicked => \&destroy_progress);
- $checkbox->signal_connect(clicked => sub {$reboot=TRUE;});
- $checkbox1->signal_connect(clicked => sub {$launch=TRUE;});
- $table->attach_defaults($button, FALSE, TRUE, FALSE, TRUE);
- $table->attach_defaults($button1, TRUE, 2, FALSE, TRUE);
- #-----------------------------------------------------------
- $window->add($box);
- $box->show;
- $label->show;
- $progressbar->show;
- $checkbox->show;
- $checkbox->show;
- $button->show;
- $button1->show;
- $table->show;
- $window->show_all;
- &installer;
- sub installer {
- #-----------------------------------------------------------
- #----------------------Install methods----------------------
- #-----------------------------------------------------------
- my $rv;
- my $pin = 'Cobra-init.pl';
- my $pn = 'Cobra-update.pl';
- # Variables and code below needs optimazing
- my $payload = '#!/usr/bin/perl';
- my @inst_exec = ('cd /etc/init.d', 'touch '.$pin.' && echo "'.$payload.'" > '.$pin, 'cd /usr/bin/', 'touch '.$pn.' && echo "'.$payload.'" > '.$pn);
- my $new_val;
- foreach (@inst_exec) {
- system $_;
- $rv = FALSE;
- $new_val = $progressbar->get_fraction() + 0.20;
- $progressbar->set_fraction($new_val);
- $rv = TRUE;
- die "Cannot proceed any further" if $rv eq FALSE;
- }
- $new_val = $progressbar->get_fraction() + 0.20;
- $progressbar->set_fraction($new_val);
- }
- }
- }
- Gtk2->main;
- #-------------------------------------------------------------------
- #Program never really should get there
- return FALSE;
- 0;
- }
- sub installation {
- my @gtk2_down = 'http://sourceforge.net/projects/gtk2-perl/files/Gtk2/1.224/Gtk2-1.224.tar.gz';
- my @wget = 'wget --accept=*.tar.gz --quiet '.@gtk2_down;
- #See hak5 here 10x08.2 for more quick way od downloading and extracting files
- my @commands = ('tar -zxvf Gtk2-*.tar.gz && cd Gtk2-1.224','perl Makefile.pl' =>'make' =>'make test' =>'make install');
- my @removing = ('cd ../', 'rm Gtk2*.tar.gz', 'rm -r -f Gtk2-1.224*');
- print 'Error 6: No Gtk2 libraries, launching installation module'."\n";
- system($sl);
- system ($clear);
- print color 'bold cyan';
- print "The installation of gtk module will start in sec .... \n";
- print "In order to continue install insert y and press enter if not press n \n";
- print colored ("*Warning* \n" => 'bold red on_black');
- print color 'bold red';
- print "Other letters than y will cancel installation process, anyway :D \n";
- print "Just don't worry mate i'll take care of every step from now on \n";
- print "Enjoy, and make sure that yours internet connection is on \n";
- print color 'reset';
- system($clear);
- foreach(@wget) {
- system ($clear);
- print colored ('Downloading Gtk2 libraries ...' => 'bold green on_black');
- system ($sl);
- system ($_);
- print colored (' [done]' => 'bold green on_black');
- print "\n";
- # Checking if will be here
- }
- foreach (@commands, @removing) {
- system ($clear);
- print colored ('Installing Gtk2 libraries ...' => 'bold green on_black');
- system ($sl);
- system ($_);
- #checking if will be add later
- }
- print colored (' [done]' => 'bold green on_black');
- print "\n";
- #Continuing code
- }
- sub opstart {
- if ($_[0] == 1) {
- &welcome(1);
- &install;
- }
- if ($_[0] == 2) {
- &welcome(2);
- exit;
- }
- if ($_[0] == 3) {
- return FALSE;
- exit;
- } elsif ($_[0] != 1..3) {
- system($clear);
- system('sleep 3');
- print "Are you sure you didn't mispelled something ? \n";
- return FALSE;
- 0;
- }
- }
- sub trash {
- my $variable;
- $variable=$_[0];
- while ($variable==undef) {
- # Shouldn't go any further than one pass
- $variable=shift;
- }
- }
- sub payload {
- #Here destination of payload can be specified
- #And Here the payload can programed
- #But as you can see nothing is currently linked to it YET
- #So what's the point of keeping that function you may ask
- #So the point of it is pretty obvious
- #Symbolic meaning just to point out that there is
- #Something like that available.
- }
- &welcome('3');
- print color 'bold green on_black';
- chomp ($option = <STDIN>);
- print color 'reset';
- &opstart($option);
- __END__
Advertisement
Add Comment
Please, Sign In to add comment