<commit_before>#!/bin/sh

# hostfile - List of subnets or addresses which to scan for a given port
# outpath - Path to store output
# port - Port(s) to scan for, comma seperated no spaces

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

interface=eth0

if [ -z "$3" ]; then
	echo usage: znmss.sh hostfile outpath port
	exit 1
fi

infile=$1
outdir=$2

outfile="znmss-`date +%s`.out"
out="${outdir}/${outfile}"

zmapscan() {
	port=$1

	zmap -i ${interface} -p $port -P 5 -w $infile -o ${out}.${port}
	if [ $? -ne 0 ]; then
		exit 1
	fi
}

zmapscan_icmp() {
	zmap -i ${interface} --probe-module=icmp_echoscan -P 2 -w $infile \
		-o ${out}.up
	if [ $? -ne 0 ]; then
		exit 1
	fi
}

zmapscan_icmp

plist=`echo ${3} | sed 's/,/ /g'`
for i in $plist; do
	zmapscan $i<commit_msg>add a small delay between scans<commit_after>#!/bin/sh

# hostfile - List of subnets or addresses which to scan for a given port
# outpath - Path to store output
# port - Port(s) to scan for, comma seperated no spaces

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

interface=eth0

if [ -z "$3" ]; then
	echo usage: znmss.sh hostfile outpath port
	exit 1
fi

infile=$1
outdir=$2

outfile="znmss-`date +%s`.out"
out="${outdir}/${outfile}"
sleeptime=90

zmapscan() {
	port=$1

	sleep $sleeptime

	zmap -i ${interface} -p $port -P 5 -w $infile -o ${out}.${port}
	if [ $? -ne 0 ]; then
		exit 1
	fi
}

zmapscan_icmp() {
	zmap -i ${interface} --probe-module=icmp_echoscan -P 2 -w $infile \
		-o ${out}.up
	if [ $? -ne 0 ]; then
		exit 1
	fi
}

zmapscan_icmp

plist=`echo ${3} | sed 's/,/ /g'`
for i in $plist; do
	zmapscan $i
{'fraction_non_alphanumeric': 0.17177914110429449, 'fraction_numerical': 0.01717791411042945, 'mean_word_length': 3.2363636363636363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '599531', 'n_tokens_mistral': 738, 'n_tokens_neox': 688, 'n_words': 205}