Skip to content
This repository was archived by the owner on Apr 3, 2018. It is now read-only.

Commit f50d4ec

Browse files
committed
Introduction of ${outputUnified} architecture in order to activate/deactivate the generation of output/result.txt
1 parent 1277367 commit f50d4ec

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

Diff for: funceble

+54-25
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ noFiles=false
7272

7373
# Generate debug file under log
7474
# DO NOT USE THIS IF YOU DON'T KNOW HOW TO DEBUG FROM OUTPUTTED FILE
75-
debugUnknown=false
75+
debugUnknown=true
7676

7777
# Defaut name for hosts file
7878
hostsDefault='hosts'
7979

8080
# Output directory.
8181
# DO NOT FORGET '/' AT THE END
82-
outputDir='%%currentDir%%/output/'
82+
outputDir='/home/funilrys/Projects/funceble/output/'
8383

8484
# hosts directory
8585
hostsDir=${outputDir}hosts/
@@ -143,7 +143,10 @@ fileNameDate=_${currentDate// /_}
143143
generateHosts=false
144144

145145
# Output less data
146-
outputLess=true
146+
outputLess=false
147+
148+
# Output unified file
149+
outputUnified=true
147150

148151
# If set to true, we don't print anything
149152
quiet=false
@@ -342,30 +345,33 @@ generateUnifiedFile()
342345
# status <string>
343346
local status=${2}
344347

345-
if [[ -f ${outputUnifiedResult} ]]
348+
if [[ ${outputUnified} == true ]]
346349
then
347-
if [[ ${outputLess} == true ]]
350+
if [[ -f ${outputUnifiedResult} ]]
348351
then
349-
# We save the domain and his data to the unified file
350-
prints "Less" "${domain}" "${status}" "${type}" >> ${outputUnifiedResult}
351-
else
352-
# We save the domain and his data to the unified file
353-
prints "Generic" "${domain}" "${status}" "Unknown" "${type}" >> ${outputUnifiedResult}
354-
fi
355-
else
356-
if [[ ${outputLess} == true ]]
357-
then
358-
# We create header into and in between, create the file
359-
beforeHeader ${outputUnifiedResult}
360-
printHeader "Less" >> ${outputUnifiedResult}
361-
# We save the domain and his data to the unified file
362-
prints "Less" "${domain}" "${status}" "${type}" >> ${outputUnifiedResult}
352+
if [[ ${outputLess} == true ]]
353+
then
354+
# We save the domain and his data to the unified file
355+
prints "Less" "${domain}" "${status}" "${type}" >> ${outputUnifiedResult}
356+
else
357+
# We save the domain and his data to the unified file
358+
prints "Generic" "${domain}" "${status}" "Unknown" "${type}" >> ${outputUnifiedResult}
359+
fi
363360
else
364-
# We create header into and in between, create the file
365-
beforeHeader ${outputUnifiedResult}
366-
printHeader "Generic" >> ${outputUnifiedResult}
367-
# We save the domain and his data to the unified file
368-
prints "Generic" "${domain}" "${status}" "Unknown" "${type}" >> ${outputUnifiedResult}
361+
if [[ ${outputLess} == true ]]
362+
then
363+
# We create header into and in between, create the file
364+
beforeHeader ${outputUnifiedResult}
365+
printHeader "Less" >> ${outputUnifiedResult}
366+
# We save the domain and his data to the unified file
367+
prints "Less" "${domain}" "${status}" "${type}" >> ${outputUnifiedResult}
368+
else
369+
# We create header into and in between, create the file
370+
beforeHeader ${outputUnifiedResult}
371+
printHeader "Generic" >> ${outputUnifiedResult}
372+
# We save the domain and his data to the unified file
373+
prints "Generic" "${domain}" "${status}" "Unknown" "${type}" >> ${outputUnifiedResult}
374+
fi
369375
fi
370376
fi
371377
}
@@ -1245,7 +1251,7 @@ main()
12451251
################################################################################
12461252
usage()
12471253
{
1248-
echo "Usage: ${0} [ -a ] [ -ex ] [ --help ] [ -h ] [ -ip ] [ -q ] [ -n ] [ -p ] [ --split ]"
1254+
echo "Usage: ${0} [ -a ] [ -ex ] [ --help ] [ -h ] [ -ip ] [ -q ] [ -n ] [ -p ] [ -nu ] [ --split ]"
12491255
echo ""
12501256
echo " {[ -d domain-name.me ]} || {[ -f listOfDomainInAFile ]}"
12511257
echo ""
@@ -1259,6 +1265,7 @@ usage()
12591265
echo " --quiet -q Activate quiet mode (${red}${bold}Must be before ${white}-d${normal} ${red}${bold}or ${white}-f${normal})"
12601266
echo " --percentage -p Show the percentage of the results (${red}${bold}Must be before ${white}-d${normal} ${red}${bold}or ${white}-f${normal})"
12611267
echo " --noFiles -n Deactivate the production of output files (${red}${bold}Must be before ${white}-d${normal} ${red}${bold}or ${white}-f${normal})"
1268+
echo " --noUnified -nu Deactivate the production of result.txt as unified result under the outpur directory (${red}${bold}Must be before ${white}-d${normal} ${red}${bold}or ${white}-f${normal})"
12621269
echo " --split Split output files (${red}${bold}Must be before ${white}-d${normal} ${red}${bold}or ${white}-f${normal})"
12631270
echo ""
12641271
echo "Examples:"
@@ -1301,79 +1308,101 @@ else
13011308
outputLess=false
13021309
shift 1
13031310
;;
1311+
13041312
# We catch domain
13051313
-d)
13061314
main "${2}" ''
13071315
shift 2
13081316
;;
1317+
13091318
# We catch if we show the execution time
13101319
-ex|--execution)
13111320
showExecutionTime=true
13121321
quiet=false
13131322
shift 1
13141323
;;
1324+
13151325
# We catch file path
13161326
-f)
13171327
main '' "${2}"
13181328
shift 2
13191329
;;
1330+
13201331
# we catch if the user want to activate the creation of hosts file
13211332
-h|--host)
13221333
generateHosts=true
13231334
checkHostsFiles
13241335
shift 1
13251336
;;
1337+
13261338
--help)
13271339
usage
13281340
shift 1
13291341
;;
1342+
13301343
# We change the IP to print into the hosts file
13311344
-ip)
13321345
customIP="${2}"
13331346
shift 2
13341347
;;
1348+
13351349
# We catch if we can produce file or not
13361350
-n|--noFiles)
13371351
noFiles=true
13381352
quiet=false
13391353
shift 1
13401354
;;
1355+
13411356
# We catch if have to show or hide the percentages
13421357
-p|--percentage)
13431358
showPercentage=true
13441359
shift 1
13451360
;;
1361+
13461362
# Activation of quiet system
13471363
-q|--quiet)
13481364
quiet=true
13491365
noFiles=false
13501366
shift 1
13511367
;;
13521368

1369+
# We catch if we need to active or deactivate the generation of
1370+
# output/result.txt
1371+
-nu|--noUnified)
1372+
outputUnified=false
1373+
shift 1
1374+
;;
1375+
13531376
# We split the result into different file
13541377
--split)
13551378
splitFiles=true
13561379
noFiles=false
13571380
shift 1
13581381
;;
1382+
13591383
# catch the domain after --domain= for example: --domain=helloworld.com
13601384
# Will result only helloworld.com
13611385
--domain=*)
13621386
domainToCheck=${1#*=}
13631387
main "${domainToCheck}" ''
13641388
shift 1
13651389
;;
1390+
13661391
# catch the domain after --domain= for example: --file=lustUsedInDev/badreferers.list
13671392
# Will get the file lustUsedInDev/badreferers.list
13681393
--file=*)
13691394
fileToCheck=${1#*=}
13701395
main "" "${fileToCheck}"
13711396
shift 1
13721397
;;
1398+
1399+
# Output if option is unknown
13731400
-*)
13741401
echo "Unknown option: $1" >&2
13751402
exit 1
13761403
;;
1404+
1405+
# Output if no option is definied
13771406
*) usage
13781407
shift 1
13791408
;;

0 commit comments

Comments
 (0)