-->
Navigation
Hacking Python 3

Hacking Python 3

Now pay Easier and Secure using Paypal
Price:

Read more

A Guide to NMAP Scanning, Networking and Information Gathering

Sanjib Sinha


e-book shop
e-book shop
Purchase Now !
Just with Paypal



Book Details
 Price
 2.50
 Pages
 130 p
 File Size 
 1,590 KB
 File Type
 PDF format
 VVersion
 published on 2018-03-29
 Copyright©   
 2016 - 2018 Sanjib Sinha 

Epilogue
This book requires a little bit programming knowledge. You don’t have to belong to the advanced
level but you need at least intermediate python knowledge to identify with few concepts. For
intermediate python learners I have discussed few essential concepts in the part two.
For absolute beginners I’ll advise to learn python basics and then come back to this book.

It’ll not be the first time that you’ve learned hacking technique along with python programming
language. There are many good books available in the market. They have discussed role of python
in ethical hacking and I hope a little bit of research about it will not do any bad for your learning purpose.

This book has been divided in three parts.
In the first part we’ll learn about the basic of networking, reconnaissance scanning and it’ll also be
a gentle reminder about the legal side of hacking – what you can do and what you cannot do with
the help of this book.

In the second part we’ll discuss and recapitulate our python knowledge. Not from the beginning.
Assuming that you have intermediate python knowledge, we’ll talk about few important concepts
that are going to help us achieve our goal of learning ethical hacking.

In the last and final part we’ll do some real hacking. We’ll build python scanner that could scan any
network, will do some cyber reconnaissance and gather important information about any target.

Table of Contents
Dedication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Cover Design: Kaberi Sinha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Art Work: Amitakkhar Deb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Epilogue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
PART ONE: LEGAL SIDE, CYBER CRIME AND NETWORKING . . . . . . . . . . . . . . 3
Legal Side of Hacking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Examples of Cyber Crime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Black Money and Bitcoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Biggest Data Heist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Chapter 3 – Hacking and Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
What Does Network Mean? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Chapter Seven - Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.1 – Using ‘re’ Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.2 - Reusing With Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.3 - Searching With Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 19
PART TWO: PYTHON AND HACKING . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Object in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
While Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
For Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Using ‘re’ Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Reusing With Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Search With Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Exceptions, Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Return Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Generate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Lists of Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
9.4 - Named Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
!/usr/bin/python3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
!/usr/bin/python3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Object Oriented Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Write a Game “Good VS Bad” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Primary Class and Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Accessing Object Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Using Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Decorator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
File Input, Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Tuple and List Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Dictionary Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Debugging, UnitTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
PART THREE: PYTHON AND SECURITY ANALYSIS, RECONNAISSANCE SCANNER . 94
Socket and Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Importing Nmap Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Nmap Network Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
TLD Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Get IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Whois Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
NMAP Port Scan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Robots Exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Prologue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125


Bookscreen
e-books shop

Prologue
In this book python programming language has played a major role and you see it in almost every
chapter. Readers with intermediate or advanced python knowledge will find it simple to grasp the
core idea of this book. If you’re a beginner I’d suggest you to acquire preliminary python knowledge first.

A good programming knowledge always helps you gain the necessary confidence for being an ethical
hacker. Moreover you have the correct mind set which is also very important. Understanding the
flow of logic in computer science is particularly essential. Besides, it builds up your skill of thinking
logically. The logical steps in any programming language help us think reasonably in real life. In
ethical hacking it’s imperative.

Ethical hacking is a very vast topic and it includes many things that you may not cover altogether at
once. You need not worry about it. Few basic things like Linux administration and programming and
knowledge of Python programming language will always help you; so try to master them slowly.
Don’t lose your heart at the very beginning.

I again repeat, ethical hacking has many branches and you’ll definitely find your own point of
interest one day and if you approach the subject with ultimate passion you’ll learn it one day.
Keep learning and enjoy the process, share your knowledge and help your fellow learners.
For any query, you feel free to contact me at sanjib12sinha@gmail.com and my twitter handle is
@sanjibsinha. You may send a direct message. I also need your assistance in finding errors.
I’ll love to hear from you. Best of luck.

0