From fb642455c6b5faa4dd7eee7157b6b6a5821c8593 Mon Sep 17 00:00:00 2001 From: Danilo Vargas Date: Thu, 19 Jul 2018 05:28:44 -0500 Subject: [PATCH] HWaddr dynamic (#819) * HWaddr dynamic * Update ifconfig.py --- cowrie/commands/ifconfig.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cowrie/commands/ifconfig.py b/cowrie/commands/ifconfig.py index 3898bb88..1ec05395 100644 --- a/cowrie/commands/ifconfig.py +++ b/cowrie/commands/ifconfig.py @@ -5,13 +5,16 @@ from __future__ import division, absolute_import from cowrie.shell.command import HoneyPotCommand +from random import randint + +HWaddr = "%02x:%02x:%02x:%02x:%02x:%02x" % (randint(0, 255), randint(0, 255), randint(0, 255), randint(0, 255), randint(0, 255), randint(0, 255)) commands = {} class command_ifconfig(HoneyPotCommand): def call(self): - l = """eth0 Link encap:Ethernet HWaddr 04:01:16:df:2d:01 + l = """eth0 Link encap:Ethernet HWaddr %s inet addr:%s Bcast:%s.255 Mask:255.255.255.0 inet6 addr: fe80::601:16ff:fedf:2d01/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 @@ -29,7 +32,7 @@ lo Link encap:Local Loopback TX packets:110 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:19932 (19.9 KB) TX bytes:19932 (19.9 KB)""" % \ - (self.protocol.kippoIP, + (HWaddr, self.protocol.kippoIP, self.protocol.kippoIP.rsplit('.', 1)[0]) self.write('{0}\n'.format(l))