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
Effective Python Penetration Testing
Effective Python Penetration Testing

Effective Python Penetration Testing: Pen test your system like a pro and overcome vulnerabilities by leveraging Python scripts, libraries, and tools

eBook
$24.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Effective Python Penetration Testing

Chapter 1. Python Scripting Essentials

Python is still the leading language in the world of penetration testing (pentesting) and information security. Python-based tools include all kinds of tools (used for inputting massive amounts of random data to find errors and security loop holes), proxies, and even the exploit frameworks. If you are interested in tinkering with pentesting tasks, Python is the best language to learn because of its large number of reverse engineering and exploitation libraries.

Over the years, Python has received numerous updates and upgrades. For example, Python 2 was released in 2000 and Python 3 in 2008. Unfortunately, Python 3 is not backward compatible, hence most of the programs written in Python 2 will not work in Python 3. Even though Python 3 was released in 2008, most of the libraries and programs still use Python 2. To do better penetration testing, the tester should be able to read, write, and rewrite Python scripts.

Python being a scripting language, security experts have preferred Python as a language to develop security toolkits. Its human-readable code, modular design, and large number of libraries provide a start for security experts and researchers to create sophisticated tools with it. Python comes with a vast library (standard library) which accommodates almost everything, from simple I/O to platform-specific API  calls. Many of the default and user-contributed libraries and modules can help us in penetration testing with building tools to achieve interesting tasks.

In this chapter, we will cover the following:

  • Setting up the scripting environment in different operating systems
  • Installing third party Python libraries
  • Working with virtual environments
  • Python language basics

Setting up the scripting environment

Your scripting environment is basically the computer you use for your daily work, combined with all the tools in it that you use to write and run Python programs. The best system to learn on is the one you are using right now. This section will help you to configure the Python scripting environment on your computer, so that you can create and run your own programs.

If you are using Mac OS X or Linux installation on your computer, you may have a Python interpreter pre-installed in it. To find out if you have one, open the terminal and type python. You will probably see something like the following:

$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> 

From the preceding output, we can see that Python 2.7.6 is installed in this system. By issuing python in your terminal, you started Python interpreter in interactive mode. Here, you can play around with Python commands, and what you type will run and you'll see the outputs immediately.

You can use your favorite text editor to write your Python programs. If you do not have one, then try installing Geany or Sublime Text and it should be perfect for you. These are simple editors and offer a straightforward way to write as well as run your Python programs. In Geany, output is shown in a separate terminal window, whereas Sublime Text uses an embedded terminal window. Sublime Text is not free, but it has a flexible trial policy that allows you to use the editor without any stricture. It is one of the few cross-platform text editors that is quite apt for beginners and has a full range of functions targeting professionals.

Setting up in Linux

The Linux system is built in a way that makes it smooth for users to get started with Python programming. Most Linux distributions already have Python installed. For example, the latest versions of Ubuntu and Fedora come with Python 2.7. Also, the latest versions of Redhat Enterprise (RHEL) and CentOS come with Python 2.6. Just for the record, you might want to check this, though.

If it is not installed, the easiest way to install Python is to use the default package manager of your distribution, such as apt-get, yum, and so on. Install Python by issuing this command in the terminal:

  • For Debian / Ubuntu Linux / Kali Linux users, use the following command:
    $ sudo apt-get install python2
  • For Red Hat / RHEL / CentOS Linux users, use the following command:
    $sudo yum install python

To install Geany, leverage your distribution's package manager:

  • For Debian / Ubuntu Linux / Kali Linux users, use the following command:
    $sudo apt-get install geany geany-common
  • For Red Hat / RHEL / CentOS Linux users, use the following command:
    $ sudo yum install geany

Setting up in Mac

Even though Macintosh is a good platform to learn Python, many people using Macs actually run some Linux distribution or other on their computer, or run Python within a virtual Linux machine. The latest version of Mac OS X, Yosemite, comes with Python 2.7 pre-installed. Once you verify that it is working, install Sublime Text.

For Python to run on your Mac, you have to install GCC, which can be obtained by downloading XCode, the smaller command-line tool. Also, we need to install Homebrew, a package manager.

To install Homebrew, open terminal and run the following:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After installing Homebrew, you have to insert the Homebrew directory into your PATH environment variable. You can do this by including the following line in your ~/.profile file:

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Now we are ready to install Python 2.7. Run the following command in your Terminal, which will do the rest:

$ brew install python

To install Sublime Text, go to Sublime Text's downloads page at http://www.sublimetext.com/3, and click on the OS X link. This will get you the Sublime Text installer for your Mac.

Setting up in Windows

Windows does not have Python pre-installed on it. To check if it is installed, open a command prompt and type the word python, and press Enter. In most cases, you will get a message that says Windows does not recognize python as a command.

We have to download an installer that will set Python for Windows. Then we have to install and configure Geany to run Python programs.

Go to Python's download page at https://www.python.org/downloads/windows/ and download the Python 2.7 installer that is compatible with your system. If you are not aware of your operating system's architecture, then download 32-bit installers, which will work on both architectures, but 64-bit will only work on 64-bit systems.

To install Geany, go to Geany's download page at http://www.geany.org/Download/Releases and download the full installer variant, which has a description Full Installer including GTK 2.16. By default, Geany doesn't know where Python resides on your system. So we need to configure it manually.

For that, write a Hello world program in Geany, and save it anywhere in your system as hello.py and run it.

There are three methods you can use to run a Python program in Geany:

  • Select Build | Execute
  • Press F5
  • Click the icon with three gears on it
Setting up in Windows

When you have a running hello.py program in Geany perform the following steps:

  1. Go to Build | Set Build Commands.
  2. Then enter the python commands option with C:\Python27\python -m py_compile "%f".
  3. Execute the command with C:\Python27\python "%f".
  4. Now you can run your Python programs while coding in Geany.

It is recommended to run a Kali Linux distribution as a virtual machine and use this as your scripting environment. Kali Linux comes with a number of tools pre-installed and is based on Debian Linux, so you'll also be able to install a wide variety of additional tools and libraries. Also, some of the libraries will not work properly on Windows systems.

Installing third-party libraries

We will be using many Python libraries throughout this book, and this section will help you to install and use third-party libraries.

Setuptools and pip

One of the most useful pieces of third-party Python software is Setuptools. With Setuptools, you can download and install any compliant Python libraries with a single command.

The best way to install Setuptools on any system is to download the ez_setup.py file from https://bootstrap.pypa.io/ez_setup.py and run this file with your Python installation.

In Linux, run this in the terminal with the correct path to ez_setup.py script:

$ sudo python path/to/ez_setup.py

For Windows 8, or old versions of Windows with PowerShell 3 installed, start the PowerShell with administrative privileges and run the following command in it:

> (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python -

For Windows systems without PowerShell 3 installed, download the ez_setup.py file from the preceding link using your web browser and run that file with your Python installation.

Pip is a package management system used to install and manage software packages written in Python. After successful installation of Setuptools, you can install pip by simply opening a command prompt and running the following:

$ easy_install pip

Alternatively, you could also install pip using your default distribution package managers:

  • On Debian, Ubuntu, and Kali Linux:
    $ sudo apt-get install python-pip
  • On Fedora:
    $ sudo yum install python-pip

Now you could run pip from command line. Try installing a package with pip:

$ pip install packagename

Working with virtual environments

Virtual environments help to separate dependencies required for different projects, by working inside a virtual environment it also helps to keep our global site-packages directory clean.

Using virtualenv and virtualwrapper

Virtualenv is a Python module which helps to create isolated Python environments for our scripting experiments, which creates a folder with all necessary executable files and modules for a basic Python project.

You can install virtualenv with the following command:

    $ sudo pip install virtualenv

To create a new virtual environment, create a folder and enter the folder from the command line:

$ cd your_new_folder 
$ virtualenv name-of-virtual-environment 

This will initiate a folder with the provided name in your current working directory with all Python executable files and pip library, which will then help to install other packages in your virtual environment.

You can select a Python interpreter of your choice by providing more parameters, such as the following command:

$ virtualenv -p /usr/bin/python2.7 name-of-virtual-environment 

This will create a virtual environment with Python 2.7. We have to activate it before starting to use this virtual environment:

$ source name-of-virtual-environment/bin/activate
Using virtualenv and virtualwrapper

Now, on the left side of the command prompt, the name of the active virtual environment will appear. Any package that you install inside this prompt using pip will belong to the active virtual environment, which will be isolated from all other virtual environments and global installation.

You can deactivate and exit from the current virtual environment using this command:

$ deactivate

Virtualenvwrapper provides a better way to use virtualenv. It also organizes all virtual environments in one place.

To install, we can use pip, but let's make sure we have installed virtualenv before installing virtualwrapper.

Linux and OS X users can install it with the following method:

$ pip install virtualenvwrapper

Also, add these three lines to your shell startup file, such as .bashrc or .profile:

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Devel 
source /usr/local/bin/virtualenvwrapper.sh 

This will set Devel folder in your home directory as the location of your virtual environment projects.

For Windows users, we can use another package: virtualenvwrapper-win. This can also be installed with pip:

$ pip install virtualenvwrapper-win

To create a virtual environment with virtualwrapper:

$ mkvirtualenv your-project-name

This creates a folder with the provided name inside ~/Envs.

To activate this environment, we can use the workon command:

$ workon your-project-name

This two commands can be combined with the single one as follows:

$ mkproject your-project-name

We can deactivate the virtual environment with the same deactivate command in virtualenv. To delete a virtual environment, we can use the following command:

$ rmvirtualenv your-project-name

Python language essentials

In this section we will go through the idea of variables, strings, data types, networking, and exception handling. For an experienced programmer, this section will be just a summary of what you already know about Python.

Variables and types

Python is brilliant in case of variables. Variables point to data stored in a memory location. This memory location may contain different values, such as integers, real numbers, Booleans, strings, lists, and dictionaries.

Python interprets and declares variables when you set some value to this variable. For example, if we set a = 1 and b = 2.

Then we print the sum of these two variables with:

print (a+b) 

The result will be 3 as Python will figure out that both a and b are numbers.

However, if we had assigned a = "1" and b = "2". Then the output will be 12, since both a and b will be considered as strings. Here, we do not have to declare variables or their type before using them as each variable is an object. The type() method can be used to get the variable type.

Strings

As with any other programming language, strings are one of the important things in Python. They are immutable. So, they cannot be changed once defined. There are many Python methods which can modify strings. They do nothing to the original one, but create a copy and return after modifications. Strings can be delimited with single quotes, double quotes, or in case of multiple lines, we can use triple quotes syntax. We can use the \ character to escape additional quotes which come inside a string.

Commonly used string methods are as follows:

  • string.count('x'): This returns the number of occurrences of 'x' in the string
  • string.find('x'): This returns the position of character 'x' in the string
  • string.lower(): This converts the string into lowercase
  • string.upper(): This converts the string into uppercase
  • string.replace('a', 'b'): This replaces all a with b in the string

Also, we can get the number of characters, including white spaces, in a string with the len() method:

#!/usr/bin/python 
a = "Python" 
b = "Python\n" 
c = "Python  " 
 
print len(a) 
print len(b) 
print len(c) 

You can read more about the string function here: https://docs.python.org/2/library/string.html.

Lists

Lists allow us to store more than one variable inside it and provide a better method for sorting arrays of objects in Python. They also have methods which help to manipulate the values inside them:

list = [1,2,3,4,5,6,7,8] 
print (list[1])  

This will print 2, as Python index starts from 0. To print out the whole list, use the following code:

list = [1,2,3,4,5,6,7,8]
for x in list:
 print (x)

This will loop through all elements and print them.

Useful list methods are as follows:

  • .append(value): This appends an element at the end of the list
  • .count('x'): This gets the number of 'x' in the list
  • .index('x'): This returns the index of 'x' in the list
  • .insert('y','x'): This inserts 'x' at location 'y'
  • .pop(): This returns the last element and also removes it from the list
  • .remove('x'): This removes first 'x' from the list
  • .reverse(): This reverses the elements in the list
  • .sort(): This sorts the list alphabetically in ascending order, or numerical in ascending order

Dictionaries

A Python dictionary is a storage method for key:value pairs. Python dictionaries are enclosed in curly braces, {}. For example:

dictionary = {'item1': 10, 'item2': 20} 
print(dictionary['item2']) 

This will output 20. We cannot create multiple values with the same key. This will overwrite the previous value of the duplicate keys. Operations on dictionaries are unique. Slicing is not supported in dictionaries.

We can combine two distinct dictionaries to one by using the update method. Also, the update method will merge existing elements if they conflict:

a = {'apples': 1, 'mango': 2, 'orange': 3} 
b = {'orange': 4, 'lemons': 2, 'grapes ': 4} 
a.update(b) 
 
Print a 

This will return the following:

{'mango': 2, 'apples': 1, 'lemons': 2, 'grapes ': 4, 'orange': 4} 

To delete elements from a dictionary we can use the del method:

del a['mango'] 
print a 

This will return the following:

{'apples': 1, 'lemons': 2, 'grapes ': 4, 'orange': 4}

Networking

Sockets are the basic blocks behind all network communications by a computer. All network communications go through a socket. So, sockets are the virtual endpoints of any communication channel that takes place between two applications which may reside on the same or different computers.

The socket module in Python provides us a better way to create network connections with Python. So to make use of this module, we have to import this in our script:

import socket 
socket.setdefaulttimeout(3) 
newSocket = socket.socket() 
newSocket.connect(("localhost",22)) 
response = newSocket.recv(1024) 
print response 

This script will get the response header from the server. We will discuss more about networking in our later chapters.

Handling exceptions

Even though we wrote syntactically correct scripts, there will be some errors while executing them. So, we have to handle the errors properly. The simplest way to handle exceptions in Python is by using try-except:

Try to divide a number by zero in your Python interpreter:

>>> 10/0
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

So, we can rewrite this script with try-except blocks:

try: 
   answer = 10/0 
except ZeroDivisionError, e: 
   answer = e 
print answer 

This will return the error integer division or modulo by zero.

Tip

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Effective-Python-Penetration-Testing. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Summary

Now we have an idea about basic installations and configurations that we have to do before coding. Also, we have gone through the basics of the Python language, which may help us to speed up scripting in our later chapters. In the next chapter we will discuss more investigating network traffic with Scapy, packet sniffing, and packet injection.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn to utilize your Python scripting skills to pentest a computer system, network, and web-application
  • Get proficient at the art of assessing vulnerabilities by conducting effective penetration testing
  • This is the ultimate guide that teaches you how to use Python to protect your systems against sophisticated cyber attacks

Description

Penetration testing is a practice of testing a computer system, network, or web application to find weaknesses in security that an attacker can exploit. Effective Python Penetration Testing will help you utilize your Python scripting skills to safeguard your networks from cyberattacks. We will begin by providing you with an overview of Python scripting and penetration testing. You will learn to analyze network traffic by writing Scapy scripts and will see how to fingerprint web applications with Python libraries such as ProxMon and Spynner. Moving on, you will find out how to write basic attack scripts, and will develop debugging and reverse engineering skills with Python libraries. Toward the end of the book, you will discover how to utilize cryptography toolkits in Python and how to automate Python tools and libraries.

Who is this book for?

This book is ideal for those who are comfortable with Python or a similar language and need no help with basic programming concepts, but want to understand the basics of penetration testing and the problems pentesters face.

What you will learn

  • Write Scapy scripts to investigate network traffic
  • Get to know application fingerprinting techniques with Python
  • Understand the attack scripting techniques
  • Write fuzzing tools with pentesting requirements
  • Learn basic attack scripting methods
  • Utilize cryptographic toolkits in Python
  • Automate pentesting with Python tools and libraries
Estimated delivery fee Deliver to Ecuador

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 29, 2016
Length: 164 pages
Edition : 1st
Language : English
ISBN-13 : 9781785280696
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Ecuador

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Publication date : Jun 29, 2016
Length: 164 pages
Edition : 1st
Language : English
ISBN-13 : 9781785280696
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 153.97
Kali Linux 2:  Windows Penetration Testing
$54.99
Learning Penetration Testing with Python
$54.99
Effective Python Penetration Testing
$43.99
Total $ 153.97 Stars icon

Table of Contents

10 Chapters
1. Python Scripting Essentials Chevron down icon Chevron up icon
2. Analyzing Network Traffic with Scapy Chevron down icon Chevron up icon
3. Application Fingerprinting with Python Chevron down icon Chevron up icon
4. Attack Scripting with Python Chevron down icon Chevron up icon
5. Fuzzing and Brute-Forcing Chevron down icon Chevron up icon
6. Debugging and Reverse Engineering Chevron down icon Chevron up icon
7. Crypto, Hash, and Conversion Functions Chevron down icon Chevron up icon
8. Keylogging and Screen Grabbing Chevron down icon Chevron up icon
9. Attack Automation Chevron down icon Chevron up icon
10. Looking Forward Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(1 Ratings)
5 star 0%
4 star 100%
3 star 0%
2 star 0%
1 star 0%
Timoteo Jan 14, 2017
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Good start, but I felt it was lacking a bit of content or explanatory information. Some sections would just show a code snippet, then follow it up with, "then, comply with the API", or something similar. Perhaps the author should have added a few pages to explain some stuff a bit more. But, nonetheless, a good start on the subject.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela