Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Kali Linux Network Scanning Cookbook

You're reading from   Kali Linux Network Scanning Cookbook A Step-by-Step Guide leveraging Custom Scripts and Integrated Tools in Kali Linux

Arrow left icon
Product type Paperback
Published in May 2017
Publisher
ISBN-13 9781787287907
Length 634 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Michael Hixon Michael Hixon
Author Profile Icon Michael Hixon
Michael Hixon
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started FREE CHAPTER 2. Reconnaissance 3. Discovery 4. Port Scanning 5. Fingerprinting 6. Vulnerability Scanning 7. Denial of Service 8. Working with Burp Suite 9. Web Application Scanning 10. Attacking the Browser with BeEF 11. Working with Sparta 12. Automating Kali Tools

Using text editors (Vim and GNU nano)

Text editors will be frequently used to create or modify existing files in the filesystem. You should use a text editor anytime you want to create a custom script in Kali. You should also use a text editor anytime you want to modify a configuration file or existing penetration testing tool.

Getting ready

There are no additional steps that must be taken prior to using the text editor tools in Kali Linux. Both Vim and GNU nano are integrated tools and come preinstalled on the operating system.

How to do it...

Working with Linux editors:

  1. To create a file using the Vim text editor in Kali, use the vim command followed by the name of the file to be created or modified:

In the example provided, the vim command is used to create a file named vim_demo.txt. Since no file currently exists in the active directory by that name, Vim automatically creates a new file and opens an empty text editor.

  1. To start entering text into the editor, press the I key or the Insert button. Then, start entering the desired text, as follows:

In the example provided, only a single line was added to the text file. However, in most cases, you will most likely use multiple lines when creating a new file.

  1. Once finished, press the Esc key to exit insert mode and enter command mode in Vim. Then, type :wq and press the Enter key to save. You can then verify that the file exists and verify its contents using the following bash commands:

The ls command can be used to view the contents of the current directory. Here, you can see that the vim_demo.txt file was created. The cat command can be used to read and display the contents of the file.

  1. An alternative text editor that can also be used is GNU nano. The basic usage of GNU nano is very similar to Vim. To get started, use the nano command, followed by the name of the file to be created or modified:

In the example provided, the nano command is used to open a file called nano_demo.txt. Since no file currently exists with that name, a new file is created.

  1. Unlike Vim, there is no separate command and writing mode. Instead, writing to the file can be done automatically, and commands are executed by pressing the Ctrl button in conjunction with a particular letter key. A list of these commands can be seen at the bottom of the text editor interface at all times:

In the example provided, a single line was written to the nano_demo.txt file. To close the editor, you can use Ctrl + X. You will then be prompted to either save the file with y or not save it with n. You will be asked to confirm the filename to be written to. By default, this will be populated with the name that was provided when the nano command was executed. However, this value can be changed and the contents of the file saved to a different filename, as follows:

  1. Once you're done, the ls and cat commands can be used again to verify that the file was written to the directory and to verify the contents of the file, respectively.

The intention of this recipe was to discuss the basic use of each of these editors to write and manipulate files. However, it is important to note that these are both very robust text editors that have a large number of other capabilities for file editing. For more information on the usage of either, access the man pages with the man command followed by the name of the specific text editor.

How it works...

Text editors are nothing more than command-line-driven word-processing tools. Each of these tools and all of their associated functions can be executed without the use of any graphical interface. Without any graphical component, these tools require very little overhead and are extremely fast. As such, they are highly effective for quickly modifying files or handling them over a remote Terminal interface, such as SSH or Telnet.

You have been reading a chapter from
Kali Linux Network Scanning Cookbook - Second Edition
Published in: May 2017
Publisher:
ISBN-13: 9781787287907
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image