Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

LINUX knowledge – Pen Testing Course

Link: https://www.youtube.com/watch?v=3Kq1MIfTWCE

GitHub and resources:

https://github.com/hmaverickadams/Beginner-Network-Pentesting

https://app.cybrary.it/immersive/10994631/activity/7212

https://www.codecademy.com/learn/learn-python

It’s 14 hours and 51 minutes course.


Table of Contents
Lesson 1.............................................................................................................................3

Information
Questions that I’m doing for myself because I don’t know how I will take this straight
away. I don’t know if I can wrap this around my head. So, these are the questions:
 How many days it will take me to end it?
 How can I understand this course?
 How will I study?
 It this a complement to the course that I’m taking in netcad, or this will take me
to investigate more intel?
 Will I finish this course?
Lesson 1:

- Taking notes
*take notes with a lot of child patches
*always screenshot
*Be organized

- Linux
Navigation Commands:
*passwd - change password
*ls = list directory (Can point at any point on the machine) (-la a flag that lists
all + permissions and hidden files)
*pwd - print working directory - check where I am at
*cd - change directory (Can address at any point on the machine)
*mkdir - make directory
*rmdir - remove a directory
*rm - remove files
*echo sends data (if not destination is given the echo will print the data to the
terminal)
*cp - copy a file (source] [destination])
*mv - move a file ([source] [destination])
*locate - locate a file (locate [filename])
*updatedb - updates the directory database (must run this before running locate)
*man - manual page of any command
*grep - search for the following words (can be used to check if a file contains
specific info)

**Linux is case sensitive so be aware of your capital letters!


** ./ - your directory right now
** ../- previous folder
** ~ - the root of the system
** | - pipe the output of one command into the next command after the |
** > - use the command on the following file (Overwrite previous information
that was in the file)
** >> - use the command on the following file (Add the information to the
previous information that was in the file)

:
*cat - reads a file to the terminal
*chmod - change permissions for a file (perms go from level 0 - 7 and are typed
with 3 number for (user group everyone) for a detailed explanation on Linux
permissions visit the node “Linux perms” (+x executes perms))
*adduser - make a new user
*sudo - give root permissions to the next command (sudo ..... [the command])
*su - switch user

Network Commands:
*ifconfig - print network information
*iwconfig - wireless network information
*ping - ping an ip address (-c flag let’s you say how much times you want to
ping a machine)
*arp -a - send out an arp request to check for machines on the network
*netstat -a - shows all open ports and what is connected to those ports
*route - shows a routing table

Viewing Creating and Editing Commands:


*history - lists the 15 commands you entered ((history | grep [command]) this
command shows you all the times you run a command on the machine (including
syntax))
*touch - create a file
*nano - use the nano text editor
*apt-get install [program name] - install a program on the machine (can be run
without the install)
*apt install - install a file from the system / kali - server
apt purge *program name - (You must use the * *) removes everything that has
to do with a certain program
*pip install - run an installer for local files
*git clone - clone a GitHub repository (This is a plugin and does not come
preinstalled on most Linux distros!)

Webserver Commands:
*service apache2 start - start a webserver
*service ssh start - start a ssh server
*service PostgreSQL start - a service that starts with Metasploit
*service apache2 stop - stops the webserver
*systemctl enable [program name] - start the service when the machine turns on

Important files/Directories in Linux:


*/etc/passwd - a file that stores all the users in the system
*/etc/shadow - stores all the passwords in the system
*/var/log/auth.log - authentication reports
Lesson 2:

-Python Basics:
*if you write a python script in a normal text editor (not an ide) your program
should start with “#!/bin/ python3” to point at the fact that we are using python.
*print - print(string) - prints to the terminal (string must be with “” or ‘’)
Math Operators:
* + - add
* - - subtract
* * - multiply
* / - divide
* ** - exponent - power of
* % - modulo - the remainder of a division
* // - number without leftovers - cleans a number - float -> int
* += - add a number into the already existing value in the variable
* -= - subtract a number from an the already existing value in the variable
String Methods:
* len - len([var name]) checks the length of a variable
* upper - [var].upper() - Capitalizes the letters in the variable
* lower - [var].lower() - returns the letters to normal (reverse capitalization)
* title - [var].title() - Capitalizes the first letter of every word in a variable
Declaring Variables:
data also means variables!
* [name] = [data] - This type of declaration will automatically set the type of the
variable
* [name] int([data]) - This type of declaration will set the var type to int
* [name] float([data]) - This type of declaration will set the var type to float
* [name] str([data]) - type of declaration will set the var type to String.
* To convert a variable to a different type you can just use [type]([data])
example:
heya int(29)
str(heya)
print(heya)

output: 29 // the print command can only print strings


* type(data) - return the type of variable the data / variable entered is
** Int variables does not round up or down they just use the first whole number
available for example - 29.8 -> 29.
Functions:
*def [name of the function] ([function input variable]): - defining a function
*return [var or operation or value resulting code] - return gives the information
back to the program after the function has ended.
** when defining a function input (A parameter) you use the name of the
variable inside the function to access that value.
** You can add multiple parameters into a function.
Boolean Expressions:
True expressions:
bool1 = True
bool2 = 3*3 == 9
False expressions:
bool3 = False
bool4 = 3*3 != 9
Relational and Logical operators:
Relational:
> - greater then
< - less then
>= - greater then equal to
<= - less then equal to
Logical:
and - both statements must be true
or - one of operators must be true (or both true)
not - Inverts the Boolean value
Conditional Statements:
if [Condition]: - check if the Condition is true and if yes executes the code
below
else - executes the code below if the statement of the if is not true
elif - can come between an if and an else statement as another condition to
check if the if is not true
** there are no switch statements in python
Lists:
* [name of the list] = [[value1], [value 2], [value 3[ ....]
* [name of the list]. append([data]) - will add the data to the end of the list
* [name of the list].pop() - will remove the last piece of data in the list (or a
certain place in the list if given data inside the () of what place to remove)
* zip([list 1] , [list 2]) - will combine the two lists and save the values in the
same place , data 0 of list 1 will be stored with data 0 of list 2 in the following way:
([data 0], [data 0]).

**lists count from 0 - ... so to print the second value we use [name][1]
** we can call multiple values by calling out +1 more value then we want. for
example, to print value 1 and 2 we will use [name][0:2] this will print 0 and 1.
** we can print the entire list from a certain point up to (or down to) the entire
list by not giving a value. [0:] or [ :3] this will print all the list or everything up to the
4th item.
** negative items (-1) will pull the last item in the list
Tuples:
**A tuple is like a list but cannot be modified.
** to make a tuple you need to use () instead of [] in a list
Loops:
For Loops:
for [variable] in [Something with value (can be a list, variable....): - This
loop will add 1 to the first variable until it reaches the end of the second variable (print
all the list, all the numbers in an int...)
While loop:
while [statement]: - this loop will execute if the statement is true

You might also like