joemccray

Quick Linux

Jan 4th, 2021 (edited)
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.07 KB | None | 0 0
  1. #############################
  2. ############################## # Day 1: Linux Fundamentals # ##############################
  3. #############################
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12. #####################################################
  13. # 2021 Intro to Linux & Comptia Linux+ Exam Prep #
  14. # By Joe McCray #
  15. #####################################################
  16.  
  17. - Here is a good set of slides for getting started with Linux:
  18. http://www.slideshare.net/olafusimichael/linux-training-24086319
  19.  
  20.  
  21. - Here is a good tutorial that you should complete before doing the labs below:
  22. http://linuxsurvival.com/linux-tutorial-introduction/
  23.  
  24.  
  25. site: https://app.shellngn.com/
  26. pass: P@ssw0rd123!@#123
  27.  
  28.  
  29. NOTE: Ask me for the correct password
  30.  
  31.  
  32. ########################
  33. # Basic Linux Commands #
  34. ########################
  35.  
  36. ---------------------------Type This-----------------------------------
  37. cd ~
  38.  
  39. pwd
  40.  
  41. whereis pwd
  42.  
  43. which pwd
  44.  
  45. sudo find / -name pwd
  46.  
  47. /bin/pwd
  48.  
  49. cd ~/students/
  50.  
  51. mkdir yourname <---- replace 'yourname' with your first name in lowercase with no spaces or special characters please
  52.  
  53. cd yourname <---- replace 'yourname' with your first name in lowercase with no spaces or special characters please
  54.  
  55. touch one two three
  56.  
  57. ls -l t (without pressing the Enter key, press the Tab key twice. What happens?)
  58.  
  59. h (and again without pressing the Enter key, press the Tab key twice. What happens?)
  60.  
  61. Press the 'Up arrow key' (What happens?)
  62.  
  63. Press 'Ctrl-A' (What happens?)
  64.  
  65. ls
  66.  
  67. clear (What happens?)
  68.  
  69. echo one > one
  70.  
  71. cat one (What happens?)
  72.  
  73. man cat (What happens?)
  74. q
  75.  
  76. cat two
  77.  
  78. cat one > two
  79.  
  80. cat two
  81.  
  82. cat one two > three
  83.  
  84. cat three
  85.  
  86. echo four >> three
  87.  
  88. cat three (What happens?)
  89.  
  90. wc -l three
  91.  
  92. man wc
  93. q
  94.  
  95. info wc
  96. q
  97.  
  98. cat three | grep four
  99.  
  100. cat three | grep one
  101.  
  102. man grep
  103. q
  104.  
  105.  
  106. man ps
  107. q
  108.  
  109. ps
  110.  
  111. ps aux
  112.  
  113. ps aux | less
  114.  
  115. Press the 'Up arrow key' (What happens?)
  116.  
  117. Press the 'Down arrow key' (What happens?)
  118. q
  119.  
  120. top
  121. q
  122. -----------------------------------------------------------------------
  123.  
  124.  
  125. #########
  126. # Files #
  127. #########
  128. ---------------------------Type This-----------------------------------
  129. cd ~
  130.  
  131. pwd
  132.  
  133. cd ~/students/yourname/
  134.  
  135. pwd
  136.  
  137. ls
  138.  
  139. mkdir LinuxBasics
  140.  
  141. cd LinuxBasics
  142.  
  143. pwd
  144.  
  145. ls
  146.  
  147. mkdir files
  148.  
  149. touch one two three
  150.  
  151. cp one files/
  152.  
  153. ls files/
  154.  
  155. cd files/
  156.  
  157. cp ../two .
  158.  
  159. ls
  160.  
  161. cp ../three .
  162.  
  163. ls
  164.  
  165. tar cvf files.tar *
  166.  
  167. ls
  168.  
  169. gzip files.tar
  170.  
  171. ls
  172.  
  173. rm -rf one two three
  174.  
  175. ls
  176.  
  177. tar -zxvf files.tar.gz
  178.  
  179. rm -rf files.tar.gz
  180.  
  181. zip data *
  182.  
  183. unzip -l data.zip
  184.  
  185. mkdir /tmp/yourname/
  186.  
  187. unzip data.zip -d /tmp/yourname/
  188. -----------------------------------------------------------------------
  189.  
  190.  
  191.  
  192. ############
  193. # VIM Demo #
  194. ############
  195. ---------------------------Type This-----------------------------------
  196. cd ~/students/yourname/LinuxBasics
  197.  
  198. mkdir vimlesson
  199.  
  200. cd vimlesson
  201.  
  202. vi lesson1.sh
  203.  
  204. i (press "i" to get into INSERT mode and then paste in the lines below)
  205.  
  206. #!/bin/bash
  207.  
  208. echo "This is my first time using vi to create a shell script"
  209. echo " "
  210. echo " "
  211. echo " "
  212. sleep 5
  213. echo "Ok, now let's clear the screen"
  214. sleep 3
  215. clear
  216.  
  217.  
  218. ---------------don't put this line in your script----------------------------
  219.  
  220. ESC (press the ESC key to get you out of INSERT mode)
  221.  
  222. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  223.  
  224.  
  225. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  226.  
  227.  
  228.  
  229. vi lesson1.sh
  230.  
  231. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  232.  
  233. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  234.  
  235. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  236.  
  237.  
  238.  
  239.  
  240. vi lesson1.sh
  241.  
  242. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  243.  
  244. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  245.  
  246.  
  247. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  248.  
  249. /echo (typing "/echo" immediately after SHIFT: will search the file for the word echo).
  250.  
  251. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  252.  
  253. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  254.  
  255.  
  256.  
  257.  
  258. vi lesson1.sh
  259.  
  260. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  261.  
  262. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  263.  
  264.  
  265. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  266.  
  267. 4 (typing "4" immediately after SHIFT: will take you to line number 4).
  268.  
  269. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  270.  
  271. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  272.  
  273.  
  274.  
  275.  
  276. vi lesson1.sh
  277.  
  278. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  279.  
  280. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  281.  
  282.  
  283. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  284.  
  285. 4 (typing "4" immediately after SHIFT: will take you to line number 4).
  286.  
  287. dd (typing "dd" will delete the line that you are on)
  288.  
  289. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  290.  
  291. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  292.  
  293.  
  294.  
  295.  
  296. vi lesson1.sh
  297.  
  298. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  299.  
  300. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  301.  
  302.  
  303. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  304.  
  305. 4 (typing "4" immediately after SHIFT: will take you to line number 4).
  306.  
  307. dd (typing "dd" will delete the line that you are on)
  308.  
  309. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  310.  
  311. syntax on (typing "syntax on" immediately after SHIFT: will turn on syntax highlighting
  312.  
  313. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  314.  
  315. set tabstop=5 (typing "set tabstop=5" immediately after SHIFT: will set your tabs to 5 spaces
  316.  
  317. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  318.  
  319. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  320.  
  321.  
  322.  
  323.  
  324. vi .vimrc
  325. i (press "i" to get into INSERT mode and then paste in the lines below)
  326.  
  327.  
  328. set number
  329. syntax on
  330. set tabstop=5
  331.  
  332. ESC (press the ESC key to get you out of INSERT mode)
  333.  
  334. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  335.  
  336. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343. vi lesson1.sh
  344.  
  345. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  346.  
  347. echo $MYVIMRC (typing "echo $MYVIMRC" immediately after SHIFT: will display the path to your new .vimrc file
  348.  
  349. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  350.  
  351. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  352. -----------------------------------------------------------------------
  353.  
  354.  
  355.  
  356.  
  357. Linux for OCO/DCO
  358.  
  359.  
  360. Level 1: I can't spell Linux
  361. ----------------------------
  362. Not even a Linux user
  363. - Browse the file system
  364. - Run commands
  365. - Install/Uninstall simple software (apt/yum)
  366.  
  367. - Auditor (Linux user)
  368.  
  369. - How (linuxsurvival.com <-- do this 4-5 times)
  370.  
  371.  
  372.  
  373. Level 2: I'm not an Admin
  374. -------------------------
  375. Not an admin
  376. - Server Administration
  377. - Highly configured systems
  378. - Basic scripting (haproxy vs nginx in front of apache)
  379.  
  380. - Penetration Tester/Red Teamer
  381.  
  382. - How (howtoforge.com and https://bitnami.com/stacks and osboxes.org)
  383. - Build 2 perfect servers a month for 3-4 months
  384.  
  385.  
  386.  
  387.  
  388. Level 3: I don't build customized versions of Linux
  389. ---------------------------------------------------
  390. No a tinkerer
  391. - Build/run custom Linux distros on any kind of hardware
  392. - Home automation for example
  393. - Custom programming
  394.  
  395. - Exploit developers
  396.  
  397. - How (linuxfromscratch.org)
  398. - Build 2 versions of LFS
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408. ################
  409. # Hashing Demo #
  410. ################
  411. ---------------------------Type This-----------------------------------
  412. cd ~/students/yourname/
  413.  
  414. mkdir LinuxBasics
  415.  
  416. cd ~/students/yourname/LinuxBasics
  417.  
  418. mkdir hashdemo
  419.  
  420. cd hashdemo
  421.  
  422. echo test > test.txt
  423.  
  424. cat test.txt
  425.  
  426. md5sum test.txt
  427.  
  428. echo hello >> test.txt
  429.  
  430. cat test.txt
  431.  
  432. md5sum test.txt
  433.  
  434. echo test2 > test2.txt
  435.  
  436. cat test2.txt
  437.  
  438. sha256sum test2.txt
  439.  
  440. echo hello >> test2.txt
  441.  
  442. cat test2.txt
  443.  
  444. sha256sum test2.txt
  445.  
  446. cd ..
  447. -----------------------------------------------------------------------
  448.  
  449.  
  450.  
  451. #################################
  452. # Symmetric Key Encryption Demo #
  453. #################################
  454. ---------------------------Type This-----------------------------------
  455. cd ~/students/yourname/LinuxBasics
  456.  
  457. mkdir gpgdemo
  458.  
  459. cd gpgdemo
  460.  
  461. echo test > test.txt
  462.  
  463. cat test.txt
  464.  
  465. gpg -c test.txt
  466. password
  467. password
  468.  
  469. ls | grep test
  470.  
  471. cat test.txt
  472.  
  473. cat test.txt.gpg
  474.  
  475. rm -rf test.txt
  476.  
  477. ls | grep test
  478.  
  479. gpg -o output.txt test.txt.gpg
  480. P@$$w0rD!@#$P@$$w0rD!@#$
  481.  
  482. cat output.txt
  483. -----------------------------------------------------------------------
  484.  
  485.  
  486.  
  487. #########################################################################################################################
  488. # Asymmetric Key Encryption Demo #
  489. # #
  490. # Configure random number generator #
  491. # https://www.howtoforge.com/helping-the-random-number-generator-to-gain-enough-entropy-with-rng-tools-debian-lenny #
  492. #########################################################################################################################
  493. ---------------------------Type This-----------------------------------
  494. cd ~/students/yourname/LinuxBasics/gpgdemo
  495.  
  496. echo hello > file1.txt
  497.  
  498. echo goodbye > file2.txt
  499.  
  500. echo green > file3.txt
  501.  
  502. echo blue > file4.txt
  503.  
  504. tar czf files.tar.gz *.txt
  505.  
  506. gpg --gen-key
  507. 1
  508. 1024
  509. 0
  510. y
  511. John Doe
  512. --blank comment--
  513. O
  514. P@$$w0rD!@#$P@$$w0rD!@#$
  515. P@$$w0rD!@#$P@$$w0rD!@#$
  516.  
  517.  
  518.  
  519. gpg --armor --output file-enc-pubkey.txt --export 'John Doe'
  520.  
  521. cat file-enc-pubkey.txt
  522.  
  523. gpg --armor --output file-enc-privkey.asc --export-secret-keys 'John Doe'
  524.  
  525. cat file-enc-privkey.asc
  526.  
  527. gpg --encrypt --recipient 'John Doe' files.tar.gz
  528.  
  529. rm -rf files.tar.gz *.txt
  530.  
  531. ls
  532.  
  533. tar -zxvf files.tar.gz.gpg
  534.  
  535. gpg --output output.tar.gz --decrypt files.tar.gz.gpg
  536. P@$$w0rD!@#$P@$$w0rD!@#$
  537.  
  538. tar -zxvf output.tar.gz
  539.  
  540. ls
  541. -----------------------------------------------------------------------
  542.  
  543.  
  544.  
  545. ##############################################
  546. # Log Analysis with Linux command-line tools #
  547. ##############################################
  548. - The following command line executables are found in the Mac as well as most Linux Distributions.
  549.  
  550. cat – prints the content of a file in the terminal window
  551. grep – searches and filters based on patterns
  552. awk – can sort each row into fields and display only what is needed
  553. sed – performs find and replace functions
  554. sort – arranges output in an order
  555. uniq – compares adjacent lines and can report, filter or provide a count of duplicates
  556.  
  557.  
  558.  
  559.  
  560.  
  561. ##############
  562. # Cisco Logs #
  563. ##############
  564. ---------------------------Type This-----------------------------------
  565. cd ~/students/yourname/
  566. mkdir security
  567. cd security
  568. mkdir log_analysis
  569. cd log_analysis
  570. wget http://45.63.104.73/cisco.log
  571. -----------------------------------------------------------------------
  572.  
  573.  
  574. AWK Basics
  575. ----------
  576. - To quickly demonstrate the print feature in awk, we can instruct it to show only the 5th word of each line. Here we will print $5. Only the last 4 lines are being shown for brevity.
  577. ---------------------------Type This-----------------------------------
  578. cat cisco.log | awk '{print $5}' | tail -n 4
  579. -----------------------------------------------------------------------
  580.  
  581.  
  582.  
  583. - Looking at a large file would still produce a large amount of output. A more useful thing to do might be to output every entry found in “$5”, group them together, count them, then sort them from the greatest to least number of occurrences. This can be done by piping the output through “sort“, using “uniq -c” to count the like entries, then using “sort -rn” to sort it in reverse order.
  584. ---------------------------Type This-----------------------------------
  585. cat cisco.log | awk '{print $5}'| sort | uniq -c | sort -rn
  586. -----------------------------------------------------------------------
  587.  
  588.  
  589.  
  590. - While that’s sort of cool, it is obvious that we have some garbage in our output. Evidently we have a few lines that aren’t conforming to the output we expect to see in $5. We can insert grep to filter the file prior to feeding it to awk. This insures that we are at least looking at lines of text that contain “facility-level-mnemonic”.
  591. ---------------------------Type This-----------------------------------
  592. cat cisco.log | grep %[a-zA-Z]*-[0-9]-[a-zA-Z]* | awk '{print $5}' | sort | uniq -c | sort -rn
  593. -----------------------------------------------------------------------
  594.  
  595.  
  596.  
  597.  
  598. - Now that the output is cleaned up a bit, it is a good time to investigate some of the entries that appear most often. One way to see all occurrences is to use grep.
  599. ---------------------------Type This-----------------------------------
  600. cat cisco.log | grep %LINEPROTO-5-UPDOWN:
  601.  
  602. cat cisco.log | grep %LINEPROTO-5-UPDOWN:| awk '{print $10}' | sort | uniq -c | sort -rn
  603.  
  604. cat cisco.log | grep %LINEPROTO-5-UPDOWN:| sed 's/,//g' | awk '{print $10}' | sort | uniq -c | sort -rn
  605.  
  606. cat cisco.log | grep %LINEPROTO-5-UPDOWN:| sed 's/,//g' | awk '{print $10 " changed to " $14}' | sort | uniq -c | sort -rn
  607. -----------------------------------------------------------------------
  608.  
  609.  
  610.  
  611.  
  612.  
  613. ##################
  614. # Day 1 Homework #
  615. ##################
  616. Task Option 1: Linux Survival
  617. -----------------------------
  618. Do all of the exercises in Linux Survival (http://linuxsurvival.com/linux-tutorial-introduction/)
  619. Create a word document that contains the screenshots of the quizzes NOTE: You must score a perfect 100 for all 4 quizzes
  620. Name the word document 'YourFirstName-YourLastName-LinuxDay1-LinuxSurvival.docx' (ex: 'Joseph-McCray-LinuxDay1-LinuxSurvival.docx')
  621. Email the document to me at joseph.mccray-at-gmail-dot-com before the start of class tomorrow
  622.  
  623.  
  624. Task Option 2: Basic Shell Scripting
  625. ------------------------------------
  626. Watch and do all of the exercises in the video https://www.youtube.com/watch?v=_n5ZegzieSQ
  627. Create a word document that contains the screenshots of the tasks performed in this video
  628. Name the word document 'YourFirstName-YourLastName-LinuxDay1-ShellScripting.docx' (ex: 'Joseph-McCray-LinuxDay1-ShellScripting.docx')
  629. Email the document to me at joseph.mccray-at-gmail-dot-com before the start of class tomorrow
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638. #############################
  639. ############################## # Day 2: Attacking Networks # ##############################
  640. #############################
  641.  
  642.  
  643.  
  644.  
  645.  
  646. ########################
  647. # Scanning Methodology #
  648. ########################
  649.  
  650. - Ping Sweep
  651. What's alive?
  652. ------------
  653. Note: On windows you won't need to use the word "sudo" in front of the command below:
  654.  
  655. ---------------------------On Linux or Mac OS X type This-----------------------------------
  656. sudo nmap -sP 157.166.226.*
  657. --------------------------------------------------------------------------------------------
  658.  
  659.  
  660.  
  661. -if -SP yields no results try:
  662. Note: On windows you won't need to use the word "sudo" in front of the command below:
  663. ---------------------------On Linux or Mac OS X type This-----------------------------------
  664. sudo nmap -sL 157.166.226.*
  665. ------------------------------------------------------------------------------------------
  666.  
  667.  
  668.  
  669. -Look for hostnames:
  670. Note: On windows you won't need to use the word "sudo" in front of the command below:
  671. ---------------------------On Linux or Mac OS X type This-----------------------------------
  672. sudo nmap -sL 157.166.226.* | grep cnn
  673.  
  674. ---------------------------or on Windows type:---------------------------------------------
  675. c:\nmap -sP 157.166.226.* | findstr "cnn"
  676.  
  677. -------------------------------------------------------------------------------------------
  678.  
  679.  
  680.  
  681. - Port Scan
  682. What's where?
  683. ------------
  684. Note: On windows you won't need to use the word "sudo" in front of the command below:
  685. ---------------------------On Linux or Mac OS X type This-----------------------------------
  686. sudo nmap -sS 162.243.126.247
  687.  
  688. ---------------------------or on Windows type:----------------------------------------------
  689. c:\nmap -sS 162.243.126.247
  690.  
  691. --------------------------------------------------------------------------------------------
  692.  
  693.  
  694.  
  695. - Bannergrab/Version Query
  696. What versions of software are running
  697. -------------------------------------
  698. Note: On windows you won't need to use the word "sudo" in front of the command below:
  699. ---------------------------On Linux or Mac OS X type This-----------------------------------
  700. sudo nmap -sV 45.63.104.73
  701.  
  702. ---------------------------or on Windows type:---------------------------------------------
  703. c:\nmap -sV 45.63.104.73
  704. -------------------------------------------------------------------------------------------
  705.  
  706.  
  707.  
  708. Let's dig into this a little bit more:
  709. -------------------------------------
  710. Note: On windows you won't need to use the word "sudo" in front of the command below:
  711. ---------------------------On Linux or Mac OS X type This-----------------------------------
  712. sudo nmap -sV --script=http-headers 45.63.104.73 -p 80,443
  713.  
  714. ---------------------------or on Windows type:---------------------------------------------
  715. c:\nmap -sV --script=http-headers 45.63.104.73 -p 80,443
  716. -------------------------------------------------------------------------------------------
  717.  
  718.  
  719.  
  720. - Vulnerability Research
  721. Lookup the banner versions for public exploits
  722. ----------------------------------------------
  723. http://exploit-db.com
  724. http://securityfocus.com/bid
  725. https://packetstormsecurity.com/files/tags/exploit/
  726.  
  727.  
  728.  
  729.  
  730. --------------------------------------------------------------------------------------------
  731.  
  732.  
  733.  
  734. Network Penetration Testing Process (known vulnerabilities)
  735. -----------------------------------------------------------
  736.  
  737.  
  738. 1. Ping Sweep:
  739. The purpose of this step is to identify live hosts
  740.  
  741. nmap -sP <ip-address/ip-range>
  742.  
  743.  
  744. 2. Port Scan
  745. Identify running services. We use the running services to map the network topology.
  746.  
  747. nmap -sS <ip-address/ip-range>
  748.  
  749.  
  750. 3. Bannergrab
  751. Identify the version of version of software running on each port
  752.  
  753. nmap -sV <ip-address/ip-range>
  754.  
  755.  
  756.  
  757. 4. Vulnerability Research
  758. Use the software version number to research and determine if it is out of date (vulnerable).
  759.  
  760. exploit-db.com/search
  761.  
  762.  
  763.  
  764.  
  765. --------------------------------------------------------------------------------------------
  766.  
  767.  
  768.  
  769.  
  770. Skill Level 1. Run the scanners
  771. -------------------------------
  772. Nexpose
  773. Qualys
  774. Retina
  775. Nessus known vulnerabilities
  776. OpenVas
  777. Foundscan
  778. GFI LanGuard
  779. NCircle
  780.  
  781.  
  782. Skill Level 2. Manual vulnerability validation (known vulnerabilities)
  783. -----------------------------------------------------------------------
  784.  
  785. windows -> systeminfo
  786. Linux-> dpkg -l (Debian/Ubuntu/Mint)
  787. rpm -qa (RHEL/Fedora/Centos)
  788.  
  789. Mac OS X-> sudo find / -iname *.app
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797. #########################################
  798. # Offensive Cyber Operations Job Roles #
  799. # Offensive Cyber Level 1 #
  800. #########################################
  801. Required Technical Skills: Comfortable with basic Linux/Windows (MCSA/Linux+)
  802. Comfortable with basic network (Network+)
  803. Comfortable with security fundamentals (Security+)
  804.  
  805.  
  806.  
  807. Job Task: Run network security scanners and assist with documentation of known vulnerabilities
  808.  
  809.  
  810. Tools Used:
  811. Nmap
  812. Nexpose
  813. Qualys
  814. Retina
  815. Nessus known vulnerabilities
  816. OpenVas
  817. Foundscan
  818. GFI LanGuard
  819. NCircle
  820.  
  821.  
  822.  
  823. #########################################
  824. # Offensive Cyber Operations Job Roles #
  825. # Offensive Cyber Level 2 #
  826. #########################################
  827. Required Technical Skills: Comfortable with basic Linux/Windows system administration
  828. Comfortable with basic network administration
  829. Comfortable with basic programming
  830. Comfortable researching IT security issues
  831.  
  832.  
  833.  
  834. Job Task: Run network security scanners and assist with document of known vulnerabilities
  835. Perform manual vulnerability validation
  836. Analyze public exploit and develop threat analysis reports
  837. Assess simple applications for vulnerabilities
  838.  
  839.  
  840.  
  841. #########################################
  842. # Security Operations Center Job Roles #
  843. # Offensive Cyber Level 3 #
  844. #########################################
  845.  
  846. Required Technical Skills: Strong programming background (C, C++, Java, Assembly, scripting languages)
  847. Advanced system/network administration background
  848. Comfortable researching IT security issues
  849.  
  850.  
  851.  
  852.  
  853.  
  854. Job Task: Perform manual vulnerability validation
  855. Analyze public exploit and develop threat analysis reports
  856. Assess complex applications for vulnerabilities
  857.  
  858.  
  859.  
  860.  
  861.  
  862. --------------------------------------------------------------------------------------------
  863. ---------------------------Type This-----------------------------------
  864. cd ~/students/yourname/
  865.  
  866. mkdir security
  867.  
  868. cd security
  869.  
  870. mkdir scripts
  871.  
  872. cd scripts
  873.  
  874. vi scan1.sh
  875.  
  876. i (press "i" to get into INSERT mode and then paste in the lines below)
  877.  
  878. #!/bin/bash
  879.  
  880. #############################################
  881. # Check to see if script is running as root #
  882. #############################################
  883. if [ "$EUID" -ne 0 ]
  884. then echo "Please run as root"
  885. exit
  886. fi
  887.  
  888.  
  889. echo "Let's scan a network"
  890. echo " "
  891. echo " "
  892. echo " "
  893. sleep 5
  894. echo "Ok, scanning CNN"
  895. sleep 3
  896. clear
  897. nmap -sL 157.166.226.* | grep cnn
  898.  
  899. ---------------don't put this line in your script----------------------------
  900.  
  901. ESC (press the ESC key to get you out of INSERT mode)
  902.  
  903. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  904.  
  905.  
  906. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  907.  
  908.  
  909. chmod +x scan1.sh
  910.  
  911. sudo ./scan1.sh
  912. ------------------------------------------------------------------------------
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923. ---------------------------Type This-----------------------------------
  924. vi scan1.sh
  925.  
  926. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  927.  
  928. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  929.  
  930. i (press "i" to get into INSERT mode and then paste in the lines below)
  931.  
  932. #!/bin/bash
  933.  
  934. #############################################
  935. # Check to see if script is running as root #
  936. #############################################
  937. if [ "$EUID" -ne 0 ]
  938. then echo "Please run as root"
  939. exit
  940. fi
  941.  
  942.  
  943. echo "Let's scan a network"
  944. echo " "
  945. echo " "
  946. sleep 5
  947. echo "Ok, scanning CNN"
  948. sleep 3
  949. clear
  950. nmap -sL 157.166.226.* | grep cnn
  951.  
  952.  
  953. echo "Let's check CNN for load balancers"
  954. echo " "
  955. echo " "
  956. sleep 5
  957. echo "Ok, scanning CNN"
  958. sleep 3
  959. clear
  960. dig cnn.com | grep cnn
  961. sleep 3
  962. halberd cnn.com
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969. ---------------don't put this line in your script----------------------------
  970.  
  971. ESC (press the ESC key to get you out of INSERT mode)
  972.  
  973. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  974.  
  975.  
  976. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  977.  
  978. sudo ./scan1.sh
  979. ------------------------------------------------------------------------------
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986. ---------------------------Type This-----------------------------------
  987. vi scan1.sh
  988.  
  989. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  990.  
  991. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  992.  
  993. i (press "i" to get into INSERT mode and then paste in the lines below)
  994.  
  995. #!/bin/bash
  996.  
  997. #############################################
  998. # Check to see if script is running as root #
  999. #############################################
  1000. if [ "$EUID" -ne 0 ]
  1001. then echo "Please run as root"
  1002. exit
  1003. fi
  1004.  
  1005.  
  1006. # DNS list scan against CNN
  1007. #--------------------------
  1008. echo "Let's scan a network"
  1009. echo " "
  1010. echo " "
  1011. sleep 5
  1012. echo "Ok, scanning CNN"
  1013. sleep 3
  1014. clear
  1015. nmap -sL 157.166.226.* | grep cnn
  1016.  
  1017.  
  1018. # Quick ways to check for load balancing
  1019. #---------------------------------------
  1020. echo "Let's check CNN for load balancers"
  1021. echo " "
  1022. echo " "
  1023. sleep 5
  1024. echo "Ok, scanning CNN"
  1025. sleep 3
  1026. clear
  1027. dig cnn.com | grep cnn
  1028. sleep 3
  1029. halberd cnn.com
  1030.  
  1031.  
  1032. #--------------------------
  1033. echo "Let's check for misconfigurations and security issues via NSE scripts"
  1034. echo " "
  1035. echo " "
  1036. sleep 5
  1037. echo "Ok, beat up Joe's box"
  1038. sleep 3
  1039. clear
  1040. nmap -sV -O --script-args=unsafe=1 --script-args=unsafe --script "version,vuln" -p80,443 45.63.104.73
  1041.  
  1042.  
  1043. nmap -sV -O --script-args=unsafe=1 --script-args=unsafe --script "auth,brute,discovery,exploit,external,fuzzer,intrusive,malware,safe,version,vuln and not(http-slowloris or http-brute or http-enum or http-form-fuzzer)" -p80,443 45.63.104.73
  1044.  
  1045.  
  1046. ---------------don't put this line in your script----------------------------
  1047.  
  1048. ESC (press the ESC key to get you out of INSERT mode)
  1049.  
  1050. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  1051.  
  1052.  
  1053. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  1054.  
  1055. sudo ./scan1.sh
  1056. ------------------------------------------------------------------------------
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. ---------------------------Type This-----------------------------------
  1067. vi scan1.sh
  1068.  
  1069. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  1070.  
  1071. set number (typing "set number" immediately after SHIFT: will add line numbers to vim).
  1072.  
  1073. i (press "i" to get into INSERT mode and then paste in the lines below)
  1074.  
  1075. #!/bin/bash
  1076.  
  1077. #############################################
  1078. # Check to see if script is running as root #
  1079. #############################################
  1080. if [ "$EUID" -ne 0 ]
  1081. then echo "Please run as root"
  1082. exit
  1083. fi
  1084.  
  1085.  
  1086. # DNS list scan against CNN
  1087. #--------------------------
  1088. echo "Let's scan a network"
  1089. echo " "
  1090. echo " "
  1091. sleep 5
  1092. echo "Ok, scanning CNN"
  1093. sleep 3
  1094. clear
  1095. nmap -sL 157.166.226.* | grep cnn
  1096.  
  1097.  
  1098. # Quick ways to check for load balancing
  1099. #---------------------------------------
  1100. echo "Let's check CNN for load balancers"
  1101. echo " "
  1102. echo " "
  1103. sleep 5
  1104. echo "Ok, scanning CNN"
  1105. sleep 3
  1106. clear
  1107. dig cnn.com | grep cnn
  1108. sleep 3
  1109. halberd cnn.com
  1110.  
  1111. # Quick security checks
  1112. #----------------------
  1113. echo "Let's check for misconfigurations and security issues via NSE scripts"
  1114. echo " "
  1115. echo " "
  1116. sleep 5
  1117. echo "Ok, beat up Joe's box"
  1118. sleep 3
  1119. clear
  1120. nmap -sV -O --script-args=unsafe=1 --script-args=unsafe --script "version,vuln" -p80,443 45.63.104.73
  1121.  
  1122.  
  1123.  
  1124. # Quick dirb run
  1125. #---------------
  1126. echo "Ok, let's do a directory brute force"
  1127. echo " "
  1128. echo " "
  1129. sleep 5
  1130. echo "Ok, beat up Joe's box"
  1131. sleep 3
  1132. clear
  1133. dirb http://45.63.104.73/
  1134.  
  1135.  
  1136. ---------------don't put this line in your script----------------------------
  1137.  
  1138. ESC (press the ESC key to get you out of INSERT mode)
  1139.  
  1140. [SHIFT+:] (press SHIFT and the : keys at the same time and you should see a : in the bottom left corner of the screen.
  1141.  
  1142.  
  1143. wq (typing "wq" immediately after SHIFT: will save (w for write, and q for quit meaning exit vim).
  1144.  
  1145. sudo ./scan1.sh
  1146. ------------------------------------------------------------------------------
  1147.  
  1148.  
  1149.  
  1150. ##################
  1151. # Day 2 Homework #
  1152. ##################
  1153.  
  1154. Task Option 1: Basic Shell Scripting
  1155. ------------------------------------
  1156. Watch and do all of the exercises in the video https://www.youtube.com/watch?v=_n5ZegzieSQ
  1157. Create a word document that contains the screenshots of the tasks performed in this video
  1158. Name the word document 'YourFirstName-YourLastName-LinuxDay1-ShellScripting.docx' (ex: 'Joseph-McCray-LinuxDay2-ShellScripting.docx'). This video instructs you to use a tool called 'whatweb'. I prefer that you use 'dirb' instead.
  1159. The example syntax is 'dirb http://45.63.104.73/'
  1160. Email the document to me at joseph.mccray-at-gmail-dot-com before the start of class tomorrow
  1161.  
  1162.  
  1163. Task Option 2: Shell Scripting for network assessments
  1164. ------------------------------------------------------
  1165. Watch and do all of the exercises in the videos:
  1166. - https://www.youtube.com/watch?v=keK99avGLvQ&ab_channel=NullByte
  1167. - https://www.youtube.com/watch?v=KNBU2MDnKgU&ab_channel=P3nt3st_guy
  1168. Create a word document that contains the screenshots of the tasks performed in this video
  1169. Name the word document 'YourFirstName-YourLastName-LinuxDay2-ShellScripting.docx' (ex: 'Joseph-McCray-LinuxDay2-ShellScripting.docx')
  1170. Email the document to me at joseph.mccray-at-gmail-dot-com before the start of class tomorrow
Add Comment
Please, Sign In to add comment