Transcription of Linux Basics for Hackers - ihatefeds.com
1 Linux Basics FOR HACKERSG etting Started with Networking, Scripting, andSecurity in Kaliby OccupyTheWebSan FranciscoLINUX Basics FOR Hackers . Copyright 2019 by rights reserved. No part of this work may be reproduced or transmitted in any form or byany means, electronic or mechanical, including photocopying, recording, or by any informationstorage or retrieval system, without the prior written permission of the copyright owner and : 1-59327-855-1 ISBN-13: 978-1-59327-855-7 Publisher: William Pollock Production Editors: Serena Yang and Meg Sneeringer Cover Illustration: Josh Ellingson Interior Design: Octopod Studios Developmental Editor: Liz Chadwick Technical Reviewer: Cliff Janzen Copyeditor.
2 Barton D. Reed Compositors: Serena Yang and Meg Sneeringer Proofreader: Paula L. Fleming Indexer: JoAnne BurekFor information on distribution, translations, or bulk sales, please contact No Starch Press, : No Starch Press, Inc. 245 8th Street, San Francisco, CA 94103 phone: ; 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.
3 , [2018]. Identifiers: LCCN 2018030544 (print) | LCCN 2018032646 (ebook) | ISBN 9781593278564 (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 (ebook) | LCC O325 2018 (print) | DDC LC record available at Starch Press and the No Starch Press logo are registered trademarks of No Starch Press,Inc.
4 Other product and company names mentioned herein may be the trademarks of theirrespective owners. Rather than use a trademark symbol with every occurrence of a trademarkedname, we are using the names only in an editorial fashion and to the benefit of the trademarkowner, with no intention of infringement of the information in this book is distributed on an As Is basis, without warranty. While everyprecaution has been taken in the preparation of this work, neither the author nor No StarchPress, Inc. shall have any liability to any person or entity with respect to any loss or damagecaused or alleged to be caused directly or indirectly by the information contained in dedicate this book to my three incredible daughters.
5 You mean the world to the AuthorOccupyTheWeb (OTW) is the pseudonym for the founder and primarywriter for the hacker and pentester training website, He is a former college professor and has over 20 years ofexperience in the information technology industry. He has trainedhackers throughout the US, including branches of the US military(Army, Air Force, and Navy) and the US intelligence community (CIA,NSA, and DNI). He is also an avid mountain biker and snow the Technical ReviewerSince the early days of Commodore PET and VIC-20, technology hasbeen a constant companion (and sometimes an obsession!)
6 To CliffJanzen. Cliff discovered his career passion when he moved toinformation security in 2008 after a decade of IT operations. Sincethen, Cliff has had the great fortune to work with and learn from someof the best people in the industry including OccupyTheWeb and thefine people at No Starch during the production of this book. He ishappily employed as a security consultant, doing everything from policyreview to penetration tests. He feels lucky to have a career that is alsohis favorite hobby and a wife that supports CONTENTSA cknowledgmentsIntroductionChapter 1: Getting Started with the BasicsChapter 2: Text ManipulationChapter 3: Analyzing and Managing NetworksChapter 4: Adding and Removing SoftwareChapter 5: Controlling File and Directory PermissionsChapter 6: Process ManagementChapter 7: Managing User Environment VariablesChapter 8: Bash ScriptingChapter 9: Compressing and ArchivingChapter 10: Filesystem and Storage Device ManagementChapter 11.
7 The Logging SystemChapter 12: Using and Abusing ServicesChapter 13: Becoming Secure and AnonymousChapter 14: Understanding and Inspecting Wireless NetworksChapter 15: Managing the Linux Kernel and Loadable Kernel ModulesChapter 16: Automating Tasks with Job SchedulingChapter 17: Python Scripting Basics for HackersIndexCONTENTS IN DETAILACKNOWLEDGMENTSINTRODUCTIONWhat s in This BookWhat Is Ethical Hacking?Penetration TestingMilitary and EspionageWhy Hackers Use LinuxLinux Is Open SourceLinux Is TransparentLinux Offers Granular ControlMost Hacking Tools Are Written for LinuxThe Future Belongs to Linux /UnixDownloading Kali LinuxVirtual MachinesInstalling VirtualBoxSetting Up Your Virtual MachineInstalling Kali on the VMSetting Up Kali1 GETTING STARTED WITH THE BASICSI ntroductory Terms and ConceptsA Tour of KaliThe TerminalThe Linux FilesystemBasic Commands in LinuxFinding Yourself with pwdChecking Your Login with
8 WhoamiNavigating the Linux FilesystemGetting HelpReferencing Manual Pages with manFinding StuffSearching with locateFinding Binaries with whereisFinding Binaries in the PATH Variable with whichPerforming More Powerful Searches with findFiltering with grepModifying Files and DirectoriesCreating FilesCreating a DirectoryCopying a FileRenaming a FileRemoving a FileRemoving a DirectoryGo Play Now!Exercises2 TEXT MANIPULATIONV iewing FilesTaking the HeadGrabbing That TailNumbering the LinesFiltering Text with grepHacker Challenge: Using grep, nl, tail.
9 And headUsing sed to Find and ReplaceViewing Files with more and lessControlling the Display with moreDisplaying and Filtering with lessSummaryExercises3 ANALYZING AND MANAGING NETWORKSA nalyzing Networks with ifconfigChecking Wireless Network Devices with iwconfigChanging Your Network InformationChanging Your IP AddressChanging Your Network Mask and Broadcast AddressSpoofing Your MAC AddressAssigning New IP Addresses from the DHCP ServerManipulating the Domain Name SystemExamining DNS with digChanging Your DNS ServerMapping Your Own IP AddressesSummaryExercises4 ADDING AND REMOVING SOFTWAREU sing apt to Handle SoftwareSearching for a PackageAdding SoftwareRemoving SoftwareUpdating PackagesUpgrading PackagesAdding Repositories to Your FileUsing a GUI-based InstallerInstalling Software with gitSummaryExercises5 CONTROLLING FILE AND DIRECTORY PERMISSIONSD ifferent Types of UsersGranting PermissionsGranting Ownership to an Individual UserGranting Ownership to a GroupChecking PermissionsChanging PermissionsChanging Permissions with Decimal
10 NotationChanging Permissions with UGOG iving Root Execute Permission on a New ToolSetting More Secure Default Permissions with MasksSpecial PermissionsGranting Temporary Root Permissions with SUIDG ranting the Root User s Group Permissions SGIDThe Outmoded Sticky BitSpecial Permissions, Privilege Escalation, and the HackerSummaryExercises6 PROCESS MANAGEMENTV iewing ProcessesFiltering by Process NameFinding the Greediest Processes with topManaging ProcessesChanging Process Priority with niceKilling ProcessesRunning Processes in the BackgroundMoving a Process to the ForegroundScheduling ProcessesSummaryExercises7 MANAGING USER ENVIRONMENT VARIABLESV iewing and Modifying Environment VariablesViewing All Environment VariablesFiltering for Particular VariablesChanging Variable Values for a SessionMaking Variable Value Changes