This commit is contained in:
Pawel Orzech 2019-11-09 21:01:55 +00:00
parent bf84bce6b7
commit 03546e2a5e
23 changed files with 8725 additions and 92 deletions

67
BotZone3.2/README.md Normal file
View file

@ -0,0 +1,67 @@
# Dragon Ball Dokkan Battle Bot
This is a Dokkan Battle bot that was first created by FlashChaser. I added a lot of new features and planning on adding more, therefore I've created my own repo.
There's no support from me - it is what it is. If you're gonna get banned - bad luck.
If you want to add a feature you've made feel free to submit a pull request.
The bot is made quite straightforwardly:
The packet module handles the encryption of packet data as well as the authorisation.
There shouldn't be too much reason to add to this file beyond fixing bugs.
The commands module is where the bulk of the code will be written for adding new features.
The dokkan module is where the command line/UI will be implemented, and will call the functions in the commands module.
The decryptor module uses: https://github.com/bssthu/pysqlsimplecipher
Although it's slow FlashChaser preferred this code over pysqlcipher simply because it's easier to package it for distribution without running into issues.
# Download
Just grab a copy of master repo and go on.
# To Do
Feel free to add feature requests. I'm gonna try and add as much as I can with my spare time. Bot already can do pretty much anything.
- Sell only Hercules
- **Hercule Punch - done**
- SBR,
- **RankUp - done**,
- Transfer but better,
- **BossRush - done**
- **EzaPLUS (up to 50lvl) - done**
# Installation
You might need to use sudo before every pip3 command.
```
pip3 install six
pip3 install pyinstaller
pip3 install colorama
pip3 install orator
pip3 install pycrypto - https://github.com/dlitz/pycrypto
OR pip3 install pycryptodome
pip3 install PySimpleGUI
pip3 install requests
```
Then go to folder where your dokkan.py file is and: python3 dokkan.py
Happy testing!
# Pull Requests
Very happy to merge pull requests.
Until I can develop some tests be careful to make sure that all new commands that you implement accurately support JP translation.
e.g Check that you read from the global database, and if the data doesn't exist, read from the jp database.
```python
try:
config.Model.set_connection_resolver(config.db_glb)
config.Quests.find_or_fail(int(stage_id))
except:
config.Model.set_connection_resolver(config.db_jp)
config.Quests.find_or_fail(int(stage_id))
```

37
BotZone3.2/setup.py Executable file
View file

@ -0,0 +1,37 @@
from distutils.core import setup
def get_version(relpath):
"""read version info from file without importing it"""
from os.path import dirname, join
for line in open(join(dirname(__file__), relpath)):
if '__version__' in line:
if '"' in line:
# __version__ = "0.9"
return line.split('"')[1]
elif "'" in line:
return line.split("'")[1]
setup(
name='wget',
version=get_version('wget.py'),
author='anatoly techtonik <techtonik@gmail.com>',
url='http://bitbucket.org/techtonik/python-wget/',
description="pure python download utility",
license="Public Domain",
classifiers=[
'Environment :: Console',
'License :: Public Domain',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Networking',
'Topic :: Utilities',
],
py_modules=['wget'],
long_description=open('README.txt').read(),
)

223
BotZoneV2.7.3.py Normal file
View file

@ -0,0 +1,223 @@
from colorama import init, Fore, Back, Style
import commands
import config
import sys
import os
import webbrowser
# Coloroma autoreset
init(autoreset=True)
if not os.path.isdir("Saves"):
try:
os.mkdir('Saves')
os.mkdir('Saves/ios')
os.mkdir('Saves/android')
os.mkdir('Saves/Jp')
os.mkdir('Saves/Jp/ios')
os.mkdir('Saves/Jp/android')
os.mkdir('Saves/fresh')
os.mkdir('Saves/fresh/ios')
os.mkdir('Saves/fresh/android')
except:
print(Fore.RED + Style.BRIGHT + 'Unable to create saves file')
while True:
# Decide which client to use.
print(' ')
print(" ___ __ ____ ")
print(" / _ )___ / //_ / ___ ___ ___ ")
print(" / _ / _ \/ __// /_/ _ \/ _ \/ -_)")
print("/____/\___/\__//___/\___/_//_/\__/")
print('Choose a version')
print('---------------------------------')
print(' ')
while True:
print('Which version? (' + 'Jp: 1 ' + 'or ' 'Global: 2' ')',end='')
client = input(" ")
if client.lower() == '1':
config.client = 'japan'
while True:
print(" ___ __ ____ ")
print(" / _ )___ / //_ / ___ ___ ___ ")
print(" / _ / _ \/ __// /_/ _ \/ _ \/ -_)")
print("/____/\___/\__//___/\___/_//_/\__/")
print("-----------------------------------")
print("Possible by SomeNi")
print(" ")
print("[ Status ] -> You're curently on JP")
print(" ")
print("[ 0 ] -> New Account")
print("[ 1 ] -> Transfer Account")
print("[ 2 ] -> Load From Save")
print("[ 3 ] -> Daily Logins")
print("[ 4 ] -> Update Both DataBase")
print("[ 5 ] -> BotZone Discord Link")
print("[ 6 ] -> Update Glb DataBase")
print("[ 7 ] -> Update JP DataBase")
print(" ")
command = input('Enter your choice: ')
if command == '0':
print(' ')
config.identifier = commands.signup()
commands.Jp_save_account()
config.access_token, config.secret = commands.signin(config.identifier)
commands.tutorial()
commands.daily_login()
break
elif command == '1':
print(' ')
commands.Jp_transfer_account()
commands.daily_login()
break
elif command == '2':
print(' ')
commands.Jp_load_account()
commands.daily_login()
commands.accept_gifts()
commands.accept_missions()
break
elif command == '3':
print('')
commands.Jp_bulk_daily_logins()
break
elif command == '4':
print('')
commands.db_download()
elif command == '6':
commamds.glb_db_dowmload()
elif command == '7':
commands.jp_db_download()
elif command == '5':
webbrowser.open(commands.discordurl, new=0, autoraise=True)
elif command == 'exit':
exit()
else:
print(Fore.RED + Style.BRIGHT + "Command not understood")
# User commands.
while True:
print('---------------------------------')
print(
Fore.CYAN + Style.BRIGHT + "Type" + Fore.YELLOW + Style.BRIGHT + " 'help'" + Fore.CYAN + Style.BRIGHT + " to view all commands.")
# Set up comma separated chain commands. Handled via stdin
try:
command = input()
except:
sys.stdin = sys.__stdin__
command = input()
if command == 'exit':
break
# Pass command to command executor and handle keyboard interrupts.
try:
commands.user_command_executor(command)
except KeyboardInterrupt:
print(Fore.CYAN + Style.BRIGHT + 'User interrupted process.')
except Exception as e:
print(Fore.RED + Style.BRIGHT + repr(e))
break
elif client.lower() == '2':
config.client = 'global'
print(' ')
while True:
print(" ___ __ ____ ")
print(" / _ )___ / //_ / ___ ___ ___ ")
print(" / _ / _ \/ __// /_/ _ \/ _ \/ -_)")
print("/____/\___/\__//___/\___/_//_/\__/")
print("-----------------------------------")
print(" ")
print("[ Status ] -> You're curently on Global")
print(" ")
print("[ 0 ] -> New Account")
print("[ 1 ] -> Transfer Account")
print("[ 2 ] -> Load From Save")
print("[ 3 ] -> Load Fresh Account")
print("[ 4 ] -> New Fresh Account")
print("[ 5 ] -> Update Both DataBase")
print("[ 6 ] -> BotZone Discord Link")
print("[ 7 ] -> Update Glb DataBase")
print("[ 8 ] -> Update JP DataBase")
print(" ")
command = input('Enter your choice: ')
if command == '0':
print(' ')
config.identifier = commands.signup()
commands.save_account()
config.access_token, config.secret = commands.signin(config.identifier)
commands.tutorial()
commands.daily_login()
break
elif command == '1':
print(' ')
commands.transfer_account()
commands.daily_login()
break
elif command == '2':
print(' ')
commands.load_account()
commands.daily_login()
commands.accept_gifts()
commands.accept_missions()
break
elif command == '4':
print(' ')
config.identifier = commands.signup()
commands.fresh_save_account()
config.access_token, config.secret = commands.signin(config.identifier)
commands.tutorial()
commands.daily_login()
break
elif command == '3':
print(' ')
commands.fresh_load_account()
commands.daily_login()
commands.accept_gifts()
commands.accept_missions()
break
elif command == '5':
print(' ')
commands.db_download()
elif command == '7':
commands.glb_db_download()
elif command == '8':
commands.jp_db_download()
elif command == '6':
webbrowser.open(commands.discordurl, new=0, autoraise=True)
elif command == 'exit':
exit()
else:
print(Fore.RED + Style.BRIGHT + "Command not understood")
# User commands.
while True:
print('---------------------------------')
print(
"Type" + " 'help'" + " to view all commands.")
# Set up comma separated chain commands. Handled via stdin
try:
command = input()
except:
sys.stdin = sys.__stdin__
command = input()
if command == 'exit':
break
# Pass command to command executor and handle keyboard interrupts.
try:
commands.user_command_executor(command)
except KeyboardInterrupt:
print(Fore.CYAN + Style.BRIGHT + 'User interrupted process.')
except Exception as e:
print(Fore.RED + Style.BRIGHT + repr(e))
break
else:
print(Fore.RED + Style.BRIGHT + "Command not understood")

165
LICENSE Normal file
View file

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

483
Lrfarm.py Normal file
View file

@ -0,0 +1,483 @@
import commands
from colorama import init, Fore, Back, Style
# Coloroma autoreset
init(autoreset=True)
def t():
print(" Lr Trunks")
stage = input('What stage would you like to complete(Proud Bloodline 320022) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Raging Counterstrike 406003) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Dignity of a Clan 408002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(The Strongest Space Pirate 420002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Warrior of Hope 414002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(The Time Patrol Warrior 422002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def mv():
print("Majin Vegeta")
stage = input('What stage would you like to complete(The Dark Prince Returns 319022) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(15): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(The Strongest Shadow Dragon 517002) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Dark Nightmare 518002) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Fusion in Blue 519001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Rose-Tinted Plot 520001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(A New Hope 522001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def gv():
print(" Lr Super Saiyan Goku & Super Saiyan Vegeta")
stage = input('What stage would you like to complete(The Ultimate Pair of the Present World 537001) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Ultimate Splendor 512003) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(7): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def b():
print("Lr Full Power Boujack (Galactic Warrior)")
stage = input('What stage would you like to complete( Extreme Peril 306008) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(25): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def c():
print("Lr Cell (Perfect Form) & Cell Jr")
stage = input('What stage would you like to complete(Waking Nightmare 502003) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(7): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def tm():
print("Lr Trunks (Teen) (Future) & Mai (Future)")
stage = input('What stage would you like to complete( The Zero Mortals Plan 328006) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(20): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(Dark Nightmare 518002) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(1): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( Rose-Tinted Plot 520001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(1): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(Fusion in Blue 519001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(1): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( The Epic Battle Begins 524001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(1): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(A New Hope 522001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(2): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( Last Judgment...Or Last Hope 523002) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(2): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(Searing Rose-Colored Fury 520002) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(2): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( Sublime Blue! 519002) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(2): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def bw():
print("Lr Beerus & Whis")
stage = input('What stage would you like to complete(God of Destruction Wrath 511002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(7): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Destruction God Awakens 314001) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(4): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(In Search of the Super Saiyan God 314002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(7): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Vegeta Pride 314007) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(4): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def gg():
print("Lr Super Saiyan Gohan (Teen) & Super Saiyan Goten (Kid)")
stage = input('What stage would you like to complete(Go! Warriors of the New Generation 552001) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(10): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Blast! Family Kamehameha! 326006) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(20): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def vg():
print("Lr Super Saiyan Goku (Angel) & Super Saiyan Vegeta (Angel)")
stage = input('What stage would you like to complete(The Ultimate Pair of the Otherworld 536001) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(10): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Fusion Reborn! 326006) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(7): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def tg():
print("Lr Trunks (Kid) & Goten (Kid)")
stage = input('What stage would you like to complete(An Unexpectedly Powerful Man! 411002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Super Gotenks! 513002) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(One Powerful Super Fusion! 513003) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def gh():
print(" Lr Super Saiyan 2 Gohan")
stage = input('What stage would you like to complete(Waking Nightmare 502003) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def ggg():
print(" Lr Super Saiyan 3 Goku")
stage = input('What stage would you like to complete(Super Saiyan Goku 403002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Phantom Majin Resurrected! 535002) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(Mighty Warrior: 24-Hour Revival 528001) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(Ultimate Finishing Move 504002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(4): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def bd():
print("Lr Bardock")
stage = input('What stage would you like to complete(Saiyans from Planet Vegeta 347001) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(10): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( 534001 The Unknown Battle) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(347007 A Lone Warriors Last Battle) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( 602002 True Fear) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(602003 Summit of the Universe) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def gb():
print("Lr Goku Black (Super Saiyan Rosé) & Zamasu")
stage = input('What stage would you like to complete( 518002 Dark Nightmare) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(519001 Fusion in Blue) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( 520001 Rose-Tinted Plot) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(522001 A New Hope) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete( 523002 Last Judgment...Or Last Hope) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(524001 The Epic Battle Begins) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(3): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def gf():
print("Lr Goku & Frieza (Final Form) (Angel)")
stage = input('What stage would you like to complete( 544001 Ever-Evolving Power) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(Ever-Evolving Evil) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(538001 Kaboom! Ultra Instinct) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
"BREAK"
stage = input('What stage would you like to complete(533002 The True Golden Frieza) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def by():
print("Lr Legendary Super Saiyan Broly")
stage = input('What stage would you like to complete(501003 The Demon Returns) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def android():
print("Lr Android 17&18")
stage = input('What stage would you like to complete(501002 awakening beyond) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(502002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(503002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(504002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(505002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(506002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(507002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(508002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(510002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(511002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(512002) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(513002) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(514001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(515002) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(516001) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def Androids():
print("Lr Android 17&18/android#17")
stage = input('What stage would you like to complete(543001) : ')
difficulty = input('Enter the difficulty|(4:Super 2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(366008) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(503002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(366008) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
stage = input('What stage would you like to complete(415002) : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)

View file

@ -1,67 +1,38 @@
# Dragon Ball Dokkan Battle Bot # pysqlsimplecipher
Encrypt or decrypt formated sqlite db.
This is a Dokkan Battle bot that was first created by FlashChaser. I added a lot of new features and planning on adding more, therefore I've created my own repo. This project is a tool for sqlite database encryption or decryption like
There's no support from me - it is what it is. If you're gonna get banned - bad luck. [sqlcipher](http://sqlcipher.net/)
without install sqlcipher.
When encrypt or decrypt database, an algorithm called AES-256-CBC is used.
Each page shares the same key derived from password,
but owns a random initialization vector stored at the end of the page.
If you want to add a feature you've made feel free to submit a pull request. ## Decrypt
```bash
The bot is made quite straightforwardly: python decrypt.py encrypted.db password output.db
The packet module handles the encryption of packet data as well as the authorisation.
There shouldn't be too much reason to add to this file beyond fixing bugs.
The commands module is where the bulk of the code will be written for adding new features.
The dokkan module is where the command line/UI will be implemented, and will call the functions in the commands module.
The decryptor module uses: https://github.com/bssthu/pysqlsimplecipher
Although it's slow FlashChaser preferred this code over pysqlcipher simply because it's easier to package it for distribution without running into issues.
# Download
Just grab a copy of master repo and go on.
# To Do
Feel free to add feature requests. I'm gonna try and add as much as I can with my spare time. Bot already can do pretty much anything.
- Sell only Hercules
- **Hercule Punch - done**
- SBR,
- **RankUp - done**,
- Transfer but better,
- **BossRush - done**
- **EzaPLUS (up to 50lvl) - done**
# Installation
You might need to use sudo before every pip3 command.
```
pip3 install six
pip3 install pyinstaller
pip3 install colorama
pip3 install orator
pip3 install pycrypto - https://github.com/dlitz/pycrypto
OR pip3 install pycryptodome
pip3 install PySimpleGUI
pip3 install requests
``` ```
Then go to folder where your dokkan.py file is and: python3 dokkan.py ## Encrypt
```bash
Happy testing! python encrypt.py plain.db password output.db
# Pull Requests
Very happy to merge pull requests.
Until I can develop some tests be careful to make sure that all new commands that you implement accurately support JP translation.
e.g Check that you read from the global database, and if the data doesn't exist, read from the jp database.
```python
try:
config.Model.set_connection_resolver(config.db_glb)
config.Quests.find_or_fail(int(stage_id))
except:
config.Model.set_connection_resolver(config.db_jp)
config.Quests.find_or_fail(int(stage_id))
``` ```
Needs reserved space at the end of each page of the database file.
Otherwise, use sqlcipher to encrypt.
#### Encrypt with sqlcipher
- Open plain db
```bash
./sqlcipher plain.db
```
- Encrypt to enc.db
```sql
ATTACH DATABASE 'enc.db' as encrypted key 'testkey';
SELECT sqlcipher_export('encrypted');
DETACH DATABASE encrypted;
```
## License
GNU Lesser General Public License Version 3

400
aa.py Normal file
View file

@ -0,0 +1,400 @@
import commands
from colorama import init, Fore, Back, Style
# Coloroma autoreset
init(autoreset=True)
def ss():
print("TEQ Super Saiyan God SS Vegito")
stage = input('What stage would you like to complete(519002 Sublime Blue!) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def sss():
print("PHY Super Saiyan Broly")
stage = input('What stage would you like to complete(548001 The Greatest Saiyan Adversary) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def ssss():
print("STR Super Gogeta")
stage = input('What stage would you like to complete(505003 Fusion Reborn!) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(2): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def s():
print("AGL Super Saiyan Gogeta")
stage = input('What stage would you like to complete(549001 The Omnipotent Saiyan Warrior) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def a():
print("INT SSJ3 Bardock")
stage = input('What stage would you like to complete(534001 The Unknown Battle : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def aa():
print("STR SSJ4 Goku")
stage = input('What stage would you like to complete(525001 The Scarlet Hero! Super Saiyan 4! : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def aaa():
print("INT UI Goku")
stage = input('What stage would you like to complete(538001 Kaboom! Ultra Instinct : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def aaaa():
print("AGL SSJ4 Vegeta")
stage = input('What stage would you like to complete(526001 The Crimson Flash! Super Saiyan 4 : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def b():
print("PHY FP Frieza")
stage = input('What stage would you like to complete(507002 Full-Power Final Battle : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def bb():
print("TEQ Golden Frieza")
stage = input('What stage would you like to complete(516001 Emperors Obsession Area : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def bbb():
print("AGL SSJ3 Goku")
stage = input('What stage would you like to complete(504002 Ultimate Finishing Move Area : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(10): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def bbbb():
print("TEQ SSJ4 Gogeta")
stage = input('What stage would you like to complete(532001 The Ultimate Super Gogeta : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def c():
print("INT Super Gogeta")
stage = input('What stage would you like to complete(505003 Fusion Reborn!) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def cc():
print("SSJ3 Gotenks")
stage = input('What stage would you like to complete(513002 Super Gotenks) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
def ccc():
print("TEQ FP SSJ4 Goku")
stage = input('What stage would you like to complete(542001 Transcend Super Saiyan 4) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def cccc():
print("STR Jiren")
stage = input('What stage would you like to complete(540002 Confronting the Strongest of All Universes) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def d():
print("INT Golden Frieza")
stage = input('What stage would you like to complete(533002 The True Golden Frieza) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def dd():
print("PHY Android 17")
stage = input('What stage would you like to complete(543001 Superb Ranger) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def ddd():
print("TEQ Hit")
stage = input('What stage would you like to complete(547001 The Deadliest Assassin) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def dddd():
print("AGL SSBE Vegeta")
stage = input('What stage would you like to complete(524002 Battle for Honor and Pride) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def e():
print("PHY Kid Buu")
stage = input('What stage would you like to complete(524003 Regression to Evil) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def ee():
print("INT Kid Buu")
stage = input('What stage would you like to complete(524003 Regression to Evil) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def eee():
print("TEQ SSJ3 Goku (Angel)")
stage = input('What stage would you like to complete(528001 Mighty Warrior: 24-Hour Revival) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def eeee():
print("PHY Goku Black")
stage = input('What stage would you like to complete(518002 Dark Nightmare) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def f():
print("INT Goku Black")
stage = input('What stage would you like to complete(518003 Black Harbinger of Destruction) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def ff():
print("TEQ SSG Goku")
stage = input('What stage would you like to complete(549001 The Omnipotent Saiyan Warrior) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def ffx():
print("STR SSG Vegeta")
stage = input('What stage would you like to complete(549001 The Omnipotent Saiyan Warrior) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def fff():
print("AGL SSGSS Goku")
stage = input('What stage would you like to complete(514001 Ceaseless Combat) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def ffff():
print("STR Toppo")
stage = input('What stage would you like to complete(524002 Battle for Honor and Pride) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def g():
print("STR Rose Goku Black")
stage = input('What stage would you like to complete(520002 Searing Rose-Colored Fury) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def gg():
print("PHY SSGSS Vegito")
stage = input('What stage would you like to complete(519001 Fusion in Blue) : ')
difficulty = input('Enter the difficulty|(3:Super): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def ggg():
print("STR SSJ3 Goku")
stage = input('What stage would you like to complete(504002 Ultimate Finishing Move Area : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(10): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def gggx():
print("TEQ SSJ3 Broly")
stage = input('What stage would you like to complete(531001 All-Time Nastiest Evolution : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def gggg():
print("AGL Transgoku")
stage = input('What stage would you like to complete(544001 Ever-Evolving Power : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def h():
print("STR SSJ3 Vegeta")
stage = input('What stage would you like to complete(510002 The Most Powerful Blow : ')
difficulty = input('Enter the difficulty|(2:Z-Hard): ')
loop = input('Enter how many times to execute(10): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def hh():
print("PHY SSJ3 Gotenks")
stage = input('What stage would you like to complete(513003 One Powerful Super Fusion! : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def hhh():
print("AGL Turles")
stage = input('What stage would you like to complete(539001 Arrival of the Universe-Crusher! : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def hhhh():
print("STR Janemba")
stage = input('What stage would you like to complete(506003 Overwhelming Force of Evil! : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def j():
print("INT Janemba")
stage = input('What stage would you like to complete(506003 Overwhelming Force of Evil! : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(2): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def jj():
print("TEQ TransFrieza")
stage = input('What stage would you like to complete(545001 Ever-Evolving Evil : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(11): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)
#####################################################################################################################
def jjj():
print("AGL Broly")
stage = input('What stage would you like to complete(548001 The Greatest Saiyan Adversary) : ')
difficulty = input('Enter the difficulty|(4:Super2): ')
loop = input('Enter how many times to execute(5): ')
for i in range(int(loop)):
commands.complete_stage(stage, difficulty)

6409
commands.py Normal file

File diff suppressed because it is too large Load diff

121
config.py Normal file
View file

@ -0,0 +1,121 @@
from orator import DatabaseManager, Model
AdId = None
UniqueId = None
identifier = None
access_token = None
secret = None
client = 'japan'
platform = 'android'
deck = 1
allow_stamina_refill = True
### Database Config
jp_config = {'mysql': {'driver': 'sqlite', 'database': 'jp.db'}}
glb_config = {'mysql': {'driver': 'sqlite', 'database': 'glb.db'}}
db_glb = DatabaseManager(glb_config)
db_jp = DatabaseManager(jp_config)
Model.set_connection_resolver(db_glb)
class LeaderSkills(Model):
__table__ = 'leader_skills'
class LinkSkills(Model):
__table__ = 'link_skills'
class AreaTabs(Model):
__table__ = 'area_tabs'
class CardSpecials(Model):
__table__ = 'card_specials'
class Passives(Model):
__table__ = 'passive_skill_sets'
class Supers(Model):
__table__ = 'specials'
class ZBattles(Model):
__table__ = 'z_battle_stage_views'
class CardCategories(Model):
__table__ = 'card_categories'
class CardCardCategories(Model):
__table__ = 'card_card_categories'
class TreasureItems(Model):
__table__ = 'treasure_items'
class AwakeningItems(Model):
__table__ = 'awakening_items'
class SupportItems(Model):
__table__ = 'support_items'
class PotentialItems(Model):
__table__ = 'potential_items'
class SpecialItems(Model):
__table__ = 'special_items'
class TrainingItems(Model):
__table__ = 'training_items'
class Cards(Model):
__table__ = 'cards'
class Quests(Model):
__table__ = 'quests'
class Ranks(Model):
__table__ = 'rank_statuses'
class TrainingFields(Model):
__table__ = 'training_fields'
class Sugoroku(Model):
__table__ = 'sugoroku_maps'
class Area(Model):
__table__ = 'areas'
class Medal(Model):
__table__ = 'awakening_items'

33
decrypt.py Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : decrypt.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-03
# Description :
#
import sys
from pysqlsimplecipher import decryptor
def usage():
print('Usage: python decrypt.py encrypted.db password output.db')
def main():
# arguments
argv = sys.argv
if len(argv) != 4:
usage()
return
filename_in = argv[1]
password = bytearray(argv[2].encode('utf8'))
filename_out = argv[3]
decryptor.decrypt_file(filename_in, password, filename_out)
if __name__ == '__main__':
main()

32
decryptor.py Normal file
View file

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Module : decrypt.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-03
# Description :
#
import sys
from pysqlsimplecipher import decryptor
def usage():
print('Usage: python decrypt.py encrypted.db password output.db')
def main(p = '9bf9c6ed9d537c399a6c4513e92ab24717e1a488381e3338593abd923fc8a13b'):
password = bytearray(p.encode('utf8'))
if p == '9bf9c6ed9d537c399a6c4513e92ab24717e1a488381e3338593abd923fc8a13b':
filename_in = 'dataenc_glb.db'
filename_out = 'glb.db'
else:
filename_in = 'dataenc_jp.db'
filename_out = 'jp.db'
decryptor.decrypt_file(filename_in, password, filename_out)
if __name__ == '__main__':
main()

33
encrypt.py Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : encrypt.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-03
# Description :
#
import sys
from pysqlsimplecipher import encryptor
def usage():
print('Usage: python encrypt.py plain.db password output.db')
def main():
# arguments
argv = sys.argv
if len(argv) != 4:
usage()
return
filename_in = argv[1]
password = bytearray(argv[2].encode('utf8'))
filename_out = argv[3]
encryptor.encrypt_file(filename_in, password, filename_out)
if __name__ == '__main__':
main()

188
extra.py Normal file
View file

@ -0,0 +1,188 @@
import commands
from colorama import init, Fore, Back, Style
# Coloroma autoreset
init(autoreset=True)
def sbr_new():
print('---------------------------------')
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Universe Survival Sagaa Category Team')
commands.change_team()
commands.complete_stage('710021', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Super Saiyan 3" Category Team')
commands.change_team()
commands.complete_stage('710022', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Giant Form Category Team')
commands.change_team()
commands.complete_stage('710023', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Transformation Boost Category Team')
commands.change_team()
commands.complete_stage('710024', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Ginyu Force Category Team')
commands.change_team()
commands.complete_stage('710025', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Movie Bosses Category Team')
commands.change_team()
commands.complete_stage('710026', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Pure Saiyans Category Team')
commands.change_team()
commands.complete_stage('710027', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Future Saga Category Team')
commands.change_team()
commands.complete_stage('710028', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Full Power Category Team')
commands.change_team()
commands.complete_stage('710029', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Androids Category Team')
commands.change_team()
commands.complete_stage('710030', 5)
def sbr_next():
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Super Class Team')
commands.change_team()
commands.complete_stage('710011', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Extreme Class Team')
commands.change_team()
commands.complete_stage('710012', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Fusion Category Team')
commands.change_team()
commands.complete_stage('710013', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Shadow Dragons Category Team')
commands.change_team()
commands.complete_stage('710014', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Peppy Gals Category Team')
commands.change_team()
commands.complete_stage('710015', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Hybrid Saiyans Category Team')
commands.change_team()
commands.complete_stage('710016', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Resurrected Warriors Category Team')
commands.change_team()
commands.complete_stage('710017', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Realm of Gods Category Team')
commands.change_team()
commands.complete_stage('710018', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Majin Buu Saga Category Team')
commands.change_team()
commands.complete_stage('710019', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Potara Category Team')
commands.change_team()
commands.complete_stage('710020', 5)
print('---------------------------------')
def complete_sbr():
print('------------------------------------')
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Super TEQ Team')
commands.change_team()
commands.complete_stage('710001', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Extreme TEQ Team')
commands.change_team()
commands.complete_stage('710002', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Super INT Team')
commands.change_team()
commands.complete_stage('710003', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Extreme INT Team')
commands.change_team()
commands.complete_stage('710004', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Super PHY Team')
commands.complete_stage('710005', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Extreme PHY Team')
commands.change_team()
commands.complete_stage('710006', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Super AGL Team')
commands.change_team()
commands.complete_stage('710007', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Extreme AGL Team')
commands.change_team()
commands.complete_stage('710008', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Super STR Team')
commands.change_team()
commands.complete_stage('710009', 5)
print(Fore.YELLOW + Style.BRIGHT + 'Clear with Extreme STR Team')
commands.change_team()
commands.complete_stage('710010', 5)
print('---------------------------------')

2
help.txt Normal file
View file

@ -0,0 +1,2 @@
1570518409
1569982484

139
packet.py Normal file
View file

@ -0,0 +1,139 @@
### packet.py contains functions critical to sending requests to the server
import base64
import binascii
import config
from Crypto.Cipher import AES
import hashlib
import hmac
import json
import os
import time
import uuid
# Padding for the input string --not
# related to encryption itself.
BLOCK_SIZE = 16 # Bytes
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * chr(BLOCK_SIZE
- len(s) % BLOCK_SIZE)
unpad = lambda s: s[:-ord(s[len(s) - 1:])]
####################################################################
def guid():
# Generates UniqueID & AdIDcompatible with Bandais servers
# Returns dict
UUID = str(uuid.uuid4())
UniqueId = str(uuid.uuid4()) + ':' + UUID[0:8]
return dict(AdId=str(uuid.uuid4()), UniqueId=UniqueId)
####################################################################
def mac(method,action):
# Creates Mac Authentication header string used when sending requests
# returns string
ts = str(int(round(time.time(), 0)))
nonce = ts + ':' + config.AdId
if config.client == 'global':
value = ts + '\n' + nonce + '\n' + method + '\n' + action + '\n' \
+ 'ishin-global.aktsk.com' + '\n' + '3001' + '''
'''
else:
value = ts + '\n' + nonce + '\n' + method + '\n' + action + '\n' \
+ 'ishin-production.aktsk.jp' + '\n' + '3001' + '''
'''
hmac_hex_bin = hmac.new(config.secret.encode('utf-8'), value.encode('utf-8'
), hashlib.sha256).digest()
mac = base64.b64encode(hmac_hex_bin).decode()
final = 'MAC ' + 'id=' + '"' + config.access_token + '"' + ' nonce=' + '"' \
+ nonce + '"' + ' ts=' + '"' + ts + '"' + ' mac=' + '"' + mac \
+ '"'
return final
####################################################################
# ================================================================
# get_key_and_iv
# ================================================================
def get_key_and_iv(
password,
salt,
klen=32,
ilen=16,
msgdgst='md5',
):
'''
Derive the key and the IV from the given password and salt.
This is a niftier implementation than my direct transliteration of
the C++ code although I modified to support different digests.
CITATION: http://stackoverflow.com/questions/13907841/implement-openssl-aes-encryption-in-python
@param password The password to use as the seed.
@param salt The salt.
@param klen The key length.
@param ilen The initialization vector length.
@param msgdgst The message digest algorithm to use.
'''
# equivalent to:
# from hashlib import <mdi> as mdf
# from hashlib import md5 as mdf
# from hashlib import sha512 as mdf
mdf = getattr(__import__('hashlib', fromlist=[msgdgst]), msgdgst)
password = password.encode('ascii', 'ignore') # convert to ASCII
try:
maxlen = klen + ilen
keyiv = mdf(password + salt).digest()
tmp = [keyiv]
while len(tmp) < maxlen:
tmp.append(mdf(tmp[-1] + password + salt).digest())
keyiv += tmp[-1] # append the last byte
key = keyiv[:klen]
iv = keyiv[klen:klen + ilen]
return (key, iv)
except UnicodeDecodeError:
return (None, None)
####################################################################
def encrypt_sign(data):
data = pad(data)
key1 = str.encode(data)
password = \
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzJ9JaHioVi6rr0TAfr6j'
salt = os.urandom(8)
(key, iv) = get_key_and_iv(password, salt, klen=32, ilen=16,
msgdgst='md5')
cipher = AES.new(key, AES.MODE_CBC, iv)
a = cipher.encrypt(key1)
a = salt + a
return base64.b64encode(a).decode()
####################################################################
def decrypt_sign(sign):
buffer = base64.b64decode(sign)
buffer_encoded = base64.b64encode(buffer)
password = \
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzJ9JaHioVi6rr0TAfr6j'
salt = buffer[0:8]
(key, iv) = get_key_and_iv(password, salt, klen=32, ilen=16,
msgdgst='md5')
data = buffer[8:len(buffer)]
cipher = AES.new(key, AES.MODE_CBC, iv)
a = unpad(cipher.decrypt(data)).decode('utf8')
return json.loads(a)
####################################################################

View file

View file

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : config.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-03
# Description :
#
salt_mask = 0x3a
key_sz = 32
key_iter = 64000
hmac_key_sz = 32
hmac_key_iter = 2
page_sz = 1024
iv_sz = 16
reserve_sz = 48
hmac_sz = 20

View file

@ -0,0 +1,143 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : decryptor.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-03
# Description :
#
from pysqlsimplecipher import config
from pysqlsimplecipher import util
def decrypt_file(filename_in, password, filename_out):
if not isinstance(filename_in, str):
raise RuntimeError('filename_in must be a str.')
if not isinstance(password, bytearray):
raise RuntimeError('password must be a bytearray.')
if not isinstance(filename_out, str):
raise RuntimeError('filename_out must be a str.')
# read
with open(filename_in, 'rb') as fp:
raw = fp.read()
# decrypt
dec = decrypt_default(raw, password)
# write
with open(filename_out, 'wb') as fp:
fp.write(dec)
def decrypt_default(raw, password):
# configs
salt_mask = config.salt_mask
key_sz = config.key_sz
key_iter = config.key_iter
hmac_key_sz = config.hmac_key_sz
hmac_key_iter = config.hmac_key_iter
page_sz = config.page_sz
iv_sz = config.iv_sz
reserve_sz = config.reserve_sz
hmac_sz = config.hmac_sz
return decrypt(raw, password, salt_mask, key_sz, key_iter, hmac_key_sz, hmac_key_iter, page_sz, iv_sz, reserve_sz, hmac_sz)
def decrypt(raw, password, salt_mask, key_sz, key_iter, hmac_key_sz, hmac_key_iter, page_sz, iv_sz, reserve_sz, hmac_sz):
dec = b'SQLite format 3\0'
# derive key
salt_sz = 16
salt = raw[:salt_sz]
key, hmac_key = util.key_derive(salt, password, salt_mask, key_sz, key_iter, hmac_key_sz, hmac_key_iter)
# decrypt file header, try with default page size
page_sz, reserve_sz = decrypt_page_header(raw, key, salt_sz, page_sz, iv_sz, reserve_sz)
if page_sz < 0 or reserve_sz < 0:
raise RuntimeError('failed to decide page size or reserve size.')
# decrypt pages
for i in range(0, int(len(raw) / 1024)):
page = util.get_page(raw, page_sz, i + 1)
if i == 0:
# skip salt
page = page[salt_sz:]
page_content = page[:-reserve_sz]
reserve = page[-reserve_sz:]
iv = reserve[:iv_sz]
# check hmac
hmac_old = reserve[iv_sz:iv_sz+hmac_sz]
hmac_new = util.generate_hmac(hmac_key, page_content + iv, i + 1)
if not hmac_old == hmac_new:
raise RuntimeError('hmac check failed in page %d.' % (i+1))
# decrypt content
page_dec = util.decrypt(page_content, key, iv)
dec += page_dec + util.random_bytes(reserve_sz)
return dec
def decrypt_page_header(raw, key, salt_sz, page_sz, iv_sz, reserve_sz):
"""Try to decrypt first page with default config.
If default page size fail, change page size.
When succeed, return page_sz, reserve_sz.
If fail, return -1, -1.
"""
if not util.is_valid_page_size(page_sz):
page_sz = 512
new_reserve_sz = try_get_reserve_size_for_specified_page_size(raw, key, salt_sz, page_sz, iv_sz, reserve_sz)
if new_reserve_sz > 0: # default page_sz is ok
return page_sz, new_reserve_sz
page_sz = 512
while page_sz <= 65536:
new_reserve_sz = try_get_reserve_size_for_specified_page_size(raw, key, salt_sz, page_sz, iv_sz, reserve_sz)
if new_reserve_sz > 0:
return page_sz, new_reserve_sz
page_sz <<= 1
return -1, -1 # fail
def try_get_reserve_size_for_specified_page_size(raw, key, salt_sz, page_sz, iv_sz, reserve_sz):
"""Try to decrypt first page with specified page size.
If default reserve size fail, change reserve size.
When succeed, return reserve size.
If always fail, return -1.
"""
first_page_content = util.get_page(raw, page_sz, 1)[salt_sz:]
if reserve_sz >= iv_sz:
first_page_dec = decrypt_by_reserve_size(first_page_content, key, iv_sz, reserve_sz)
# default reserve_sz is ok
if util.is_valid_decrypted_header(first_page_dec) \
and page_sz == util.get_page_size_from_database_header(raw[:salt_sz] + first_page_dec) \
and reserve_sz == util.get_reserved_size_from_database_header(raw[:salt_sz] + first_page_dec):
return reserve_sz
# try every possible reserve size.
# the usable size of a page is at least 480.
for reserve_sz in range(iv_sz, page_sz - 480):
first_page_dec = decrypt_by_reserve_size(first_page_content, key, iv_sz, reserve_sz)
if util.is_valid_decrypted_header(first_page_dec) \
and page_sz == util.get_page_size_from_database_header(raw[:salt_sz] + first_page_dec) \
and reserve_sz == util.get_reserved_size_from_database_header(raw[:salt_sz] + first_page_dec):
return reserve_sz
return -1 # fail
def decrypt_by_reserve_size(first_page_without_salt, key, iv_sz, reserve_sz):
"""Decrypt page content using specified reserve size"""
reserve = first_page_without_salt[-reserve_sz:]
iv = reserve[:iv_sz]
return util.decrypt(first_page_without_salt, key, iv)

View file

@ -0,0 +1,95 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : encryptor.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-03
# Description :
#
import hashlib
import hmac
from pysqlsimplecipher import config
from pysqlsimplecipher import util
def check_database_header(header):
if not util.is_valid_database_header(header):
raise RuntimeError('invalid database header.')
page_sz = util.get_page_size_from_database_header(header)
if not util.is_valid_page_size(page_sz):
raise RuntimeError('invalid page size %d.' % page_sz)
reserve_sz = util.get_reserved_size_from_database_header(header)
if reserve_sz == 0:
raise RuntimeError('needs reserved space at the end of each page.')
return page_sz, reserve_sz
def encrypt_file(filename_in, password, filename_out):
if not isinstance(filename_in, str):
raise RuntimeError('filename_in must be a str.')
if not isinstance(password, bytearray):
raise RuntimeError('password must be a bytearray.')
if not isinstance(filename_out, str):
raise RuntimeError('filename_out must be a str.')
# read
with open(filename_in, 'rb') as fp:
raw = fp.read()
# check header
page_sz, reserve_sz = check_database_header(raw[:100])
# encrypt
dec = encrypt_default(raw, password, page_sz, reserve_sz)
# write
with open(filename_out, 'wb') as fp:
fp.write(dec)
def encrypt_default(raw, password, page_sz, reserve_sz):
# configs
salt_mask = config.salt_mask
key_sz = config.key_sz
key_iter = config.key_iter
hmac_key_sz = config.hmac_key_sz
hmac_key_iter = config.hmac_key_iter
iv_sz = config.iv_sz
hmac_sz = config.hmac_sz
if reserve_sz < iv_sz + hmac_sz:
raise RuntimeError('reserved space at the end of each page is %d, needs %d.' % (reserve_sz, iv_sz + hmac_sz))
return encrypt(raw, password, salt_mask, key_sz, key_iter, hmac_key_sz, hmac_key_iter, page_sz, iv_sz, reserve_sz, hmac_sz)
def encrypt(raw, password, salt_mask, key_sz, key_iter, hmac_key_sz, hmac_key_iter, page_sz, iv_sz, reserve_sz, hmac_sz):
salt_sz = 16
salt = util.random_bytes(salt_sz)
enc = salt
# derive key
key, hmac_key = util.key_derive(salt, password, salt_mask, key_sz, key_iter, hmac_key_sz, hmac_key_iter)
# encrypt pages
for i in range(0, int(len(raw) / 1024)):
page = util.get_page(raw, page_sz, i + 1)
if i == 0:
# skip header string
page = page[salt_sz:]
page_content = page[:-reserve_sz]
iv = util.random_bytes(iv_sz)
# encrypt content
page_enc = util.encrypt(page_content, key, iv)
# generate hmac
hmac_new = util.generate_hmac(hmac_key, page_enc + iv, i + 1)
enc += page_enc + iv + hmac_new
if reserve_sz > iv_sz + hmac_sz:
enc += util.random_bytes(reserve_sz - iv_sz - hmac_sz)
return enc

88
pysqlsimplecipher/util.py Normal file
View file

@ -0,0 +1,88 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : util.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-03
# Description :
#
import os
import math
import hashlib
import hmac
import struct
from Crypto.Cipher import AES
def encrypt(raw, key, iv):
cipher = AES.new(key, AES.MODE_CBC, iv)
return cipher.encrypt(raw)
def decrypt(raw, key, iv):
cipher = AES.new(key, AES.MODE_CBC, iv)
return cipher.decrypt(raw)
def is_valid_database_header(header):
return header[:16] == b'SQLite format 3\0' and is_valid_decrypted_header(header[16:])
def is_valid_decrypted_header(header):
# skip first 16 bytes
if type(header) is str: # python2
header = [ord(x) for x in header]
return header[21-16] == 64 and header[22-16] == 32 and header[23-16] == 32
def get_page_size_from_database_header(header):
if type(header) is str: # python2
page_sz = 256 * ord(header[16]) + ord(header[17])
else:
page_sz = int.from_bytes(header[16:18], 'big')
if page_sz == 1: # since SQLite version 3.7.1
page_sz = 65536
return page_sz
def get_reserved_size_from_database_header(header):
if type(header) is str: # python2
return ord(header[20])
else:
return int(header[20])
def is_valid_page_size(page_sz):
# page_sz must be power of 2, and greater than 512
return page_sz >= 512 and page_sz == 2 ** int(math.log(page_sz, 2))
def get_page(raw, page_sz, page_no):
return raw[page_sz*(page_no-1):page_sz*page_no]
def random_bytes(n):
return os.urandom(n)
def key_derive(salt, password, salt_mask, key_sz, key_iter, hmac_key_sz, hmac_key_iter):
"""Derive an encryption key for page encryption/decryption, an key for hmac generation"""
key = hashlib.pbkdf2_hmac('sha1', password, salt, key_iter, key_sz)
try:
hmac_salt = bytearray([x ^ salt_mask for x in salt])
hmac_key = hashlib.pbkdf2_hmac('sha1', key, hmac_salt, hmac_key_iter, hmac_key_sz)
except TypeError: # python2
hmac_salt = b''
for x in salt:
hmac_salt += chr(ord(x) ^ salt_mask)
hmac_key = hashlib.pbkdf2_hmac('sha1', str(key), hmac_salt, hmac_key_iter, hmac_key_sz)
return key, hmac_key
def generate_hmac(hmac_key, content, page_no):
hmac_obj = hmac.new(hmac_key, content, hashlib.sha1)
hmac_obj.update(struct.pack('<i', page_no))
return hmac_obj.digest()

51
setup.py Executable file → Normal file
View file

@ -1,37 +1,22 @@
from distutils.core import setup #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Module : setup.py
# Author : bssthu
# Project : pysqlsimplecipher
# Creation date : 2016-06-05
# Description :
#
def get_version(relpath): from setuptools import setup
"""read version info from file without importing it"""
from os.path import dirname, join
for line in open(join(dirname(__file__), relpath)):
if '__version__' in line:
if '"' in line:
# __version__ = "0.9"
return line.split('"')[1]
elif "'" in line:
return line.split("'")[1]
setup(
name='wget',
version=get_version('wget.py'),
author='anatoly techtonik <techtonik@gmail.com>',
url='http://bitbucket.org/techtonik/python-wget/',
description="pure python download utility", setup(name='pysqlsimplecipher',
license="Public Domain", version='0.2',
classifiers=[ url='https://github.com/bssthu/pysqlsimplecipher',
'Environment :: Console', license='GNU Lesser General Public License Version 3',
'License :: Public Domain', author='bssthu',
'Operating System :: OS Independent', description='A tool for sqlite database encryption or decryption like sqlcipher without install sqlcipher',
'Programming Language :: Python :: 2', install_requires=['pycrypto'],
'Programming Language :: Python :: 3', packages=['pysqlsimplecipher']
'Topic :: Software Development :: Libraries :: Python Modules', )
'Topic :: System :: Networking',
'Topic :: Utilities',
],
py_modules=['wget'],
long_description=open('README.txt').read(),
)