target = self.args['icmp_dst'] data = self.args['icmp_payload'] unused = self.args['icmp_unused'] ip = IP(dst=self.args['icmp_dst']) icmp = ICMP(type=self.args['icmp_type'], code=self.args['icmp_code'], unused=self.args['icmp_unused'] ) # Create ICMP packet(s) to send p=sr1(ip/icmp/data) if p: p.summary() def usage(self): self.parser.print_usage() def read_parameters(self, params_source): if len(params_source)==0: self.usage() sys.exit(1) else: self.args = vars(self.parser.parse_args(params_source)) if __name__ == '__main__': myICMP = ICMP() myICMP.read_parameters(sys.argv[1:]) myICMP.run()