Python for Cybersecurity
Home > Computing and Information Technology > Computer security > Data encryption > Python for Cybersecurity: Using Python for Cyber Offense and Defense
Python for Cybersecurity: Using Python for Cyber Offense and Defense

Python for Cybersecurity: Using Python for Cyber Offense and Defense


     0     
5
4
3
2
1



Out of Stock


Notify me when this book is in stock
X
About the Book

Discover an up-to-date and authoritative exploration of Python cybersecurity strategies Python For Cybersecurity: Using Python for Cyber Offense and Defense delivers an intuitive and hands-on explanation of using Python for cybersecurity. It relies on the MITRE ATT&CK framework to structure its exploration of cyberattack techniques, attack defenses, and the key cybersecurity challenges facing network administrators and other stakeholders today. Offering downloadable sample code, the book is written to help you discover how to use Python in a wide variety of cybersecurity situations, including: Reconnaissance, resource development, initial access, and execution Persistence, privilege escalation, defense evasion, and credential access Discovery, lateral movement, collection, and command and control Exfiltration and impact Each chapter includes discussions of several techniques and sub-techniques that could be used to achieve an attacker's objectives in any of these use cases. The ideal resource for anyone with a professional or personal interest in cybersecurity, Python For Cybersecurity offers in-depth information about a wide variety of attacks and effective, Python-based defenses against them.

Table of Contents:
Introduction xvii Chapter 1 Fulfilling Pre- ATT&CK Objectives 1 Active Scanning 2 Scanning Networks with scapy 2 Implementing a SYN Scan in scapy 4 Performing a DNS Scan in scapy 5 Running the Code 5 Network Scanning for Defenders 6 Monitoring Traffic with scapy 7 Building Deceptive Responses 8 Running the Code 9 Search Open Technical Databases 9 Offensive DNS Exploration 10 Searching DNS Records 11 Performing a DNS Lookup 12 Reverse DNS Lookup 12 Running the Code 13 DNS Exploration for Defenders 13 Handling DNS Requests 15 Building a DNS Response 15 Running the Code 16 Summary 17 Suggested Exercises 17 Chapter 2 Gaining Initial Access 19 Valid Accounts 20 Discovering Default Accounts 20 Accessing a List of Default Credentials 21 Starting SSH Connections in Python 22 Performing Telnet Queries in Python 23 Running the Code 24 Account Monitoring for Defenders 24 Introduction to Windows Event Logs 25 Accessing Event Logs in Python 28 Detecting Failed Logon Attempts 28 Identifying Unauthorized Access to Default Accounts 30 Running the Code 30 Replication Through Removable Media 31 Exploiting Autorun 31 Converting Python Scripts to Windows Executables 32 Generating an Autorun File 33 Setting Up the Removable Media 34 Running the Code 34 Detecting Autorun Scripts 34 Identifying Removable Drives 35 Finding Autorun Scripts 36 Detecting Autorun Processes 36 Running the Code 36 Summary 37 Suggested Exercises 37 Chapter 3 Achieving Code Execution 39 Windows Management Instrumentation 40 Executing Code with WMI 40 Creating Processes with WMI 41 Launching Processes with PowerShell 41 Running the Code 42 WMI Event Monitoring for Defenders 42 WMI in Windows Event Logs 43 Accessing WMI Event Logs in Python 45 Processing Event Log XML Data 45 Running the Code 46 Scheduled Task/Job 47 Scheduling Malicious Tasks 47 Checking for Scheduled Tasks 48 Scheduling a Malicious Task 48 Running the Code 49 Task Scheduling for Defenders 50 Querying Scheduled Tasks 51 Identifying Suspicious Tasks 52 Running the Code 52 Summary 53 Suggested Exercises 53 Chapter 4 Maintaining Persistence 55 Boot or Logon Autostart Execution 56 Exploiting Registry Autorun 56 The Windows Registry and Autorun Keys 57 Modifying Autorun Keys with Python 60 Running the Code 61 Registry Monitoring for Defenders 62 Querying Windows Registry Keys 63 Searching the HKU Hive 64 Running the Code 64 Hijack Execution Flow 65 Modifying the Windows Path 65 Accessing the Windows Path 66 Modifying the Path 67 Running the Code 68 Path Management for Defenders 69 Detecting Path Modification via Timestamps 69 Enabling Audit Events 71 Monitoring Audit Logs 73 Running the Code 75 Summary 76 Suggested Exercises 76 Chapter 5 Performing Privilege Escalation 77 Boot or Logon Initialization Scripts 78 Creating Malicious Logon Scripts 78 Achieving Privilege Escalation with Logon Scripts 79 Creating a Logon Script 79 Running the Code 79 Searching for Logon Scripts 80 Identifying Autorun Keys 81 Running the Code 81 Hijack Execution Flow 81 Injecting Malicious Python Libraries 82 How Python Finds Libraries 82 Creating a Python Library 83 Running the Code 83 Detecting Suspicious Python Libraries 83 Identifying Imports 85 Detecting Duplicates 85 Running the Code 86 Summary 86 Suggested Exercises 87 Chapter 6 Evading Defenses 89 Impair Defenses 90 Disabling Antivirus 90 Disabling Antivirus Autorun 90 Terminating Processes 93 Creating Decoy Antivirus Processes 94 Catching Signals 95 Running the Code 95 Hide Artifacts 95 Concealing Files in Alternate Data Streams 96 Exploring Alternate Data Streams 96 Alternate Data Streams in Python 97 Running the Code 98 Detecting Alternate Data Streams 98 Walking a Directory with Python 99 Using PowerShell to Detect ADS 100 Parsing PowerShell Output 101 Running the Code 102 Summary 102 Suggested Exercises 103 Chapter 7 Accessing Credentials 105 Credentials from Password Stores 106 Dumping Credentials from Web Browsers 106 Accessing the Chrome Master Key 108 Querying the Chrome Login Data Database 108 Parsing Output and Decrypting Passwords 109 Running the Code 109 Monitoring Chrome Passwords 110 Enabling File Auditing 110 Detecting Local State Access Attempts 111 Running the Code 113 Network Sniffing 114 Sniffing Passwords with scapy 114 Port- Based Protocol Identification 116 Sniffing FTP Passwords 116 Extracting SMTP Passwords 117 Tracking Telnet Authentication State 119 Running the Code 121 Creating Deceptive Network Connections 121 Creating Decoy Connections 122 Running the Code 122 Summary 123 Suggested Exercises 123 Chapter 8 Performing Discovery 125 Account Discovery 126 Collecting User Account Data 126 Identifying Administrator Accounts 127 Collecting User Account Information 128 Accessing Windows Password Policies 128 Running the Code 129 Monitoring User Accounts 130 Monitoring Last Login Times 130 Monitoring Administrator Login Attempts 131 Running the Code 132 File and Directory Discovery 133 Identifying Valuable Files and Folders 133 Regular Expressions for Data Discovery 135 Parsing Different File Formats 135 Running the Code 136 Creating Honeypot Files and Folders 136 Monitoring Decoy Content 136 Creating the Decoy Content 137 Running the Code 138 Summary 138 Suggested Exercises 139 Chapter 9 Moving Laterally 141 Remote Services 142 Exploiting Windows Admin Shares 142 Enabling Full Access to Administrative Shares 143 Transferring Files via Administrative Shares 144 Executing Commands on Administrative Shares 144 Running the Code 144 Admin Share Management for Defenders 145 Monitoring File Operations 146 Detecting Authentication Attempts 147 Running the Code 148 Use Alternative Authentication Material 148 Collecting Web Session Cookies 149 Accessing Web Session Cookies 150 Running the Code 150 Creating Deceptive Web Session Cookies 151 Creating Decoy Cookies 151 Monitoring Decoy Cookie Usage 153 Running the Code 153 Summary 154 Suggested Exercises 155 Chapter 10 Collecting Intelligence 157 Clipboard Data 158 Collecting Data from the Clipboard 158 Accessing the Windows Clipboard 159 Replacing Clipboard Data 159 Running the Code 160 Clipboard Management for Defenders 160 Monitoring the Clipboard 161 Processing Clipboard Messages 161 Identifying the Clipboard Owner 161 Running the Code 162 Email Collection 162 Collecting Local Email Data 162 Accessing Local Email Caches 163 Running the Code 163 Protecting Against Email Collection 164 Identifying Email Caches 165 Searching Archive Files 165 Running the Code 166 Summary 166 Suggested Exercises 166 Chapter 11 Implementing Command and Control 169 Encrypted Channel 170 Command and Control Over Encrypted Channels 170 Encrypted Channel Client 171 Encrypted Channel Server 172 Running the Code 173 Detecting Encrypted C2 Channels 174 Performing Entropy Calculations 175 Detecting Encrypted Traffic 175 Running the Code 176 Protocol Tunneling 176 Command and Control via Protocol Tunneling 176 Protocol Tunneling Client 177 Protocol Tunneling Server 177 Running the Code 179 Detecting Protocol Tunneling 179 Extracting Field Data 181 Identifying Encoded Data 181 Running the Code 181 Summary 182 Suggested Exercises 182 Chapter 12 Exfiltrating Data 183 Alternative Protocols 184 Data Exfiltration Over Alternative Protocols 184 Alternative Protocol Client 185 Alternative Protocol Server 186 Running the Code 188 Detecting Alternative Protocols 189 Detecting Embedded Data 190 Running the Code 191 Non- Application Layer Protocols 191 Data Exfiltration via Non- Application Layer Protocols 192 Non- Application Layer Client 193 Non- Application Layer Server 193 Running the Code 194 Detecting Non- Application Layer Exfiltration 195 Identifying Anomalous Type and Code Values 196 Running the Code 196 Summary 197 Suggested Exercises 197 Chapter 13 Achieving Impact 199 Data Encrypted for Impact 200 Encrypting Data for Impact 200 Identifying Files to Encrypt 201 Encrypting and Decrypting Files 202 Running the Code 202 Detecting File Encryption 203 Finding Files of Interest 204 Calculating File Entropies 204 Running the Code 205 Account Access Removal 205 Removing Access to User Accounts 205 Changing Windows Passwords 207 Changing Linux Passwords 207 Running the Code 207 Detecting Account Access Removal 208 Detecting Password Changes in Windows 209 Detecting Password Changes in Linux 210 Running the Code 211 Summary 211 Suggested Exercises 212 Index 213

About the Author :
HOWARD E. POSTON III is a freelance consultant and content creator with a professional focus on blockchain and cybersecurity. He has over ten years’ experience in programming with Python and has developed and taught over a dozen courses teaching cybersecurity. He is a sought-after speaker on blockchain and cybersecurity at international security conferences.


Best Sellers


Product Details
  • ISBN-13: 9781119850700
  • Publisher: John Wiley & Sons Inc
  • Publisher Imprint: Standards Information Network
  • Language: English
  • Sub Title: Using Python for Cyber Offense and Defense
  • ISBN-10: 1119850703
  • Publisher Date: 01 Feb 2022
  • Binding: Digital (delivered electronically)
  • No of Pages: 240


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Python for Cybersecurity: Using Python for Cyber Offense and Defense
John Wiley & Sons Inc -
Python for Cybersecurity: Using Python for Cyber Offense and Defense
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Python for Cybersecurity: Using Python for Cyber Offense and Defense

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!