Python Penetration Testing - Tutorialspoint

3y ago
215 Views
58 Downloads
1.40 MB
76 Pages
Last View : 14d ago
Last Download : 3m ago
Upload by : Jamie Paz
Transcription

Python Penetration Testingi

Python Penetration TestingAbout the TutorialPenetration testing (Pen testing) is an attempt to evaluate the security of an ITinfrastructure by simulating a cyber-attack against computer system to exploitvulnerabilities. It helps an organization strengthen its defenses against cyber-attacks byidentifying vulnerabilities.AudienceThis tutorial will be useful for graduates, postgraduates, and research students who eitherhave an interest in this subject or have this subject as part of their curriculum. The readercan be a beginner or an advanced learner.PrerequisitesThe reader must have basic knowledge about Testing, Operating System, and ComputerNetworks. He/she should also be aware about basic Python programming concepts.Copyright & Disclaimer Copyright 2018 by Tutorials Point (I) Pvt. Ltd.All the content and graphics published in this e-book are the property of Tutorials Point (I)Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republishany contents or a part of contents of this e-book in any manner without written consentof the publisher.We strive to update the contents of our website and tutorials as timely and as precisely aspossible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of ourwebsite or its contents including this tutorial. If you discover any errors on our website orin this tutorial, please notify us at contact@tutorialspoint.comi

Python Penetration TestingTable of ContentsAbout the Tutorial . iAudience . iPrerequisites . iCopyright & Disclaimer . iTable of Contents . ii1.Python Penetration Testing — Introduction. 1Significance of Penetration (pen) Testing . 1Who is a good pen tester? . 2Penetration Testing Scope. 2What to install for practice penetration testing? . 32.Python Penetration Testing — Assessment Methodology . 4What is PTES? . 4Seven Phases of PTES . 4Pre-engagement Interactions Phase . 5Intelligence Gathering Phase . 6Threat Modeling Phase. 6Vulnerability Analysis Phase . 8Active testing . 8Passive testing . 8Validation . 9Research . 9Exploitation Phase . 9Post Exploitation Phase . 10Reporting . 103.Python Penetration Testing — A Primer on Network Communication . 13Reference Model . 13ii

Python Penetration TestingOSI Model . 14TCP/IP Model . 15Useful Architecture. 17Extended Ethernet Frame (Ethernet II frame) Format . 18The IP Packet Architecture . 19IPv4 . 19IPv6 . 21The TCP (Transmission Control Protocol) Header Architecture . 23The UDP (User Datagram Protocol) header architecture . 254.Python Penetration Testing — The Socket and its Methods . 27Python’s Socket Module for Socket Programming . 27Socket Methods . 28Program to establish a connection between server & client . 295.Python Penetration Testing — Python Network Scanner . 32Port Scanner using Socket . 32Port Scanner using ICMP (Live hosts in a network) . 33Concept of Ping Sweep . 34Port Scanner using TCP scan . 35Threaded Port Scanner for increasing efficiency . 376.Python Penetration Testing — Network Packet Sniffing . 39What can be sniffed? . 39How does sniffing work? . 39Types of Sniffing . 40The Sniffing Effects on Protocols . 40Implementation using Python . 417.Python Penetration Testing — ARP Spoofing . 43Working of ARP. 43What is ARP Spoofing? . 43iii

Python Penetration TestingImplementation using Python . 43Implementation using Scapy on Kali Linux . 458.Python Penetration Testing — Pentesting of Wireless Network . 47Important Terminologies . 47Communication between client and the wireless system . 47The Beacon Frame . 48Finding Wireless Service Set Identifier (SSID) using Python . 49Detecting Access Point Clients . 51Wireless Attacks . 519.Python Penetration Testing — Application Layer . 55Foot printing of a web server . 55Methods for footprinting of a web server . 55Footprinting of a Web Application . 58Methods for Footprinting of a Web Application . 5810. Python Penetration Testing — Client-side Validation . 60Server-side Validation & Client-side Validation . 60Tempering Client-side Parameter: Validation Bypass . 60Python Module for Validation Bypass . 6011. Python Penetration Testing — DoS & DDoS attack . 62DoS (Denial-of-Service) Attack . 62Types of DoS Attack & its Python Implementation . 62DDoS (Distributed Denial-of-Service) Attack . 6512. Python Penetration Testing — SQLi Web Attack . 67Types of SQLi Attack . 6713. Python Penetration Testing — XSS Web Attack . 70Types of XSS Attack . 70iv

1. Python Penetration Testing — IntroductionPython Penetration TestingPen test or penetration testing, may be defined as an attempt to evaluate the security ofan IT infrastructure by simulating a cyber-attack against computer system to exploitvulnerabilities.What is the difference between vulnerability scanning and penetration testing?Vulnerability scanning simply identifies the noted vulnerabilities and penetration testing,as told earlier, is an attempt to exploit vulnerabilities. Penetration testing helps todetermine whether unauthorized access or any other malicious activity is possible in thesystem.We can perform penetration testing for servers, web applications, wireless networks,mobile devices and any other potential point of exposure using manual or automatedtechnologies. Because of penetration testing, if we exploit any kind of vulnerabilities, thesame must be forwarded to the IT and the network system manager to reach a strategicconclusion.Significance of Penetration (pen) TestingIn this section, we will learn about the significance of penetration testing. Consider thefollowing points to know about the significance:Security of organizationThe significance of penetration testing can be understood from the point that it providesassurance to the organization with a detailed assessment of the security of thatorganization.Protecting confidentiality of organizationWith the help of penetration testing, we can spot potential threats before facing anydamage and protect confidentiality of that organization.Implementation of security policiesPenetration testing can ensure us regarding the implementation of security policy in anorganization.Managing network efficiencyWith the help of penetration testing, the efficiency of network can be managed. It canscrutinize the security of devices like firewalls, routers, etc.Ensure organization’s safetySuppose if we want to implement any change in network design or update the software,hardware, etc. then penetration testing ensures the safety of organization against any kindof vulnerability.1

Python Penetration TestingWho is a good pen tester?Penetration testers are software professionals who help organizations strengthen theirdefenses against cyber-attacks by identifying vulnerabilities. A penetration tester can usemanual techniques or automated tools for testing.Let us now consider the following important characteristics of a good penetration tester:Knowledge of networking and application developmentA good pentester must have knowledge of application development, databaseadministration and networking because he/she will be expected to deal with configurationsettings as well as coding.Outstanding thinkerPentester must be an outstanding thinker and will not hesitate to apply different tools andmethodologies on a particular assignment for getting the best output.Knowledge of procedureA good pentester must have the knowledge to establish the scope for each penetrationtest such as its objectives, limitations and the justification of procedures.Up-to-date in technologyA pentester must be up-to-date in his/her technological skills because there can be anychange in technology anytime.Skillful in report makingAfter successfully implementing penetration testing, a pen tester must mention all thefindings and potential risks in the final report. Hence, he/she must have good skills ofreport making.Passionate about cyber securityA passionate person can achieve success in life. Similarly, if a person is passionate aboutcyber securities then he/she can become a good pen tester.Penetration Testing ScopeWe will now learn about the scope of penetration testing. The following two kinds of testscan define the scope of penetration testing:Nondestructive testing (NDT)Nondestructive testing does not put the system into any kind of risk. NDT is used to finddefects, before they become dangerous, without harming the system, object, etc. Whiledoing penetration testing, NDT performs the following actions:2

Python Penetration TestingScanning of remote systemsThis test scans and identifies the remote system for possible vulnerabilities.VerificationAfter finding vulnerabilities, it also does the verification of all that is found.Proper utilization of remote systemIn NDT, a pen tester would utilize the remote system properly. This helps in avoidinginterruptions.Note: On the other hand, while doing penetration testing, NDT does not perform Denialof-Service (DoS) attack.Destructive testingDestructive testing can put the system into risk. It is more expensive and requires moreskills than nondestructive testing. While doing penetration testing, destructive testingperforms the following actions: Denial-of-Service (DoS) attack: Destructive testing performs DoS attack. Buffer overflow attack: It also performs buffer overflow attack which can lead tothe crash of system.What to install for practice penetration testing?The penetration testing techniques & tools should only be executed in environments youown or have permission to run these tools in. We must never practice these techniques inenvironments wherein, we are not authorized to do so because penetration testing withoutpermission is illegal. We can practice penetration testing by installing a virtualization suite - .html We can also create Virtual Machines (VMs) out of the current version of:oKali Linux (https://www.kali.org/downloads/)oSamurai Web Testing Framework .com/metasploit-3

2. Python Penetration Testing — AssessmentMethodologyPython Penetration TestingIn recent times, both government and private organizations have taken up cyber securityas a strategic priority. Cyber criminals have often made government and privateorganizations their soft targets by using different attacking vectors. Unfortunately, due tolack of efficient policies, standards and complexity of information system, cyber criminalshave large number of targets and they are becoming successful in exploiting the systemand stealing information too.Penetration testing is one strategy that can be used to mitigate the risks of cyberattacks.The success of penetration testing depends u

Open Web Application Security Project (OWASP) National Institute of Standards and Technology (NIST) Penetration Testing Execution Standard (PTES) What is PTES? PTES, penetration testing execution standard, as the name implies is an assessment methodology for penetration testing. It covers everything related to a penetration test.

Related Documents:

Assessment, Penetration Testing, Vulnerability Assessment, and Which Option is Ideal to Practice? Types of Penetration Testing: Types of Pen Testing, Black Box Penetration Testing. White Box Penetration Testing, Grey Box Penetration Testing, Areas of Penetration Testing. Penetration Testing Tools, Limitations of Penetration Testing, Conclusion.

Python Programming for the Absolute Beginner Second Edition. CONTENTS CHAPTER 1 GETTING STARTED: THE GAME OVER PROGRAM 1 Examining the Game Over Program 2 Introducing Python 3 Python Is Easy to Use 3 Python Is Powerful 3 Python Is Object Oriented 4 Python Is a "Glue" Language 4 Python Runs Everywhere 4 Python Has a Strong Community 4 Python Is Free and Open Source 5 Setting Up Python on .

Python 2 versus Python 3 - the great debate Installing Python Setting up the Python interpreter About virtualenv Your first virtual environment Your friend, the console How you can run a Python program Running Python scripts Running the Python interactive shell Running Python as a service Running Python as a GUI application How is Python code .

Python is readable 5 Python is complete—"batteries included" 6 Python is cross-platform 6 Python is free 6 1.3 What Python doesn't do as well 7 Python is not the fastest language 7 Python doesn't have the most libraries 8 Python doesn't check variable types at compile time 8 1.4 Why learn Python 3? 8 1.5 Summary 9

site "Python 2.x is legacy, Python 3.x is the present and future of the language". In addition, "Python 3 eliminates many quirks that can unnecessarily trip up beginning programmers". However, note that Python 2 is currently still rather widely used. Python 2 and 3 are about 90% similar. Hence if you learn Python 3, you will likely

There are currently two versions of Python in use; Python 2 and Python 3. Python 3 is not backward compatible with Python 2. A lot of the imported modules were only available in Python 2 for quite some time, leading to a slow adoption of Python 3. However, this not really an issue anymore. Support for Python 2 will end in 2020.

A Python Book A Python Book: Beginning Python, Advanced Python, and Python Exercises Author: Dave Kuhlman Contact: dkuhlman@davekuhlman.org

The Pearson Edexcel Level 3 Advanced GCE in Business is designed for use in schools and colleges. It is part of a suite of GCE qualifications offered by Pearson. These sample assessment materials have been developed to support this qualification and will be used as the benchmark to develop the assessment students will take. P v 3 1 2014 2014 2. P v 3 1 2014 2014 3 General marking guidance .