J'apprends pentesting . Je ne veux pas installer BackTrack comme système d'exploitation principal. Au lieu de cela, j'aimerais installer les outils pertinents sur mon système Ubuntu 12.04. D'après ce que j'ai compris, il est possible d'installer ce logiciel sur Ubuntu, mais je ne sais pas comment. Comment puis-je faire ceci?
L’installation du logiciel Backtrack sur Ubuntu n’est pas recommandée, car cela pourrait brouiller ou casser le gestionnaire de paquets. Toutefois, si vous souhaitez le faire, ouvrez le terminal et procédez comme suit:
Sudo bash
echo deb http://repo.offensive-security.com/dist/bt4 binary/ >> /etc/apt/sources.list
wget http://repo.offensive-security.com/dist/bt4/binary/public-key && Sudo apt-key add public-key && Sudo aptitude update
for i in $(cat backtrack.txt); do Sudo apt-get -y install $i; done
Maintenant, copiez le texte suivant dans Gedit et enregistrez-le dans votre répertoire personnel sous le nom bt_menu_update.pl
:
#!/usr/bin/Perl
#
##
# Written by Mick Grove
# http://micksmix.wordpress.com
#
# [v0.1] 11/20/2009
##
#
# BSD Licensed
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of the nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
use strict;
use warnings;
use Tie::File;
my $dir = "/usr/local/share/applications";
my $section = "Desktop Entry";
my $in_section;
my @files;
opendir(BIN, $dir) or die "Can't open $dir: $!";
while (defined(my $file = readdir BIN))
{
next if $file =~ /^\.\.?$/; # skip . and ..
if ($file =~ m/.*\.desktop$/i)
{
Push(@files, $file);
}
}
closedir(BIN);
foreach my $curfile (@files)
{
open(FH, " chomp(my @fileparts = );
close(FH);
my $termval = TerminalStatus(\@fileparts);
next if $termval == 0; # skip if this is not a terminal application
#lets see if this is actually a BT program
my $btprogram = IsBTProgram(\@fileparts);
next if $btprogram == 0; # skip if this is not a BT application
my $ExecKey = "Exec";
my $TerminalKey = "Terminal";
my @tiedfile;
#open this file for editing
tie @tiedfile, 'Tie::File', "$dir/$curfile" or die "$!";
#read file line by line here
# updating "Exec" line
foreach my $fline (@tiedfile)
{
next if $fline =~ /^#/; # skip comments
next if $fline =~ /^\s*$/; # skip empty lines
if ($fline =~ /^\[$section\]$/)
{
$in_section = 1;
next;
}
if ($fline =~ /^\[/)
{
$in_section = 0;
next;
}
my $oldline;
my $updatedline;
if ($in_section and $fline =~ /^$ExecKey\s*=\s*(.*)$/)
{
# this means we have the "Exec key"
$oldline = $1;
next if $oldline =~ m/^.*xterm -e.*;bash.*$/i; #skip
$oldline =~ s/"/\\"/img;
$updatedline = "Exec=xterm -e \"$oldline;bash\"";
$fline = $updatedline;
print "New exec: " . $fline . "\n";
next;
}
elsif ($in_section and $fline =~ /^$TerminalKey\s*=\s*(.*)$/)
{
# this means we have the "Terminal key"
# we will set it to "0" to turn it off --- we are launching
# xterm ourselves, if we set to 1, we'll get an extra
# terminal opened
#
$oldline = $1;
$updatedline = "Terminal=0";
$fline = $updatedline;
next;
}
}
untie @tiedfile;
}
print "\n\nAll menu entries have been updated\n";
###
### Subroutines ###
###
sub TerminalStatus
{
my @lines = @{$_[0]};
my $TerminalKey = "Terminal";
my $ExecKey = "Exec";
my $termkeyval = 0; #default = 0 FALSE, 1= TRUE
my $i = 0;
my $execkeyval = 0; #default = 0 = this exec line probably wasn't set by us
foreach my $fline (@lines)
{
next if $fline =~ /^#/; # skip comments
next if $fline =~ /^\s*$/; # skip empty lines
if ($fline =~ /^\[$section\]$/)
{
$in_section = 1;
next;
}
if ($fline =~ /^\[/)
{
$in_section = 0;
next;
}
if ($in_section and $fline =~ /^$TerminalKey\s*=\s*(.*)$/)
{
# this means we have the "terminal key"
$termkeyval = $1;
next; #last;
}
if ($in_section and $fline =~ /^$ExecKey\s*=\s*(.*)$/)
{
# this means we have the "exec key"
$execkeyval = $1;
if ($execkeyval =~ m/^.*xterm -e.*;bash.*$/i)
{
$execkeyval = 1; # this script likely set this value before
}
next; #last;
}
}
if ($execkeyval eq 1)
{
# force this to true, because this can be updated by this script,
# b/c we appear to have modified this entry before.
$termkeyval = 1;
}
return $termkeyval;
}
<a name="IsBTProgram-"></a>sub IsBTProgram
{
my @lines = @{$_[0]};
my $key = "Categories";
my $isbtprog = 0; #default = FALSE = 0
my $i = 0;
foreach my $fline (@lines) {
next if $fline =~ /^#/; # skip comments
next if $fline =~ /^\s*$/; # skip empty lines
if ($fline =~ /^\[$section\]$/) {
$in_section = 1;
next;
}
if ($fline =~ /^\[/) {
$in_section = 0;
next;
}
if ($in_section and $fline =~ /^$key\s*=\s*(.*)$/)
{
# this means we have the "terminal key"
if ($1 =~ m/.*BT-.*/i)
{
$isbtprog = 1;
}
last;
}
}
return $isbtprog;
}
et dans le terminal, lancez:
cd ~/
mkdir menu_backup
Sudo cp /usr/local/share/applications/* ~/menu_backup
suivi de Perl ./bt_menu_update.pl
. Déconnectez-vous et reconnectez-vous, et profitez-en.
Source: http://micksmix.wordpress.com/2009/10/28/install-backtrack-4-tools-in-ubuntu/