fixes after new merging
This commit is contained in:
commit
23a8ab2c19
24
LICENSE
24
LICENSE
|
@ -68,3 +68,27 @@ CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
===== based on namecoin.py namecoin.py python implementation by Daniel Kraft <d@domob.eu>
|
||||
|
||||
Copyright (C) 2013 by Daniel Kraft <d@domob.eu>
|
||||
|
||||
This file is part of the Bitmessage project.
|
||||
|
||||
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.
|
|
@ -1,173 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# INIT
|
||||
MACHINE_TYPE=`uname -m`
|
||||
BASE_DIR=$(pwd)
|
||||
PYTHON_VERSION=2.7.15
|
||||
PYQT_VERSION=4-4.11.4-gpl-Py2.7-Qt4.8.7
|
||||
OPENSSL_VERSION=1_0_2t
|
||||
DIRECTORY32BIT=SoftwareDownloads32bit
|
||||
DIRECTORY64BIT=SoftwareDownloads64bit
|
||||
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
if [ ! -d "$DIRECTORY64BIT" ]; then
|
||||
mkdir SoftwareDownloads64bit
|
||||
cd SoftwareDownloads64bit
|
||||
else
|
||||
echo "Directory already exists"
|
||||
cd SoftwareDownloads64bit
|
||||
fi
|
||||
else
|
||||
if [ ! -d "$DIRECTORY32BIT" ]; then
|
||||
mkdir SoftwareDownloads32bit
|
||||
cd SoftwareDownloads32bit
|
||||
else
|
||||
echo "Directory 32 bit alrready exists"
|
||||
cd SoftwareDownloads32bit
|
||||
fi
|
||||
fi
|
||||
#Functions
|
||||
function install_wine {
|
||||
|
||||
|
||||
wget -nc https://dl.winehq.org/wine-builds/Release.key --no-check-certificate
|
||||
sudo apt-key add Release.key
|
||||
sudo apt-add-repository 'https://dl.winehq.org/wine-builds/ubuntu/'
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install wine1.8 winetricks
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
sudo apt-get -y install wine64-development
|
||||
env WINEPREFIX=$HOME/.wine64 WINEARCH=win64 winecfg
|
||||
WINE="env WINEPREFIX=$HOME/.wine64 wine"
|
||||
export WINEPREFIX
|
||||
|
||||
else
|
||||
sudo apt-get -y install wine32-development
|
||||
env WINEPREFIX=$HOME/.wine32 WINEARCH=win32 winecfg
|
||||
WINE="env WINEPREFIX=$HOME/.wine32 wine"
|
||||
export WINEPREFIX
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
function install_python(){
|
||||
echo "Download Python2.7"
|
||||
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
# For 64 bit machine
|
||||
wget -nc wget http://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}.amd64.msi --no-check-certificate
|
||||
echo "Install Python2.7 for 64 bit"
|
||||
$WINE msiexec -i python-${PYTHON_VERSION}.amd64.msi /q /norestart
|
||||
|
||||
wget -nc https://download.microsoft.com/download/d/2/4/d242c3fb-da5a-4542-ad66-f9661d0a8d19/vcredist_x64.exe --no-check-certificate
|
||||
$WINE vcredist_x64.exe /q /norestart
|
||||
echo "Installed vcredist for 64 bit"
|
||||
$WINE pip install --upgrade pip
|
||||
|
||||
else
|
||||
# For 32 bit machine
|
||||
wget -nc https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}.msi --no-check-certificate
|
||||
echo "Install Python2.7 for 32 bit"
|
||||
$WINE msiexec -i python-${PYTHON_VERSION}.msi /q /norestart
|
||||
|
||||
echo "Installing vc_redist for 32 bit "
|
||||
wget -nc https://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140/vcredist_x86.exe --no-check-certificate
|
||||
$WINE vcredist_x86.exe /q /norestart
|
||||
#insatlled msvcr120.dll for 32 bit system
|
||||
wget -nc http://www.dll-found.com/zip/m/msvcr120.dll.zip --no-check-certificate
|
||||
unzip msvcr120.dll.zip
|
||||
sudo cp msvcr120.dll $HOME/.wine32/drive_c/windows/system32/
|
||||
$WINE pip install --upgrade pip
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
function install_pyqt(){
|
||||
|
||||
echo "Download PyQT"
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
# For 64 bit machine
|
||||
wget -nc --content-disposition https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe?raw=true --no-check-certificate
|
||||
$WINE PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe /q /norestart /silent /verysiling /sp- /suppressmsgboxes
|
||||
else
|
||||
# For 32 bit machine
|
||||
wget -nc --content-disposition https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe?raw=true --no-check-certificate
|
||||
$WINE PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe /q /norestart /silent /verysiling /sp- /suppressmsgboxes
|
||||
fi
|
||||
}
|
||||
|
||||
function install_openssl(){
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
wget -nc --content-disposition https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/Win64OpenSSL-${OPENSSL_VERSION}.exe?raw=true --no-check-certificate
|
||||
$WINE Win64OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysiling /sp- /suppressmsgboxes
|
||||
|
||||
else
|
||||
wget -nc --content-disposition https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/Win32OpenSSL-${OPENSSL_VERSION}.exe?raw=true --no-check-certificate
|
||||
$WINE Win32OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysiling /sp- /suppressmsgboxes
|
||||
echo "Install PyInstaller 32 bit"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_pyinstaller()
|
||||
{
|
||||
$WINE pip install pyinstaller
|
||||
echo "Install PyInstaller"
|
||||
echo "Install Pyopencl"
|
||||
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
wget -nc https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/pyopencl-2015.1-cp27-none-win_amd64.whl --no-check-certificate
|
||||
$WINE pip install pyopencl-2015.1-cp27-none-win_amd64.whl
|
||||
$WINE pip install msgpack-python
|
||||
|
||||
else
|
||||
wget -nc --content-disposition https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/pyopencl-2015.1-cp27-none-win_amd64one-win32.whl?raw=true --no-check-certificate
|
||||
$WINE pip install msgpack-python
|
||||
$WINE pip install pyopencl-2015.1-cp27-none-win32.whl
|
||||
fi
|
||||
echo "Install Message Pack"
|
||||
|
||||
}
|
||||
|
||||
|
||||
function build_dll(){
|
||||
cd $BASE_DIR
|
||||
rm -rf master.zip
|
||||
rm -rf PyBitmessage
|
||||
git clone https://github.com/Bitmessage/PyBitmessage.git
|
||||
cd PyBitmessage/src/bitmsghash
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
# Do stuff for 64 bit machine
|
||||
echo "Install MinGW"
|
||||
sudo apt-get -y install mingw-w64
|
||||
echo "Create dll"
|
||||
x86_64-w64-mingw32-g++ -D_WIN32 -Wall -O3 -march=native -I$HOME/.wine64/drive_c/OpenSSL-Win64/include -I/usr/x86_64-w64-mingw32/include -L$HOME/.wine64/drive_c/OpenSSL-Win64/lib -c bitmsghash.cpp
|
||||
x86_64-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o -D_WIN32 -O3 -march=native -I$HOME/.wine64/drive_c/OpenSSL-Win64/include -L$HOME/.wine64/drive_c/OpenSSL-Win64 -L/usr/lib/x86_64-linux-gnu/wine -fPIC -shared -lcrypt32 -leay32 -lwsock32 -o bitmsghash64.dll -Wl,--out-implib,bitmsghash.a
|
||||
echo "DLL generated successfully "
|
||||
cd ..
|
||||
cp -R bitmsghash ../../../src/
|
||||
cd ../../../
|
||||
cd packages/pyinstaller/
|
||||
env WINEPREFIX=$HOME/.wine64 wine pyinstaller bitmessagemain.spec
|
||||
else
|
||||
echo "Install MinGW for 32 bit"
|
||||
sudo apt-get install mingw-w64
|
||||
echo "Create dll"
|
||||
|
||||
|
||||
i686-w64-mingw32-g++ -D_WIN32 -Wall -m32 -O3 -march=native -I$HOME/.wine32/drive_c/OpenSSL-Win32/include -I/usr/i686-w64-mingw32/include -L$HOME/.wine32/drive_c/OpenSSL-Win32/lib -c bitmsghash.cpp
|
||||
i686-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o -D_WIN32 -O3 -march=native -I$HOME/.wine32/drive_c/OpenSSL-Win32/include -L$HOME/.wine32/drive_c/OpenSSL-Win32/lib/MinGW -fPIC -shared -lcrypt32 -leay32 -lwsock32 -o bitmsghash32.dll -Wl,--out-implib,bitmsghash.a
|
||||
cd ..
|
||||
cp -R bitmsghash ../../../src/
|
||||
cd ../../../
|
||||
cd packages/pyinstaller/
|
||||
env WINEPREFIX=$HOME/.wine32 wine pyinstaller bitmessagemain.spec
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
install_wine
|
||||
install_python
|
||||
install_pyqt
|
||||
install_openssl
|
||||
install_pyinstaller
|
||||
build_dll
|
165
buildscripts/winbuild.sh
Executable file
165
buildscripts/winbuild.sh
Executable file
|
@ -0,0 +1,165 @@
|
|||
#!/bin/bash
|
||||
|
||||
# INIT
|
||||
MACHINE_TYPE=`uname -m`
|
||||
BASE_DIR=$(pwd)
|
||||
PYTHON_VERSION=2.7.17
|
||||
PYQT_VERSION=4-4.11.4-gpl-Py2.7-Qt4.8.7
|
||||
OPENSSL_VERSION=1_0_2t
|
||||
SRCPATH=~/Downloads
|
||||
|
||||
#Functions
|
||||
function download_sources_32 {
|
||||
if [ ! -d ${SRCPATH} ]; then
|
||||
mkdir -p ${SRCPATH}
|
||||
fi
|
||||
wget -P ${SRCPATH} -c -nc --content-disposition \
|
||||
https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}.msi \
|
||||
https://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140/vcredist_x86.exe \
|
||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/PyQt${PYQT_VERSION}-x32.exe?raw=true \
|
||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/Win32OpenSSL-${OPENSSL_VERSION}.exe?raw=true \
|
||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/pyopencl-2015.1-cp27-none-win32.whl?raw=true
|
||||
}
|
||||
|
||||
function download_sources_64 {
|
||||
if [ ! -d ${SRCPATH} ]; then
|
||||
mkdir -p ${SRCPATH}
|
||||
fi
|
||||
wget -P ${SRCPATH} -c -nc --content-disposition \
|
||||
http://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}.amd64.msi \
|
||||
https://download.microsoft.com/download/d/2/4/d242c3fb-da5a-4542-ad66-f9661d0a8d19/vcredist_x64.exe \
|
||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/PyQt${PYQT_VERSION}-x64.exe?raw=true \
|
||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/Win64OpenSSL-${OPENSSL_VERSION}.exe?raw=true \
|
||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/pyopencl-2015.1-cp27-none-win_amd64.whl?raw=true
|
||||
}
|
||||
|
||||
function download_sources {
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
download_sources_64
|
||||
else
|
||||
download_sources_32
|
||||
fi
|
||||
}
|
||||
|
||||
function install_wine {
|
||||
echo "Setting up wine"
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
export WINEPREFIX=${HOME}/.wine64 WINEARCH=win64
|
||||
else
|
||||
export WINEPREFIX=${HOME}/.wine32 WINEARCH=win32
|
||||
fi
|
||||
rm -rf ${WINEPREFIX}
|
||||
rm -rf packages/pyinstaller/{build,dist}
|
||||
}
|
||||
|
||||
function install_python(){
|
||||
cd ${SRCPATH}
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
echo "Installing Python ${PYTHON_VERSION} 64b"
|
||||
wine msiexec -i python-${PYTHON_VERSION}.amd64.msi /q /norestart
|
||||
echo "Installing vcredist for 64 bit"
|
||||
wine vcredist_x64.exe /q /norestart
|
||||
else
|
||||
echo "Installing Python ${PYTHON_VERSION} 32b"
|
||||
wine msiexec -i python-${PYTHON_VERSION}.msi /q /norestart
|
||||
# MSVCR 2008 required for Windows XP
|
||||
cd ${SRCPATH}
|
||||
echo "Installing vc_redist (2008) for 32 bit "
|
||||
wine vcredist_x86.exe /Q
|
||||
fi
|
||||
echo "Upgrading pip"
|
||||
wine python -m pip install --upgrade pip
|
||||
}
|
||||
|
||||
function install_pyqt(){
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
echo "Installing PyQt-${PYQT_VERSION} 64b"
|
||||
wine PyQt${PYQT_VERSION}-x64.exe /S /WX
|
||||
else
|
||||
echo "Installing PyQt-${PYQT_VERSION} 32b"
|
||||
wine PyQt${PYQT_VERSION}-x32.exe /S /WX
|
||||
fi
|
||||
}
|
||||
|
||||
function install_openssl(){
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
echo "Installing OpenSSL ${OPENSSL_VERSION} 64b"
|
||||
wine Win64OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysilent /sp- /suppressmsgboxes
|
||||
else
|
||||
echo "Installing OpenSSL ${OPENSSL_VERSION} 32b"
|
||||
wine Win32OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysilent /sp- /suppressmsgboxes
|
||||
fi
|
||||
}
|
||||
|
||||
function install_pyinstaller()
|
||||
{
|
||||
cd ${BASE_DIR}
|
||||
echo "Installing PyInstaller"
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
wine python -m pip install pyinstaller
|
||||
else
|
||||
# 3.2.1 is the last version to work on XP
|
||||
# see https://github.com/pyinstaller/pyinstaller/issues/2931
|
||||
wine python -m pip install -I pyinstaller==3.2.1
|
||||
fi
|
||||
}
|
||||
|
||||
function install_msgpack()
|
||||
{
|
||||
cd ${BASE_DIR}
|
||||
echo "Installing msgpack"
|
||||
wine python -m pip install msgpack-python
|
||||
}
|
||||
|
||||
function install_pyopencl()
|
||||
{
|
||||
cd ${SRCPATH}
|
||||
echo "Installing PyOpenCL"
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
wine python -m pip install pyopencl-2015.1-cp27-none-win_amd64.whl
|
||||
else
|
||||
wine python -m pip install pyopencl-2015.1-cp27-none-win32.whl
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function build_dll(){
|
||||
cd ${BASE_DIR}
|
||||
cd src/bitmsghash
|
||||
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
|
||||
echo "Create dll"
|
||||
x86_64-w64-mingw32-g++ -D_WIN32 -Wall -O3 -march=native -I$HOME/.wine64/drive_c/OpenSSL-Win64/include -I/usr/x86_64-w64-mingw32/include -L$HOME/.wine64/drive_c/OpenSSL-Win64/lib -c bitmsghash.cpp
|
||||
x86_64-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o -D_WIN32 -O3 -march=native -I$HOME/.wine64/drive_c/OpenSSL-Win64/include -L$HOME/.wine64/drive_c/OpenSSL-Win64 -L/usr/lib/x86_64-linux-gnu/wine -fPIC -shared -lcrypt32 -leay32 -lwsock32 -o bitmsghash64.dll -Wl,--out-implib,bitmsghash.a
|
||||
else
|
||||
echo "Create dll"
|
||||
i686-w64-mingw32-g++ -D_WIN32 -Wall -m32 -O3 -march=native -I$HOME/.wine32/drive_c/OpenSSL-Win32/include -I/usr/i686-w64-mingw32/include -L$HOME/.wine32/drive_c/OpenSSL-Win32/lib -c bitmsghash.cpp
|
||||
i686-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o -D_WIN32 -O3 -march=native -I$HOME/.wine32/drive_c/OpenSSL-Win32/include -L$HOME/.wine32/drive_c/OpenSSL-Win32/lib/MinGW -fPIC -shared -lcrypt32 -leay32 -lwsock32 -o bitmsghash32.dll -Wl,--out-implib,bitmsghash.a
|
||||
fi
|
||||
}
|
||||
|
||||
function build_exe(){
|
||||
cd ${BASE_DIR}
|
||||
cd packages/pyinstaller
|
||||
wine pyinstaller bitmessagemain.spec
|
||||
}
|
||||
|
||||
# prepare on ubuntu
|
||||
# dpkg --add-architecture i386
|
||||
# apt update
|
||||
# apt -y install wget wine-stable wine-development winetricks mingw-w64 wine32 wine64 xvfb
|
||||
|
||||
|
||||
download_sources
|
||||
if [ "$1" == "--download-only" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
install_wine
|
||||
install_python
|
||||
install_pyqt
|
||||
install_openssl
|
||||
install_pyopencl
|
||||
install_msgpack
|
||||
install_pyinstaller
|
||||
build_dll
|
||||
build_exe
|
|
@ -11,13 +11,13 @@ else:
|
|||
sslName = 'OpenSSL-Win%s' % ("32" if arch == 32 else "64")
|
||||
site_root = os.path.abspath(HOMEPATH)
|
||||
spec_root = os.path.abspath(SPECPATH)
|
||||
cdrivePath= site_root[0:3]
|
||||
srcPath = spec_root[:-20]+"src\\"
|
||||
qtPath = site_root+"\\PyQt4\\"
|
||||
openSSLPath = cdrivePath+sslName+"\\"
|
||||
msvcrDllPath = cdrivePath+"windows\\system32\\"
|
||||
pythonDllPath = cdrivePath+"Python27\\"
|
||||
outPath = spec_root+"\\bitmessagemain"
|
||||
cdrivePath = site_root[0:3]
|
||||
srcPath = os.path.join(spec_root[:-20], "src")
|
||||
qtBase = "PyQt4"
|
||||
openSSLPath = os.path.join(cdrivePath, sslName)
|
||||
msvcrDllPath = os.path.join(cdrivePath, "windows", "system32")
|
||||
pythonDllPath = os.path.join(cdrivePath, "Python27")
|
||||
outPath = os.path.join(spec_root, "bitmessagemain")
|
||||
|
||||
importPath = srcPath
|
||||
sys.path.insert(0,importPath)
|
||||
|
@ -31,9 +31,9 @@ os.rename(os.path.join(srcPath, '__init__.py'), os.path.join(srcPath, '__init__.
|
|||
|
||||
# -*- mode: python -*-
|
||||
a = Analysis(
|
||||
[srcPath + 'bitmessagemain.py'],
|
||||
[os.path.join(srcPath, 'bitmessagemain.py')],
|
||||
pathex=[outPath],
|
||||
hiddenimports=['pyopencl','numpy', 'win32com' , 'setuptools.msvc' ,'_cffi_backend'],
|
||||
hiddenimports=['bitmessageqt.languagebox', 'pyopencl','numpy', 'win32com' , 'setuptools.msvc' ,'_cffi_backend'],
|
||||
hookspath=None,
|
||||
runtime_hooks=None
|
||||
)
|
||||
|
@ -43,23 +43,32 @@ os.rename(os.path.join(srcPath, '__init__.py.backup'), os.path.join(srcPath, '__
|
|||
def addTranslations():
|
||||
import os
|
||||
extraDatas = []
|
||||
for file in os.listdir(srcPath + 'translations'):
|
||||
if file[-3:] != ".qm":
|
||||
for file_ in os.listdir(os.path.join(srcPath, 'translations')):
|
||||
if file_[-3:] != ".qm":
|
||||
continue
|
||||
extraDatas.append((os.path.join('translations', file), os.path.join(srcPath, 'translations', file), 'DATA'))
|
||||
for file in os.listdir(qtPath + 'translations'):
|
||||
if file[0:3] != "qt_" or file[5:8] != ".qm":
|
||||
extraDatas.append((os.path.join('translations', file_),
|
||||
os.path.join(srcPath, 'translations', file_), 'DATA'))
|
||||
for libdir in sys.path:
|
||||
qtdir = os.path.join(libdir, qtBase, 'translations')
|
||||
if os.path.isdir(qtdir):
|
||||
break
|
||||
if not os.path.isdir(qtdir):
|
||||
return extraDatas
|
||||
for file_ in os.listdir(qtdir):
|
||||
if file_[0:3] != "qt_" or file_[5:8] != ".qm":
|
||||
continue
|
||||
extraDatas.append((os.path.join('translations', file), os.path.join(qtPath, 'translations', file), 'DATA'))
|
||||
extraDatas.append((os.path.join('translations', file_),
|
||||
os.path.join(qtdir, file_), 'DATA'))
|
||||
return extraDatas
|
||||
|
||||
def addUIs():
|
||||
import os
|
||||
extraDatas = []
|
||||
for file in os.listdir(srcPath + 'bitmessageqt'):
|
||||
if file[-3:] != ".ui":
|
||||
for file_ in os.listdir(os.path.join(srcPath, 'bitmessageqt')):
|
||||
if file_[-3:] != ".ui":
|
||||
continue
|
||||
extraDatas.append((os.path.join('ui', file), os.path.join(srcPath, 'bitmessageqt', file), 'DATA'))
|
||||
extraDatas.append((os.path.join('ui', file_), os.path.join(srcPath,
|
||||
'bitmessageqt', file_), 'DATA'))
|
||||
return extraDatas
|
||||
|
||||
# append the translations directory
|
||||
|
@ -67,10 +76,8 @@ a.datas += addTranslations()
|
|||
a.datas += addUIs()
|
||||
|
||||
|
||||
|
||||
a.binaries += [('libeay32.dll', openSSLPath + 'libeay32.dll', 'BINARY'),
|
||||
('python27.dll', pythonDllPath + 'python27.dll', 'BINARY'),
|
||||
('msvcr120.dll', msvcrDllPath + 'msvcr120.dll','BINARY'),
|
||||
a.binaries += [('libeay32.dll', os.path.join(openSSLPath, 'libeay32.dll'), 'BINARY'),
|
||||
('python27.dll', os.path.join(pythonDllPath, 'python27.dll'), 'BINARY'),
|
||||
(os.path.join('bitmsghash', 'bitmsghash%i.dll' % (arch)), os.path.join(srcPath, 'bitmsghash', 'bitmsghash%i.dll' % (arch)), 'BINARY'),
|
||||
(os.path.join('bitmsghash', 'bitmsghash.cl'), os.path.join(srcPath, 'bitmsghash', 'bitmsghash.cl'), 'BINARY'),
|
||||
(os.path.join('sslkeys', 'cert.pem'), os.path.join(srcPath, 'sslkeys', 'cert.pem'), 'BINARY'),
|
||||
|
@ -93,14 +100,14 @@ exe = EXE(pyz,
|
|||
name=fname,
|
||||
debug=False,
|
||||
strip=None,
|
||||
upx=True,
|
||||
console=True, icon= os.path.join(srcPath, 'images', 'can-icon.ico'))
|
||||
upx=False,
|
||||
console=False, icon= os.path.join(srcPath, 'images', 'can-icon.ico'))
|
||||
|
||||
coll = COLLECT(exe,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx=False,
|
||||
name='main')
|
||||
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
Operations with addresses
|
||||
"""
|
||||
# pylint: disable=redefined-outer-name,inconsistent-return-statements
|
||||
|
||||
import hashlib
|
||||
from binascii import hexlify, unhexlify
|
||||
from struct import pack, unpack
|
||||
|
||||
from debug import logger
|
||||
|
||||
|
||||
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||
|
||||
|
||||
|
@ -180,7 +178,8 @@ def decodeAddress(address):
|
|||
returns (status, address version number, stream number,
|
||||
data (almost certainly a ripe hash))
|
||||
"""
|
||||
# pylint: disable=too-many-return-statements,too-many-statements,too-many-return-statements,too-many-branches
|
||||
# pylint: disable=too-many-return-statements,too-many-statements
|
||||
# pylint: disable=too-many-branches
|
||||
|
||||
address = str(address).strip()
|
||||
|
||||
|
|
110
src/api.py
110
src/api.py
|
@ -1,15 +1,11 @@
|
|||
# pylint: disable=too-many-locals,too-many-lines,no-self-use,too-many-public-methods,too-many-branches
|
||||
# pylint: disable=too-many-statements
|
||||
|
||||
# Copyright (c) 2012-2016 Jonathan Warren
|
||||
# Copyright (c) 2012-2020 The Bitmessage developers
|
||||
|
||||
"""
|
||||
This is not what you run to run the Bitmessage API. Instead, enable the API
|
||||
( https://bitmessage.org/wiki/API ) and optionally enable daemon mode
|
||||
( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py.
|
||||
"""
|
||||
|
||||
# Copyright (c) 2012-2016 Jonathan Warren
|
||||
# Copyright (c) 2012-2020 The Bitmessage developers
|
||||
# pylint: disable=too-many-lines,no-self-use,unused-variable,unused-argument
|
||||
import base64
|
||||
import errno
|
||||
import hashlib
|
||||
|
@ -22,8 +18,6 @@ from binascii import hexlify, unhexlify
|
|||
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer
|
||||
from struct import pack
|
||||
|
||||
from version import softwareVersion
|
||||
|
||||
import defaults
|
||||
import helper_inbox
|
||||
import helper_sent
|
||||
|
@ -33,13 +27,20 @@ import queues
|
|||
import shared
|
||||
import shutdown
|
||||
import state
|
||||
from addresses import addBMIfNotPresent, calculateInventoryHash, decodeAddress, decodeVarint, varintDecodeError
|
||||
from addresses import (
|
||||
addBMIfNotPresent,
|
||||
calculateInventoryHash,
|
||||
decodeAddress,
|
||||
decodeVarint,
|
||||
varintDecodeError
|
||||
)
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
from helper_ackPayload import genAckPayload
|
||||
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sqlStoredProcedure
|
||||
from inventory import Inventory
|
||||
from network.threads import StoppableThread
|
||||
from version import softwareVersion
|
||||
|
||||
str_chan = '[chan]'
|
||||
|
||||
|
@ -136,9 +137,11 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
"""
|
||||
This is one of several classes that constitute the API
|
||||
|
||||
This class was written by Vaibhav Bhatia. Modified by Jonathan Warren (Atheros).
|
||||
This class was written by Vaibhav Bhatia.
|
||||
Modified by Jonathan Warren (Atheros).
|
||||
http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/
|
||||
"""
|
||||
# pylint: disable=too-many-public-methods
|
||||
|
||||
def do_POST(self):
|
||||
"""
|
||||
|
@ -175,7 +178,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
# SimpleXMLRPCDispatcher. To maintain backwards compatibility,
|
||||
# check to see if a subclass implements _dispatch and dispatch
|
||||
# using that method if present.
|
||||
response = self.server._marshaled_dispatch( # pylint: disable=protected-access
|
||||
# pylint: disable=protected-access
|
||||
response = self.server._marshaled_dispatch(
|
||||
data, getattr(self, '_dispatch', None)
|
||||
)
|
||||
except BaseException: # This should only happen if the module is buggy
|
||||
|
@ -213,8 +217,10 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
_, encstr = self.headers.get('Authorization').split()
|
||||
emailid, password = encstr.decode('base64').split(':')
|
||||
return (
|
||||
emailid == BMConfigParser().get('bitmessagesettings', 'apiusername') and
|
||||
password == BMConfigParser().get('bitmessagesettings', 'apipassword')
|
||||
emailid == BMConfigParser().get(
|
||||
'bitmessagesettings', 'apiusername') and
|
||||
password == BMConfigParser().get(
|
||||
'bitmessagesettings', 'apipassword')
|
||||
)
|
||||
else:
|
||||
logger.warning(
|
||||
|
@ -251,10 +257,14 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
if status == 'invalidcharacters':
|
||||
raise APIError(9, 'Invalid characters in address: ' + address)
|
||||
if status == 'versiontoohigh':
|
||||
raise APIError(10, 'Address version number too high (or zero) in address: ' + address)
|
||||
raise APIError(
|
||||
10,
|
||||
'Address version number too high (or zero) in address: ' +
|
||||
address)
|
||||
if status == 'varintmalformed':
|
||||
raise APIError(26, 'Malformed varint in address: ' + address)
|
||||
raise APIError(7, 'Could not decode address: %s : %s' % (address, status))
|
||||
raise APIError(
|
||||
7, 'Could not decode address: %s : %s' % (address, status))
|
||||
if addressVersionNumber < 2 or addressVersionNumber > 4:
|
||||
raise APIError(
|
||||
11, 'The address version number currently must be 2, 3 or 4.'
|
||||
|
@ -272,10 +282,9 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
|
||||
def HandleListAddresses(self, method):
|
||||
"""Handle a request to list addresses"""
|
||||
|
||||
data = '{"addresses":['
|
||||
for addressInKeysFile in BMConfigParser().addresses():
|
||||
status, addressVersionNumber, streamNumber, hash01 = decodeAddress( # pylint: disable=unused-variable
|
||||
status, addressVersionNumber, streamNumber, hash01 = decodeAddress(
|
||||
addressInKeysFile)
|
||||
if len(data) > 20:
|
||||
data += ','
|
||||
|
@ -379,16 +388,19 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
elif len(params) == 3:
|
||||
label, eighteenByteRipe, totalDifficulty = params
|
||||
nonceTrialsPerByte = int(
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte *
|
||||
totalDifficulty)
|
||||
payloadLengthExtraBytes = BMConfigParser().get(
|
||||
'bitmessagesettings', 'defaultpayloadlengthextrabytes')
|
||||
elif len(params) == 4:
|
||||
label, eighteenByteRipe, totalDifficulty, \
|
||||
smallMessageDifficulty = params
|
||||
nonceTrialsPerByte = int(
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte *
|
||||
totalDifficulty)
|
||||
payloadLengthExtraBytes = int(
|
||||
defaults.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty)
|
||||
defaults.networkDefaultPayloadLengthExtraBytes *
|
||||
smallMessageDifficulty)
|
||||
else:
|
||||
raise APIError(0, 'Too many parameters!')
|
||||
label = self._decode(label, "base64")
|
||||
|
@ -406,6 +418,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
|
||||
def HandleCreateDeterministicAddresses(self, params):
|
||||
"""Handle a request to create a deterministic address"""
|
||||
# pylint: disable=too-many-branches, too-many-statements
|
||||
|
||||
if not params:
|
||||
raise APIError(0, 'I need parameters!')
|
||||
|
@ -461,7 +474,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
passphrase, numberOfAddresses, addressVersionNumber, \
|
||||
streamNumber, eighteenByteRipe, totalDifficulty = params
|
||||
nonceTrialsPerByte = int(
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte *
|
||||
totalDifficulty)
|
||||
payloadLengthExtraBytes = BMConfigParser().get(
|
||||
'bitmessagesettings', 'defaultpayloadlengthextrabytes')
|
||||
|
||||
|
@ -470,9 +484,11 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
streamNumber, eighteenByteRipe, totalDifficulty, \
|
||||
smallMessageDifficulty = params
|
||||
nonceTrialsPerByte = int(
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte *
|
||||
totalDifficulty)
|
||||
payloadLengthExtraBytes = int(
|
||||
defaults.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty)
|
||||
defaults.networkDefaultPayloadLengthExtraBytes *
|
||||
smallMessageDifficulty)
|
||||
else:
|
||||
raise APIError(0, 'Too many parameters!')
|
||||
if not passphrase:
|
||||
|
@ -606,9 +622,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
label = str_chan + ' ' + passphrase
|
||||
except BaseException:
|
||||
label = str_chan + ' ' + repr(passphrase)
|
||||
|
||||
status, addressVersionNumber, streamNumber, toRipe = self._verifyAddress( # pylint: disable=unused-variable
|
||||
suppliedAddress)
|
||||
status, addressVersionNumber, streamNumber, toRipe = (
|
||||
self._verifyAddress(suppliedAddress))
|
||||
suppliedAddress = addBMIfNotPresent(suppliedAddress)
|
||||
queues.apiAddressGeneratorReturnQueue.queue.clear()
|
||||
queues.addressGeneratorQueue.put((
|
||||
|
@ -631,8 +646,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
raise APIError(0, 'I need parameters.')
|
||||
elif len(params) == 1:
|
||||
address, = params
|
||||
# pylint: disable=unused-variable
|
||||
status, addressVersionNumber, streamNumber, toRipe = self._verifyAddress(address)
|
||||
status, addressVersionNumber, streamNumber, toRipe = (
|
||||
self._verifyAddress(address))
|
||||
address = addBMIfNotPresent(address)
|
||||
if not BMConfigParser().has_section(address):
|
||||
raise APIError(
|
||||
|
@ -653,8 +668,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
raise APIError(0, 'I need parameters.')
|
||||
elif len(params) == 1:
|
||||
address, = params
|
||||
# pylint: disable=unused-variable
|
||||
status, addressVersionNumber, streamNumber, toRipe = self._verifyAddress(address)
|
||||
status, addressVersionNumber, streamNumber, toRipe = (
|
||||
self._verifyAddress(address))
|
||||
address = addBMIfNotPresent(address)
|
||||
if not BMConfigParser().has_section(address):
|
||||
raise APIError(
|
||||
|
@ -666,7 +681,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
shared.reloadMyAddressHashes()
|
||||
return 'success'
|
||||
|
||||
def HandleGetAllInboxMessages(self, params): # pylint: disable=unused-argument
|
||||
def HandleGetAllInboxMessages(self, params):
|
||||
"""Handle a request to get all inbox messages"""
|
||||
|
||||
queryreturn = sqlQuery(
|
||||
|
@ -694,7 +709,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
data += ']}'
|
||||
return data
|
||||
|
||||
def HandleGetAllInboxMessageIds(self, params): # pylint: disable=unused-argument
|
||||
def HandleGetAllInboxMessageIds(self, params):
|
||||
"""Handle a request to get all inbox message IDs"""
|
||||
|
||||
queryreturn = sqlQuery(
|
||||
|
@ -753,7 +768,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
data += ']}'
|
||||
return data
|
||||
|
||||
def HandleGetAllSentMessages(self, params): # pylint: disable=unused-argument
|
||||
def HandleGetAllSentMessages(self, params):
|
||||
"""Handle a request to get all sent messages"""
|
||||
|
||||
queryreturn = sqlQuery(
|
||||
|
@ -782,7 +797,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
data += ']}'
|
||||
return data
|
||||
|
||||
def HandleGetAllSentMessageIds(self, params): # pylint: disable=unused-argument
|
||||
def HandleGetAllSentMessageIds(self, params):
|
||||
"""Handle a request to get all sent message IDs"""
|
||||
|
||||
queryreturn = sqlQuery(
|
||||
|
@ -873,7 +888,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
data = '{"sentMessages":['
|
||||
for row in queryreturn:
|
||||
msgid, toAddress, fromAddress, subject, lastactiontime, message, \
|
||||
encodingtype, status, ackdata = row # pylint: disable=unused-variable
|
||||
encodingtype, status, ackdata = row
|
||||
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||
if len(data) > 25:
|
||||
|
@ -952,7 +967,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', msgid)
|
||||
return 'Trashed sent message (assuming message existed).'
|
||||
|
||||
def HandleSendMessage(self, params):
|
||||
def HandleSendMessage(self, params): # pylint: disable=too-many-locals
|
||||
"""Handle a request to send a message"""
|
||||
|
||||
if not params:
|
||||
|
@ -983,7 +998,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
TTL = 28 * 24 * 60 * 60
|
||||
toAddress = addBMIfNotPresent(toAddress)
|
||||
fromAddress = addBMIfNotPresent(fromAddress)
|
||||
# pylint: disable=unused-variable
|
||||
status, addressVersionNumber, streamNumber, toRipe = \
|
||||
self._verifyAddress(toAddress)
|
||||
self._verifyAddress(fromAddress)
|
||||
|
@ -1157,10 +1171,9 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
queues.UISignalQueue.put(('rerenderSubscriptions', ''))
|
||||
return 'Deleted subscription if it existed.'
|
||||
|
||||
def ListSubscriptions(self, params): # pylint: disable=unused-argument
|
||||
def ListSubscriptions(self, params):
|
||||
"""Handle a request to list susbcriptions"""
|
||||
|
||||
# pylint: disable=unused-variable
|
||||
queryreturn = sqlQuery(
|
||||
"SELECT label, address, enabled FROM subscriptions")
|
||||
data = {'subscriptions': []}
|
||||
|
@ -1195,12 +1208,15 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
)
|
||||
with shared.printLock:
|
||||
print(
|
||||
'(For msg message via API) Doing proof of work. Total required difficulty:',
|
||||
'(For msg message via API) Doing proof of work.'
|
||||
'Total required difficulty:',
|
||||
float(
|
||||
requiredAverageProofOfWorkNonceTrialsPerByte
|
||||
) / defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
|
||||
'Required small message difficulty:',
|
||||
float(requiredPayloadLengthExtraBytes) / defaults.networkDefaultPayloadLengthExtraBytes,
|
||||
float(
|
||||
requiredPayloadLengthExtraBytes
|
||||
) / defaults.networkDefaultPayloadLengthExtraBytes,
|
||||
)
|
||||
powStartTime = time.time()
|
||||
initialHash = hashlib.sha512(encryptedPayload).digest()
|
||||
|
@ -1209,8 +1225,9 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
print '(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce
|
||||
try:
|
||||
print(
|
||||
'POW took', int(time.time() - powStartTime), 'seconds.',
|
||||
nonce / (time.time() - powStartTime), 'nonce trials per second.',
|
||||
'POW took', int(time.time() - powStartTime),
|
||||
'seconds.', nonce / (time.time() - powStartTime),
|
||||
'nonce trials per second.',
|
||||
)
|
||||
except BaseException:
|
||||
pass
|
||||
|
@ -1237,7 +1254,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
sqlExecute("UPDATE sent SET folder='trash' WHERE ackdata=?", ackdata)
|
||||
return 'Trashed sent message (assuming message existed).'
|
||||
|
||||
def HandleDissimatePubKey(self, params): # pylint: disable=unused-argument
|
||||
def HandleDissimatePubKey(self, params):
|
||||
"""Handle a request to disseminate a public key"""
|
||||
|
||||
# The device issuing this command to PyBitmessage supplies a pubkey
|
||||
|
@ -1266,7 +1283,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
pubkeyReadPosition += 8
|
||||
else:
|
||||
pubkeyReadPosition += 4
|
||||
# pylint: disable=unused-variable
|
||||
addressVersion, addressVersionLength = decodeVarint(
|
||||
payload[pubkeyReadPosition:pubkeyReadPosition + 10])
|
||||
pubkeyReadPosition += addressVersionLength
|
||||
|
@ -1325,7 +1341,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
data += ']}'
|
||||
return data
|
||||
|
||||
def HandleClientStatus(self, params): # pylint: disable=unused-argument
|
||||
def HandleClientStatus(self, params):
|
||||
"""Handle a request to get the status of the client"""
|
||||
|
||||
connections_num = len(network.stats.connectedHostsList())
|
||||
|
|
|
@ -13,15 +13,15 @@ TODO: fix the following (currently ignored) violations:
|
|||
|
||||
"""
|
||||
|
||||
import xmlrpclib
|
||||
import datetime
|
||||
import imghdr
|
||||
import ntpath
|
||||
import json
|
||||
import socket
|
||||
import time
|
||||
import sys
|
||||
import ntpath
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import xmlrpclib
|
||||
|
||||
from bmconfigparser import BMConfigParser
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ The PyBitmessage startup script
|
|||
|
||||
# Right now, PyBitmessage only support connecting to stream 1. It doesn't
|
||||
# yet contain logic to expand into further streams.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ctypes
|
||||
|
@ -26,8 +25,8 @@ from struct import pack
|
|||
import defaults
|
||||
import depends
|
||||
import shared
|
||||
import state
|
||||
import shutdown
|
||||
import state
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger # this should go before any threads
|
||||
from helper_startup import (
|
||||
|
@ -38,14 +37,15 @@ from inventory import Inventory
|
|||
from knownnodes import readKnownNodes
|
||||
# Network objects and threads
|
||||
from network import (
|
||||
BMConnectionPool, Dandelion,
|
||||
AddrThread, AnnounceThread, BMNetworkThread, InvThread, ReceiveQueueThread,
|
||||
DownloadThread, UploadThread)
|
||||
BMConnectionPool, Dandelion, AddrThread, AnnounceThread, BMNetworkThread,
|
||||
InvThread, ReceiveQueueThread, DownloadThread, UploadThread
|
||||
)
|
||||
from singleinstance import singleinstance
|
||||
# Synchronous threads
|
||||
from threads import (
|
||||
set_thread_name,
|
||||
addressGenerator, objectProcessor, singleCleaner, singleWorker, sqlThread)
|
||||
set_thread_name, addressGenerator, objectProcessor, singleCleaner,
|
||||
singleWorker, sqlThread
|
||||
)
|
||||
|
||||
app_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
os.chdir(app_dir)
|
||||
|
@ -88,7 +88,8 @@ def _fixSocket():
|
|||
addressToString = ctypes.windll.ws2_32.WSAAddressToStringA
|
||||
|
||||
def inet_ntop(family, host):
|
||||
"""Converting an IP address in packed binary format to string format"""
|
||||
"""Converting an IP address in packed
|
||||
binary format to string format"""
|
||||
if family == socket.AF_INET:
|
||||
if len(host) != 4:
|
||||
raise ValueError("invalid IPv4 host")
|
||||
|
@ -110,7 +111,8 @@ def _fixSocket():
|
|||
stringToAddress = ctypes.windll.ws2_32.WSAStringToAddressA
|
||||
|
||||
def inet_pton(family, host):
|
||||
"""Converting an IP address in string format to a packed binary format"""
|
||||
"""Converting an IP address in string format
|
||||
to a packed binary format"""
|
||||
buf = "\0" * 28
|
||||
lengthBuf = pack("I", len(buf))
|
||||
if stringToAddress(str(host),
|
||||
|
@ -151,8 +153,8 @@ def signal_handler(signum, frame):
|
|||
if thread.name not in ("PyBitmessage", "MainThread"):
|
||||
return
|
||||
logger.error("Got signal %i", signum)
|
||||
# there are possible non-UI variants to run bitmessage which should shutdown
|
||||
# especially test-mode
|
||||
# there are possible non-UI variants to run bitmessage
|
||||
# which should shutdown especially test-mode
|
||||
if shared.thisapp.daemon or not state.enableGUI:
|
||||
shutdown.doCleanShutdown()
|
||||
else:
|
||||
|
@ -381,10 +383,14 @@ class Main(object):
|
|||
if daemon:
|
||||
while state.shutdown == 0:
|
||||
time.sleep(1)
|
||||
if (state.testmode and time.time() - state.last_api_response >= 30):
|
||||
if (
|
||||
state.testmode and time.time() -
|
||||
state.last_api_response >= 30
|
||||
):
|
||||
self.stop()
|
||||
elif not state.enableGUI:
|
||||
from tests import core as test_core # pylint: disable=relative-import
|
||||
# pylint: disable=relative-import
|
||||
from tests import core as test_core
|
||||
test_core_result = test_core.run()
|
||||
state.enableGUI = True
|
||||
self.stop()
|
||||
|
@ -429,7 +435,6 @@ class Main(object):
|
|||
# wait until child ready
|
||||
while True:
|
||||
time.sleep(1)
|
||||
|
||||
os._exit(0) # pylint: disable=protected-access
|
||||
except AttributeError:
|
||||
# fork not implemented
|
||||
|
|
|
@ -3,8 +3,8 @@ BMConfigParser class definition and default configuration settings
|
|||
"""
|
||||
|
||||
import ConfigParser
|
||||
import shutil
|
||||
import os
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
|
||||
import state
|
||||
|
@ -47,6 +47,7 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
|||
Singleton class inherited from :class:`ConfigParser.SafeConfigParser`
|
||||
with additional methods specific to bitmessage config.
|
||||
"""
|
||||
# pylint: disable=too-many-ancestors
|
||||
|
||||
_temp = {}
|
||||
|
||||
|
@ -58,7 +59,8 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
|||
raise ValueError("Invalid value %s" % value)
|
||||
return ConfigParser.ConfigParser.set(self, section, option, value)
|
||||
|
||||
def get(self, section, option, raw=False, variables=None): # pylint: disable=arguments-differ
|
||||
def get(self, section, option, raw=False, variables=None):
|
||||
# pylint: disable=arguments-differ
|
||||
try:
|
||||
if section == "bitmessagesettings" and option == "timeformat":
|
||||
return ConfigParser.ConfigParser.get(
|
||||
|
@ -94,7 +96,8 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
|||
return False
|
||||
|
||||
def safeGetInt(self, section, field, default=0):
|
||||
"""Return value as integer, default on exceptions, 0 if default missing"""
|
||||
"""Return value as integer, default on exceptions,
|
||||
0 if default missing"""
|
||||
try:
|
||||
return self.getint(section, field)
|
||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError,
|
||||
|
@ -109,8 +112,10 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
|||
ValueError, AttributeError):
|
||||
return default
|
||||
|
||||
def items(self, section, raw=False, variables=None): # pylint: disable=arguments-differ
|
||||
"""Return section variables as parent, but override the "raw" argument to always True"""
|
||||
def items(self, section, raw=False, variables=None):
|
||||
"""Return section variables as parent,
|
||||
but override the "raw" argument to always True"""
|
||||
# pylint: disable=arguments-differ
|
||||
return ConfigParser.ConfigParser.items(self, section, True, variables)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Building osx."""
|
||||
from glob import glob
|
||||
import os
|
||||
from glob import glob
|
||||
from PyQt4 import QtCore
|
||||
from setuptools import setup
|
||||
|
||||
|
@ -13,8 +13,14 @@ DATA_FILES = [
|
|||
('bitmsghash', ['bitmsghash/bitmsghash.cl', 'bitmsghash/bitmsghash.so']),
|
||||
('translations', glob('translations/*.qm')),
|
||||
('ui', glob('bitmessageqt/*.ui')),
|
||||
('translations', glob(str(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)) + '/qt_??.qm')),
|
||||
('translations', glob(str(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)) + '/qt_??_??.qm')),
|
||||
(
|
||||
'translations',
|
||||
glob(os.path.join(str(QtCore.QLibraryInfo.location(
|
||||
QtCore.QLibraryInfo.TranslationsPath)), 'qt_??.qm'))),
|
||||
(
|
||||
'translations',
|
||||
glob(os.path.join(str(QtCore.QLibraryInfo.location(
|
||||
QtCore.QLibraryInfo.TranslationsPath)), 'qt_??_??.qm'))),
|
||||
]
|
||||
|
||||
setup(
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
"""
|
||||
A thread for creating addresses
|
||||
"""
|
||||
import time
|
||||
import hashlib
|
||||
import time
|
||||
from binascii import hexlify
|
||||
from pyelliptic import arithmetic
|
||||
from pyelliptic.openssl import OpenSSL
|
||||
import tr
|
||||
import queues
|
||||
import state
|
||||
import shared
|
||||
|
||||
import defaults
|
||||
import highlevelcrypto
|
||||
from bmconfigparser import BMConfigParser
|
||||
import queues
|
||||
import shared
|
||||
import state
|
||||
import tr
|
||||
from addresses import decodeAddress, encodeAddress, encodeVarint
|
||||
from bmconfigparser import BMConfigParser
|
||||
from fallback import RIPEMD160Hash
|
||||
from network import StoppableThread
|
||||
from pyelliptic import arithmetic
|
||||
from pyelliptic.openssl import OpenSSL
|
||||
|
||||
|
||||
class addressGenerator(StoppableThread):
|
||||
|
@ -35,7 +36,8 @@ class addressGenerator(StoppableThread):
|
|||
Process the requests for addresses generation
|
||||
from `.queues.addressGeneratorQueue`
|
||||
"""
|
||||
# pylint: disable=too-many-locals, too-many-branches, protected-access, too-many-statements
|
||||
# pylint: disable=too-many-locals, too-many-branches
|
||||
# pylint: disable=protected-access, too-many-statements
|
||||
while state.shutdown == 0:
|
||||
queueValue = queues.addressGeneratorQueue.get()
|
||||
nonceTrialsPerByte = 0
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
"""
|
||||
The objectProcessor thread, of which there is only one, processes the network objects
|
||||
The objectProcessor thread, of which there is only one,
|
||||
processes the network objects
|
||||
"""
|
||||
# pylint: disable=too-many-locals,too-many-return-statements
|
||||
# pylint: disable=too-many-branches,too-many-statements
|
||||
import hashlib
|
||||
import logging
|
||||
import random
|
||||
|
@ -9,31 +12,28 @@ import time
|
|||
from binascii import hexlify
|
||||
from subprocess import call # nosec
|
||||
|
||||
import highlevelcrypto
|
||||
import knownnodes
|
||||
import shared
|
||||
from addresses import (
|
||||
calculateInventoryHash, decodeAddress, decodeVarint, encodeAddress,
|
||||
encodeVarint, varintDecodeError
|
||||
)
|
||||
from bmconfigparser import BMConfigParser
|
||||
|
||||
import helper_bitcoin
|
||||
import helper_inbox
|
||||
import helper_msgcoding
|
||||
import helper_sent
|
||||
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery
|
||||
from helper_ackPayload import genAckPayload
|
||||
from network import bmproto
|
||||
from network.node import Peer
|
||||
|
||||
import highlevelcrypto
|
||||
import knownnodes
|
||||
import l10n
|
||||
import protocol
|
||||
import queues
|
||||
import shared
|
||||
import state
|
||||
import tr
|
||||
from addresses import (
|
||||
calculateInventoryHash, decodeAddress, decodeVarint,
|
||||
encodeAddress, encodeVarint, varintDecodeError
|
||||
)
|
||||
from bmconfigparser import BMConfigParser
|
||||
from fallback import RIPEMD160Hash
|
||||
|
||||
import l10n
|
||||
from helper_ackPayload import genAckPayload
|
||||
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery
|
||||
from network import bmproto
|
||||
from network.node import Peer
|
||||
# pylint: disable=too-many-locals, too-many-return-statements, too-many-branches, too-many-statements
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
@ -647,7 +647,8 @@ class objectProcessor(threading.Thread):
|
|||
if decodeAddress(toAddress)[1] >= 3 \
|
||||
and not BMConfigParser().safeGetBoolean(toAddress, 'chan'):
|
||||
# If I'm not friendly with this person:
|
||||
if not shared.isAddressInMyAddressBookSubscriptionsListOrWhitelist(fromAddress):
|
||||
if not shared.isAddressInMyAddressBookSubscriptionsListOrWhitelist(
|
||||
fromAddress):
|
||||
requiredNonceTrialsPerByte = BMConfigParser().getint(
|
||||
toAddress, 'noncetrialsperbyte')
|
||||
requiredPayloadLengthExtraBytes = BMConfigParser().getint(
|
||||
|
|
|
@ -30,7 +30,7 @@ import queues
|
|||
import state
|
||||
import tr
|
||||
from bmconfigparser import BMConfigParser
|
||||
from helper_sql import sqlQuery, sqlExecute
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
from inventory import Inventory
|
||||
from network import BMConnectionPool, StoppableThread
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ Thread for performing PoW
|
|||
"""
|
||||
# pylint: disable=protected-access,too-many-branches,too-many-statements
|
||||
# pylint: disable=no-self-use,too-many-lines,too-many-locals,relative-import
|
||||
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import hashlib
|
||||
|
@ -23,7 +25,9 @@ import queues
|
|||
import shared
|
||||
import state
|
||||
import tr
|
||||
from addresses import calculateInventoryHash, decodeAddress, decodeVarint, encodeVarint
|
||||
from addresses import (
|
||||
calculateInventoryHash, decodeAddress, decodeVarint, encodeVarint
|
||||
)
|
||||
from bmconfigparser import BMConfigParser
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
from inventory import Inventory
|
||||
|
@ -239,11 +243,13 @@ class singleWorker(StoppableThread):
|
|||
return payload
|
||||
|
||||
def doPOWForMyV2Pubkey(self, adressHash):
|
||||
""" This function also broadcasts out the pubkey message once it is done with the POW"""
|
||||
""" This function also broadcasts out the pubkey
|
||||
message once it is done with the POW"""
|
||||
# Look up my stream number based on my address hash
|
||||
myAddress = shared.myAddressesByHash[adressHash]
|
||||
# status
|
||||
_, addressVersionNumber, streamNumber, adressHash = decodeAddress(myAddress)
|
||||
_, addressVersionNumber, streamNumber, adressHash = (
|
||||
decodeAddress(myAddress))
|
||||
|
||||
# 28 days from now plus or minus five minutes
|
||||
TTL = int(28 * 24 * 60 * 60 + helper_random.randomrandrange(-300, 300))
|
||||
|
|
|
@ -22,8 +22,9 @@ class smtpDeliver(StoppableThread):
|
|||
_instance = None
|
||||
|
||||
def stopThread(self):
|
||||
# pylint: disable=no-member
|
||||
try:
|
||||
queues.UISignallerQueue.put(("stopThread", "data")) # pylint: disable=no-member
|
||||
queues.UISignallerQueue.put(("stopThread", "data"))
|
||||
except:
|
||||
pass
|
||||
super(smtpDeliver, self).stopThread()
|
||||
|
@ -37,6 +38,7 @@ class smtpDeliver(StoppableThread):
|
|||
|
||||
def run(self):
|
||||
# pylint: disable=too-many-branches,too-many-statements,too-many-locals
|
||||
# pylint: disable=deprecated-lambda
|
||||
while state.shutdown == 0:
|
||||
command, data = queues.UISignalQueue.get()
|
||||
if command == 'writeNewAddressToTable':
|
||||
|
@ -59,9 +61,9 @@ class smtpDeliver(StoppableThread):
|
|||
msg = MIMEText(body, 'plain', 'utf-8')
|
||||
msg['Subject'] = Header(subject, 'utf-8')
|
||||
msg['From'] = fromAddress + '@' + SMTPDOMAIN
|
||||
toLabel = map( # pylint: disable=deprecated-lambda
|
||||
toLabel = map(
|
||||
lambda y: BMConfigParser().safeGet(y, "label"),
|
||||
filter( # pylint: disable=deprecated-lambda
|
||||
filter(
|
||||
lambda x: x == toAddress, BMConfigParser().addresses())
|
||||
)
|
||||
if toLabel:
|
||||
|
|
|
@ -76,8 +76,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
|||
# print >> DEBUGSTREAM, 'Incoming connection from %s' % repr(addr)
|
||||
self.channel = smtpServerChannel(self, conn, addr)
|
||||
|
||||
def send(self, fromAddress, toAddress, subject, message): # pylint: disable=arguments-differ
|
||||
def send(self, fromAddress, toAddress, subject, message):
|
||||
"""Send a bitmessage"""
|
||||
# pylint: disable=arguments-differ
|
||||
streamNumber, ripe = decodeAddress(toAddress)[2:]
|
||||
stealthLevel = BMConfigParser().safeGetInt('bitmessagesettings', 'ackstealthlevel')
|
||||
ackdata = genAckPayload(streamNumber, stealthLevel)
|
||||
|
@ -114,8 +115,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
|||
|
||||
return ret
|
||||
|
||||
def process_message(self, peer, mailfrom, rcpttos, data): # pylint: disable=too-many-locals, too-many-branches
|
||||
def process_message(self, peer, mailfrom, rcpttos, data):
|
||||
"""Process an email"""
|
||||
# pylint: disable=too-many-locals, too-many-branches
|
||||
# print 'Receiving message from:', peer
|
||||
p = re.compile(".*<([^>]+)>")
|
||||
if not hasattr(self.channel, "auth") or not self.channel.auth:
|
||||
|
|
|
@ -2,15 +2,12 @@
|
|||
sqlThread is defined here
|
||||
"""
|
||||
|
||||
import threading
|
||||
from bmconfigparser import BMConfigParser
|
||||
|
||||
import sqlite3
|
||||
import time
|
||||
import shutil # used for moving the messages.dat file
|
||||
import sys
|
||||
import os
|
||||
from debug import logger
|
||||
import shutil # used for moving the messages.dat file
|
||||
import sqlite3
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
import helper_sql
|
||||
import helper_startup
|
||||
|
@ -18,6 +15,8 @@ import paths
|
|||
import queues
|
||||
import state
|
||||
import tr
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
# pylint: disable=attribute-defined-outside-init,protected-access
|
||||
|
||||
|
||||
|
|
|
@ -231,12 +231,13 @@ def check_sqlite():
|
|||
conn.close()
|
||||
|
||||
|
||||
def check_openssl(): # pylint: disable=too-many-branches, too-many-return-statements
|
||||
def check_openssl():
|
||||
"""Do openssl dependency check.
|
||||
|
||||
Here we are checking for openssl with its all dependent libraries
|
||||
and version checking.
|
||||
"""
|
||||
# pylint: disable=too-many-branches, too-many-return-statements
|
||||
# pylint: disable=protected-access, redefined-outer-name
|
||||
ctypes = try_import('ctypes')
|
||||
if not ctypes:
|
||||
|
|
|
@ -5,8 +5,8 @@ This module is for generating ack payload
|
|||
from binascii import hexlify
|
||||
from struct import pack
|
||||
|
||||
import highlevelcrypto
|
||||
import helper_random
|
||||
import highlevelcrypto
|
||||
from addresses import encodeVarint
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,11 @@ Message encoding end decoding functions
|
|||
import string
|
||||
import zlib
|
||||
|
||||
import messagetypes
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
from tr import _translate
|
||||
|
||||
try:
|
||||
import msgpack
|
||||
except ImportError:
|
||||
|
@ -13,11 +18,6 @@ except ImportError:
|
|||
except ImportError:
|
||||
import fallback.umsgpack.umsgpack as msgpack
|
||||
|
||||
import messagetypes
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
from tr import _translate
|
||||
|
||||
BITMESSAGE_ENCODING_IGNORE = 0
|
||||
BITMESSAGE_ENCODING_TRIVIAL = 1
|
||||
BITMESSAGE_ENCODING_SIMPLE = 2
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
import os
|
||||
import random
|
||||
|
||||
from pyelliptic.openssl import OpenSSL
|
||||
|
||||
NoneType = type(None)
|
||||
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ SQLite objects can only be used from one thread.
|
|||
or isn't thread-safe.
|
||||
"""
|
||||
|
||||
import threading
|
||||
import Queue
|
||||
import threading
|
||||
|
||||
sqlSubmitQueue = Queue.Queue()
|
||||
"""the queue for SQL"""
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""The Inventory singleton"""
|
||||
|
||||
# TODO make this dynamic, and watch out for frozen, like with messagetypes
|
||||
import storage.sqlite
|
||||
import storage.filesystem
|
||||
import storage.sqlite
|
||||
from bmconfigparser import BMConfigParser
|
||||
from singleton import Singleton
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import time
|
|||
|
||||
from bmconfigparser import BMConfigParser
|
||||
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""This module is for thread start."""
|
||||
import state
|
||||
from bitmessagemain import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
state.kivy = True
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
from importlib import import_module
|
||||
from os import path, listdir
|
||||
from os import listdir, path
|
||||
from string import lower
|
||||
try:
|
||||
from kivy.utils import platform
|
||||
|
|
|
@ -1,28 +1,7 @@
|
|||
# pylint: disable=too-many-branches,protected-access
|
||||
"""
|
||||
Copyright (C) 2013 by Daniel Kraft <d@domob.eu>
|
||||
|
||||
Namecoin queries
|
||||
"""
|
||||
# This file is part of the Bitmessage project.
|
||||
|
||||
# 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.
|
||||
# pylint: disable=too-many-branches,protected-access
|
||||
|
||||
import base64
|
||||
import httplib
|
||||
|
@ -31,11 +10,11 @@ import os
|
|||
import socket
|
||||
import sys
|
||||
|
||||
from addresses import decodeAddress
|
||||
from debug import logger
|
||||
import defaults
|
||||
import tr # translate
|
||||
from addresses import decodeAddress
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
|
||||
|
||||
configSection = "bitmessagesettings"
|
||||
|
|
|
@ -4,7 +4,6 @@ Announce myself (node address)
|
|||
import time
|
||||
|
||||
import state
|
||||
|
||||
from bmconfigparser import BMConfigParser
|
||||
from network.assemble import assemble_addr
|
||||
from network.connectionpool import BMConnectionPool
|
||||
|
|
|
@ -19,9 +19,9 @@ from bmconfigparser import BMConfigParser
|
|||
from inventory import Inventory
|
||||
from network.advanceddispatcher import AdvancedDispatcher
|
||||
from network.bmobject import (
|
||||
BMObject, BMObjectInsufficientPOWError, BMObjectInvalidDataError,
|
||||
BMObjectExpiredError, BMObjectUnwantedStreamError,
|
||||
BMObjectInvalidError, BMObjectAlreadyHaveError
|
||||
BMObject, BMObjectAlreadyHaveError, BMObjectExpiredError,
|
||||
BMObjectInsufficientPOWError, BMObjectInvalidDataError,
|
||||
BMObjectInvalidError, BMObjectUnwantedStreamError
|
||||
)
|
||||
from network.constants import (
|
||||
ADDRESS_ALIVE, MAX_MESSAGE_SIZE, MAX_OBJECT_COUNT,
|
||||
|
@ -30,8 +30,8 @@ from network.constants import (
|
|||
from network.dandelion import Dandelion
|
||||
from network.proxy import ProxyError
|
||||
from node import Node, Peer
|
||||
from objectracker import missingObjects, ObjectTracker
|
||||
from queues import objectProcessorQueue, portCheckerQueue, invQueue, addrQueue
|
||||
from objectracker import ObjectTracker, missingObjects
|
||||
from queues import invQueue, objectProcessorQueue, portCheckerQueue
|
||||
from randomtrackingdict import RandomTrackingDict
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
@ -466,8 +466,9 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
}
|
||||
# since we don't track peers outside of knownnodes,
|
||||
# only spread if in knownnodes to prevent flood
|
||||
addrQueue.put((stream, peer, seenTime,
|
||||
self.destination))
|
||||
# DISABLED TO WORKAROUND FLOOD/LEAK
|
||||
# addrQueue.put((stream, peer, seenTime,
|
||||
# self.destination))
|
||||
return True
|
||||
|
||||
def bm_command_portcheck(self):
|
||||
|
|
|
@ -6,8 +6,8 @@ import Queue
|
|||
import socket
|
||||
|
||||
import state
|
||||
from network.connectionpool import BMConnectionPool
|
||||
from network.advanceddispatcher import UnknownStateError
|
||||
from network.connectionpool import BMConnectionPool
|
||||
from queues import receiveDataQueue
|
||||
from threads import StoppableThread
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ SOCKS4a proxy module
|
|||
import socket
|
||||
import struct
|
||||
|
||||
from proxy import Proxy, ProxyError, GeneralProxyError
|
||||
from proxy import GeneralProxyError, Proxy, ProxyError
|
||||
|
||||
|
||||
class Socks4aError(ProxyError):
|
||||
|
|
|
@ -7,11 +7,10 @@ import socket
|
|||
import ssl
|
||||
import sys
|
||||
|
||||
from network.advanceddispatcher import AdvancedDispatcher
|
||||
import network.asyncore_pollchoose as asyncore
|
||||
|
||||
from queues import receiveDataQueue
|
||||
import paths
|
||||
from network.advanceddispatcher import AdvancedDispatcher
|
||||
from queues import receiveDataQueue
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
|
|
3
src/nohup.out
Normal file
3
src/nohup.out
Normal file
|
@ -0,0 +1,3 @@
|
|||
python: can't open file 'main.py.py': [Errno 2] No such file or directory
|
||||
[[1;33mWARNING[0m] [Config ] Older configuration version detected (21 instead of 20)
|
||||
[[1;33mWARNING[0m] [Config ] Upgrading configuration in progress.
|
|
@ -2,14 +2,14 @@
|
|||
"""
|
||||
Module for Proof of Work using OpenCL
|
||||
"""
|
||||
from struct import pack, unpack
|
||||
import hashlib
|
||||
import os
|
||||
from struct import pack, unpack
|
||||
|
||||
from bmconfigparser import BMConfigParser
|
||||
import paths
|
||||
from state import shutdown
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
from state import shutdown
|
||||
|
||||
libAvailable = True
|
||||
ctx = False
|
||||
|
|
|
@ -10,7 +10,6 @@ from datetime import datetime
|
|||
from shutil import move
|
||||
from kivy.utils import platform
|
||||
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
# When using py2exe or py2app, the variable frozen is added to the sys
|
||||
|
|
|
@ -6,7 +6,7 @@ A menu plugin showing QR-Code for bitmessage address in modal dialog.
|
|||
import urllib
|
||||
|
||||
import qrcode
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from pybitmessage.tr import _translate
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ Configure tor proxy and hidden service with
|
|||
* otherwise use stem's 'BEST' version and save onion keys to the new
|
||||
section using *onionhostname* as name for future use.
|
||||
"""
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
import random # noseq
|
||||
import tempfile
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
Sound theme plugin using pycanberra
|
||||
"""
|
||||
|
||||
from pybitmessage.bitmessageqt import sound
|
||||
|
||||
import pycanberra
|
||||
from pybitmessage.bitmessageqt import sound
|
||||
|
||||
_canberra = pycanberra.Canberra()
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import socket
|
|||
import sys
|
||||
import time
|
||||
from binascii import hexlify
|
||||
from struct import pack, unpack, Struct
|
||||
from struct import Struct, pack, unpack
|
||||
|
||||
import defaults
|
||||
import highlevelcrypto
|
||||
|
|
|
@ -9,11 +9,11 @@ For modern cryptography with ECC, AES, HMAC, Blowfish, ...
|
|||
This is an abandoned package maintained inside of the PyBitmessage.
|
||||
"""
|
||||
|
||||
from .openssl import OpenSSL
|
||||
from .cipher import Cipher
|
||||
from .ecc import ECC
|
||||
from .eccblind import ECCBlind
|
||||
from .cipher import Cipher
|
||||
from .hash import hmac_sha256, hmac_sha512, pbkdf2
|
||||
from .openssl import OpenSSL
|
||||
|
||||
__version__ = '1.3'
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
This module loads openssl libs with ctypes and incapsulates
|
||||
needed openssl functionality in class _OpenSSL.
|
||||
"""
|
||||
# pylint: disable=protected-access
|
||||
import sys
|
||||
import ctypes
|
||||
from kivy.utils import platform
|
||||
import sys
|
||||
# pylint: disable=protected-access
|
||||
|
||||
OpenSSL = None
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ Return a PIL Image class instance which have generated identicon image.
|
|||
"""
|
||||
|
||||
from PyQt4 import QtGui
|
||||
from PyQt4.QtCore import QSize, QPointF, Qt
|
||||
from PyQt4.QtGui import QPixmap, QPainter, QPolygonF
|
||||
from PyQt4.QtCore import QPointF, QSize, Qt
|
||||
from PyQt4.QtGui import QPainter, QPixmap, QPolygonF
|
||||
|
||||
|
||||
class IdenticonRendererBase(object):
|
||||
|
|
|
@ -10,13 +10,14 @@ from __future__ import division
|
|||
# Libraries.
|
||||
import hashlib
|
||||
import os
|
||||
import sys
|
||||
import stat
|
||||
import threading
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
from binascii import hexlify
|
||||
from pyelliptic import arithmetic
|
||||
from kivy.utils import platform
|
||||
|
||||
# Project imports.
|
||||
import highlevelcrypto
|
||||
import state
|
||||
|
@ -25,6 +26,8 @@ from bmconfigparser import BMConfigParser
|
|||
from debug import logger
|
||||
from helper_sql import sqlQuery
|
||||
|
||||
from pyelliptic import arithmetic
|
||||
|
||||
|
||||
verbose = 1
|
||||
# This is obsolete with the change to protocol v3
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
"""
|
||||
Module for using filesystem (directory with files) for inventory storage
|
||||
"""
|
||||
import string
|
||||
import time
|
||||
from binascii import hexlify, unhexlify
|
||||
from os import listdir, makedirs, path, remove, rmdir
|
||||
import string
|
||||
from threading import RLock
|
||||
import time
|
||||
|
||||
from paths import lookupAppdataFolder
|
||||
from storage import InventoryStorage, InventoryItem
|
||||
from storage import InventoryItem, InventoryStorage
|
||||
|
||||
|
||||
class FilesystemInventory(InventoryStorage):
|
||||
|
|
|
@ -5,8 +5,8 @@ import sqlite3
|
|||
import time
|
||||
from threading import RLock
|
||||
|
||||
from helper_sql import sqlQuery, SqlBulkExecute, sqlExecute
|
||||
from storage import InventoryStorage, InventoryItem
|
||||
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery
|
||||
from storage import InventoryItem, InventoryStorage
|
||||
|
||||
|
||||
class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
|
||||
|
|
|
@ -15,6 +15,12 @@ There are also other threads in the `.network` package.
|
|||
|
||||
import threading
|
||||
|
||||
from class_addressGenerator import addressGenerator
|
||||
from class_objectProcessor import objectProcessor
|
||||
from class_singleCleaner import singleCleaner
|
||||
from class_singleWorker import singleWorker
|
||||
from class_sqlThread import sqlThread
|
||||
|
||||
try:
|
||||
import prctl
|
||||
except ImportError:
|
||||
|
@ -33,12 +39,6 @@ else:
|
|||
threading.Thread.__bootstrap_original__ = threading.Thread._Thread__bootstrap
|
||||
threading.Thread._Thread__bootstrap = _thread_name_hack
|
||||
|
||||
from class_addressGenerator import addressGenerator
|
||||
from class_objectProcessor import objectProcessor
|
||||
from class_singleCleaner import singleCleaner
|
||||
from class_singleWorker import singleWorker
|
||||
from class_sqlThread import sqlThread
|
||||
|
||||
|
||||
__all__ = [
|
||||
"addressGenerator", "objectProcessor", "singleCleaner", "singleWorker",
|
||||
|
|
|
@ -25,7 +25,8 @@ class translateClass:
|
|||
return self.text
|
||||
|
||||
|
||||
def _translate(context, text, disambiguation=None, encoding=None, n=None): # pylint: disable=unused-argument
|
||||
def _translate(context, text, disambiguation=None, encoding=None, n=None):
|
||||
# pylint: disable=unused-argument
|
||||
return translateText(context, text, n)
|
||||
|
||||
|
||||
|
|
Reference in New Issue
Block a user