Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
master_doc = 'index'

# General information about the project.
project = u'Cryptully'
copyright = u'2013, Shane Tully'
project = 'Cryptully'
copyright = '2013, Shane Tully'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -183,8 +183,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Cryptully.tex', u'Cryptully Documentation',
u'Shane Tully', 'manual'),
('index', 'Cryptully.tex', 'Cryptully Documentation',
'Shane Tully', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -213,8 +213,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'cryptully', u'Cryptully Documentation',
[u'Shane Tully'], 1)
('index', 'cryptully', 'Cryptully Documentation',
['Shane Tully'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -227,8 +227,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Cryptully', u'Cryptully Documentation',
u'Shane Tully', 'Cryptully', 'One line description of project.',
('index', 'Cryptully', 'Cryptully Documentation',
'Shane Tully', 'Cryptully', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
10 changes: 5 additions & 5 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def deleteDirectory(path):
except OSError as ose:
# Ignore 'no such file or directory' errors
if ose.errno != 2:
print ose
print(ose)


def deleteFile(path):
try:
os.unlink(path)
except OSError as ose:
if ose.errno != 2:
print ose
print(ose)


arg = sys.argv[1] if len(sys.argv) >= 2 else None
Expand All @@ -36,13 +36,13 @@ def deleteFile(path):
if len(sys.argv) == 3:
pyinstallerPath = sys.argv[2]
else:
pyinstallerPath = raw_input("Path to pyinstaller: ")
pyinstallerPath = input("Path to pyinstaller: ")

clean()
subprocess.call(['python2.7', os.path.join(pyinstallerPath, 'pyinstaller.py'), 'cryptully.spec'])

elif arg == 'deb':
print "Ensure you have the python-stdeb package installed!"
print("Ensure you have the python-stdeb package installed!")
subprocess.call(['python2.7', 'setup.py', '--command-packages=stdeb.command', 'bdist_deb'])

elif arg == 'rpm':
Expand All @@ -66,4 +66,4 @@ def deleteFile(path):
clean()

else:
print "Invalid option\nPossible options: dist, deb, rpm, install, source, run, test, clean"
print("Invalid option\nPossible options: dist, deb, rpm, install, source, run, test, clean")
2 changes: 1 addition & 1 deletion src/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import cryptully
from . import cryptully

cryptully.main()
4 changes: 2 additions & 2 deletions src/crypto/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ def __generateFingerprint(self, key):


def __octx_to_num(self, data):
converted = 0L
converted = 0
length = len(data)
for i in range(length):
converted = converted + ord(data[i]) * (256L ** (length - i - 1))
converted = converted + ord(data[i]) * (256 ** (length - i - 1))
return converted


Expand Down
10 changes: 5 additions & 5 deletions src/crypto/smp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto
from . import crypto
import M2Crypto
import struct

Expand Down Expand Up @@ -221,7 +221,7 @@ def isValidArgument(self, val):


def hash(self, message):
return long(self.crypto.stringHash(message), 16)
return int(self.crypto.stringHash(message), 16)



Expand Down Expand Up @@ -263,8 +263,8 @@ def bytesToLong(bytes):

def longToBytes(long):
bytes = ''
while long != 0:
bytes = longToByte(long & 0xff) + bytes
while int != 0:
bytes = longToByte(int & 0xff) + bytes
long >>= 8
return bytes

Expand All @@ -274,7 +274,7 @@ def byteToLong(byte):


def longToByte(long):
return struct.pack('B', long)
return struct.pack('B', int)


def mulm(x, y, mod):
Expand Down
10 changes: 5 additions & 5 deletions src/cryptully.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import signal
import argparse

from utils import constants
from .utils import constants


turnServer = None
Expand All @@ -18,19 +18,19 @@ def main():
signal.signal(signal.SIGINT, signalHandler)

if args.server:
from server.turnServer import TURNServer
from .server.turnServer import TURNServer
global turnServer

turnServer = TURNServer(args.port)
turnServer.start()
elif args.ncurses:
from ncurses.ncurses import NcursesUI
from .ncurses.ncurses import NcursesUI
global ncursesUI

ncursesUI = NcursesUI(args.nick, args.turn, args.port)
ncursesUI.start()
else:
from qt.qt import QtUI
from .qt.qt import QtUI
global qtUI

qtUI = QtUI(sys.argv, args.nick, args.turn, args.port)
Expand All @@ -51,7 +51,7 @@ def parse_cmdline_args():

# Check the port range
if args.port <= 0 or args.port > 65536:
print "The port must be between 1 and 65536 inclusive."
print("The port must be between 1 and 65536 inclusive.")
sys.exit(1)

return args
Expand Down
18 changes: 9 additions & 9 deletions src/ncurses/ncurses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
import curses.ascii
import curses.textpad
import os
import Queue
import queue
import signal
import sys
import threading
import time

from cursesAcceptDialog import CursesAcceptDialog
from cursesDialog import CursesDialog
from cursesInputDialog import CursesInputDialog
from cursesModeDialog import CursesModeDialog
from cursesPassphraseDialog import CursesPassphraseDialog
from cursesSendThread import CursesSendThread
from cursesStatusWindow import CursesStatusWindow
from .cursesAcceptDialog import CursesAcceptDialog
from .cursesDialog import CursesDialog
from .cursesInputDialog import CursesInputDialog
from .cursesModeDialog import CursesModeDialog
from .cursesPassphraseDialog import CursesPassphraseDialog
from .cursesSendThread import CursesSendThread
from .cursesStatusWindow import CursesStatusWindow

from network.client import Client
from network.connectionManager import ConnectionManager
Expand All @@ -34,7 +34,7 @@ def __init__(self, nick, turn, port):
self.connectedNick = None
self.inRecveiveLoop = False
self.clientConnectError = False
self.messageQueue = Queue.Queue()
self.messageQueue = queue.Queue()
self.connectionManager = None
self.sendThread = None

Expand Down
10 changes: 5 additions & 5 deletions src/network/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import base64
import Queue
import queue

from crypto.crypto import Crypto
from crypto.smp import SMP

from message import Message
from .message import Message

from threading import Thread

Expand Down Expand Up @@ -32,7 +32,7 @@ def __init__(self, connectionManager, remoteNick, sendMessageCallback, recvMessa
self.outgoingMessageNum = 0
self.isEncrypted = False
self.wasHandshakeDone = False
self.messageQueue = Queue.Queue()
self.messageQueue = queue.Queue()

self.crypto = Crypto()
self.crypto.generateDHKey()
Expand Down Expand Up @@ -142,7 +142,7 @@ def __doHandshake(self):

# Receive the client's public key
clientPublicKey = self.__getHandshakeMessagePayload(constants.COMMAND_PUBLIC_KEY)
self.crypto.computeDHSecret(long(base64.b64decode(clientPublicKey)))
self.crypto.computeDHSecret(int(base64.b64decode(clientPublicKey)))

# Send our public key
publicKey = base64.b64encode(str(self.crypto.getDHPubKey()))
Expand Down Expand Up @@ -174,7 +174,7 @@ def __initiateHandshake(self):

# Receive the client's public key
clientPublicKey = self.__getHandshakeMessagePayload(constants.COMMAND_PUBLIC_KEY)
self.crypto.computeDHSecret(long(base64.b64decode(clientPublicKey)))
self.crypto.computeDHSecret(int(base64.b64decode(clientPublicKey)))

# Switch to AES encryption for the remainder of the connection
self.isEncrypted = True
Expand Down
14 changes: 7 additions & 7 deletions src/network/connectionManager.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Queue
import queue
import socket
import sys
import traceback

from threading import Thread

from client import Client
from message import Message
from sock import Socket
from .client import Client
from .message import Message
from .sock import Socket

from utils import constants
from utils import exceptions
Expand All @@ -28,7 +28,7 @@ def __init__(self, nick, serverAddr, recvMessageCallback, newClientCallback, han
self.errorCallback = errorCallback
self.sendThread = SendThread(self.sock, self.errorCallback)
self.recvThread = RecvThread(self.sock, self.recvMessage, self.errorCallback)
self.messageQueue = Queue.Queue()
self.messageQueue = queue.Queue()


def connectToServer(self):
Expand All @@ -43,7 +43,7 @@ def disconnectFromServer(self):
if self.sock.isConnected:
try:
# Send the end command to all clients
for nick, client in self.clients.iteritems():
for nick, client in self.clients.items():
client.disconnect()

# Send the end command to the server
Expand Down Expand Up @@ -189,7 +189,7 @@ def __init__(self, sock, errorCallback):

self.sock = sock
self.errorCallback = errorCallback
self.messageQueue = Queue.Queue()
self.messageQueue = queue.Queue()


def run(self):
Expand Down
2 changes: 1 addition & 1 deletion src/network/qtThreads.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from client import Client
from .client import Client

from PyQt4.QtCore import QThread
from PyQt4.QtCore import pyqtSignal
Expand Down
10 changes: 5 additions & 5 deletions src/qt/qChatTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from PyQt4.QtGui import QStackedWidget
from PyQt4.QtGui import QWidget

import qtUtils
from qChatWidget import QChatWidget
from qConnectingWidget import QConnectingWidget
from qHelpDialog import QHelpDialog
from qNickInputWidget import QNickInputWidget
from . import qtUtils
from .qChatWidget import QChatWidget
from .qConnectingWidget import QConnectingWidget
from .qHelpDialog import QHelpDialog
from .qNickInputWidget import QNickInputWidget

from utils import errors

Expand Down
2 changes: 1 addition & 1 deletion src/qt/qChatWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from PyQt4.QtGui import QTextEdit
from PyQt4.QtGui import QWidget

import qtUtils
from . import qtUtils

from utils import constants
from utils import utils
Expand Down
14 changes: 7 additions & 7 deletions src/qt/qChatWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QWidget

from qChatTab import QChatTab
from qAcceptDialog import QAcceptDialog
from qHelpDialog import QHelpDialog
from qSMPInitiateDialog import QSMPInitiateDialog
from qSMPRespondDialog import QSMPRespondDialog
import qtUtils
from .qChatTab import QChatTab
from .qAcceptDialog import QAcceptDialog
from .qHelpDialog import QHelpDialog
from .qSMPInitiateDialog import QSMPInitiateDialog
from .qSMPRespondDialog import QSMPRespondDialog
from . import qtUtils

from utils import constants
from utils import errors
Expand Down Expand Up @@ -247,7 +247,7 @@ def sendMessageToTab(self, command, sourceNick, payload):
elif payload == constants.TYPING_STOP_WITH_TEXT:
self.statusBar.showMessage("%s has entered text" % sourceNick)
elif command == constants.COMMAND_SMP_0:
print('got request for smp in tab %d' % (tabIndex))
print(('got request for smp in tab %d' % (tabIndex)))
else:
tab.appendMessage(payload, constants.RECEIVER)

Expand Down
2 changes: 1 addition & 1 deletion src/qt/qConnectingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from PyQt4.QtGui import QMovie
from PyQt4.QtGui import QWidget

import qtUtils
from . import qtUtils


class QConnectingWidget(QWidget):
Expand Down
2 changes: 1 addition & 1 deletion src/qt/qHelpDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from PyQt4.QtGui import QLabel
from PyQt4.QtGui import QVBoxLayout

from qLinkLabel import QLinkLabel
from .qLinkLabel import QLinkLabel

class QHelpDialog(QMessageBox):
def __init__(self, parent=None):
Expand Down
6 changes: 3 additions & 3 deletions src/qt/qLoginWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QVBoxLayout

from qNickInputWidget import QNickInputWidget
from qLinkLabel import QLinkLabel
import qtUtils
from .qNickInputWidget import QNickInputWidget
from .qLinkLabel import QLinkLabel
from . import qtUtils

from utils import constants
from utils import utils
Expand Down
2 changes: 1 addition & 1 deletion src/qt/qNickInputWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QWidget

import qtUtils
from . import qtUtils

from utils import constants
from utils import errors
Expand Down
Loading