Advertisement
Mukezh

Session Linux Basics

Feb 17th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.58 KB | None | 0 0
  1. Linux Basics
  2. Introducation to Wordlist Generator
  3. Introduction to Pentesting OS
  4. __________________________________________________
  5.  
  6. Garry Kildal-The man Who could have been bill gates
  7.  
  8. https://www.youtube.com/watch?v=sDIK-C6dGks
  9.  
  10.  
  11. Linux
  12. _____________________
  13. linus Torvald
  14. =============
  15. He created linux OS. Kernel ---> deploy.
  16. Open source. --> Any one can download, modify it and upload it. And can be used for our own purpose.
  17.  
  18. Kernel ---> Modify ---> Publish --> Copyright
  19. Linux Kernel ----> Modify ----> Networking ----> Red Hat
  20. Linux Kernel ----> Modify ----> Application Dev. ----> Fedora
  21.  
  22. Linux Kernel ----> GUI ---> User Friendly ----> Ubuntu
  23.  
  24. File Architecture
  25. ------------------
  26. There are pre defined folder with their pre defined functionalities.
  27.  
  28. 1. root --> /
  29. 2. etc --> Configuration Folder
  30. It containes all the configuration files
  31. .conf
  32. 3. bin --> binary folder
  33. It contains all the binary file of the linux terminal commands.
  34. 4. Proc --> Process Folder
  35. It contains all the process files
  36. up-time
  37. time-stat
  38. 5. Media --> Devices ---> storage Media
  39. 6. VAR --> Variable Folder
  40. Files jinka size static nahi hota. The size of the file keeps on increasing.
  41. temp
  42. log
  43. mail
  44. server
  45. 7. dev --> Device Folder
  46. ----> Devices which are currently used by the machine and the OS.
  47. 8. Home ---> Users ---> contains all the user's data and files
  48.  
  49. Linux always treats everything as a file.
  50.  
  51. Some Basic Commands
  52. ===================
  53. cd---> change directory
  54.  
  55. ls---> list directory
  56.  
  57. man--> to get the manual of a command
  58.  
  59. mkdir--> to make a directory in linux
  60.  
  61. cp--> copy a file to another folder
  62.  
  63. mv---> move a file to another location
  64.  
  65. rm --> to remove a file only
  66.  
  67. rmdir---> remove directory
  68.  
  69. cat --> to read the contents of the file
  70.  
  71. locate --> to locate the specific file----> kisi bhi file ok dhundo
  72.  
  73. echo --> to print something on the terminal
  74.  
  75. date --> for viewing the current date and time
  76.  
  77. cal -->calendar -----------------------------------------------------------------------------
  78. -------
  79. Chmod->Change mod
  80. permissions
  81. r=4
  82. w=2
  83. x=1
  84.  
  85. 4+2+1=7
  86. root saunder user&group
  87. -rwx-r-
  88. chmod 7 amitstudhackers.p
  89.  
  90. Crunch
  91. man crunch
  92.  
  93. Crunch minlength maxlength charaterset options
  94.  
  95. @-lower case charaterset
  96. ,-upper case characterset
  97. %-numbers
  98. ^-symbols
  99. -t specificying pattern
  100.  
  101. crunch 10 10 1234567890 -t 99999%%%%% -o /root/Desktop/file.txt
  102.  
  103. Introduction to Linux Basics
  104. ====================
  105.  
  106. Linux word derived and evolved from UNIX.
  107. Unix was the first operating system came to existence with CLI environment and mainly used for server side working as per today's requirements. It is the most flexible and customizable OS used by skilled individuals.It is an open source
  108. Like INDIA has its own linux based operating system i.e. BOSS.
  109. Its a myth that linux based system are purely Command based like now we can see that like ubuntu or any other version have its GUI
  110.  
  111. Advantages of using Linux OS
  112. =============================
  113. It is very secure compared to windows as to even implement a malware most of the time it need to be run seperately not like a windows just al click and a program executed.
  114.  
  115.  
  116. Unix : Server Side OS
  117. File Extension : .tar.gz and other compressed packages
  118. Popular OS : Red Hat, Fedora, CENT OS, MAC OS etc.
  119.  
  120. Linux : Is derived from Unix and to engage more users (simple users) Linux was developed under a open source community began in 1991 and hence is the most popular non commercial os on the planet.
  121.  
  122. File Extension : .tar.gz , .deb etc.
  123. Popular OS : Ubuntu Flavours, Linux Mint, Kali OS etc.
  124.  
  125.  
  126. INTRODUCTION TO PENTESTING OS - KALI
  127. =====================================
  128. 1. Virtual Box (Vmware)
  129. 2. Kali Linux (Image download : kali.org)
  130. 3. Run it LIVE
  131. 4. Shutdown
  132.  
  133.  
  134. = Installation of Kali Linux.
  135. During the installation one will encounter several issues :
  136. Unable to boot from CD-DVD rom
  137. setting a SWAP memory -> needs to be approx twice of ram installed
  138. Grub installation.
  139. etc.. etc..
  140. Then after installation we will first update the repositories
  141. by going to the directory
  142. #cd /etc/apt
  143. Now go to kali official documentation pag and copy the repository
  144. copy the content to soureces.list
  145. # nano sources.list
  146. # apt-get update
  147. # apt-get upgrade
  148. ----------------------------------------------------------------------------------------------------------------------------
  149.  
  150. DIRECTORIES ARCHITECTURE IN LINUX
  151. ==================================
  152.  
  153. 1. /root : This is known as the home directory for the root user. Every single file path in Linux begins from root in one way or another.
  154.  
  155. 2. /bin : Binary folder, this is where most of your binary files are stored, typically for the Linux terminal commands and core utilities,
  156.  
  157. 3. /boot : This is where all the needed files for Linux to boot are kept which helps in loading the operating system.
  158.  
  159. 4. /dev : This is where your physical devices are mounted, devices are those whenever we insert a USB, or any other device via peripheral ports they always go in dev folder.
  160.  
  161. 5. /etc : Configuration files specific to the machine are stored in the "/etc" folder. Configuration files of each and every thing present in the linux is stated as “.conf”
  162. extensions.
  163.  
  164. 6. /home : It is like the "Users" folder in Windows os. The Desktop, Documents, Downloads, Photos, and Videos folders are all stored under the /home/username directory of every particular user.
  165.  
  166. 7. /lib : This is where libraries are kept which are having basic utility files of the operations performed in the OS.
  167.  
  168. 8. /proc : This includes a directory for each running process, including kernel processes, in directories named /proc/PID, where PID is the process number for every processes.
  169.  
  170. 9. /media : Removable Media Devices Folder. It is a place where external devices such as USB drives can be mounted. it holds and mounts the external devices attached to the devices
  171.  
  172. 10. /mnt : This is basically a placeholder folder used for mounting other folders or drives. When we want to mount or place any internal drive or folder in the operating system we will use "/mnt" folder.
  173.  
  174. 11. /usr : Contains files and utilities that are shared between users. This folder is use for sharing data and other stuffs between two different users on the same OS.
  175.  
  176. Basic Commands of Linux
  177. =======================
  178.  
  179. 1. cd: Changes directories.
  180.  
  181. 2. ls : List directory
  182.  
  183. 3. man : To get the manual page of any command or tool.
  184.  
  185. 4. mkdir : To make a directory in linux
  186.  
  187. 5. cp : Copy a file to another folder
  188.  
  189. 6. mv : Move a file to another location
  190.  
  191. 7. rm : To remove a file only.
  192.  
  193. 8. rmdir : Remove Directory.
  194.  
  195. 9. grep : To check whether a particular word is in a perticular file or not
  196.  
  197.  
  198. 10. cat : To read the contents of the file.
  199.  
  200. 11. locate : To locate the specific file.
  201.  
  202. 12. echo : For printing something on the terminal.
  203.  
  204. 13. date : For viewing the current date and time
  205.  
  206. 14. cal : For finding the Calendar.
  207.  
  208. 15. uname : Finding out your OS Version.
  209.  
  210. 16. uname -a : Finding out all the information of the OS. Like User Information, OS Information etc.
  211.  
  212. 17. init 0 : Shutting down the OS.
  213.  
  214. 18. reboot : Restarting the OS.
  215.  
  216. 19. Starting a Python Server : python -m SimpleHTTPServer 4444(Port Number)
  217. Any machine who is connected to a particular router of that network can share any content of that machine in which a server is starting on. To stop the Server, Ctrl+C .
  218.  
  219. 20. sudo : Sudo allows a system admin to give certain users the ability to run some (or all) commands at the root level and logs all commands and arguments.
  220.  
  221. 21. ifconfig : Interface configuration and details
  222.  
  223. 22. iwconfig : Wireless Configuration and details
  224.  
  225. 23. route -n : Gateway IP Details
  226.  
  227. 24. apt-get install applicationname : Installation of Application through terminal.
  228.  
  229. 25. gunzip filename.tar.gz | .zip : For unzipping the file.
  230.  
  231. 26. gedit filename.txt : Text Editor
  232.  
  233. 27. leafpad filename.txt : Text Editor
  234.  
  235. 28. vi fulename.txt
  236.  
  237. there are multiple editors present in a Linux based system which gives you several interface to edit a file.
  238.  
  239.  
  240. Understanding Privileges and Permissions
  241. ========================================
  242.  
  243. 1. Read - a readable permission allows the contents of the file to be viewed. A read permission on a directory allows you to list the contents of a directory.
  244. 2. Write - a write permission on a file allows you to modify the contents of that file. For a directory, the write permission allows you to edit the contents of a directory.
  245. 3. Execute - for a file, the executable permission allows you to run the file and execute a program or script. For a directory, the execute permission allows you to change to a different directory and make it your current working directory.
  246.  
  247. = Command : "ls -al" - Show Privileges
  248.  
  249. drwxr-xr-x 7 prabhankartripathi staff 224 Jun 13 17:29 .xdman
  250.  
  251. d -> directory if its a file then it will be like -
  252.  
  253. In this example, the file owner has read and write permissions only.
  254. - The first three characters (rwx) define the owner’s permission to the file.
  255. - The next three characters (r-x) are the permissions for the members of the same group as The file owner (which in this example is read only).
  256. - The last three characters (r-x) show the permissions for all other users and in this example it is read only.
  257.  
  258.  
  259. Command "chmod" : chmod changes the permissions of each given file according to mode, where mode describes the permissions to modify.
  260.  
  261. Syntax : "chmod 754 filename"
  262.  
  263. 4 stands for "read",
  264. 2 stands for "write",
  265. 1 stands for "execute",
  266. and 0 stands for "no permission."
  267.  
  268. Here,
  269. 7 is the combination of permissions 4+2+1 (read, write, and execute)
  270. 5 is 4+0+1 (read, no write, and execute)
  271. and 4 is 4+0+0 (read, no write, and no execute)
  272.  
  273.  
  274. ---------------------------------------------------------------------------------------------------------------------------
  275.  
  276. WORDLISTS GENERATOR
  277. ===================
  278.  
  279. Tool = Crunch
  280.  
  281. Usage Syntax -
  282.  
  283. Crunch Min.Value Max.Value Characters
  284.  
  285. Example - crunch 4 4 0123456789
  286.  
  287. For saving it to a file : crunch 4 4 0123456789 > filename.txt
  288.  
  289. now if I want to generate a file with some specific characters in a word we can go like
  290. crunch 9 9 -t ^%hello%%
  291.  
  292.  
  293. ----------------------------------------------------------------------------------------------------------------------------
  294.  
  295. OWASP ZAP - LINUX TOOL
  296. ======================
  297. The OWASP ZAP (ZAP) tool is one of the most popular free penetration testing tool. It can help you automatically find security vulnerabilities in your web applications while for experienced pentesters to use for manual security testing. The main goal is to allow easy penetration testing to find vulnerabilities in web applications.
  298.  
  299. ZAP tool in Kali Linux.
  300.  
  301. Steps
  302. =====
  303. 1. Adding the Target site to the testing scope.
  304. 2. Setting up Proxy for ZAP. - ZAP tool > Tools Menu > Options > Local Proxy > Change Address = 127.0.0.1 Port = 8080.
  305. Setting up the Proxy in the Browser : Mozilla browser > Tools Menu > Options > Advanced tab > Network > Settings > Select Manual Proxy configuration:- HTTP Proxy = 127.0.0.1 Port = 8080.
  306. 3. Attacking on the Websites through ZAP.
  307. 4. Saving the ZAP Session.
  308. 5. Generating Report = ZAP tool > Report > Generate HTML report > Save and share the report.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement