migrate to git.charlotte.sh
This commit is contained in:
commit
fbd588721e
412 changed files with 13750 additions and 0 deletions
21
automation-sys320/week15/finalC1.bash
Normal file
21
automation-sys320/week15/finalC1.bash
Normal file
|
@ -0,0 +1,21 @@
|
|||
#! /bin/bash
|
||||
|
||||
# This is the link we will scrape
|
||||
link="10.0.17.6/IOC.html"
|
||||
|
||||
# get it with curl and tell curl not to give errors
|
||||
fullPage=$(curl -sL "$link")
|
||||
|
||||
# Utilizing xmlstarlet tool to extract table from the page
|
||||
toolOutput=$(echo "$fullPage" | \
|
||||
xmlstarlet format --html --recover 2>/dev/null | \
|
||||
xmlstarlet select -n --template --copy-of \
|
||||
"//html//body//table//tr//td[1]")
|
||||
|
||||
# Processing HTML with sed
|
||||
echo "$toolOutput" | sed -e 's/<td[^>]*>//g' | sed -e 's/<\/td>/;/g' | \
|
||||
tr ';' '\n' | sed '/^$/d' > IOC.txt
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue