diff --git a/Makefile b/Makefile index 36927797..d3818f4d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ APP=pybitmessage -VERSION=0.4.4 +VERSION=0.4.2 RELEASE=1 ARCH_TYPE=`uname -m` PREFIX?=/usr/local diff --git a/arch.sh b/arch.sh index 825367d8..64c903a7 100755 --- a/arch.sh +++ b/arch.sh @@ -1,8 +1,8 @@ #!/bin/bash APP=pybitmessage -PREV_VERSION=0.4.4 -VERSION=0.4.4 +PREV_VERSION=0.4.2 +VERSION=0.4.2 RELEASE=1 ARCH_TYPE=any CURRDIR=`pwd` diff --git a/archpackage/PKGBUILD b/archpackage/PKGBUILD index 061795dc..33eed270 100644 --- a/archpackage/PKGBUILD +++ b/archpackage/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Bob Mottram (4096 bits) pkgname=pybitmessage -pkgver=0.4.4 +pkgver=0.4.2 pkgrel=1 pkgdesc="Bitmessage is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide "non-content" data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs." arch=('any') diff --git a/debian.sh b/debian.sh index 709f1879..117d863c 100755 --- a/debian.sh +++ b/debian.sh @@ -1,8 +1,8 @@ #!/bin/bash APP=pybitmessage -PREV_VERSION=0.4.4 -VERSION=0.4.4 +PREV_VERSION=0.4.2 +VERSION=0.4.2 RELEASE=1 ARCH_TYPE=all DIR=${APP}-${VERSION} diff --git a/ebuild.sh b/ebuild.sh index cacd7b06..e5550355 100755 --- a/ebuild.sh +++ b/ebuild.sh @@ -1,8 +1,8 @@ #!/bin/bash APP=pybitmessage -PREV_VERSION=0.4.4 -VERSION=0.4.4 +PREV_VERSION=0.4.2 +VERSION=0.4.2 RELEASE=1 SOURCEDIR=. ARCH_TYPE=`uname -m` diff --git a/generate.sh b/generate.sh index c8f0e393..933c08e9 100755 --- a/generate.sh +++ b/generate.sh @@ -4,7 +4,7 @@ rm -f Makefile rpmpackage/*.spec -packagemonkey -n "PyBitmessage" --version "0.4.4" --dir "." -l "mit" \ +packagemonkey -n "PyBitmessage" --version "0.4.2" --dir "." -l "mit" \ -e "Bob Mottram (4096 bits) " \ --brief "Send encrypted messages" \ --desc "Bitmessage is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide \"non-content\" data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs." \ diff --git a/puppy.sh b/puppy.sh index 48832734..6107ff4a 100755 --- a/puppy.sh +++ b/puppy.sh @@ -1,8 +1,8 @@ #!/bin/bash APP=pybitmessage -PREV_VERSION=0.4.4 -VERSION=0.4.4 +PREV_VERSION=0.4.2 +VERSION=0.4.2 RELEASE=1 BUILDDIR=~/petbuild CURRDIR=`pwd` diff --git a/rpm.sh b/rpm.sh index be2e21fa..9b67ba61 100755 --- a/rpm.sh +++ b/rpm.sh @@ -1,8 +1,8 @@ #!/bin/bash APP=pybitmessage -PREV_VERSION=0.4.4 -VERSION=0.4.4 +PREV_VERSION=0.4.2 +VERSION=0.4.2 RELEASE=1 SOURCEDIR=. ARCH_TYPE=`uname -m` diff --git a/rpmpackage/pybitmessage.spec b/rpmpackage/pybitmessage.spec index 537a012e..c30bbe0d 100644 --- a/rpmpackage/pybitmessage.spec +++ b/rpmpackage/pybitmessage.spec @@ -1,5 +1,5 @@ Name: pybitmessage -Version: 0.4.4 +Version: 0.4.2 Release: 1%{?dist} Summary: Send encrypted messages License: MIT diff --git a/slack.sh b/slack.sh index c19ff954..9b6d70f7 100755 --- a/slack.sh +++ b/slack.sh @@ -1,8 +1,8 @@ #!/bin/bash APP=pybitmessage -PREV_VERSION=0.4.4 -VERSION=0.4.4 +PREV_VERSION=0.4.2 +VERSION=0.4.2 RELEASE=1 ARCH_TYPE=`uname -m` BUILDDIR=~/slackbuild diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 9952caf8..1c1c08a6 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2663,15 +2663,19 @@ class MyForm(QtGui.QMainWindow): def on_action_InboxMarkUnread(self): font = QFont() font.setBold(True) + inventoryHashesToMarkUnread = [] for row in self.ui.tableWidgetInbox.selectedIndexes(): currentRow = row.row() inventoryHashToMarkUnread = str(self.ui.tableWidgetInbox.item( currentRow, 3).data(Qt.UserRole).toPyObject()) - sqlExecute('''UPDATE inbox SET read=0 WHERE msgid=?''', inventoryHashToMarkUnread) + inventoryHashesToMarkUnread.append(inventoryHashToMarkUnread) self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 3).setFont(font) + #sqlite requires the exact number of ?s to prevent injection + sqlExecute('''UPDATE inbox SET read=0 WHERE msgid IN (%s)''' % ( + "?," * len(inventoryHashesToMarkUnread))[:-1], *inventoryHashesToMarkUnread) self.changedInboxUnread() # self.ui.tableWidgetInbox.selectRow(currentRow + 1) # This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary. @@ -3852,7 +3856,7 @@ def run(): translator = QtCore.QTranslator() translationpath = os.path.join( - getattr(sys, '_MEIPASS', sys.path[0]), + getattr(sys, '_MEIPASS', ''), 'translations', 'bitmessage_' + l10n.getTranslationLanguage() ) diff --git a/src/class_singleWorker.py b/src/class_singleWorker.py index 541ecd98..8fad2ea8 100644 --- a/src/class_singleWorker.py +++ b/src/class_singleWorker.py @@ -96,8 +96,8 @@ class singleWorker(threading.Thread): status, addressVersionNumber, streamNumber, hash = decodeAddress( myAddress) - TTL = int(28 * 24 * 60 * 60 + random.randrange(-300, 300))# 28 days from now plus or minus five minutes - embeddedTime = int(time.time() + TTL) + TTL = 28 * 24 * 60 * 60 # 28 days + embeddedTime = int(time.time() + random.randrange(-300, 300) + TTL) # 28 days from now plus or minus five minutes payload = pack('>Q', (embeddedTime)) payload += '\x00\x00\x00\x01' # object type: pubkey payload += encodeVarint(addressVersionNumber) # Address version number @@ -174,8 +174,8 @@ class singleWorker(threading.Thread): status, addressVersionNumber, streamNumber, hash = decodeAddress( myAddress) - TTL = int(28 * 24 * 60 * 60 + random.randrange(-300, 300))# 28 days from now plus or minus five minutes - embeddedTime = int(time.time() + TTL) + TTL = 28 * 24 * 60 * 60 # 28 days + embeddedTime = int(time.time() + random.randrange(-300, 300) + TTL) # 28 days from now plus or minus five minutes signedTimeForProtocolV2 = embeddedTime - TTL """ According to the protocol specification, the expiresTime along with the pubkey information is @@ -273,8 +273,8 @@ class singleWorker(threading.Thread): status, addressVersionNumber, streamNumber, hash = decodeAddress( myAddress) - TTL = int(28 * 24 * 60 * 60 + random.randrange(-300, 300))# 28 days from now plus or minus five minutes - embeddedTime = int(time.time() + TTL) + TTL = 28 * 24 * 60 * 60 # 28 days + embeddedTime = int(time.time() + random.randrange(-300, 300) + TTL) # 28 days from now plus or minus five minutes payload = pack('>Q', (embeddedTime)) payload += '\x00\x00\x00\x01' # object type: pubkey payload += encodeVarint(addressVersionNumber) # Address version number @@ -407,8 +407,8 @@ class singleWorker(threading.Thread): pubEncryptionKey = highlevelcrypto.privToPub( privEncryptionKeyHex).decode('hex') - TTL = int(28 * 24 * 60 * 60 + random.randrange(-300, 300))# 28 days from now plus or minus five minutes - embeddedTime = int(time.time() + TTL) + TTL = 2.5 * 24 * 60 * 60 # 2.5 days + embeddedTime = int(time.time() + random.randrange(-300, 300) + TTL) payload = pack('>Q', embeddedTime) payload += '\x00\x00\x00\x03' # object type: broadcast @@ -460,11 +460,9 @@ class singleWorker(threading.Thread): dataToEncrypt += encodeVarint(len(signature)) dataToEncrypt += signature - # Encrypt the broadcast with the information contained in the broadcaster's address. - # Anyone who knows the address can generate the private encryption key to decrypt - # the broadcast. This provides virtually no privacy; its purpose is to keep - # questionable and illegal content from flowing through the Internet connections - # and being stored on the disk of 3rd parties. + # Encrypt the broadcast with the information contained in the broadcaster's address. Anyone who knows the address can generate + # the private encryption key to decrypt the broadcast. This provides virtually no privacy; its purpose is to keep questionable + # and illegal content from flowing through the Internet connections and being stored on the disk of 3rd parties. if addressVersionNumber <= 3: privEncryptionKey = hashlib.sha512(encodeVarint( addressVersionNumber) + encodeVarint(streamNumber) + ripe).digest()[:32] @@ -626,8 +624,8 @@ class singleWorker(threading.Thread): continue #on with the next msg on which we can do some work # At this point we know that we have the necessary pubkey in the pubkeys table. - TTL = int(28 * 24 * 60 * 60 + random.randrange(-300, 300))# 28 days from now plus or minus five minutes - embeddedTime = int(time.time() + TTL) + TTL = 2.5 * 24 * 60 * 60 # 2.5 days + embeddedTime = int(time.time() + random.randrange(-300, 300) + TTL) # 2.5 days from now plus or minus five minutes if not shared.config.has_section(toaddress): # if we aren't sending this to ourselves or a chan shared.ackdataForWhichImWatching[ackdata] = 0 @@ -969,8 +967,8 @@ class singleWorker(threading.Thread): if tag not in shared.neededPubkeys: shared.neededPubkeys[tag] = (toAddress, highlevelcrypto.makeCryptor(privEncryptionKey.encode('hex'))) # We'll need this for when we receive a pubkey reply: it will be encrypted and we'll need to decrypt it. - TTL = int(2.5 * 24 * 60 * 60 + random.randrange(-300, 300)) # 2.5 days from now plus or minus five minutes - embeddedTime = int(time.time() + TTL) + TTL = 2.5 * 24 * 60 * 60 # 2.5 days + embeddedTime = int(time.time() + random.randrange(-300, 300) + TTL) # 2.5 days from now plus or minus five minutes payload = pack('>Q', embeddedTime) payload += '\x00\x00\x00\x00' # object type: getpubkey payload += encodeVarint(addressVersionNumber) @@ -990,6 +988,7 @@ class singleWorker(threading.Thread): shared.UISignalQueue.put(('updateSentItemStatusByHash', ( ripe, tr.translateText("MainWindow",'Doing work necessary to request encryption key.')))) + TTL = 2.5 * 24 * 60 * 60 # 2.5 days target = 2 ** 64 / (shared.networkDefaultProofOfWorkNonceTrialsPerByte*(len(payload) + 8 + shared.networkDefaultPayloadLengthExtraBytes + ((TTL*(len(payload)+8+shared.networkDefaultPayloadLengthExtraBytes))/(2 ** 16)))) initialHash = hashlib.sha512(payload).digest() trialValue, nonce = proofofwork.run(target, initialHash) @@ -1015,14 +1014,13 @@ class singleWorker(threading.Thread): shared.UISignalQueue.put(('updateSentItemStatusByHash', (ripe, tr.translateText("MainWindow",'Sending public key request. Waiting for reply. Requested at %1').arg(l10n.formatTimestamp())))) def generateFullAckMessage(self, ackdata, toStreamNumber): - TTL = int(2.5 * 24 * 60 * 60 + random.randrange(-300, 300)) # 2.5 days plus or minus 5 minutes - embeddedTime = int(time.time() + TTL) + embeddedTime = int(time.time() + random.randrange(-300, 300)) # the current time plus or minus five minutes. payload = pack('>Q', (embeddedTime)) payload += '\x00\x00\x00\x02' # object type: msg if int(time.time()) >= 1416175200: # Sun, 16 Nov 2014 22:00:00 GMT payload += encodeVarint(1) # msg version payload += encodeVarint(toStreamNumber) + ackdata - + TTL = 2.5 * 24 * 60 * 60 # 2.5 days target = 2 ** 64 / (shared.networkDefaultProofOfWorkNonceTrialsPerByte*(len(payload) + 8 + shared.networkDefaultPayloadLengthExtraBytes + ((TTL*(len(payload)+8+shared.networkDefaultPayloadLengthExtraBytes))/(2 ** 16)))) with shared.printLock: print '(For ack message) Doing proof of work...'