GETTING STARTED WITH NETWORKING SCRIPTING , AND SECURITY .

3y ago
88 Views
15 Downloads
7.53 MB
250 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Carlos Cepeda
Transcription

ASPIRINGHACKER?START HERE.COVERSKALI LINUXAND PYTHON 3 Keep your internet activity stealthy using Tor, proxyservers, VPNs, and encrypted emailFirst, you’ll learn how to install Kali on a virtual machineand get an introduction to basic Linux concepts. Next,you’ll tackle broader Linux topics like manipulating text,controlling file and directory permissions, and managinguser environment variables. You’ll then focus in on foundational hacking concepts like security and anonymityand learn scripting skills with bash and Python. Build your own hacking tools, such as a remote videospy camera and a password crackerPractical tutorials and exercises throughout will reinforceand test your skills as you learn how to: Cover your tracks by changing your network information and manipulating the rsyslog logging utility Write a tool to scan for network connections, andconnect and listen to wireless networks Write a bash script to scan open ports for potentialtargets Use and abuse services like MySQL, Apache webserver, and OpenSSHHacking is complex, and there is no single way in. Whynot start at the beginning with Linux Basics for Hackers?ABOUT THE AUTHOROccupyTheWeb is an infosec consultant, forensicinvestigator, and trainer with more than 20 years inthe industry. He maintains the Hackers-Arise trainingsite (https://www.hackers-arise.com/) and trains USmilitary personnel, Department of Defense contractors,and federal employees in information security andhacking.w w w.nostarch.com 34.95 ( 45.95 CDN)SHELVE IN:COMPUTERS/SECURITYOCCUPYTHEWEBT H E F I N E ST I N G E E K E N T E RTA I N M E N T LINU X BASICS FOR HACKERSIf you’re getting started along the exciting path ofhacking, cybersecurity, and pentesting, Linux Basicsfor Hackers is an excellent first step. Using Kali Linux,an advanced penetration testing distribution of Linux,you’ll learn the basics of using the Linux operatingsystem and acquire the tools and techniques you’llneed to take control of a Linux environment.LINUX BASICSFOR H ACKERSN E T W O R K I N G,S C R I P T I N G, A N D S E C U R I T Y I N K A L IG E T T I N GS T A R T E DW I T HOCCUPY THE WEB

Linux Basics for Hackers

Linux Basicsfor HackersGetting Started withNetworking, Scripting,a n d  S e c u r i t y i n K a l ib y O c cu p y T h e W e bSan Francisco

LINUX BASICS FOR HACKERS. Copyright 2019 by OccupyTheWeb.All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,electronic or mechanical, including photocopying, recording, or by any information storage or retrievalsystem, without the prior written permission of the copyright owner and the publisher.ISBN-10: 1-59327-855-1ISBN-13: 978-1-59327-855-7Publisher: William PollockProduction Editors: Serena Yang and Meg SneeringerCover Illustration: Josh EllingsonInterior Design: Octopod StudiosDevelopmental Editor: Liz ChadwickTechnical Reviewer: Cliff JanzenCopyeditor: Barton D. ReedCompositors: Serena Yang and Meg SneeringerProofreader: Paula L. FlemingIndexer: JoAnne BurekFor information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly:No Starch Press, Inc.245 8th Street, San Francisco, CA 94103phone: 1.415.863.9900; info@nostarch.comwww.nostarch.comLibrary of Congress Cataloging-in-Publication DataNames: OccupyTheWeb, author.Title: Linux basics for hackers : getting started with networking, scripting,and security in Kali / OccupyTheWeb.Description: First edition. San Francisco : No Starch Press, Inc., [2018].Identifiers: LCCN 2018030544 (print) LCCN 2018032646 (ebook) ISBN9781593278564 (epub) ISBN 159327856X (epub) ISBN 9781593278557 (print) ISBN 1593278551 (print) ISBN 9781593278564 (ebook) ISBN 159327856X(ebook)Subjects: LCSH: Penetration testing (Computer security) Kali Linux. Hackers. Operating systems (Computers)Classification: LCC QA76.9.A25 (ebook) LCC QA76.9.A25 O325 2018 (print) DDC 005.8--dc23LC record available at https://lccn.loc.gov/2018030544No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Otherproduct and company names mentioned herein may be the trademarks of their respective owners. Ratherthan use a trademark symbol with every occurrence of a trademarked name, we are using the names onlyin an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of thetrademark.The information in this book is distributed on an “As Is” basis, without warranty. While every precautionhas been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have anyliability to any person or entity with respect to any loss or damage caused or alleged to be caused directly orindirectly by the information contained in it.

I dedicate this book to my three incredible daughters.You mean the world to me.

About the AuthorOccupyTheWeb (OTW) is the pseudonym for the founder and primarywriter for the hacker and pentester training website, https://www.hackersarise.com/. He is a former college professor and has over 20 years of experience in the information technology industry. He has trained hackersthroughout the US, including branches of the US military (Army, Air Force,and Navy) and the US intelligence community (CIA, NSA, and DNI). He isalso an avid mountain biker and snow boarder.About the Technical ReviewerSince the early days of Commodore PET and VIC-20, technology has beena constant companion (and sometimes an obsession!) to Cliff Janzen. Cliffdiscovered his career passion when he moved to information security in2008 after a decade of IT operations. Since then, Cliff has had the greatfortune to work with and learn from some of the best people in the industryincluding OccupyTheWeb and the fine people at No Starch during theproduction of this book. He is happily employed as a security consultant,doing everything from policy review to penetration tests. He feels lucky tohave a career that is also his favorite hobby and a wife that supports him.

Brief ContentsAcknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xixIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiChapter 1: Getting Started with the Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Chapter 2: Text Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Chapter 3: Analyzing and Managing Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Chapter 4: Adding and Removing Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Chapter 5: Controlling File and Directory Permissions . . . . . . . . . . . . . . . . . . . . . . . . . 49Chapter 6: Process Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61Chapter 7: Managing User Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 71Chapter 8: Bash Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Chapter 9: Compressing and Archiving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93Chapter 10: Filesystem and Storage Device Management . . . . . . . . . . . . . . . . . . . . . 101Chapter 11: The Logging System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Chapter 12: Using and Abusing Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121Chapter 13: Becoming Secure and Anonymous . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Chapter 14: Understanding and Inspecting Wireless Networks . . . . . . . . . . . . . . . . . 153Chapter 15: Managing the Linux Kernel and Loadable Kernel Modules . . . . . . . . . . . . 165Chapter 16: Automating Tasks with Job Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . 173Chapter 17: Python Scripting Basics for Hackers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

Conte nt s in De ta ilAcknowledgmentsxixIntroductionxxiWhat’s in This Book . . . . . . . . . . . . . . . . . . . . . .What Is Ethical Hacking? . . . . . . . . . . . . . . . . . . .Penetration Testing . . . . . . . . . . . . . . . . .Military and Espionage . . . . . . . . . . . . . .Why Hackers Use Linux . . . . . . . . . . . . . . . . . . . .Linux Is Open Source . . . . . . . . . . . . . . .Linux Is Transparent . . . . . . . . . . . . . . . .Linux Offers Granular Control . . . . . . . . .Most Hacking Tools Are Written for Linux .The Future Belongs to Linux/Unix . . . . . . .Downloading Kali Linux . . . . . . . . . . . . . . . . . . . .Virtual Machines . . . . . . . . . . . . . . . . . . . . . . . . .Installing VirtualBox . . . . . . . . . . . . . . . .Setting Up Your Virtual Machine . . . . . . .Installing Kali on the VM . . . . . . . . . . . . .Setting Up Kali . . . . . . . . . . . . . . . . . . . . . . . . . .xxiixxiiixxiiixxiiixxivxxivxxivxxivxxivxxiv. xxvxxvixxvixxviixxixxxxi1Getting Started with the BasicsIntroductory Terms and Concepts . . . . . . . . . . . . . . . . . . .A Tour of Kali . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The Terminal . . . . . . . . . . . . . . . . . . . . . . . . . . .The Linux Filesystem . . . . . . . . . . . . . . . . . . . . . .Basic Commands in Linux . . . . . . . . . . . . . . . . . . . . . . . . .Finding Yourself with pwd . . . . . . . . . . . . . . . . . .Checking Your Login with whoami . . . . . . . . . . . .Navigating the Linux Filesystem . . . . . . . . . . . . . .Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . .Referencing Manual Pages with man . . . . . . . . . .Finding Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Searching with locate . . . . . . . . . . . . . . . . . . . . .Finding Binaries with whereis . . . . . . . . . . . . . . .Finding Binaries in the PATH Variable with which .Performing More Powerful Searches with find . . . .Filtering with grep . . . . . . . . . . . . . . . . . . . . . . .Modifying Files and Directories . . . . . . . . . . . . . . . . . . . . .Creating Files . . . . . . . . . . . . . . . . . . . . . . . . . .Creating a Directory . . . . . . . . . . . . . . . . . . . . . .Copying a File . . . . . . . . . . . . . . . . . . . . . . . . . .1. 1. 3. 4. 4. 5. 6. 6. 6. 8. 9. 9101010111213131515

Renaming a File . . . . .Removing a File . . . . .Removing a Directory .Go Play Now! . . . . . . . . . . . .Exercises . . . . . . . . . . . . . . . .2Text Manipulation19Viewing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Taking the Head . . . . . . . . . . . . . . . . . . . . . . . .Grabbing That Tail . . . . . . . . . . . . . . . . . . . . . . .Numbering the Lines . . . . . . . . . . . . . . . . . . . . . .Filtering Text with grep . . . . . . . . . . . . . . . . . . . . . . . . . .Hacker Challenge: Using grep, nl, tail, and head .Using sed to Find and Replace . . . . . . . . . . . . . . . . . . . . .Viewing Files with more and less . . . . . . . . . . . . . . . . . . . .Controlling the Display with more . . . . . . . . . . . . .Displaying and Filtering with less . . . . . . . . . . . . .Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3Analyzing and Managing Networks.4Adding and Removing Softwarexii   Contents in Detail.20202122222323242525262729Analyzing Networks with ifconfig . . . . . . . . . . . . . . . . . . . . . .Checking Wireless Network Devices with iwconfig . . . . . . . . . .Changing Your Network Information . . . . . . . . . . . . . . . . . . . .Changing Your IP Address . . . . . . . . . . . . . . . . . . . .Changing Your Network Mask and Broadcast Address .Spoofing Your MAC Address . . . . . . . . . . . . . . . . . .Assigning New IP Addresses from the DHCP Server . . .Manipulating the Domain Name System . . . . . . . . . . . . . . . . .Examining DNS with dig . . . . . . . . . . . . . . . . . . . . . .Changing Your DNS Server . . . . . . . . . . . . . . . . . . .Mapping Your Own IP Addresses . . . . . . . . . . . . . . .Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Using apt to Handle Software . . . . . . . . . . .Searching for a Package . . . . . . . .Adding Software . . . . . . . . . . . . .Removing Software . . . . . . . . . . .Updating Packages . . . . . . . . . . .Upgrading Packages . . . . . . . . . .Adding Repositories to Your sources.list File .Using a GUI-based Installer . . . . . . . . . . . .Installing Software with git . . . . . . . . . . . . .Summary . . . . . . . . . . . . . . . . . . . . . . . . .Exercises . . . . . . . . . . . . . . . . . . . . . . . . 424345464747

5Controlling File and Directory PermissionsDifferent Types of Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Granting Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Granting Ownership to an Individual User . . . . . . . . . . .Granting Ownership to a Group . . . . . . . . . . . . . . . . . .Checking Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Changing Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Changing Permissions with Decimal Notation . . . . . . . . .Changing Permissions with UGO . . . . . . . . . . . . . . . . . .Giving Root Execute Permission on a New Tool . . . . . . . .Setting More Secure Default Permissions with Masks . . . . . . . . . . .Special Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Granting Temporary Root Permissions with SUID . . . . . . .Granting the Root User’s Group Permissions SGID . . . . . .The Outmoded Sticky Bit . . . . . . . . . . . . . . . . . . . . . . . .Special Permissions, Privilege Escalation, and the Hacker .Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49.6Process ManagementViewing Processes . . . . . . . . . . . . . . . . . . . . . . .Filtering by Process Name . . . . . . . . . . .Finding the Greediest Processes with top .Managing Processes . . . . . . . . . . . . . . . . . . . . .Changing Process Priority with nice . . . .Killing Processes . . . . . . . . . . . . . . . . .Running Processes in the Background . . .Moving a Process to the Foreground . . . .Scheduling Processes . . . . . . . . . . . . . . . . . . . . .Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . .505050515152525455565757585858606061.

hacking, cybersecurity, and pentesting, Linux Basics for Hackers is an excellent first step. Using Kali Linux, an advanced penetration testing distribution of Linux, you’ll learn the basics of using the Linux operating system and acquire the tools and techniques you’ll need to take control of a Linux environment.

Related Documents:

Applications of traditional scripting languages are: 1. system administration, 2. experimental programming, 3. controlling applications. Application areas : Four main usage areas for scripting languages: 1. Command scripting languages 2.Application scripting languages 3.Markup language 4. Universal scripting languages 1.

The main features of php is; it is open source scripting language so you can free download this and use. PHP is a server site scripting language. It is open source scripting language. It is widely used all over the world. It is faster than other scripting language. Some important features of php are given below; Features of php

Server Side Scripting merupakan sebuah teknologi scripting atau pemrograman web dimana script (program) dikompilasi atau diterjemahkan di server. Dengan server side scripting, memungkinkan untuk menghasilkan halaman web yang dinamis. Beberapa contoh Server Side Scripting (Programming) : 1. ASP (Active Server Page) dan ASP.NET 2.

User Guide - Scripting 30 June, 2017 Scripting Enterprise Architect's scripting environment is a flexible and easy to use facility that supports both Javascript and the Microsoft scripting languages JScript and VBScript. When any scri

Shell, Unix lesystem, basic tools Combining tools/commands (pipe'ing) Advanced tools Regular expressions Stream manipulation Scripting Shell scripting Python scripting Instructor: Bruno Abrahao CS2043 - Unix Tools & Scripting. What are scripts? Programs written for a special run-time environment that can

Biacore T200 Getting Started 28-9840-98 Edition AB 5 Biacore T200 Getting Started Biacore T200 Getting Started Introduction This Getting Started handbook is designed as a self-study guide to introduce you to the basic operations of BiacoreTM T200, Biacore T200 Control Software and Biacore T200 Evaluation Software.

Tool: Sample Observation Techniques Focus Technique Student involvement Verbal flow At task Sampling Overview/scripting Tally marks Individualized instruction Class traffic Sampling Overview/scripting Tally marks Levels of student thinking Selective verbatim Overview/scripting Tally marks Teacher talk/behavior Selective verbatim Overview/scripting Tally marks Classroom climate Verbal flow .

However, if you write your Java application in a scripting language, then you lose the benefits of the Java language (such as type safety and access to the class library). Java Specification Request (JSR) 223: Scripting for the Java Platform addresses the issue of integrating Java and scripting languages. It defines a standard framework and