Security patterns and a weighting scheme for mobile agents