Need bash help

Chris Pressey cpressey at catseye.mine.nu
Mon Mar 15 16:57:35 PST 2004


On Tue, 16 Mar 2004 01:40:51 +0200
hugle <hugle at vkt.lt> wrote:

> Hello all.
> I'm writing here, cause i think just here people can help me.
> (p.s. didn't find bash mailing lists)
> [...]
> So what I wanna do is smth like:
> 
> for i in `seq 1 254`; do
> ./dc 192.168.1.$i
> and if it returns 'Dropping to system shell' then add these IP to
> vulderable_users done

You could pipe the output of dc to grep and check the exit code. 
Something like:

	if ./dc 192.168.1.$i | grep 'Dropping to system shell'; then
		echo "192.168.1.$i" >> vulnerable_users
	fi

YMMV, I haven't used bash; the above is sh, should work about the same.

-Chris


More information about the freebsd-questions mailing list