Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 8555883

Browse files
authored
Merge pull request #1 from sergioro9/master
remove unnecessary cat/echo and create gitignore
2 parents 704739e + cc0609f commit 8555883

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ignore
2+
*.TMP
3+
*.XTMP
4+
*.log
5+
bashter-tempdata/
6+
scan-logs
7+
8+
# don't ignore
9+
!bashter-tempdata/empty.txt
10+
!scan-logs/empty.txt

bashter.bash

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ function UrlSelector() {
5555

5656
function UrlCrawler() {
5757
SOURCECODE="${1}"
58-
cat ${SOURCECODE} | grep -o 'href=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^href=["'"'"']//' -e 's/["'"'"']$//'
59-
cat ${SOURCECODE} | grep -o 'src=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^src=["'"'"']//' -e 's/["'"'"']$//'
58+
grep -o 'href=['"'"'"][^"'"'"']*['"'"'"]' "${SOURCECODE}" | sed -e 's/^href=["'"'"']//' -e 's/["'"'"']$//'
59+
grep -o 'src=['"'"'"][^"'"'"']*['"'"'"]' "${SOURCECODE}" | sed -e 's/^src=["'"'"']//' -e 's/["'"'"']$//'
6060
}
6161

6262
function CheckForm() {
@@ -67,7 +67,7 @@ function CheckForm() {
6767
TEMPDIR="${HOME_DIR}/bashter-tempdata"
6868
CHECKEDFORMFILE="${TEMPDIR}/CHECKED-FORM.BASHTER-${PROC_ID}.TMP"
6969
IFS=$'\n'
70-
for FORM in $(cat ${SOURCECODE} | perl -nle'print $& while m{<form\K.*?(?=>)}g' | sed 's/^/<form/g' | sed 's/$/>/g')
70+
for FORM in $(perl -nle'print $& while m{<form\K.*?(?=>)}g' "${SOURCECODE}" | sed 's/^/<form/g' | sed 's/$/>/g')
7171
do
7272
FORMPOST=$(echo $FORM | grep -o 'method=['"'"'"][^"'"'"']*['"'"'"]' | grep -i post)
7373
if [[ ! -z $(cat ${CHECKEDFORMFILE} 2> /dev/null | grep ''$FORM'') ]]
@@ -84,7 +84,7 @@ function CheckForm() {
8484
bash ${FORM_TEST} ${URL} ${SOURCECODE}
8585
fi
8686
done
87-
else
87+
else
8888
echo "$(date +"[%H:%M:%S]") INFO: Form POST on \"${URL}\""
8989
echo "$(date +"[%H:%M:%S]") FORM [POST]: \"${URL}\"" >> ${HOME_DIR}/scan-logs/${PROC_ID}-info.log
9090
for FORM_TEST in $(find ${HOME_DIR}/modules/form | grep bash$)
@@ -110,19 +110,22 @@ then
110110
fi
111111

112112
cat ${HOME_DIR}/BANNER.file
113-
echo ""
114-
echo " ##### Version ${BASHTER_VERSION} released on ${RELEASED_DATE} #####"
115-
echo " [ $(hostname)@HOME_DIR : ${HOME_DIR} ]"
116-
echo ""
113+
cat <<eof
114+
115+
##### Version ${BASHTER_VERSION} released on ${RELEASED_DATE} #####"
116+
[ $(hostname)@HOME_DIR : ${HOME_DIR} ]"
117117
118-
echo " Please enter the URL you want to scan..."
119-
echo " Example: https://website.com/[optional-path]/"
118+
Please enter the URL you want to scan...
119+
Example: https://website.com/[optional-path]/
120+
eof
120121
echo -ne " >>> "
121122
read WEBSITE
122-
echo ""
123-
echo " Crawling site based on main domain or domain which you scan only"
124-
echo " If you want to scan *.domain.com you can enter: [Y/y]"
125-
echo " But If you want to scan sub.domain.com only (let it empty)"
123+
cat <<eof
124+
125+
Crawling site based on main domain or domain which you scan only
126+
If you want to scan *.domain.com you can enter: [Y/y]
127+
But If you want to scan sub.domain.com only (let it empty)
128+
eof
126129
echo -ne " >>> "
127130
read URL_SELECTOR_MODE
128131
echo ""

0 commit comments

Comments
 (0)