Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup encrypt references in linux, mac and docker setups #6105

Merged
merged 1 commit into from
Jul 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,3 @@ pip-selfcheck.json
# Mac Gargage
.DS_Store
data/mqtt_client_id

# pgoapi files
encrypt.so
encrypt.dll
encrypt_64.dll
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,12 @@ ADD https://raw.githubusercontent.com/$BUILD_REPO/$BUILD_BRANCH/requirements.txt
RUN apk update
RUN apk add ca-certificates wget
RUN update-ca-certificates
RUN wget -P /tmp/ http://pgoapi.com/pgoencrypt.tar.gz

RUN apk -U --no-cache add --virtual .build-dependencies python-dev gcc make musl-dev git
RUN tar xvzf /tmp/pgoencrypt.tar.gz -C /tmp
RUN make -C /tmp/pgoencrypt/src
RUN cp /tmp/pgoencrypt/src/libencrypt.so /usr/src/app/encrypt.so
RUN ln -s locale.h /usr/include/xlocale.h
RUN pip install --no-cache-dir -r requirements.txt
RUN apk del .build-dependencies
RUN rm -rf /var/cache/apk/* /tmp/pgoencrypt* /usr/include/xlocale.h
RUN rm -rf /var/cache/apk/* /usr/include/xlocale.h
RUN find / -name '*.pyc' -o -name '*.pyo' | xargs -rn1 rm -f


Expand Down
3 changes: 1 addition & 2 deletions configs/auth.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
],
"gmapkey": "GOOGLE_MAPS_API_KEY",
"hashkey" : "YOUR_PURCHASED_HASH_KEY",
"encrypt_location": "",
"telegram_token": "",
"discord_token": "",
"discord_token": "",
"2captcha_token": ""
}
1 change: 0 additions & 1 deletion pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,6 @@ def _json_loader(filename):
config.password = getpass("Password: ")

config.favorite_locations = load.get('favorite_locations', [])
config.encrypt_location = load.get('encrypt_location', '')
config.telegram_token = load.get('telegram_token', '')
config.discord_token = load.get('discord_token', '')
config.twocaptcha_token = load.get('2captcha_token', '')
Expand Down
65 changes: 0 additions & 65 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,6 @@ def check_session(self, position):
self.api = ApiWrapper(config=self.config)
self.api.set_position(*position)
self.login()
#self.api.set_signature_lib(self.get_encryption_lib())
#self.api.set_hash_lib(self.get_hash_lib())

def login(self):
status = {}
Expand Down Expand Up @@ -1115,66 +1113,6 @@ def login(self):

self.heartbeat()

def get_encryption_lib(self):
if _platform == "Windows" or _platform == "win32":
# Check if we are on 32 or 64 bit
if sys.maxsize > 2**32:
file_name = 'encrypt64.dll'
else:
file_name = 'encrypt32.dll'
if _platform.lower() == "darwin":
file_name= 'libencrypt-osx-64.so'
if _platform.lower() == "linux" or _platform.lower() == "linux2":
file_name = 'libencrypt-linux-x86-64.so'
if self.config.encrypt_location == '':
path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
else:
path = self.config.encrypt_location

full_path = ''
if os.path.isfile(path + '/' + file_name): # check encrypt_location or local dir first
full_path = path + '/' + file_name
elif os.path.isfile(path + '/src/pgoapi/pgoapi/lib/' + file_name): # if not found, check pgoapi lib folder
full_path = path + '/src/pgoapi/pgoapi/lib/' + file_name

if full_path == '':
self.logger.error(file_name + ' is not found! Please place it in the bots root directory or set encrypt_location in config.')
sys.exit(1)
else:
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + full_path)

return full_path

def get_hash_lib(self):
if _platform == "Windows" or _platform == "win32":
# Check if we are on 32 or 64 bit
if sys.maxsize > 2**32:
file_name = 'niantichash64.dll'
else:
file_name = 'niantichash32.dll'
if _platform.lower() == "darwin":
file_name= 'libniantichash-macos-64.dylib'
if _platform.lower() == "linux" or _platform.lower() == "linux2":
file_name = 'libniantichash-linux-x86-64.so'
if self.config.encrypt_location == '':
path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
else:
path = self.config.encrypt_location

full_path = ''
if os.path.isfile(path + '/' + file_name): # check encrypt_location or local dir first
full_path = path + '/'+ file_name
elif os.path.isfile(path + '/src/pgoapi/pgoapi/lib/' + file_name): # if not found, check pgoapi lib folder
full_path = path + '/src/pgoapi/pgoapi/lib/' + file_name

if full_path == '':
self.logger.error(file_name + ' is not found! Please place it in the bots root directory or set encrypt_location in config.')
sys.exit(1)
else:
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + full_path)

return full_path

def _setup_api(self):
# instantiate pgoapi @var ApiWrapper
self.api = ApiWrapper(config=self.config)
Expand All @@ -1185,9 +1123,6 @@ def _setup_api(self):
self.login()
# chain subrequests (methods) into one RPC call

#self.api.set_signature_lib(self.get_encryption_lib())
#self.api.set_hash_lib(self.get_hash_lib())

self.logger.info('')
# send empty map_cells and then our position
self.update_web_location()
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/event_handlers/captcha_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_token(self, url):
file_name = 'chromedriver'

full_path = ''
if os.path.isfile(path + '/' + file_name): # check encrypt_location or local dir first
if os.path.isfile(path + '/' + file_name): # check local dir first
full_path = path + '/' + file_name

if full_path == '':
Expand Down
29 changes: 3 additions & 26 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@ pip install -r requirements.txt --upgrade
pip install -r requirements.txt
}

function Pokebotencrypt () {
echo "Start to make encrypt.so."
if [ -x "$(command -v curl)" ]
then
curl -O http://pgoapi.com/pgoencrypt.tar.gz
else
wget http://pgoapi.com/pgoencrypt.tar.gz
fi
tar -xf pgoencrypt.tar.gz
cd pgoencrypt/src/
make
mv libencrypt.so $pokebotpath/encrypt.so
cd ../..
rm -rf pgoencrypt.tar.gz
rm -rf pgoencrypt
}

function Pokebotescapestring () {
echo "$1" | sed 's/\//\\\//g' | sed 's/"/\\"/g' # escape slash and double quotes
}
Expand All @@ -42,7 +25,7 @@ Auth generator
Enter 1 for Google or 2 for Pokemon Trainer Club (PTC)
-----------------
" auth
read -p "Input E-Mail (Google) or Username(PTC)
read -p "Input E-Mail (Google) or Username (PTC)
" username
read -p "Input Password
" -s password
Expand Down Expand Up @@ -131,8 +114,8 @@ echo "You are on Open SUSE"
sudo zypper update
sudo zypper -y install python-pip python-devel gcc make
else
echo "Please check if you have python pip gcc make installed on your device."
echo "Wait 5 seconds to continue or Use ctrl+c to interrupt this shell."
echo "Please check if you have python, pip, gcc and make installed on your device."
echo "Wait 5 seconds to continue or use ctrl+c to interrupt this shell."
sleep 5
fi
if [ ! -e /etc/fedora-release ]
Expand All @@ -141,7 +124,6 @@ easy_install virtualenv
fi
Pokebotreset
Pokebotupdate
Pokebotencrypt
echo "Install complete. Starting to generate auth.json and config.json."
Pokebotauth
Pokebotconfig
Expand Down Expand Up @@ -174,7 +156,6 @@ echo " -i,--install. Install PokemonGo-Bot."
echo " -b,--backup. Backup config files."
echo " -a,--auth. Easy auth generator."
echo " -c,--config. Easy config generator."
echo " -e,--encrypt. Make encrypt.so."
echo " -r,--reset. Force sync source branch."
echo " -u,--update. Command git pull to update."
}
Expand All @@ -183,9 +164,6 @@ case $* in
--install|-i)
Pokebotinstall
;;
--encrypt|-e)
Pokebotencrypt
;;
--reset|-r)
Pokebotreset
;;
Expand All @@ -204,7 +182,6 @@ echo "Backup complete."
--auth|-a)
Pokebotauth
;;

--config|-c)
Pokebotconfig
;;
Expand Down