Pyinstaller 암호 화 패키지 응용 예시 코드
4054 단어 Pyinstaller암호 화포장 하 다.
공식 문서:pyinstaller
코드 혼동
코드 혼동https://pyob.oxyry.com/을 사용 하여 코드 혼동(사용 가능 한 오프라인 혼동 라 이브 러 리 를 찾 을 수 없습니다)
실제 api 캡 처 후
def obfuscation(py_file, save_path):
print(" :", py_file)
with open(py_file, "r", encoding="utf-8") as f:
py_content = f.read()
print(" ...")
url = "https://pyob.oxyry.com/obfuscate"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://pyob.oxyry.com/",
"content-type": "application/json",
"cookie": "_ga=GA1.2.1306886713.1588752647; _gid=GA1.2.46944674.1588899118"
}
data = json.dumps({
"append_source": "false",
"preserve": "",
"remove_docstrings": "true",
"rename_default_parameters": "false",
"rename_nondefault_parameters": "true",
"source": py_content
})
result = json.loads(requests.post(url, data=data, headers=headers).text)["dest"]
result = "# cython: language_level=3
" + result
print(" ...")
with open(save_path, "w", encoding="utf-8") as f:
f.write(result)
print(" {}
".format(save_path))
if __name__ == '__main__':
obfuscation("my.py", "../ /my.py")
obfuscation("approach.py", "../ /approach.py")
컴 파일 pydbuild_pyd.py
from distutils.core import setup
from Cython.Build import cythonize
setup(
name='any words.....',
ext_modules=cythonize(["my.py","approach.py" ])
)
실행 패키지
import json
import os
# pyd
import uuid
import requests
def clearPyd():
for file in os.listdir():
if ".pyd" in file:
print(" .pyd:", file)
os.remove(file)
print("***********************************************************************")
# pyd
def buildPyd():
os.system("python build_pyd.py build_ext --inplace")
# pyd
def renamePyd():
print("***********************************************************************")
for file in os.listdir():
if ".pyd" in file:
print(" pyd:", file)
os.rename(file, file[:file.find(".")] + ".pyd")
for file in os.listdir():
if ".c" in file:
print(" .c :", file)
os.remove(file)
print("***********************************************************************")
#
def pyinstaller(key, ico):
os.system("pyinstaller -F --key {} -i {} main.py".format(key, ico))
# bulid spec
def clearBuildAndSpec():
import shutil
shutil.rmtree('build')
print(" bulid ")
os.remove("main.spec")
print(" spec ")
if __name__ == '__main__':
clearPyd() # pyd
buildPyd() # pyd
renamePyd() # pyd
pyinstaller(uuid.uuid4()[0:16], "1.ico") #
clearPyd() # pyd
clearBuildAndSpec() # bulid spec
총결산Pyinstaller 암호 화 패키지 애플 리 케 이 션 에 관 한 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 Pyinstaller 암호 화 패키지 내용 은 예전 의 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 많은 응원 부탁드립니다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Pyinstaller 패키지 의 고급 용법 을 정리 합 니 다.성공 적 으로 포 장 된 .py실행 가능 한 파일 에 대해 서 는 아이콘 이 기본 이 고 시작 할 때 명령 행 창 이 표 시 됩 니 다.그렇다면 아이콘 을 어떻게 정의 하거나 명령 행 창 을 지 울 수 있 습 니까?...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.