Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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 Over 90 hands-on recipes explaining how to leverage custom scripts, and integrated tools in Kali Linux to effectively master network scanning

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher
ISBN-13 9781783982141
Length 452 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Justin Hutchens Justin Hutchens
Author Profile Icon Justin Hutchens
Justin Hutchens
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Getting Started FREE CHAPTER 2. Discovery Scanning 3. Port Scanning 4. Fingerprinting 5. Vulnerability Scanning 6. Denial of Service 7. Web Application Scanning 8. Automating Kali Tools Index

Using text editors (VIM and 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 Nano are integrated tools and are already installed in the operating system.

How to do it…

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:

root@kali:~# vim vim_demo.txt

In the example provided, VIM 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. To start entering text into the editor, press I or the Insert button. Then, start entering the desired text as follows:

Write to file demonstration with VIM
~                                                                               
~                                                                               
~                                                                               
~

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. Once finished, press the Esc key to exit insert mode and enter the command mode in VIM. Then, type :wq and press Enter to save. You can then verify that the file exists and verify the contents of the file by using the following bash commands:

root@kali:~# ls
Desktop  vim_demo.txt
root@kali:~# cat vim_demo.txt 
Write to file demonstration with VIM

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. An alternative text editor that can also be used is Nano. The basic usage of 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:

root@kali:~# nano nano_demo.txt

In the example provided, nano is used to open a file called nano_demo.txt. Since no file currently exists with that name, a new file is created. 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:

  GNU nano 2.2.6             File: nano_demo.txt                                

Write to file demonstration with Nano

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 Nano was executed. However, this value can be changed and the contents of the file saved to a different filename as follows:

root@kali:~# ls
Desktop  nano_demo.txt  vim_demo.txt
root@kali:~# cat nano_demo.txt 
Write to file demonstration with Nano

Once complete, 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 to quickly modify files or handle them over a remote terminal interface such as SSH or Telnet.

You have been reading a chapter from
KALI LINUX NETWORK SCANNING COOKBOOK
Published in: Aug 2014
Publisher:
ISBN-13: 9781783982141
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 €18.99/month. Cancel anytime