diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..34cba6df --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**pyc diff --git a/COPYING b/COPYING index e386f371..078afb1b 100644 --- a/COPYING +++ b/COPYING @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE. \ No newline at end of file diff --git a/LICENSE b/LICENSE index de7d6159..daaa84e7 100644 --- a/LICENSE +++ b/LICENSE @@ -17,4 +17,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100755 index 21b9f793..00000000 --- a/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -APP=pybitmessage -VERSION=0.2.8 - -all: - -debug: - -source: - tar -cvzf ../$(APP)_$(VERSION).orig.tar.gz ../$(APP)-$(VERSION) --exclude=.git - -install: - mkdir -m 755 -p /usr/share/applications - mkdir -m 755 -p /usr/share/applications/$(APP) - mkdir -m 755 -p /usr/share/applications/$(APP)/images - mkdir -m 755 -p /usr/share/applications/$(APP)/pyelliptic - mkdir -m 755 -p /usr/share/applications/$(APP)/socks - mkdir -m 755 -p /usr/share/pixmaps - mkdir -m 755 -p /usr/share/icons - mkdir -m 755 -p /usr/share/icons/hicolor - mkdir -m 755 -p /usr/share/icons/hicolor/scalable - mkdir -m 755 -p /usr/share/icons/hicolor/scalable/apps - mkdir -m 755 -p /usr/share/icons/hicolor/24x24 - mkdir -m 755 -p /usr/share/icons/hicolor/24x24/apps - - install -m 644 src/*.ui /usr/share/applications/$(APP) - install -m 644 src/*.py /usr/share/applications/$(APP) - install -m 644 src/*.qrc /usr/share/applications/$(APP) - - install -m 644 src/images/*.png /usr/share/applications/$(APP)/images - install -m 644 src/images/*.ico /usr/share/applications/$(APP)/images - install -m 644 src/pyelliptic/*.py /usr/share/applications/$(APP)/pyelliptic - install -m 644 src/socks/*.py /usr/share/applications/$(APP)/socks - install -m 755 debian/pybm /usr/bin - - install -m 644 desktop/$(APP).desktop /usr/share/applications/$(APP)/$(APP).desktop - install -m 644 src/images/can-icon-24px.png /usr/share/icons/hicolor/24x24/apps/$(APP).png - install -m 644 desktop/can-icon.svg /usr/share/icons/hicolor/scalable/apps/$(APP).svg - install -m 644 desktop/can-icon.svg /usr/share/pixmaps/$(APP).svg - -clean: - rm -rf debian/$(APP) - rm -f ../$(APP)_*.deb ../$(APP)_*.asc ../$(APP)_*.dsc ../$(APP)*.changes - rm -f *.sh~ src/*.pyc src/socks/*.pyc src/pyelliptic/*.pyc - rm -f *.deb \#* \.#* debian/*.log debian/*.substvars - rm -f Makefile~ diff --git a/README.md b/README.md index 979872f9..f124c30d 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,4 @@ references ---------- * [project website](https://bitmessage.org) * [protocol specification](https://bitmessage.org/wiki/Protocol_specification) -* [whitepaper](https://bitmessage.org/bitmessage.pdf) +* [whitepaper](https://bitmessage.org/bitmessage.pdf) \ No newline at end of file diff --git a/src/about.py b/about.py similarity index 100% rename from src/about.py rename to about.py diff --git a/src/about.ui b/about.ui similarity index 100% rename from src/about.ui rename to about.ui diff --git a/src/addresses.py b/addresses.py similarity index 100% rename from src/addresses.py rename to addresses.py diff --git a/src/api client.py b/api client.py similarity index 100% rename from src/api client.py rename to api client.py diff --git a/src/bitmessage_icons.qrc b/bitmessage_icons.qrc similarity index 100% rename from src/bitmessage_icons.qrc rename to bitmessage_icons.qrc diff --git a/src/bitmessage_icons_rc.py b/bitmessage_icons_rc.py similarity index 100% rename from src/bitmessage_icons_rc.py rename to bitmessage_icons_rc.py diff --git a/src/bitmessagemain.py b/bitmessagemain.py similarity index 93% rename from src/bitmessagemain.py rename to bitmessagemain.py index 409b1ad2..71af5982 100755 --- a/src/bitmessagemain.py +++ b/bitmessagemain.py @@ -181,7 +181,7 @@ class outgoingSynSender(QThread): knownNodesLock.release() print 'deleting ', HOST, 'from knownNodes because it is more than 48 hours old and we could not connect to it.' except Exception, err: - sys.stderr.write('An exception has occurred in the outgoingSynSender thread that was not caught by other exception types: %s\n' % err) + print 'An exception has occurred in the outgoingSynSender thread that was not caught by other exception types:', err time.sleep(0.1) #Only one singleListener thread will ever exist. It creates the receiveDataThread and sendDataThread for each incoming connection. Note that it cannot set the stream number because it is not known yet- the other node will have to tell us its stream number in a version message. If we don't care about their stream, we will close the connection (within the recversion function of the recieveData thread) @@ -439,7 +439,7 @@ class receiveDataThread(QThread): printLock.release() self.broadcastaddr([(int(time.time()), self.streamNumber, 1, self.HOST, remoteNodeIncomingPort)]) #This lets all of our peers know about this new node. self.sendaddr() #This is one large addr message to this one peer. - if not self.initiatedConnection and connectionsCount[self.streamNumber] > 150: + if connectionsCount[self.streamNumber] > 150: printLock.acquire() print 'We are connected to too many people. Closing connection.' printLock.release() @@ -511,16 +511,7 @@ class receiveDataThread(QThread): if not self.isProofOfWorkSufficient(data): print 'Proof of work in broadcast message insufficient.' return - readPosition = 8 #bypass the nonce - embeddedTime, = unpack('>I',data[readPosition:readPosition+4]) - - #This section is used for the transition from 32 bit time to 64 bit time in the protocol. - if embeddedTime == 0: - embeddedTime, = unpack('>Q',data[readPosition:readPosition+8]) - readPosition += 8 - else: - readPosition += 4 - + embeddedTime, = unpack('>I',data[8:12]) if embeddedTime > (int(time.time())+10800): #prevent funny business print 'The embedded time in this broadcast message is more than three hours in the future. That doesn\'t make sense. Ignoring message.' return @@ -548,7 +539,7 @@ class receiveDataThread(QThread): self.emit(SIGNAL("incrementNumberOfBroadcastsProcessed()")) - self.processbroadcast(readPosition,data)#When this function returns, we will have either successfully processed this broadcast because we are interested in it, ignored it because we aren't interested in it, or found problem with the broadcast that warranted ignoring it. + self.processbroadcast(data)#When this function returns, we will have either successfully processed this broadcast because we are interested in it, ignored it because we aren't interested in it, or found problem with the broadcast that warranted ignoring it. # Let us now set lengthOfTimeWeShouldUseToProcessThisMessage. If we haven't used the specified amount of time, we shall sleep. These values are mostly the same values used for msg messages although broadcast messages are processed faster. if len(data) > 100000000: #Size is greater than 100 megabytes @@ -572,7 +563,8 @@ class receiveDataThread(QThread): printLock.release() #A broadcast message has a valid time and POW and requires processing. The recbroadcast function calls this one. - def processbroadcast(self,readPosition,data): + def processbroadcast(self,data): + readPosition = 12 broadcastVersion, broadcastVersionLength = decodeVarint(data[readPosition:readPosition+9]) if broadcastVersion <> 1: #Cannot decode incoming broadcast versions higher than 1. Assuming the sender isn\' being silly, you should upgrade Bitmessage because this message shall be ignored. @@ -701,20 +693,13 @@ class receiveDataThread(QThread): readPosition = 8 embeddedTime, = unpack('>I',data[readPosition:readPosition+4]) - - #This section is used for the transition from 32 bit time to 64 bit time in the protocol. - if embeddedTime == 0: - embeddedTime, = unpack('>Q',data[readPosition:readPosition+8]) - readPosition += 8 - else: - readPosition += 4 - if embeddedTime > int(time.time())+10800: print 'The time in the msg message is too new. Ignoring it. Time:', embeddedTime return if embeddedTime < int(time.time())-maximumAgeOfAnObjectThatIAmWillingToAccept: print 'The time in the msg message is too old. Ignoring it. Time:', embeddedTime return + readPosition += 4 streamNumberAsClaimedByMsg, streamNumberAsClaimedByMsgLength = decodeVarint(data[readPosition:readPosition+9]) if streamNumberAsClaimedByMsg != self.streamNumber: print 'The stream number encoded in this msg (' + str(streamNumberAsClaimedByMsg) + ') message does not match the stream number on which it was received. Ignoring it.' @@ -1039,14 +1024,6 @@ class receiveDataThread(QThread): readPosition = 8 #for the nonce embeddedTime, = unpack('>I',data[readPosition:readPosition+4]) - - #This section is used for the transition from 32 bit time to 64 bit time in the protocol. - if embeddedTime == 0: - embeddedTime, = unpack('>Q',data[readPosition:readPosition+8]) - readPosition += 8 - else: - readPosition += 4 - if embeddedTime < int(time.time())-lengthOfTimeToHoldOnToAllPubkeys: printLock.acquire() print 'The embedded time in this pubkey message is too old. Ignoring. Embedded time is:', embeddedTime @@ -1057,6 +1034,7 @@ class receiveDataThread(QThread): print 'The embedded time in this pubkey message more than several hours in the future. This is irrational. Ignoring message.' printLock.release() return + readPosition += 4 #for the time addressVersion, varintLength = decodeVarint(data[readPosition:readPosition+10]) readPosition += varintLength streamNumber, varintLength = decodeVarint(data[readPosition:readPosition+10]) @@ -1176,29 +1154,19 @@ class receiveDataThread(QThread): if len(data) < 34: print 'getpubkey message doesn\'t contain enough data. Ignoring.' return - readPosition = 8 #bypass the nonce - embeddedTime, = unpack('>I',data[readPosition:readPosition+4]) - - #This section is used for the transition from 32 bit time to 64 bit time in the protocol. - if embeddedTime == 0: - embeddedTime, = unpack('>Q',data[readPosition:readPosition+8]) - readPosition += 8 - else: - readPosition += 4 - + embeddedTime, = unpack('>I',data[8:12]) if embeddedTime > int(time.time())+10800: print 'The time in this getpubkey message is too new. Ignoring it. Time:', embeddedTime return if embeddedTime < int(time.time())-maximumAgeOfAnObjectThatIAmWillingToAccept: print 'The time in this getpubkey message is too old. Ignoring it. Time:', embeddedTime return - addressVersionNumber, addressVersionLength = decodeVarint(data[readPosition:readPosition+10]) - readPosition += addressVersionLength - streamNumber, streamNumberLength = decodeVarint(data[readPosition:readPosition+10]) + + addressVersionNumber, addressVersionLength = decodeVarint(data[12:22]) + streamNumber, streamNumberLength = decodeVarint(data[12+addressVersionLength:22+addressVersionLength]) if streamNumber <> self.streamNumber: print 'The streamNumber', streamNumber, 'doesn\'t match our stream number:', self.streamNumber return - readPosition += streamNumberLength inventoryHash = calculateInventoryHash(data) inventoryLock.acquire() @@ -1227,7 +1195,7 @@ class receiveDataThread(QThread): print 'The addressVersionNumber of the pubkey request is too high. Can\'t understand. Ignoring it.' return - requestedHash = data[readPosition:readPosition+20] + requestedHash = data[12+addressVersionLength+streamNumberLength:32+addressVersionLength+streamNumberLength] if len(requestedHash) != 20: print 'The length of the requested hash is not 20 bytes. Something is wrong. Ignoring.' return @@ -1381,189 +1349,98 @@ class receiveDataThread(QThread): printLock.acquire() print 'addr message contains', numberOfAddressesIncluded, 'IP addresses.' printLock.release() + #print 'lengthOfNumberOfAddresses', lengthOfNumberOfAddresses - if self.remoteProtocolVersion == 1: - if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0: - return - if len(data) != lengthOfNumberOfAddresses + (34 * numberOfAddressesIncluded): - print 'addr message does not contain the correct amount of data. Ignoring.' - return + if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0: + return + if len(data) < lengthOfNumberOfAddresses + (34 * numberOfAddressesIncluded): + print 'addr message does not contain enough data. Ignoring.' + return - needToWriteKnownNodesToDisk = False - for i in range(0,numberOfAddressesIncluded): - try: - if data[16+lengthOfNumberOfAddresses+(34*i):28+lengthOfNumberOfAddresses+(34*i)] != '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF': - printLock.acquire() - print 'Skipping IPv6 address.', repr(data[16+lengthOfNumberOfAddresses+(34*i):28+lengthOfNumberOfAddresses+(34*i)]) - printLock.release() - continue - except Exception, err: + needToWriteKnownNodesToDisk = False + for i in range(0,numberOfAddressesIncluded): + try: + if data[16+lengthOfNumberOfAddresses+(34*i):28+lengthOfNumberOfAddresses+(34*i)] != '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF': printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (to test for an IPv6 address). Message: %s\n' % str(err)) + print 'Skipping IPv6 address.', repr(data[16+lengthOfNumberOfAddresses+(34*i):28+lengthOfNumberOfAddresses+(34*i)]) printLock.release() - break #giving up on unpacking any more. We should still be connected however. + continue + except Exception, err: + printLock.acquire() + sys.stderr.write('ERROR TRYING TO UNPACK recaddr (to test for an IPv6 address). Message: %s\n' % str(err)) + printLock.release() + break #giving up on unpacking any more. We should still be connected however. - try: - recaddrStream, = unpack('>I',data[4+lengthOfNumberOfAddresses+(34*i):8+lengthOfNumberOfAddresses+(34*i)]) - except Exception, err: - printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrStream). Message: %s\n' % str(err)) - printLock.release() - break #giving up on unpacking any more. We should still be connected however. - if recaddrStream == 0: - continue - if recaddrStream != self.streamNumber and recaddrStream != (self.streamNumber * 2) and recaddrStream != ((self.streamNumber * 2) + 1): #if the embedded stream number is not in my stream or either of my child streams then ignore it. Someone might be trying funny business. - continue - try: - recaddrServices, = unpack('>Q',data[8+lengthOfNumberOfAddresses+(34*i):16+lengthOfNumberOfAddresses+(34*i)]) - except Exception, err: - printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrServices). Message: %s\n' % str(err)) - printLock.release() - break #giving up on unpacking any more. We should still be connected however. + try: + recaddrStream, = unpack('>I',data[4+lengthOfNumberOfAddresses+(34*i):8+lengthOfNumberOfAddresses+(34*i)]) + except Exception, err: + printLock.acquire() + sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrStream). Message: %s\n' % str(err)) + printLock.release() + break #giving up on unpacking any more. We should still be connected however. + if recaddrStream == 0: + continue + if recaddrStream != self.streamNumber and recaddrStream != (self.streamNumber * 2) and recaddrStream != ((self.streamNumber * 2) + 1): #if the embedded stream number is not in my stream or either of my child streams then ignore it. Someone might be trying funny business. + continue + try: + recaddrServices, = unpack('>Q',data[8+lengthOfNumberOfAddresses+(34*i):16+lengthOfNumberOfAddresses+(34*i)]) + except Exception, err: + printLock.acquire() + sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrServices). Message: %s\n' % str(err)) + printLock.release() + break #giving up on unpacking any more. We should still be connected however. - try: - recaddrPort, = unpack('>H',data[32+lengthOfNumberOfAddresses+(34*i):34+lengthOfNumberOfAddresses+(34*i)]) - except Exception, err: - printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrPort). Message: %s\n' % str(err)) - printLock.release() - break #giving up on unpacking any more. We should still be connected however. - #print 'Within recaddr(): IP', recaddrIP, ', Port', recaddrPort, ', i', i - hostFromAddrMessage = socket.inet_ntoa(data[28+lengthOfNumberOfAddresses+(34*i):32+lengthOfNumberOfAddresses+(34*i)]) - #print 'hostFromAddrMessage', hostFromAddrMessage - if data[28+lengthOfNumberOfAddresses+(34*i)] == '\x7F': - print 'Ignoring IP address in loopback range:', hostFromAddrMessage - continue - if data[28+lengthOfNumberOfAddresses+(34*i)] == '\x0A': - print 'Ignoring IP address in private range:', hostFromAddrMessage - continue - if data[28+lengthOfNumberOfAddresses+(34*i):30+lengthOfNumberOfAddresses+(34*i)] == '\xC0A8': - print 'Ignoring IP address in private range:', hostFromAddrMessage - continue - timeSomeoneElseReceivedMessageFromThisNode, = unpack('>I',data[lengthOfNumberOfAddresses+(34*i):4+lengthOfNumberOfAddresses+(34*i)]) #This is the 'time' value in the received addr message. - if recaddrStream not in knownNodes: #knownNodes is a dictionary of dictionaries with one outer dictionary for each stream. If the outer stream dictionary doesn't exist yet then we must make it. - knownNodesLock.acquire() - knownNodes[recaddrStream] = {} - knownNodesLock.release() - if hostFromAddrMessage not in knownNodes[recaddrStream]: - if len(knownNodes[recaddrStream]) < 20000 and timeSomeoneElseReceivedMessageFromThisNode > (int(time.time())-10800) and timeSomeoneElseReceivedMessageFromThisNode < (int(time.time()) + 10800): #If we have more than 20000 nodes in our list already then just forget about adding more. Also, make sure that the time that someone else received a message from this node is within three hours from now. - knownNodesLock.acquire() - knownNodes[recaddrStream][hostFromAddrMessage] = (recaddrPort, timeSomeoneElseReceivedMessageFromThisNode) - knownNodesLock.release() - needToWriteKnownNodesToDisk = True - hostDetails = (timeSomeoneElseReceivedMessageFromThisNode, recaddrStream, recaddrServices, hostFromAddrMessage, recaddrPort) - listOfAddressDetailsToBroadcastToPeers.append(hostDetails) - else: - PORT, timeLastReceivedMessageFromThisNode = knownNodes[recaddrStream][hostFromAddrMessage]#PORT in this case is either the port we used to connect to the remote node, or the port that was specified by someone else in a past addr message. - if (timeLastReceivedMessageFromThisNode < timeSomeoneElseReceivedMessageFromThisNode) and (timeSomeoneElseReceivedMessageFromThisNode < int(time.time())): - knownNodesLock.acquire() - knownNodes[recaddrStream][hostFromAddrMessage] = (PORT, timeSomeoneElseReceivedMessageFromThisNode) - knownNodesLock.release() - if PORT != recaddrPort: - print 'Strange occurance: The port specified in an addr message', str(recaddrPort),'does not match the port',str(PORT),'that this program (or some other peer) used to connect to it',str(hostFromAddrMessage),'. Perhaps they changed their port or are using a strange NAT configuration.' - if needToWriteKnownNodesToDisk: #Runs if any nodes were new to us. Also, share those nodes with our peers. - output = open(appdata + 'knownnodes.dat', 'wb') + try: + recaddrPort, = unpack('>H',data[32+lengthOfNumberOfAddresses+(34*i):34+lengthOfNumberOfAddresses+(34*i)]) + except Exception, err: + printLock.acquire() + sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrPort). Message: %s\n' % str(err)) + printLock.release() + break #giving up on unpacking any more. We should still be connected however. + #print 'Within recaddr(): IP', recaddrIP, ', Port', recaddrPort, ', i', i + hostFromAddrMessage = socket.inet_ntoa(data[28+lengthOfNumberOfAddresses+(34*i):32+lengthOfNumberOfAddresses+(34*i)]) + #print 'hostFromAddrMessage', hostFromAddrMessage + if data[28+lengthOfNumberOfAddresses+(34*i)] == '\x7F': + print 'Ignoring IP address in loopback range:', hostFromAddrMessage + continue + if data[28+lengthOfNumberOfAddresses+(34*i)] == '\x0A': + print 'Ignoring IP address in private range:', hostFromAddrMessage + continue + if data[28+lengthOfNumberOfAddresses+(34*i):30+lengthOfNumberOfAddresses+(34*i)] == '\xC0A8': + print 'Ignoring IP address in private range:', hostFromAddrMessage + continue + timeSomeoneElseReceivedMessageFromThisNode, = unpack('>I',data[lengthOfNumberOfAddresses+(34*i):4+lengthOfNumberOfAddresses+(34*i)]) #This is the 'time' value in the received addr message. + if recaddrStream not in knownNodes: #knownNodes is a dictionary of dictionaries with one outer dictionary for each stream. If the outer stream dictionary doesn't exist yet then we must make it. knownNodesLock.acquire() - pickle.dump(knownNodes, output) + knownNodes[recaddrStream] = {} knownNodesLock.release() - output.close() - self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers) #no longer broadcast - printLock.acquire() - print 'knownNodes currently has', len(knownNodes[self.streamNumber]), 'nodes for this stream.' - printLock.release() - elif self.remoteProtocolVersion >= 2: #The difference is that in protocol version 2, network addresses use 64 bit times rather than 32 bit times. - if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0: - return - if len(data) != lengthOfNumberOfAddresses + (38 * numberOfAddressesIncluded): - print 'addr message does not contain the correct amount of data. Ignoring.' - return - - needToWriteKnownNodesToDisk = False - for i in range(0,numberOfAddressesIncluded): - try: - if data[20+lengthOfNumberOfAddresses+(38*i):32+lengthOfNumberOfAddresses+(38*i)] != '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF': - printLock.acquire() - print 'Skipping IPv6 address.', repr(data[20+lengthOfNumberOfAddresses+(38*i):32+lengthOfNumberOfAddresses+(38*i)]) - printLock.release() - continue - except Exception, err: - printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (to test for an IPv6 address). Message: %s\n' % str(err)) - printLock.release() - break #giving up on unpacking any more. We should still be connected however. - - try: - recaddrStream, = unpack('>I',data[8+lengthOfNumberOfAddresses+(38*i):12+lengthOfNumberOfAddresses+(38*i)]) - except Exception, err: - printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrStream). Message: %s\n' % str(err)) - printLock.release() - break #giving up on unpacking any more. We should still be connected however. - if recaddrStream == 0: - continue - if recaddrStream != self.streamNumber and recaddrStream != (self.streamNumber * 2) and recaddrStream != ((self.streamNumber * 2) + 1): #if the embedded stream number is not in my stream or either of my child streams then ignore it. Someone might be trying funny business. - continue - try: - recaddrServices, = unpack('>Q',data[12+lengthOfNumberOfAddresses+(38*i):20+lengthOfNumberOfAddresses+(38*i)]) - except Exception, err: - printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrServices). Message: %s\n' % str(err)) - printLock.release() - break #giving up on unpacking any more. We should still be connected however. - - try: - recaddrPort, = unpack('>H',data[36+lengthOfNumberOfAddresses+(38*i):38+lengthOfNumberOfAddresses+(38*i)]) - except Exception, err: - printLock.acquire() - sys.stderr.write('ERROR TRYING TO UNPACK recaddr (recaddrPort). Message: %s\n' % str(err)) - printLock.release() - break #giving up on unpacking any more. We should still be connected however. - #print 'Within recaddr(): IP', recaddrIP, ', Port', recaddrPort, ', i', i - hostFromAddrMessage = socket.inet_ntoa(data[32+lengthOfNumberOfAddresses+(38*i):36+lengthOfNumberOfAddresses+(38*i)]) - #print 'hostFromAddrMessage', hostFromAddrMessage - if data[32+lengthOfNumberOfAddresses+(38*i)] == '\x7F': - print 'Ignoring IP address in loopback range:', hostFromAddrMessage - continue - if data[32+lengthOfNumberOfAddresses+(38*i)] == '\x0A': - print 'Ignoring IP address in private range:', hostFromAddrMessage - continue - if data[32+lengthOfNumberOfAddresses+(38*i):34+lengthOfNumberOfAddresses+(38*i)] == '\xC0A8': - print 'Ignoring IP address in private range:', hostFromAddrMessage - continue - timeSomeoneElseReceivedMessageFromThisNode, = unpack('>Q',data[lengthOfNumberOfAddresses+(38*i):8+lengthOfNumberOfAddresses+(38*i)]) #This is the 'time' value in the received addr message. 64-bit. - if recaddrStream not in knownNodes: #knownNodes is a dictionary of dictionaries with one outer dictionary for each stream. If the outer stream dictionary doesn't exist yet then we must make it. + if hostFromAddrMessage not in knownNodes[recaddrStream]: + if len(knownNodes[recaddrStream]) < 20000 and timeSomeoneElseReceivedMessageFromThisNode > (int(time.time())-10800) and timeSomeoneElseReceivedMessageFromThisNode < (int(time.time()) + 10800): #If we have more than 20000 nodes in our list already then just forget about adding more. Also, make sure that the time that someone else received a message from this node is within three hours from now. knownNodesLock.acquire() - knownNodes[recaddrStream] = {} + knownNodes[recaddrStream][hostFromAddrMessage] = (recaddrPort, timeSomeoneElseReceivedMessageFromThisNode) knownNodesLock.release() - if hostFromAddrMessage not in knownNodes[recaddrStream]: - if len(knownNodes[recaddrStream]) < 20000 and timeSomeoneElseReceivedMessageFromThisNode > (int(time.time())-10800) and timeSomeoneElseReceivedMessageFromThisNode < (int(time.time()) + 10800): #If we have more than 20000 nodes in our list already then just forget about adding more. Also, make sure that the time that someone else received a message from this node is within three hours from now. - knownNodesLock.acquire() - knownNodes[recaddrStream][hostFromAddrMessage] = (recaddrPort, timeSomeoneElseReceivedMessageFromThisNode) - knownNodesLock.release() - print 'added new node', hostFromAddrMessage, 'to knownNodes in stream', recaddrStream - needToWriteKnownNodesToDisk = True - hostDetails = (timeSomeoneElseReceivedMessageFromThisNode, recaddrStream, recaddrServices, hostFromAddrMessage, recaddrPort) - listOfAddressDetailsToBroadcastToPeers.append(hostDetails) - else: - PORT, timeLastReceivedMessageFromThisNode = knownNodes[recaddrStream][hostFromAddrMessage]#PORT in this case is either the port we used to connect to the remote node, or the port that was specified by someone else in a past addr message. - if (timeLastReceivedMessageFromThisNode < timeSomeoneElseReceivedMessageFromThisNode) and (timeSomeoneElseReceivedMessageFromThisNode < int(time.time())): - knownNodesLock.acquire() - knownNodes[recaddrStream][hostFromAddrMessage] = (PORT, timeSomeoneElseReceivedMessageFromThisNode) - knownNodesLock.release() - if PORT != recaddrPort: - print 'Strange occurance: The port specified in an addr message', str(recaddrPort),'does not match the port',str(PORT),'that this program (or some other peer) used to connect to it',str(hostFromAddrMessage),'. Perhaps they changed their port or are using a strange NAT configuration.' - if needToWriteKnownNodesToDisk: #Runs if any nodes were new to us. Also, share those nodes with our peers. - output = open(appdata + 'knownnodes.dat', 'wb') - knownNodesLock.acquire() - pickle.dump(knownNodes, output) - knownNodesLock.release() - output.close() - self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers) - printLock.acquire() - print 'knownNodes currently has', len(knownNodes[self.streamNumber]), 'nodes for this stream.' - printLock.release() - + print 'added new node', hostFromAddrMessage, 'to knownNodes in stream', recaddrStream + needToWriteKnownNodesToDisk = True + hostDetails = (timeSomeoneElseReceivedMessageFromThisNode, recaddrStream, recaddrServices, hostFromAddrMessage, recaddrPort) + listOfAddressDetailsToBroadcastToPeers.append(hostDetails) + else: + PORT, timeLastReceivedMessageFromThisNode = knownNodes[recaddrStream][hostFromAddrMessage]#PORT in this case is either the port we used to connect to the remote node, or the port that was specified by someone else in a past addr message. + if (timeLastReceivedMessageFromThisNode < timeSomeoneElseReceivedMessageFromThisNode) and (timeSomeoneElseReceivedMessageFromThisNode < int(time.time())): + knownNodesLock.acquire() + knownNodes[recaddrStream][hostFromAddrMessage] = (PORT, timeSomeoneElseReceivedMessageFromThisNode) + knownNodesLock.release() + if PORT != recaddrPort: + print 'Strange occurance: The port specified in an addr message', str(recaddrPort),'does not match the port',str(PORT),'that this program (or some other peer) used to connect to it',str(hostFromAddrMessage),'. Perhaps they changed their port or are using a strange NAT configuration.' + if needToWriteKnownNodesToDisk: #Runs if any nodes were new to us. Also, share those nodes with our peers. + output = open(appdata + 'knownnodes.dat', 'wb') + knownNodesLock.acquire() + pickle.dump(knownNodes, output) + knownNodesLock.release() + output.close() + self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers) + printLock.acquire() + print 'knownNodes currently has', len(knownNodes[self.streamNumber]), 'nodes for this stream.' + printLock.release() #Function runs when we want to broadcast an addr message to all of our peers. Runs when we learn of nodes that we didn't previously know about and want to share them with our peers. def broadcastaddr(self,listOfAddressDetailsToBroadcastToPeers): @@ -1571,7 +1448,7 @@ class receiveDataThread(QThread): payload = '' for hostDetails in listOfAddressDetailsToBroadcastToPeers: timeLastReceivedMessageFromThisNode, streamNumber, services, host, port = hostDetails - payload += pack('>Q',timeLastReceivedMessageFromThisNode) #now uses 64-bit time + payload += pack('>I',timeLastReceivedMessageFromThisNode) payload += pack('>I',streamNumber) payload += pack('>q',services) #service bit flags offered by this node payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + socket.inet_aton(host) @@ -1626,10 +1503,7 @@ class receiveDataThread(QThread): PORT, timeLastReceivedMessageFromThisNode = value if timeLastReceivedMessageFromThisNode > (int(time.time())- maximumAgeOfNodesThatIAdvertiseToOthers): #If it is younger than 3 hours old.. numberOfAddressesInAddrMessage += 1 - if self.remoteProtocolVersion == 1: - payload += pack('>I',timeLastReceivedMessageFromThisNode) #32-bit time - else: - payload += pack('>Q',timeLastReceivedMessageFromThisNode) #64-bit time + payload += pack('>I',timeLastReceivedMessageFromThisNode) payload += pack('>I',self.streamNumber) payload += pack('>q',1) #service bit flags offered by this node payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + socket.inet_aton(HOST) @@ -1638,10 +1512,7 @@ class receiveDataThread(QThread): PORT, timeLastReceivedMessageFromThisNode = value if timeLastReceivedMessageFromThisNode > (int(time.time())- maximumAgeOfNodesThatIAdvertiseToOthers): #If it is younger than 3 hours old.. numberOfAddressesInAddrMessage += 1 - if self.remoteProtocolVersion == 1: - payload += pack('>I',timeLastReceivedMessageFromThisNode) #32-bit time - else: - payload += pack('>Q',timeLastReceivedMessageFromThisNode) #64-bit time + payload += pack('>I',timeLastReceivedMessageFromThisNode) payload += pack('>I',self.streamNumber*2) payload += pack('>q',1) #service bit flags offered by this node payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + socket.inet_aton(HOST) @@ -1650,10 +1521,7 @@ class receiveDataThread(QThread): PORT, timeLastReceivedMessageFromThisNode = value if timeLastReceivedMessageFromThisNode > (int(time.time())- maximumAgeOfNodesThatIAdvertiseToOthers): #If it is younger than 3 hours old.. numberOfAddressesInAddrMessage += 1 - if self.remoteProtocolVersion == 1: - payload += pack('>I',timeLastReceivedMessageFromThisNode) #32-bit time - else: - payload += pack('>Q',timeLastReceivedMessageFromThisNode) #64-bit time + payload += pack('>I',timeLastReceivedMessageFromThisNode) payload += pack('>I',(self.streamNumber*2)+1) payload += pack('>q',1) #service bit flags offered by this node payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + socket.inet_aton(HOST) @@ -1708,7 +1576,6 @@ class receiveDataThread(QThread): print 'Closing connection to myself: ', self.HOST printLock.release() return - broadcastToSendDataQueues((0,'setRemoteProtocolVersion',(self.HOST,self.remoteProtocolVersion))) knownNodesLock.acquire() knownNodes[self.streamNumber][self.HOST] = (self.remoteNodeIncomingPort, int(time.time())) @@ -1723,10 +1590,39 @@ class receiveDataThread(QThread): #Sends a version message def sendversion(self): + global softwareVersion + payload = '' + payload += pack('>L',1) #protocol version. + payload += pack('>q',1) #bitflags of the services I offer. + payload += pack('>q',int(time.time())) + + payload += pack('>q',1) #boolservices offered by the remote node. This data is ignored by the remote host because how could We know what Their services are without them telling us? + payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + socket.inet_aton(self.HOST) + payload += pack('>H',self.PORT)#remote IPv6 and port + + payload += pack('>q',1) #bitflags of the services I offer. + payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + pack('>L',2130706433) # = 127.0.0.1. This will be ignored by the remote host. The actual remote connected IP will be used. + payload += pack('>H',config.getint('bitmessagesettings', 'port'))#my external IPv6 and port + + random.seed() + payload += eightBytesOfRandomDataUsedToDetectConnectionsToSelf + userAgent = '/PyBitmessage:' + softwareVersion + '/' #Length of userAgent must be less than 253. + payload += pack('>B',len(userAgent)) #user agent string length. If the user agent is more than 252 bytes long, this code isn't going to work. + payload += userAgent + payload += encodeVarint(1) #The number of streams about which I care. PyBitmessage currently only supports 1. + payload += encodeVarint(self.streamNumber) + + datatosend = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits. + datatosend = datatosend + 'version\x00\x00\x00\x00\x00' #version command + datatosend = datatosend + pack('>L',len(payload)) #payload length + datatosend = datatosend + hashlib.sha512(payload).digest()[0:4] + datatosend = datatosend + payload + printLock.acquire() print 'Sending version message' printLock.release() - self.sock.sendall(assembleVersionMessage(self.HOST,self.PORT,self.streamNumber)) + self.sock.sendall(datatosend) + #self.versionSent = 1 #Sends a verack message def sendverack(self): @@ -1770,7 +1666,35 @@ class sendDataThread(QThread): printLock.release() def sendVersionMessage(self): - datatosend = assembleVersionMessage(self.HOST,self.PORT,self.streamNumber)#the IP and port of the remote host, and my streamNumber. + + #Note that there is another copy of this version-sending code in the receiveData class which would need to be changed if you make changes here. + global softwareVersion + payload = '' + payload += pack('>L',1) #protocol version. + payload += pack('>q',1) #bitflags of the services I offer. + payload += pack('>q',int(time.time())) + + payload += pack('>q',1) #boolservices of remote connection. How can I even know this for sure? This is probably ignored by the remote host. + payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + socket.inet_aton(self.HOST) + payload += pack('>H',self.PORT)#remote IPv6 and port + + payload += pack('>q',1) #bitflags of the services I offer. + payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + pack('>L',2130706433) # = 127.0.0.1. This will be ignored by the remote host. The actual remote connected IP will be used. + payload += pack('>H',config.getint('bitmessagesettings', 'port'))#my external IPv6 and port + + random.seed() + payload += eightBytesOfRandomDataUsedToDetectConnectionsToSelf + userAgent = '/PyBitmessage:' + softwareVersion + '/' #Length of userAgent must be less than 253. + payload += pack('>B',len(userAgent)) #user agent string length. If the user agent is more than 252 bytes long, this code isn't going to work. + payload += userAgent + payload += encodeVarint(1) #The number of streams about which I care. PyBitmessage currently only supports 1 per connection. + payload += encodeVarint(self.streamNumber) + + datatosend = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits. + datatosend = datatosend + 'version\x00\x00\x00\x00\x00' #version command + datatosend = datatosend + pack('>L',len(payload)) #payload length + datatosend = datatosend + hashlib.sha512(payload).digest()[0:4] + datatosend = datatosend + payload printLock.acquire() print 'Sending version packet: ', repr(datatosend) @@ -1804,31 +1728,19 @@ class sendDataThread(QThread): print 'setting the stream number in the sendData thread (ID:',id(self), ') to', specifiedStreamNumber printLock.release() self.streamNumber = specifiedStreamNumber - elif command == 'setRemoteProtocolVersion': - hostInMessage, specifiedRemoteProtocolVersion = data - if hostInMessage == self.HOST: - printLock.acquire() - print 'setting the remote node\'s protocol version in the sendData thread (ID:',id(self), ') to', specifiedRemoteProtocolVersion - printLock.release() - self.remoteProtocolVersion = specifiedRemoteProtocolVersion elif command == 'sendaddr': - if self.remoteProtocolVersion == 1: - printLock.acquire() - print 'a sendData thread is not sending an addr message to this particular peer ('+self.HOST+') because their protocol version is 1.' - printLock.release() - else: - try: - #To prevent some network analysis, 'leak' the data out to our peer after waiting a random amount of time unless we have a long list of messages in our queue to send. - random.seed() - time.sleep(random.randrange(0, 10)) - self.sock.sendall(data) - self.lastTimeISentData = int(time.time()) - except: - print 'self.sock.sendall failed' - self.sock.close() - sendDataQueues.remove(self.mailbox) - print 'sendDataThread thread', self, 'ending now' - break + try: + #To prevent some network analysis, 'leak' the data out to our peer after waiting a random amount of time unless we have a long list of messages in our queue to send. + random.seed() + time.sleep(random.randrange(0, 10)) + self.sock.sendall(data) + self.lastTimeISentData = int(time.time()) + except: + print 'self.sock.sendall failed' + self.sock.close() + sendDataQueues.remove(self.mailbox) + print 'sendDataThread thread', self, 'ending now' + break elif command == 'sendinv': if data not in self.objectsOfWhichThisRemoteNodeIsAlreadyAware: payload = '\x01' + data @@ -2024,35 +1936,6 @@ def isAddressInMyAddressBook(address): sqlLock.release() return queryreturn != [] -def assembleVersionMessage(remoteHost,remotePort,myStreamNumber): - global softwareVersion - payload = '' - payload += pack('>L',2) #protocol version. - payload += pack('>q',1) #bitflags of the services I offer. - payload += pack('>q',int(time.time())) - - payload += pack('>q',1) #boolservices of remote connection. How can I even know this for sure? This is probably ignored by the remote host. - payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + socket.inet_aton(remoteHost) - payload += pack('>H',remotePort)#remote IPv6 and port - - payload += pack('>q',1) #bitflags of the services I offer. - payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + pack('>L',2130706433) # = 127.0.0.1. This will be ignored by the remote host. The actual remote connected IP will be used. - payload += pack('>H',config.getint('bitmessagesettings', 'port'))#my external IPv6 and port - - random.seed() - payload += eightBytesOfRandomDataUsedToDetectConnectionsToSelf - userAgent = '/PyBitmessage:' + softwareVersion + '/' #Length of userAgent must be less than 253. - payload += pack('>B',len(userAgent)) #user agent string length. If the user agent is more than 252 bytes long, this code isn't going to work. - payload += userAgent - payload += encodeVarint(1) #The number of streams about which I care. PyBitmessage currently only supports 1 per connection. - payload += encodeVarint(myStreamNumber) - - datatosend = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits. - datatosend = datatosend + 'version\x00\x00\x00\x00\x00' #version command - datatosend = datatosend + pack('>L',len(payload)) #payload length - datatosend = datatosend + hashlib.sha512(payload).digest()[0:4] - return datatosend + payload - #This thread exists because SQLITE3 is so un-threadsafe that we must submit queries to it and it puts results back in a different queue. They won't let us just use locks. class sqlThread(QThread): def __init__(self, parent = None): @@ -4110,7 +3993,18 @@ class MyForm(QtGui.QMainWindow): sqlSubmitQueue.put('commit') sqlLock.release() + + + + """try: + fromLabel = config.get(fromAddress, 'label') + except: + fromLabel = '' + if fromLabel == '': + fromLabel = fromAddress""" + toLabel = '' + t = (toAddress,) sqlLock.acquire() sqlSubmitQueue.put('''select label from addressbook where address=?''') @@ -4124,6 +4018,30 @@ class MyForm(QtGui.QMainWindow): self.displayNewSentMessage(toAddress,toLabel,fromAddress, subject, message, ackdata) workerQueue.put(('sendmessage',toAddress)) + """self.ui.tableWidgetSent.insertRow(0) + if toLabel == '': + newItem = QtGui.QTableWidgetItem(unicode(toAddress,'utf-8')) + else: + newItem = QtGui.QTableWidgetItem(unicode(toLabel,'utf-8')) + newItem.setData(Qt.UserRole,str(toAddress)) + self.ui.tableWidgetSent.setItem(0,0,newItem) + + if fromLabel == '': + newItem = QtGui.QTableWidgetItem(unicode(fromAddress,'utf-8')) + else: + newItem = QtGui.QTableWidgetItem(unicode(fromLabel,'utf-8')) + newItem.setData(Qt.UserRole,str(fromAddress)) + self.ui.tableWidgetSent.setItem(0,1,newItem) + newItem = QtGui.QTableWidgetItem(unicode(subject,'utf-8)')) + newItem.setData(Qt.UserRole,unicode(message,'utf-8)')) + self.ui.tableWidgetSent.setItem(0,2,newItem) + newItem = myTableWidgetItem('Just pressed ''send'' ' + unicode(strftime(config.get('bitmessagesettings', 'timeformat'),localtime(int(time.time()))),'utf-8')) + newItem.setData(Qt.UserRole,QByteArray(ackdata)) + newItem.setData(33,int(time.time())) + self.ui.tableWidgetSent.setItem(0,3,newItem) + + self.ui.textEditSentMessage.setPlainText(self.ui.tableWidgetSent.item(0,2).data(Qt.UserRole).toPyObject())""" + self.ui.comboBoxSendFrom.setCurrentIndex(0) self.ui.labelFrom.setText('') self.ui.lineEditTo.setText('') @@ -4674,14 +4592,6 @@ class MyForm(QtGui.QMainWindow): else: event.ignore()''' - self.statusBar().showMessage('Bitmessage is stuck waiting for the knownNodesLock.') - knownNodesLock.acquire() - self.statusBar().showMessage('Saving the knownNodes list of peers to disk...') - output = open(appdata + 'knownnodes.dat', 'wb') - pickle.dump(knownNodes, output) - output.close() - knownNodesLock.release() - broadcastToSendDataQueues((0, 'shutdown', 'all')) printLock.acquire() @@ -4697,6 +4607,13 @@ class MyForm(QtGui.QMainWindow): sqlReturnQueue.get() sqlLock.release() + self.statusBar().showMessage('Saving the knownNodes list of peers to disk...') + knownNodesLock.acquire() + output = open(appdata + 'knownnodes.dat', 'wb') + pickle.dump(knownNodes, output) + output.close() + knownNodesLock.release() + self.trayIcon.hide() printLock.acquire() print 'Done.' @@ -4704,8 +4621,7 @@ class MyForm(QtGui.QMainWindow): self.statusBar().showMessage('All done. Closing user interface...') event.accept() print 'done. (passed event.accept())' - #raise SystemExit - os._exit(0) + raise SystemExit def on_action_InboxMessageForceHtml(self): currentInboxRow = self.ui.tableWidgetInbox.currentRow() diff --git a/src/bitmessageui.py b/bitmessageui.py similarity index 100% rename from src/bitmessageui.py rename to bitmessageui.py diff --git a/src/bitmessageui.ui b/bitmessageui.ui similarity index 100% rename from src/bitmessageui.ui rename to bitmessageui.ui diff --git a/debian.sh b/debian.sh deleted file mode 100755 index 4ffe1b87..00000000 --- a/debian.sh +++ /dev/null @@ -1,21 +0,0 @@ -# To build a debian package first ensure that the code exists -# within a directory called pybitmessage-x.x.x (where the x's -# are the version number), make sure that the VERSION parameter -# within debian/rules and this script are correct, then run -# this script. - -#!/bin/bash - -APP=pybitmessage -VERSION=0.2.8 -ARCH_TYPE=all - -# Create a source archive -make clean -make source - -# Build the package -fakeroot dpkg-buildpackage -A - -gpg -ba ../${APP}_${VERSION}-1_${ARCH_TYPE}.deb -gpg -ba ../${APP}_${VERSION}.orig.tar.gz diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index a7d2a84c..00000000 --- a/debian/changelog +++ /dev/null @@ -1,52 +0,0 @@ -pybitmessage (0.2.8-1) unstable; urgency=low - - * Fixed Ubuntu & OS X issue: - Bitmessage wouldn't receive any objects from peers after restart. - - * Inventory flush to disk when exiting program now vastly faster. - - * Fixed address generation bug (kept Bitmessage from restarting). - - * Improve deserialization of messages - before processing (a 'best practice'). - - * Change to help Macs find OpenSSL the way Unix systems find it. - - * Do not share or accept IPs which are in the private IP ranges. - - * Added time-fuzzing - to the embedded time in pubkey and getpubkey messages. - - * Added a knownNodes lock - to prevent an exception from sometimes occurring when saving - the data-structure to disk. - - * Show unread messages in bold - and do not display new messages automatically. - - * Support selecting multiple items - in the inbox, sent box, and address book. - - * Use delete key to trash Inbox or Sent messages. - - * Display richtext(HTML) messages - from senders in address book or subscriptions (although not - pseudo-mailing-lists; use new right-click option). - - * Trim spaces - from the beginning and end of addresses when adding to - address book, subscriptions, and blacklist. - - * Improved the display of the time for foreign language users. - - -- Bob Mottram (4096 bits) Tue, 9 Apr 2013 17:44:00 +0100 - -pybitmessage (0.2.7-1) unstable; urgency=low - - * Added debian packaging - * Script to generate debian packages - * SVG icon for Gnome shell, etc - * Source moved int src directory for debian standards compatibility - * Trailing carriage return on COPYING LICENSE and README.md - - -- Bob Mottram (4096 bits) Tue, 1 Apr 2013 17:12:14 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 45a4fb75..00000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/debian/control b/debian/control deleted file mode 100644 index 975082c3..00000000 --- a/debian/control +++ /dev/null @@ -1,21 +0,0 @@ -Source: pybitmessage -Section: contrib/comm -Priority: extra -Maintainer: Jonathan Warren -Build-Depends: debhelper (>= 8.0.0), python, openssl, python-qt4, libqt4-dev, python-qt4-dev, sqlite3, libsqlite3-dev -Standards-Version: 3.9.2 -Homepage: https://bitmessage.org/ -Vcs-Browser: https://github.com/Bitmessage/PyBitmessage -Vcs-Git: https://github.com/Bitmessage/PyBitmessage.git - -Package: pybitmessage -Architecture: all -Depends: ${misc:Depends}, python, openssl, python-qt4, libqt4-dev, python-qt4-dev, sqlite3, libsqlite3-dev -Description: Send encrypted messages to another person or to many subscribers - 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/debian/copyright b/debian/copyright deleted file mode 100644 index 4c5f69f3..00000000 --- a/debian/copyright +++ /dev/null @@ -1,30 +0,0 @@ -Format: http://dep.debian.net/deps/dep5 -Upstream-Name: PyBitmessage -Source: https://github.com/Bitmessage/PyBitmessage - -Files: * -Copyright: 2012 Jonathan Warren -License: MIT - -Files: debian/* -Copyright: 2012 Jonathan Warren -License: MIT - -License: MIT - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - . - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. \ No newline at end of file diff --git a/debian/docs b/debian/docs deleted file mode 100644 index 8b137891..00000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/debian/files b/debian/files deleted file mode 100644 index 471f54a3..00000000 --- a/debian/files +++ /dev/null @@ -1 +0,0 @@ -pybitmessage_0.2.8-1_all.deb contrib/comm extra diff --git a/debian/pybm b/debian/pybm deleted file mode 100644 index 1d90ee60..00000000 --- a/debian/pybm +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -cd /usr/share/applications/pybitmessage -python bitmessagemain.py - diff --git a/debian/rules b/debian/rules deleted file mode 100755 index ca977463..00000000 --- a/debian/rules +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/make -f -APP=pybitmessage - -DEST_MAIN = $(CURDIR)/debian/$(APP)/usr/bin -DEST_SHARE = $(CURDIR)/debian/$(APP)/usr/share - -build: build-stamp - make -build-stamp: - dh_testdir - touch build-stamp -clean: - dh_testdir - dh_testroot - rm -f build-stamp - dh_clean -install: build clean - dh_testdir - dh_testroot - dh_prep - dh_installdirs - mkdir -m 755 -p $(CURDIR)/debian/$(APP)/usr - mkdir -m 755 -p $(CURDIR)/debian/$(APP)/usr/bin - mkdir -m 755 -p $(DEST_SHARE)/applications - mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP) - mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)/images - mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)/pyelliptic - mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)/socks - mkdir -m 755 -p $(DEST_SHARE)/pixmaps - mkdir -m 755 -p $(DEST_SHARE)/icons - mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor - mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/scalable - mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/scalable/apps - mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24 - mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24/apps - - install -m 644 $(CURDIR)/src/*.ui $(DEST_SHARE)/applications/$(APP) - install -m 644 $(CURDIR)/src/*.py $(DEST_SHARE)/applications/$(APP) - install -m 644 $(CURDIR)/src/*.qrc $(DEST_SHARE)/applications/$(APP) - - install -m 644 $(CURDIR)/src/images/*.png $(DEST_SHARE)/applications/$(APP)/images - install -m 644 $(CURDIR)/src/images/*.ico $(DEST_SHARE)/applications/$(APP)/images - install -m 644 $(CURDIR)/src/pyelliptic/*.py $(DEST_SHARE)/applications/$(APP)/pyelliptic - install -m 644 $(CURDIR)/src/socks/*.py $(DEST_SHARE)/applications/$(APP)/socks - install -m 755 $(CURDIR)/debian/pybm $(DEST_MAIN) - - install -m 644 $(CURDIR)/desktop/$(APP).desktop $(DEST_SHARE)/applications/$(APP)/$(APP).desktop - install -m 644 $(CURDIR)/src/images/can-icon-24px.png $(DEST_SHARE)/icons/hicolor/24x24/apps/$(APP).png - install -m 644 $(CURDIR)/desktop/can-icon.svg $(DEST_SHARE)/icons/hicolor/scalable/apps/$(APP).svg - install -m 644 $(CURDIR)/desktop/can-icon.svg $(DEST_SHARE)/pixmaps/$(APP).svg -binary-indep: build install - dh_shlibdeps - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs -# dh_installexamples -# dh_installman - dh_link - dh_compress - dh_fixperms - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb -binary-arch: build install -binary: binary-indep -.PHONY: build clean binary-indep binary install diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8d..00000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/debian/source/include-binaries b/debian/source/include-binaries deleted file mode 100644 index 8569d576..00000000 --- a/debian/source/include-binaries +++ /dev/null @@ -1,15 +0,0 @@ -src/images/sent.png -src/images/can-icon-16px.png -src/images/addressbook.png -src/images/networkstatus.png -src/images/redicon.png -src/images/subscriptions.png -src/images/blacklist.png -src/images/can-icon-24px.png -src/images/identities.png -src/images/yellowicon.png -src/images/inbox.png -src/images/greenicon.png -src/images/can-icon.ico -src/images/send.png -desktop/can-icon.svg diff --git a/src/defaultKnownNodes.py b/defaultKnownNodes.py similarity index 100% rename from src/defaultKnownNodes.py rename to defaultKnownNodes.py diff --git a/desktop/can-icon.svg b/desktop/can-icon.svg deleted file mode 100644 index 9b8a9ded..00000000 --- a/desktop/can-icon.svg +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/desktop/pybitmessage.desktop b/desktop/pybitmessage.desktop deleted file mode 100644 index affd63d1..00000000 --- a/desktop/pybitmessage.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Application -Name=PyBitmessage -GenericName=PyBitmessage -Comment=Send encrypted messages to another person or to many subscribers -Exec=pybm %U -Icon=pybitmessage -Terminal=false -Categories=Network diff --git a/src/help.py b/help.py similarity index 100% rename from src/help.py rename to help.py diff --git a/src/help.ui b/help.ui similarity index 100% rename from src/help.ui rename to help.ui diff --git a/src/highlevelcrypto.py b/highlevelcrypto.py similarity index 100% rename from src/highlevelcrypto.py rename to highlevelcrypto.py diff --git a/src/iconglossary.py b/iconglossary.py similarity index 100% rename from src/iconglossary.py rename to iconglossary.py diff --git a/src/iconglossary.ui b/iconglossary.ui similarity index 100% rename from src/iconglossary.ui rename to iconglossary.ui diff --git a/src/images/addressbook.png b/images/addressbook.png similarity index 100% rename from src/images/addressbook.png rename to images/addressbook.png diff --git a/src/images/blacklist.png b/images/blacklist.png similarity index 100% rename from src/images/blacklist.png rename to images/blacklist.png diff --git a/src/images/can-icon-16px.png b/images/can-icon-16px.png similarity index 100% rename from src/images/can-icon-16px.png rename to images/can-icon-16px.png diff --git a/src/images/can-icon-24px.png b/images/can-icon-24px.png similarity index 100% rename from src/images/can-icon-24px.png rename to images/can-icon-24px.png diff --git a/src/images/can-icon.ico b/images/can-icon.ico similarity index 100% rename from src/images/can-icon.ico rename to images/can-icon.ico diff --git a/src/images/greenicon.png b/images/greenicon.png similarity index 100% rename from src/images/greenicon.png rename to images/greenicon.png diff --git a/src/images/identities.png b/images/identities.png similarity index 100% rename from src/images/identities.png rename to images/identities.png diff --git a/src/images/inbox.png b/images/inbox.png similarity index 100% rename from src/images/inbox.png rename to images/inbox.png diff --git a/src/images/networkstatus.png b/images/networkstatus.png similarity index 100% rename from src/images/networkstatus.png rename to images/networkstatus.png diff --git a/src/images/redicon.png b/images/redicon.png similarity index 100% rename from src/images/redicon.png rename to images/redicon.png diff --git a/src/images/send.png b/images/send.png similarity index 100% rename from src/images/send.png rename to images/send.png diff --git a/src/images/sent.png b/images/sent.png similarity index 100% rename from src/images/sent.png rename to images/sent.png diff --git a/src/images/subscriptions.png b/images/subscriptions.png similarity index 100% rename from src/images/subscriptions.png rename to images/subscriptions.png diff --git a/src/images/yellowicon.png b/images/yellowicon.png similarity index 100% rename from src/images/yellowicon.png rename to images/yellowicon.png diff --git a/src/messages.dat reader.py b/messages.dat reader.py similarity index 100% rename from src/messages.dat reader.py rename to messages.dat reader.py diff --git a/src/newaddressdialog.py b/newaddressdialog.py similarity index 100% rename from src/newaddressdialog.py rename to newaddressdialog.py diff --git a/src/newaddressdialog.ui b/newaddressdialog.ui similarity index 100% rename from src/newaddressdialog.ui rename to newaddressdialog.ui diff --git a/src/newsubscriptiondialog.py b/newsubscriptiondialog.py similarity index 100% rename from src/newsubscriptiondialog.py rename to newsubscriptiondialog.py diff --git a/src/newsubscriptiondialog.ui b/newsubscriptiondialog.ui similarity index 100% rename from src/newsubscriptiondialog.ui rename to newsubscriptiondialog.ui diff --git a/src/pyelliptic/LICENSE b/pyelliptic/LICENSE similarity index 100% rename from src/pyelliptic/LICENSE rename to pyelliptic/LICENSE diff --git a/src/pyelliptic/README.md b/pyelliptic/README.md similarity index 100% rename from src/pyelliptic/README.md rename to pyelliptic/README.md diff --git a/src/pyelliptic/__init__.py b/pyelliptic/__init__.py similarity index 100% rename from src/pyelliptic/__init__.py rename to pyelliptic/__init__.py diff --git a/src/pyelliptic/arithmetic.py b/pyelliptic/arithmetic.py similarity index 100% rename from src/pyelliptic/arithmetic.py rename to pyelliptic/arithmetic.py diff --git a/src/pyelliptic/cipher.py b/pyelliptic/cipher.py similarity index 100% rename from src/pyelliptic/cipher.py rename to pyelliptic/cipher.py diff --git a/src/pyelliptic/ecc.py b/pyelliptic/ecc.py similarity index 100% rename from src/pyelliptic/ecc.py rename to pyelliptic/ecc.py diff --git a/src/pyelliptic/hash.py b/pyelliptic/hash.py similarity index 100% rename from src/pyelliptic/hash.py rename to pyelliptic/hash.py diff --git a/src/pyelliptic/openssl.py b/pyelliptic/openssl.py similarity index 100% rename from src/pyelliptic/openssl.py rename to pyelliptic/openssl.py diff --git a/src/regenerateaddresses.py b/regenerateaddresses.py similarity index 100% rename from src/regenerateaddresses.py rename to regenerateaddresses.py diff --git a/src/regenerateaddresses.ui b/regenerateaddresses.ui similarity index 100% rename from src/regenerateaddresses.ui rename to regenerateaddresses.ui diff --git a/src/settings.py b/settings.py similarity index 100% rename from src/settings.py rename to settings.py diff --git a/src/settings.ui b/settings.ui similarity index 100% rename from src/settings.ui rename to settings.ui diff --git a/src/socks/BUGS b/socks/BUGS similarity index 100% rename from src/socks/BUGS rename to socks/BUGS diff --git a/src/socks/LICENSE b/socks/LICENSE similarity index 100% rename from src/socks/LICENSE rename to socks/LICENSE diff --git a/src/socks/README b/socks/README similarity index 100% rename from src/socks/README rename to socks/README diff --git a/src/socks/__init__.py b/socks/__init__.py similarity index 100% rename from src/socks/__init__.py rename to socks/__init__.py diff --git a/src/specialaddressbehavior.py b/specialaddressbehavior.py similarity index 100% rename from src/specialaddressbehavior.py rename to specialaddressbehavior.py diff --git a/src/specialaddressbehavior.ui b/specialaddressbehavior.ui similarity index 100% rename from src/specialaddressbehavior.ui rename to specialaddressbehavior.ui