Linux tools and configurations for a development machine with Debian Server 8 for hacking and pentesting
Views
Make sure you have the source of the first DVD inserted in your server then book Debian 8 and get to the command prompt/terminal.
Install VMware Tools in a command:
apt-get install open-vm-tools
Press ENTER to each question to validate the default choice.
Check Vmware tools with a command:
vmware-toolbox-cmd -v
Install the essential tools:
Make sure you have the source of the first DVD inserted in your server then
Install the tools with the following commands:
apt-get install build-essential
apt-get install xinetd
apt-get install nmap snmp
apt-get install ntpdate
ntpdate europe.pool.ntp.org
Depending on your connection, it is possible that the NTP port is not allowed
(Wifi)
Install console access
Install SSH server, authorize root login and start the service with the following
command:
apt-get install ssh
vi /etc/ssh/sshd_config
add :
PermitRootLogin Yes
service ssh start
You can now log in on your console server with PUTTY
Verify the DNS resolution
Try typing nslookup google.com and then you have to get an ip address
Retype the IP address you need to get names
If it’s doesn’t work edit the etc/resolv.conf in order to have the correct Dns Ip like
that :
search labs.intra
nameserver 208.67.220.220
nameserver 8.8.8.8
Stop your server! Remove the .iso file, so that VMware Workstation does not boot into it, find vmdk and vmx file and copy it into a backup location. When you have finish, you can restart your server, open a terminal into root account.
Installation of webserver:
Mysql
Install the common library for databases :
apt-get install dbconfig-common
Start a install command :
apt-get install mysql-server mysql-common libmysqlclient-dev mysql-client
Choose a root mysql password (we choose MysqlPassword)
Verify your Mysql by :
mysql –V
Verify your Mysql password by :
mysql –u root -p
Php
We launch the installation by :
aptitude install php5 libapache2-mod-php5 php5-mysql
We create a sample page to confirm that it’s work :
touch /var/www/html/phpinfo.php
echo “<?php phpinfo(); ?>” >> /var/www/html/phpinfo.php
Verify by open a browser onto : http://localhost/phpinfo.php.
We install the complementary module :
aptitude install php5-curl php5-gd php5-intl php-pear php5-imagick php5-
imap php5-mcrypt php5-ps
aptitude install php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc
php5-xsl
And we install the php cache page : PHP APC to accelerate the making of php page :
aptitude install php-apc
phpmyadmin
Install it by :
aptitude install phpmyadmin
choose Yes.
Confirm your MysqlPassword!
Follow the prompts!
Use Apache instead of lighttpd!
Try to open http://localhost/phpmyadmin/ :
(here we use root and MysqlPassword)
For improve performance go to phpmyadmin directory
cd /usr/share/phpmyadmin
create config.inc.php
cp config.sample.inc.php config.inc.php
modify locahost by 127.0.0.1 into the file :
Ruby
Install Ruby on rail :
aptitude install ruby2.1 ruby-dev libruby rubygems
verify your version by : ruby -v
Python
Install and verify Python version :
apt-get install python-pip
apt-cache policy python python3
python -V
Ddclient
Install and verify Dynamic Dns with ddclient package
apt-get install ddclient
Valid all questions by just pressing enter key (we vill configure with the CONF file)
vi /etc/ddclient.conf
OVH CONFIG FILE EXAMPLE:
# Configuration file for ddclient
mail=root # mail all msgs to root
mail-failure=root # mail failed update msgs to root
pid=/var/run/ddclient.pid # record PID in file.
cache=/tmp/ddclient.cache # Cache file
daemon=600 # check every 600 seconds
syslog=yes # log update msgs to syslog
## via our CheckIP server
use=web, web=checkip.dyndns.com, web-skip=‘IP Address’
## Enter your Ovh DynHost username and password here
login=your-login # your Ovh DynHost username
password=your-password # your Ovh DynHost password
## This section requires no changes unless you need to set a default proxy server
protocol=dyndns2 # default protocol
server=www.ovh.com # default server
## Dynamic DNS hosts go here
your.domaine.com
Conclusion
That it ! : You have a powerfull Debian Template that you can use now to make open source webserver !!!
You must modify somes file like :
/etc/network/interfaces for the configuration of network :
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.200
netmask 255.255.255.0
gateway 192.168.2.2
/etc/hosts for FQDN (here my machine name are debian) :
127.0.0.1 localhost
192.168.2.200 debian.labs.intra debian
/etc/resolv.conf contain dns ip address :
search labs.intra
nameserver 208.67.220.220
nameserver 8.8.8.8
nameserver 208.67.222.222
nameserver 8.8.4.4
/etc/hostname (contain hotname of your server) :
debian
Change root Mysql password :
Stop service
/etc/init.d/mysql stop
Go on safe mysql
mysqld_safe —skip-grant-tables &
open mysql
mysql -u root
Change Mysql password like this :
mysql> use mysql;
mysql> update user set password=PASSWORD(”MysqlPassword”) where
user=’root’;
mysql> flush privileges;
mysql> quit
stop MySQL service
/etc/init.d/mysql stop
And restart it :
/etc/init.d/mysql start
Python Script Test
python.php
<?php
$dir = dirname(__FILE__);
$result = exec(“/usr/bin/python “. $dir . “/python.py”);
print_r( $result);
?>
python.py
#!/usr/bin/env python
import sys
print(“Your Python version is %s.%s.%s” % sys.version_info[:3])
Make sure you have the source of the first DVD inserted in your server then book Debian 8 and get to the command prompt/terminal.
Install VMware Tools in a command:
apt-get install open-vm-tools
Press ENTER to each question to validate the default choice.
Check Vmware tools with a command:
vmware-toolbox-cmd -v
Install the essential tools:
Make sure you have the source of the first DVD inserted in your server then
Install the tools with the following commands:
apt-get install build-essential
apt-get install xinetd
apt-get install nmap snmp
apt-get install ntpdate
ntpdate europe.pool.ntp.org
Depending on your connection, it is possible that the NTP port is not allowed
(Wifi)
Install console access
Install SSH server, authorize root login and start the service with the following
command:
apt-get install ssh
vi /etc/ssh/sshd_config
add :
PermitRootLogin Yes
service ssh start
You can now log in on your console server with PUTTY
Verify the DNS resolution
Try typing nslookup google.com and then you have to get an ip address
Retype the IP address you need to get names
If it’s doesn’t work edit the etc/resolv.conf in order to have the correct Dns Ip like
that :
search labs.intra
nameserver 208.67.220.220
nameserver 8.8.8.8
Stop your server! Remove the .iso file, so that VMware Workstation does not boot into it, find vmdk and vmx file and copy it into a backup location. When you have finish, you can restart your server, open a terminal into root account.
Installation of webserver:
Mysql
Install the common library for databases :
apt-get install dbconfig-common
Start a install command :
apt-get install mysql-server mysql-common libmysqlclient-dev mysql-client
Choose a root mysql password (we choose MysqlPassword)
Verify your Mysql by :
mysql –V
Verify your Mysql password by :
mysql –u root -p
Php
We launch the installation by :
aptitude install php5 libapache2-mod-php5 php5-mysql
We create a sample page to confirm that it’s work :
touch /var/www/html/phpinfo.php
echo “<?php phpinfo(); ?>” >> /var/www/html/phpinfo.php
Verify by open a browser onto : http://localhost/phpinfo.php.
We install the complementary module :
aptitude install php5-curl php5-gd php5-intl php-pear php5-imagick php5-
imap php5-mcrypt php5-ps
aptitude install php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc
php5-xsl
And we install the php cache page : PHP APC to accelerate the making of php page :
aptitude install php-apc
phpmyadmin
Install it by :
aptitude install phpmyadmin
choose Yes.
Confirm your MysqlPassword!
Follow the prompts!
Use Apache instead of lighttpd!
Try to open http://localhost/phpmyadmin/ :
(here we use root and MysqlPassword)
For improve performance go to phpmyadmin directory
cd /usr/share/phpmyadmin
create config.inc.php
cp config.sample.inc.php config.inc.php
modify locahost by 127.0.0.1 into the file :
Ruby
Install Ruby on rail :
aptitude install ruby2.1 ruby-dev libruby rubygems
verify your version by : ruby -v
Python
Install and verify Python version :
apt-get install python-pip
apt-cache policy python python3
python -V
Ddclient
Install and verify Dynamic Dns with ddclient package
apt-get install ddclient
Valid all questions by just pressing enter key (we vill configure with the CONF file)
vi /etc/ddclient.conf
OVH CONFIG FILE EXAMPLE:
# Configuration file for ddclient
mail=root # mail all msgs to root
mail-failure=root # mail failed update msgs to root
pid=/var/run/ddclient.pid # record PID in file.
cache=/tmp/ddclient.cache # Cache file
daemon=600 # check every 600 seconds
syslog=yes # log update msgs to syslog
## via our CheckIP server
use=web, web=checkip.dyndns.com, web-skip=‘IP Address’
## Enter your Ovh DynHost username and password here
login=your-login # your Ovh DynHost username
password=your-password # your Ovh DynHost password
## This section requires no changes unless you need to set a default proxy server
protocol=dyndns2 # default protocol
server=www.ovh.com # default server
## Dynamic DNS hosts go here
your.domaine.com
Conclusion
That it ! : You have a powerfull Debian Template that you can use now to make open source webserver !!!
You must modify somes file like :
/etc/network/interfaces for the configuration of network :
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.200
netmask 255.255.255.0
gateway 192.168.2.2
/etc/hosts for FQDN (here my machine name are debian) :
127.0.0.1 localhost
192.168.2.200 debian.labs.intra debian
/etc/resolv.conf contain dns ip address :
search labs.intra
nameserver 208.67.220.220
nameserver 8.8.8.8
nameserver 208.67.222.222
nameserver 8.8.4.4
/etc/hostname (contain hotname of your server) :
debian
Change root Mysql password :
Stop service
/etc/init.d/mysql stop
Go on safe mysql
mysqld_safe —skip-grant-tables &
open mysql
mysql -u root
Change Mysql password like this :
mysql> use mysql;
mysql> update user set password=PASSWORD(”MysqlPassword”) where
user=’root’;
mysql> flush privileges;
mysql> quit
stop MySQL service
/etc/init.d/mysql stop
And restart it :
/etc/init.d/mysql start
Python Script Test
python.php
<?php
$dir = dirname(__FILE__);
$result = exec(“/usr/bin/python “. $dir . “/python.py”);
print_r( $result);
?>
python.py
#!/usr/bin/env python
import sys
print(“Your Python version is %s.%s.%s” % sys.version_info[:3])