joemccray

Quick Linux

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