moved config from .bat to .py
This commit is contained in:
parent
358657c3d8
commit
1a6e96ee47
62
dmmBypass.py
62
dmmBypass.py
|
@ -1,12 +1,40 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import wmi
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import argparse
|
||||||
import requests
|
import requests
|
||||||
import dmmUpdater
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from uuid import getnode
|
from uuid import getnode
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='DMM bypass script')
|
||||||
|
parser.add_argument('-g', '--game', type=str, help="DMM code name of the game", default="kfp2g")
|
||||||
|
parser.add_argument('-u', '--update', help="Check for game update before launching", action='store_true')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
config_name = args.game + '.cfg'
|
||||||
|
|
||||||
|
if not os.path.exists(config_name):
|
||||||
|
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
|
||||||
|
config = {
|
||||||
|
"game_id" : args.game,
|
||||||
|
"file_path" : input('Enter full file path to KF3 .exe: ').strip('\"'),
|
||||||
|
"dmm_login" : input('DMM Login (email): '),
|
||||||
|
"dmm_password" : input('DMM Password: '),
|
||||||
|
"use_proxy" : input('Your login tokens will be sent through my VPN machine.\nIs that okay? (yes/no): ').lower() == "yes"
|
||||||
|
}
|
||||||
|
with open(config_name, 'wt', encoding="utf-8") as f:
|
||||||
|
json.dump(config, f, indent=1, ensure_ascii=False)
|
||||||
|
else:
|
||||||
|
with open(config_name, "rt", encoding="utf-8") as f:
|
||||||
|
config = json.load(f)
|
||||||
|
print(f'Loaded settings from {config_name}')
|
||||||
|
|
||||||
|
config["update_game"] = args.update
|
||||||
|
|
||||||
|
import wmi
|
||||||
|
import dmmUpdater
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from pypasser import reCaptchaV3
|
from pypasser import reCaptchaV3
|
||||||
|
|
||||||
|
@ -88,24 +116,13 @@ def retrieve_launch_params(game_id, mac_addr, hdd_serial, motherboard, login_sec
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Failed to retrieve launch arguments:", e)
|
print("Failed to retrieve launch arguments:", e)
|
||||||
|
|
||||||
def main(args):
|
def main(config):
|
||||||
if len(args) != 7:
|
game_id = config["game_id"]
|
||||||
print("Usage:",
|
exe_location = config["file_path"]
|
||||||
"\tpython dmmBypass.py game_id game_path email password update_game use_proxy",
|
login = urllib.parse.quote_plus(config["dmm_login"])
|
||||||
"\t- game_id: DMM code name of the game",
|
password = urllib.parse.quote_plus(config["dmm_password"])
|
||||||
"\t- game_path: full path to the game .exe. Wrap in \" if there are spaces in the path",
|
update_game = config["update_game"] if "update_game" in config else False
|
||||||
"\t- email, password: dmm credentials",
|
use_proxy = config["use_proxy"] if "use_proxy" in config else False
|
||||||
"\t- update_game: \"true\" to check for game update before launching",
|
|
||||||
"\t- use_proxy: \"true\" to send required request through Katboi VPN. Otherwise use your own VPN",
|
|
||||||
"\texample: python dmmBypass.py kfp2g \"D:\Games\KFP2G\けもフレ3.exe\" kat@email.com abc123 true", sep="\n")
|
|
||||||
return
|
|
||||||
|
|
||||||
game_id = args[1]
|
|
||||||
exe_location = args[2]
|
|
||||||
login = urllib.parse.quote_plus(args[3])
|
|
||||||
password = urllib.parse.quote_plus(args[4])
|
|
||||||
update_game = args[5].lower() == "true"
|
|
||||||
use_proxy = args[6].lower() == "true"
|
|
||||||
mac_addr = get_mac()
|
mac_addr = get_mac()
|
||||||
hdd_serial = get_hash('')
|
hdd_serial = get_hash('')
|
||||||
motherboard = get_hash(get_motherboard())
|
motherboard = get_hash(get_motherboard())
|
||||||
|
@ -139,7 +156,6 @@ def main(args):
|
||||||
args = [exe_location] + execute_args.split()
|
args = [exe_location] + execute_args.split()
|
||||||
print(args)
|
print(args)
|
||||||
subprocess.Popen(args, start_new_session=True)
|
subprocess.Popen(args, start_new_session=True)
|
||||||
input("Done. Press enter to exit")
|
input("Done. Press enter to exit (this will close the game)")
|
||||||
|
|
||||||
args = sys.argv
|
main(config)
|
||||||
main(args)
|
|
34
run_KF3.bat
34
run_KF3.bat
|
@ -1,35 +1,3 @@
|
||||||
@echo off
|
@echo off
|
||||||
chcp 65001
|
python dmmBypass.py -g kfp2g
|
||||||
setlocal enabledelayedexpansion
|
|
||||||
|
|
||||||
set file_name="kfp2g.cfg"
|
|
||||||
|
|
||||||
IF NOT EXIST %file_name% (
|
|
||||||
set /p null="Make sure python is installed. In next step, required packages will be installed. Press Enter to continue"
|
|
||||||
pip install -r requirements.txt
|
|
||||||
set /p file_path=Enter full file path to KF3 .exe:
|
|
||||||
set /p dmm_login=DMM Login:
|
|
||||||
set /p dmm_password=DMM Password:
|
|
||||||
set /p confirm="Your login tokens will be sent through Katboi's VPN machine, is that ok? Personal VPN is required if not (yes/no):"
|
|
||||||
if /i "!confirm!"=="yes" (
|
|
||||||
set use_proxy=true
|
|
||||||
) else (
|
|
||||||
set use_proxy=false
|
|
||||||
)
|
|
||||||
echo !file_path!> %file_name%
|
|
||||||
echo !dmm_login!>> %file_name%
|
|
||||||
echo !dmm_password!>> %file_name%
|
|
||||||
echo !use_proxy!>> %file_name%
|
|
||||||
) ELSE (
|
|
||||||
< %file_name% (
|
|
||||||
set /p file_path=
|
|
||||||
set /p dmm_login=
|
|
||||||
set /p dmm_password=
|
|
||||||
set /p use_proxy=
|
|
||||||
)
|
|
||||||
echo Loaded settings from %file_name%
|
|
||||||
)
|
|
||||||
|
|
||||||
python dmmBypass.py kfp2g %file_path% %dmm_login% %dmm_password% false %use_proxy%
|
|
||||||
|
|
||||||
pause
|
pause
|
|
@ -1,35 +1,3 @@
|
||||||
@echo off
|
@echo off
|
||||||
chcp 65001
|
python dmmBypass.py -g kfp2g -u
|
||||||
setlocal enabledelayedexpansion
|
|
||||||
|
|
||||||
set file_name="kfp2g.cfg"
|
|
||||||
|
|
||||||
IF NOT EXIST %file_name% (
|
|
||||||
set /p null="Make sure python is installed. In next step, required packages will be installed. Press Enter to continue"
|
|
||||||
pip install -r requirements.txt
|
|
||||||
set /p file_path=Enter full file path to KF3 .exe:
|
|
||||||
set /p dmm_login=DMM Login:
|
|
||||||
set /p dmm_password=DMM Password:
|
|
||||||
set /p confirm="Your login tokens will be sent through Katboi's VPN machine, is that ok? Personal VPN is required if not (yes/no):"
|
|
||||||
if /i "!confirm!"=="yes" (
|
|
||||||
set use_proxy=true
|
|
||||||
) else (
|
|
||||||
set use_proxy=false
|
|
||||||
)
|
|
||||||
echo !file_path!> %file_name%
|
|
||||||
echo !dmm_login!>> %file_name%
|
|
||||||
echo !dmm_password!>> %file_name%
|
|
||||||
echo !use_proxy!>> %file_name%
|
|
||||||
) ELSE (
|
|
||||||
< %file_name% (
|
|
||||||
set /p file_path=
|
|
||||||
set /p dmm_login=
|
|
||||||
set /p dmm_password=
|
|
||||||
set /p use_proxy=
|
|
||||||
)
|
|
||||||
echo Loaded settings from %file_name%
|
|
||||||
)
|
|
||||||
|
|
||||||
python dmmBypass.py kfp2g %file_path% %dmm_login% %dmm_password% true %use_proxy%
|
|
||||||
|
|
||||||
pause
|
pause
|
Loading…
Reference in New Issue