From 0f32988be7def2fe90ba7dd90df1510229e14f6e Mon Sep 17 00:00:00 2001 From: Nikolaos Kamarinakis Date: Wed, 7 Nov 2018 08:49:57 +0200 Subject: [PATCH] Upgrade scapy to kamene --- .DS_Store | Bin 0 -> 6148 bytes .github/ISSUE_TEMPLATE.md | 2 +- kickthemout.py | 16 ++++++++-------- requirements.txt | 2 +- spoof.py | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9c7e095a39565e9fec75f52b03c6c0fb8e8f112e GIT binary patch literal 6148 zcmeHKOG-mQ5Uh>?1KDKha!w$4gCQg*$OR+_QIH5?vVNBc8SOA#O9dYt7Ha~YC*`zW?r1Oqv9I!oZ-uJI>qw4Dk=icHTJG|iI zJAc2+Td&iUl>$;g3P=GdAO(J@fcIY7Y@Vnn1*Cu!I4j`ahemhog+pR|Iv8REAWoSM z<2q&uV)F#C7Y>Qc&@8FMq*{#_mUQM@)%C(5G3l@xKCGT>HKABMo%gpWhxJ57DIf(d z6}ZXm!u$W4{=@u#NzzUVNP&N)fK6AM)snANy>;|*-fJ8Ek?u90bT_Vp!VvA4810xF fZ^w60ly%M5Jnw}=V$hinI#E9Zu8T|x{IvpK{InHg literal 0 HcmV?d00001 diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 61d1d5d..97d4f10 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -21,7 +21,7 @@ - **OS name & version**: - **Python version**: -- **Scapy version**: +- **Kamene version**: - **Nmap version**: - **Link of [Gist](https://gist.github.com/)**: diff --git a/kickthemout.py b/kickthemout.py index b057dff..56e4459 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -25,11 +25,11 @@ def shutdown(): '\nCatch ya later!{}'.format(GREEN, END)) os._exit(1) -logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! +logging.getLogger("kamene.runtime").setLevel(logging.ERROR) # Shut up kamene! try: - from scapy.config import conf + from kamene.config import conf conf.ipv6_enabled = False - from scapy.all import * + from kamene.all import * import scan, spoof, nmap from urllib.request import urlopen, Request from urllib.error import URLError @@ -143,14 +143,14 @@ def getDefaultInterface(returnNet=False): raise ValueError("illegal netmask value", hex(arg)) return 32 - int(round(math.log(0xFFFFFFFF - arg, 2))) def to_CIDR_notation(bytes_network, bytes_netmask): - network = scapy.utils.ltoa(bytes_network) + network = kamene.utils.ltoa(bytes_network) netmask = long2net(bytes_netmask) net = "%s/%s" % (network, netmask) if netmask < 16: return None return net - iface_routes = [route for route in scapy.config.conf.route.routes if route[3] == scapy.config.conf.iface and route[1] != 0xFFFFFFFF] + iface_routes = [route for route in kamene.config.conf.route.routes if route[3] == kamene.config.conf.iface and route[1] != 0xFFFFFFFF] network, netmask, _, interface, address = max(iface_routes, key=lambda item:item[1]) net = to_CIDR_notation(network, netmask) if net: @@ -174,7 +174,7 @@ def getDefaultInterfaceMAC(): else: return defaultInterfaceMac except: - # request interface MAC address (after failed detection by scapy) + # request interface MAC address (after failed detection by kamene) print("\n{}ERROR: Default Interface MAC Address could not be obtained. Please enter MAC manually.{}\n".format(RED, END)) header = ('{}kickthemout{}> {}Enter MAC Address {}(MM:MM:MM:SS:SS:SS): '.format(BLUE, WHITE, RED, END)) return (input(header)) @@ -188,7 +188,7 @@ def getGatewayIP(): getGateway = sr1(IP(dst="github.com", ttl=0) / ICMP() / "XXXXXXXXXXX", verbose=False) return getGateway.src except: - # request gateway IP address (after failed detection by scapy) + # request gateway IP address (after failed detection by kamene) stopAnimation = True print("\n{}ERROR: Gateway IP could not be obtained. Please enter IP manually.{}\n".format(RED, END)) header = ('{}kickthemout{}> {}Enter Gateway IP {}(e.g. 192.168.1.1): '.format(BLUE, WHITE, RED, END)) @@ -242,7 +242,7 @@ def regenOnlineIPs(): defaultGatewayMac = host[1] if not defaultGatewayMacSet and defaultGatewayMac == "": - # request gateway MAC address (after failed detection by scapy) + # request gateway MAC address (after failed detection by kamene) print("\n{}ERROR: Default Gateway MAC Address could not be obtained. Please enter MAC manually.{}\n".format(RED, END)) header = ("{}kickthemout{}> {}Enter your gateway's MAC Address {}(MM:MM:MM:SS:SS:SS): ".format(BLUE, WHITE, RED, END)) defaultGatewayMac = input(header) diff --git a/requirements.txt b/requirements.txt index 489a5ac..0401b2b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -scapy-python3 +kamene python-nmap netifaces \ No newline at end of file diff --git a/spoof.py b/spoof.py index 8a8872f..e704751 100644 --- a/spoof.py +++ b/spoof.py @@ -8,8 +8,8 @@ See License at nikolaskama.me (https://nikolaskama.me/kickthemoutproject) """ import sys, logging -logging.getLogger("scapy.runtime").setLevel(logging.ERROR) -from scapy.all import ( +logging.getLogger("kamene.runtime").setLevel(logging.ERROR) +from kamene.all import ( get_if_hwaddr, getmacbyip, ARP,