use_agent() {
	[ -r "$SSH_AUTH_SOCK" ] || {
	[ -s "$agent_file" ] &&
	. "$agent_file" >/dev/null &&
	[ -r "$SSH_AUTH_SOCK" ]
	}
}

replace_agent() {
	(
	umask 077
	kill_agent &&
	ssh-agent >"$agent_file"
	) &&
	use_agent &&
	ssh-add
}

kill_agent() {
	use_agent
	rm -f "$agent_file"
	kill $SSH_AGENT_PID 2>/dev/null
	SSH_AGENT_PID=
	SSH_AUTH_SOCK=
}

anti_security_measures() {
	export agent_file="$HOME/.splish.ssh-agent"
	if [ -n "`glob "$HOME/.ssh/id*"`" ]
	then
		use_agent ||
		replace_agent
	fi
}

anti_security_measures "$@"
