Skip to content

Commit

Permalink
fix python3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
phikshun committed Jul 9, 2017
1 parent 8eccc24 commit 81b9854
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 14 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/jackit/duckyparser.py → jackit/duckyparser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import print_function, absolute_import
import keymap


Expand Down
9 changes: 5 additions & 4 deletions src/jackit/jackit.py → jackit/jackit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function
from __future__ import print_function, absolute_import
from six import iteritems
import os
import sys
import time
Expand Down Expand Up @@ -29,7 +30,7 @@


def launch_attacks(jack, targets, attack, use_ping=True):
for addr_string, target in targets.iteritems():
for addr_string, target in iteritems(targets):
payload = target['payload']
channels = target['channels']
address = target['address']
Expand Down Expand Up @@ -75,7 +76,7 @@ def scan_loop(jack, interval, targeted, address):
print("")

pretty_devices = []
for addr_string, device in jack.devices.iteritems():
for addr_string, device in iteritems(jack.devices):
if device['device']:
device_name = device['device'].description()
else:
Expand Down Expand Up @@ -234,7 +235,7 @@ def cli(debug, script, lowpower, interval, layout, address, vendor, reset, autop
else:
targets = {}
target_list = [int(x) for x in value.split(',')]
for addr_string, device in jack.devices.iteritems():
for addr_string, device in iteritems(jack.devices):
if device['index'] in target_list:
targets[addr_string] = device

Expand Down
4 changes: 3 additions & 1 deletion src/jackit/keylogger.py → jackit/keylogger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

from __future__ import print_function, absolute_import
from six import iteritems
import sys
import duckyparser
from plugins import microsoft_enc
Expand Down Expand Up @@ -57,7 +59,7 @@ def log_keystroke(self, address, payload):
sys.stdout.flush()

def hid_decode(self, key, status):
for letter, codes in self.mapping.iteritems():
for letter, codes in iteritems(self.mapping):
if codes[0] == key and codes[1] == status:
if len(letter) > 1:
return '[' + letter + ']'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/jackit/mousejack.py → jackit/mousejack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

from __future__ import print_function, absolute_import
import time
from lib import nrf24, nrf24_reset
from plugins import logitech, microsoft, microsoft_enc, amazon
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/jackit/plugins/amazon.py → jackit/plugins/amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def build_frames(self, attack):
key['frames'].append([self.frame(), 5])
elif key['sleep']:
count = int(key['sleep']) / 10
for i in range(0, count):
for i in range(0, int(count)):
key['frames'].append([self.frame(), 10])

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def build_frames(self, attack):
key['frames'].append([self.frame(), 0])
elif key['sleep']:
count = int(key['sleep']) / 10
for i in range(0, count):
for i in range(0, int(count)):
key['frames'].append([self.keepalive[:], 10])

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def build_frames(self, attack):

elif key['sleep']:
count = int(key['sleep']) / 10
for i in range(0, count):
for i in range(0, int(count)):
key['frames'].append([self.frame(), 0])

@classmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

import microsoft
from __future__ import print_function, absolute_import
from plugins import microsoft


class HID(microsoft.HID):
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
click==5.1
pyusb==1.0.0
tabulate==0.7.5
six==1.10.0
pyusb==1.0.0
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def read(*names, **kwargs):
author='phikshun and infamy',
author_email='',
url='https://github.com/insecurityofthings/jackit',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
packages=find_packages('jackit'),
package_dir={'': 'jackit'},
py_modules=[splitext(basename(path))[0] for path in glob('jackit/*.py')],
include_package_data=True,
zip_safe=False,
classifiers=[
Expand All @@ -62,7 +62,7 @@ def read(*names, **kwargs):
# eg: 'keyword1', 'keyword2', 'keyword3',
],
install_requires=[
'pyusb', 'click', 'tabulate',
'pyusb', 'click', 'tabulate', 'six', 'pyusb'
],
entry_points={
'console_scripts': [
Expand Down
1 change: 1 addition & 0 deletions tests/test_duckyparser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import print_function, absolute_import
from jackit import duckyparser


Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ envlist = py27, py36, flake8
deps=pytest
click
tabulate
six
pyusb
commands=py.test --verbose

[testenv:flake8]
Expand Down

0 comments on commit 81b9854

Please sign in to comment.