/usr/lib/python2.7/dist-packages/impacket/Dot11Crypto.py is in python-impacket 0.9.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Copyright (c) 2003-2016 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Description:
# IEEE 802.11 Network packet codecs.
#
# Author:
# Gustavo Moreira
class RC4():
def __init__(self, key):
j = 0
self.state = range(256)
for i in range(256):
j = (j + self.state[i] + ord(key[i % len(key)])) & 0xff
self.state[i],self.state[j] = self.state[j],self.state[i] # SSWAP(i,j)
def encrypt(self, data):
i = j = 0
out=''
for char in data:
i = (i+1) & 0xff
j = (j+self.state[i]) & 0xff
self.state[i],self.state[j] = self.state[j],self.state[i] # SSWAP(i,j)
out+=chr(ord(char) ^ self.state[(self.state[i] + self.state[j]) & 0xff])
return out
def decrypt(self, data):
# It's symmetric
return self.encrypt(data)
|