Book Image

Kali Linux 2 - Assuring Security by Penetration Testing - Third Edition

By : Gerard Johansen, Lee Allen, Tedi Heriyanto, Shakeel Ali
Book Image

Kali Linux 2 - Assuring Security by Penetration Testing - Third Edition

By: Gerard Johansen, Lee Allen, Tedi Heriyanto, Shakeel Ali

Overview of this book

Kali Linux is a comprehensive penetration testing platform with advanced tools to identify, detect, and exploit the vulnerabilities uncovered in the target network environment. With Kali Linux, you can apply appropriate testing methodology with defined business objectives and a scheduled test plan, resulting in a successful penetration testing project engagement. Kali Linux – Assuring Security by Penetration Testing is a fully focused, structured book providing guidance on developing practical penetration testing skills by demonstrating cutting-edge hacker tools and techniques with a coherent, step-by-step approach. This book offers you all of the essential lab preparation and testing procedures that reflect real-world attack scenarios from a business perspective, in today's digital age.
Table of Contents (24 chapters)
Kali Linux 2 – Assuring Security by Penetration Testing Third Edition
Credits
Disclaimer
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Network services in Kali Linux


There are several network services available in Kali Linux; in this section, we will describe only some of them: the HTTP, MySQL, and SSH services. You can find the other services by navigating to Kali Linux | System Services.

HTTP

In your penetration testing work, you may want to have a web server for various reasons, such as to serve malicious web application scripts. In Kali Linux, there is already an Apache web server installed; you just need to start the service.

The following are the steps that are required to activate your HTTP server in Kali Linux:

  1. To start the Apache HTTP service, open a command line terminal and type the following command to start the Apache server:

    service apache2 start
    
  2. After this, you can browse to the web page at 127.0.0.1; it will display the It works! page by default:

To stop the Apache HTTP service, perform the following steps:

  1. Open a command line terminal and type the following command to stop the Apache server:

    service apache2 stop
    

    Note

    Remember that the previous command will not survive the boot up. After the boot up, you need to give the command again. Fortunately, there is a way to start the Apache HTTP service automatically after the Kali Linux boots up by giving the following command:

    update-rc.d apache2 defaults

    The command will add the apache2 service to be started on boot up.

MySQL

The second service that we will discuss is MySQL. It is one of the relational database systems. MySQL is often used with the PHP programming language and Apache web server to create a dynamic, web-based application. For the penetration testing process, you can use MySQL to store your penetration testing results; for example, the vulnerability information and network mapping result. Of course, you need to use the application to store those results.

To start the MySQL service in Kali Linux, you can perform the following steps:

  1. In a terminal window, type the following:

    service mysql start
    
  2. To test whether your MySQL has already started, you can use the MySQL client to connect to the server. We define the username (root) and the password to log in to the MySQL server:

    mysql -u root
    

    The system will respond with the following:

    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 39
    Server version: 5.5.44-1 (Debian)
    Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the current input statement.
    mysql>
    
  3. After this MySQL prompt, you can give any SQL commands. To exit from MySQL, just type quit.

Note

By default, for security reasons, the MySQL service in Kali Linux can be accessed only from a local machine. You can change this configuration by editing the bind-address stanza in the MySQL configuration file located in /etc/mysql/my.cnf. We don't recommend that you change this behavior unless you want your MySQL to

To stop the MySQL service, you can perform the following steps:

  1. In a terminal window type the following:

    service mysql stop
    
  2. To start the MySQL service automatically after Kali Linux's boots up, you can give the following command:

    update-rc.d mysql defaults
    

    This command will make the MySQL service start after the boot up.

SSH

For the next service, we will look into the Secure Shell (SSH). SSH can be used to log in to a remote machine securely; apart from that, there are several other usages of SSH, such as securely transferring a file between machines, executing a command in a remote machine, and X11 session forwarding.

To manage your SSH service in Kali Linux, you can perform the following steps:

  1. To start the SSHD service, from the command line, type the following:

    service ssh start
    
  2. To test your SSH, you can log in to the Kali Linux server from another server using a SSH client such as putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/) if you are using the Microsoft Windows operating system.

  3. To stop the SSHD service, from the command line, type the following:

    service ssh stop
    
  4. To start the SSH service automatically after Kali Linux boots up, you can give the following command:

    update-rc.d ssh defaults
    

This command will add the SSH service to be started on boot up.