吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1969|回复: 7
收起左侧

[求助] python转成GUI的InputBox,再编译成EXE

[复制链接]
冥界3大法王 发表于 2021-2-26 18:27
本帖最后由 冥界3大法王 于 2021-2-26 18:29 编辑

[Asm] 纯文本查看 复制代码
#[url=https://bbs.pediy.com/]https://bbs.pediy.com/[/url]
#!/usr/bin/env python
import os, sys, struct, time, binascii, hashlib

RC4_Key2= 'Eg\xa2\x99_\x83\xf1\x10'

def rc4(Key, inData):
    Buf = ""
    S = range(256)
    K = (map(lambda x:ord(x), Key) * (256 / len(Key) + 1))[:256]
    j = 0
    for i in range(256):
        j = (S[i] + K[i] + j) % 256
        S[i], S[j] = S[j], S[i]
    i, j = 0, 0
    for x in range(len(inData)):
        i = (i + 1) % 256
        j = (j + S[i]) % 256
        S[i], S[j] = S[j], S[i]
        Buf += chr(S[(S[j] + S[i]) % 256] ^ ord(inData[x]))
    return Buf

def Long2Int(longdata):
    lo = longdata & 0xFFFFFFFF
    hi = (longdata >> 32) & 0x7FFFFFFF
    return hi, lo
    
def KeygenSN(LicenseSerial, MachineID):
    mhi, mlo = Long2Int(MachineID)
    lhi, llo = Long2Int(LicenseSerial)
    hi_Key = (mhi - lhi + 0x55667788) & 0x7FFFFFFF
    lo_Key = (mlo + llo + 0x11223344) & 0xFFFFFFFF
    Z0, = struct.unpack('<Q', struct.pack('<LL', lo_Key, hi_Key))
    Z1 = int(time.time()) ^ 0x56739ACD
    s = sum(map(lambda x:int(x, 16), "%x" % Z1)) % 10
    return "%dZ%d%d" % (Z0, Z1, s)

def ParsePost(buf):
    Info = struct.unpack('<3L2Q4LQ3L', buf[:0x40])
    flag, CRC, UserSerial, LicenseSerial, MachineID, build_type, \
          Ver_Major, Ver_Minor, Ver_Buildid, Ver_Timestamp, \
          TimeOffset, Kclass, Random2 = Info
    SysInfoData = buf[0x40:]
    assert CRC == binascii.crc32(buf[8:]) & 0xFFFFFFFF
    return Info, SysInfoData

def DecodeRc4Str(buf):
    buf = buf.decode('hex')
    i, s = ParsePost(rc4(buf[:8] + RC4_Key2, buf[8:]))
    return i, s
    
def GetJebLicenseKey():
    licdata = raw_input("Input License Data:\n") # "粘来注册码!"                     =========>就这行
    if licdata:
        i, MachineID = DecodeRc4Str(licdata)
        SN = KeygenSN(i[3], i[4])
        print "JEB License Key:", SN
        return SN

GetJebLicenseKey()
raw_input("Enter to Exit...")


用的是py2exe, 要求:python 2.7 x64
转成EXE成功了,但是命令行的回显功能没有了。。。
生成的注册码看不到了。。。
调用一个GUI的,然后转成EXE的就成
不然下次系统一重装JEB注册码生成,又得折腾一通
在线的不好用,抽风。。。

免费评分

参与人数 2吾爱币 +3 热心值 +2 收起 理由
周二两 + 1 + 1 我很赞同!
我是不会改名的 + 2 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

ccwuax 发表于 2021-2-26 18:40
这个是做什么的?看不明白呀
 楼主| 冥界3大法王 发表于 2021-2-26 18:44
ReLoading 发表于 2021-2-26 19:44
zyjsuper 发表于 2021-2-26 20:58
本帖最后由 zyjsuper 于 2021-2-26 21:06 编辑

建议考虑PyQT实现,代码是用python3编写,GUI界面可供参考,代码部分还是您自己完善。
安装依赖pip install pyqt5 pyqt5-tools pyperclip
使用pyinstaller --noupx -Fw gui.py -i gui.ico打包成exe即可
[Python] 纯文本查看 复制代码
[mw_shl_code=python,true]# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'form.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.

import os, sys, struct, time, binascii, hashlib
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt, QRectF
from PyQt5.QtGui import QCursor, QPainterPath, QPainter, QBrush, QColor
from PyQt5.QtWidgets import QWidget
import pyperclip



class RoundShadow(QWidget):
    """圆角边框类"""

    def __init__(self, parent=None):
        super(RoundShadow, self).__init__(parent)
        self.border_width = 8
        # 设置 窗口无边框和背景透明 *必须
        # self.setAttribute(Qt.WA_TranslucentBackground)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint|QtCore.Qt.WindowStaysOnTopHint)


    def paintEvent(self, event):
        # 阴影
        path = QPainterPath()
        path.setFillRule(Qt.WindingFill)

        pat = QPainter(self)
        pat.setRenderHint(pat.Antialiasing)
        pat.fillPath(path, QBrush(Qt.white))

        color = QColor(192, 192, 192, 50)

        for i in range(10):
            i_path = QPainterPath()
            i_path.setFillRule(Qt.WindingFill)
            ref = QRectF(10 - i, 10 - i, self.width() - (10 - i) * 2, self.height() - (10 - i) * 2)
            # i_path.addRect(ref)
            i_path.addRoundedRect(ref, self.border_width, self.border_width)
            color.setAlpha(int(150 - i ** 0.5 * 50))
            pat.setPen(color)
            pat.drawPath(i_path)

        # 圆角
        pat2 = QPainter(self)
        pat2.setRenderHint(pat2.Antialiasing)  # 抗锯齿
        pat2.setBrush(Qt.cyan)
        pat2.setPen(Qt.transparent)

        rect = self.rect()
        rect.setLeft(-1)
        rect.setTop(-1)
        rect.setWidth(rect.width() - 1 )
        rect.setHeight(rect.height() -1 )
        pat2.drawRoundedRect(rect, 8, 8)

class Ui_keygen(RoundShadow,QWidget):
    def __init__(self):
        super(Ui_keygen, self).__init__()
        self.setupUi()

    def setupUi(self):
        self.setObjectName("keygen")
        self.setFixedSize(364, 196)
        self.label = QtWidgets.QLabel(self)
        self.label.setGeometry(QtCore.QRect(110, 0, 211, 31))
        font = QtGui.QFont()
        font.setFamily("微软雅黑")
        font.setPointSize(16)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.frame = QtWidgets.QFrame(self)
        self.frame.setGeometry(QtCore.QRect(10, 40, 261, 71))
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.frame.setObjectName("frame")
        self.textEdit = QtWidgets.QTextEdit(self.frame)
        self.textEdit.setGeometry(QtCore.QRect(0, 0, 261, 61))
        self.textEdit.setObjectName("textEdit")
        self.frame_2 = QtWidgets.QFrame(self)
        self.frame_2.setGeometry(QtCore.QRect(10, 100, 261, 81))
        self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.frame_2.setObjectName("frame_2")
        self.textEdit_2 = QtWidgets.QTextEdit(self.frame_2)
        self.textEdit_2.setGeometry(QtCore.QRect(0, 10, 261, 71))
        self.textEdit_2.setObjectName("textEdit_2")
        self.pushButton = QtWidgets.QPushButton(self)
        self.pushButton.setGeometry(QtCore.QRect(280, 60, 75, 23))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(self)
        self.pushButton_2.setGeometry(QtCore.QRect(280, 130, 75, 23))
        self.pushButton_2.setObjectName("pushButton_2")
        self.pushButton_3 = QtWidgets.QPushButton(self)
        self.pushButton_3.setGeometry(QtCore.QRect(330, 0, 31, 23))
        self.pushButton_3.setObjectName("pushButton_3")
        self.pushButton.setStyleSheet(''' 
                                                                QPushButton
                                                                {text-align : center;
                                                                background-color : white;
                                                                font: bold;
                                                                border-color: gray;
                                                                border-width: 1px;
                                                                border-radius: 3px;
                                                                padding: 2px;
                                                                height : 14px;
                                                                border-style: outset;
                                                                font : 12px;}
                                                                QPushButton:hover
                                                                {text-align : center;
                                                                background-color : DeepSkyBlue;
                                                                font: bold;
                                                                border-color: gray;
                                                                border-width: 1px;
                                                                border-radius: 5px;
                                                                padding: 1px;
                                                                height : 14px;
                                                                border-style: outset;
                                                                font : 12px;}
                                                                QPushButton:pressed
                                                                {text-align : center;
                                                                background-color : CadetBlue;
                                                                font: bold;
                                                                border-color: gray;
                                                                border-width: 1px;
                                                                border-radius: 5px;
                                                                padding: 1px;
                                                                height : 14px;
                                                                border-style: outset;
                                                                font : 12px;}                                                    
                                                                ''')
        self.pushButton_2.setStyleSheet(''' 
                                                                QPushButton
                                                                {text-align : center;
                                                                background-color : white;
                                                                font: bold;
                                                                border-color: gray;
                                                                border-width: 1px;
                                                                border-radius: 3px;
                                                                padding: 2px;
                                                                height : 14px;
                                                                border-style: outset;
                                                                font : 12px;}
                                                                QPushButton:hover
                                                                {text-align : center;
                                                                background-color : DeepSkyBlue;
                                                                font: bold;
                                                                border-color: gray;
                                                                border-width: 1px;
                                                                border-radius: 5px;
                                                                padding: 1px;
                                                                height : 14px;
                                                                border-style: outset;
                                                                font : 12px;}
                                                                QPushButton:pressed
                                                                {text-align : center;
                                                                background-color : CadetBlue;
                                                                font: bold;
                                                                border-color: gray;
                                                                border-width: 1px;
                                                                border-radius: 5px;
                                                                padding: 1px;
                                                                height : 14px;
                                                                border-style: outset;
                                                                font : 12px;}                                                    
                                                                ''')
        self.pushButton_3.setStyleSheet(''' 
                                                        QPushButton
                                                        {text-align : center;
                                                        background-color : white;
                                                        font: bold;
                                                        border-color: gray;
                                                        border-width: 1px;
                                                        border-radius: 3px;
                                                        padding: 2px;
                                                        height : 14px;
                                                        border-style: outset;
                                                        font : 12px;}
                                                        QPushButton:hover
                                                        {text-align : center;
                                                        background-color : DeepSkyBlue;
                                                        font: bold;
                                                        border-color: gray;
                                                        border-width: 1px;
                                                        border-radius: 5px;
                                                        padding: 1px;
                                                        height : 14px;
                                                        border-style: outset;
                                                        font : 12px;}
                                                        QPushButton:pressed
                                                        {text-align : center;
                                                        background-color : CadetBlue;
                                                        font: bold;
                                                        border-color: gray;
                                                        border-width: 1px;
                                                        border-radius: 5px;
                                                        padding: 1px;
                                                        height : 14px;
                                                        border-style: outset;
                                                        font : 12px;}                                                    
                                                        ''')
        self.retranslateUi(self)
        QtCore.QMetaObject.connectSlotsByName(self)
        self.pushButton_3.clicked.connect(self.exitapp)
        self.pushButton.clicked.connect(self.GetJebLicenseKey)

    def mousePressEvent(self, event):
        if event.button() == Qt.LeftButton:
            self.m_flag = True
            self.m_Position = event.globalPos() - self.pos()  # 获取鼠标相对窗口的位置
            event.accept()
            self.setCursor(QCursor(Qt.OpenHandCursor))  # 更改鼠标图标

    def mouseMoveEvent(self, QMouseEvent):
        if Qt.LeftButton and self.m_flag:
            self.move(QMouseEvent.globalPos() - self.m_Position)  # 更改窗口位置
            QMouseEvent.accept()

    def mouseReleaseEvent(self, QMouseEvent):
        self.m_flag = False
        self.setCursor(QCursor(Qt.ArrowCursor))

    def exitapp(self):
        sys.exit(0)

    def rc4(self,Key, inData):
        Buf = ""
        S = range(256)
        K = (list(map(lambda x: ord(x), Key)) * (256 / len(Key) + 1))[:256]
        j = 0
        for i in range(256):
            j = (S[i] + K[i] + j) % 256
            S[i], S[j] = S[j], S[i]
        i, j = 0, 0
        for x in range(len(inData)):
            i = (i + 1) % 256
            j = (j + S[i]) % 256
            S[i], S[j] = S[j], S[i]
            Buf += chr(S[(S[j] + S[i]) % 256] ^ ord(inData[x]))
        return Buf

    def RC4_Key2(self):
        return "result"

    def Long2Int(self,longdata):
        lo = longdata & 0xFFFFFFFF
        hi = (longdata >> 32) & 0x7FFFFFFF
        return hi, lo

    def KeygenSN(self,LicenseSerial, MachineID):
        mhi, mlo = self.Long2Int(MachineID)
        lhi, llo = self.Long2Int(LicenseSerial)
        hi_Key = (mhi - lhi + 0x55667788) & 0x7FFFFFFF
        lo_Key = (mlo + llo + 0x11223344) & 0xFFFFFFFF
        Z0, = struct.unpack('<Q', struct.pack('<LL', lo_Key, hi_Key))
        Z1 = int(time.time()) ^ 0x56739ACD
        s = sum(map(lambda x: int(x, 16), "%x" % Z1)) % 10
        return "%dZ%d%d" % (Z0, Z1, s)

    def ParsePost(self,buf):
        Info = struct.unpack('<3L2Q4LQ3L', buf[:0x40])
        flag, CRC, UserSerial, LicenseSerial, MachineID, build_type, \
        Ver_Major, Ver_Minor, Ver_Buildid, Ver_Timestamp, \
        TimeOffset, Kclass, Random2 = Info
        SysInfoData = buf[0x40:]
        assert CRC == binascii.crc32(buf[8:]) & 0xFFFFFFFF
        return Info, SysInfoData

    def DecodeRc4Str(self,buf):
        buf = binascii.hexlify(bytes(buf, "utf-8"))
        i, s = self.ParsePost(self.rc4(str(buf[:8]) + str(buf[8:]),"result"))
       # i, s = self.ParsePost(self.rc4(str(buf[:8]) + self.RC4_Key2, str(buf[8:])))
        return i, s

    def GetJebLicenseKey(self):
        self.textEdit.setText(pyperclip.paste())
        licdata = self.textEdit.toPlainText()  # "粘来注册码!"                     =========>就这行
        print(licdata)
        if licdata:
            i, MachineID = self.DecodeRc4Str(licdata    )
            SN = self.KeygenSN(i[3], i[4])
            self.textEdit_2.setText(SN)

    def retranslateUi(self, keygen):
        _translate = QtCore.QCoreApplication.translate
        keygen.setWindowTitle(_translate("keygen", "keygen"))
        self.label.setText(_translate("keygen", "JEB 算号器"))
        self.pushButton.setText(_translate("keygen", "粘贴"))
        self.pushButton_2.setText(_translate("keygen", "复制"))
        self.pushButton_3.setText(_translate("keygen", "X"))

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = Ui_keygen()
    MainWindow.show()
    sys.exit(app.exec_())
[/mw_shl_code]
 楼主| 冥界3大法王 发表于 2021-2-26 22:20
ReLoading 发表于 2021-2-26 19:44
至少 发一个  License,别人也好调试

"48000000A369CE73763028AACBDDF79057B8BEE91AEDB88F8E0DEE0615D9B33C03DE6A7698B9ACF89DCA78AC5AFBB5F468403DBF682D7B17B8D26155C4CFE116F89580C4FE02E7EE27E4E9052A88929B"
ReLoading 发表于 2021-2-27 00:55

懒得写UI,放在云函数了,key=(这里填上License)

https://service-2fyjhk0z-1256931199.sh.apigw.tencentcs.com/CreateKeyGen?key=48000000A369CE73763028AACBDDF79057B8BEE91AEDB88F8E0DEE0615D9B33C03DE6A7698B9ACF89DCA78AC5AFBB5F468403DBF682D7B17B8D26155C4CFE116F89580C4FE02E7EE27E4E9052A88929B

免费评分

参与人数 1吾爱币 +2 收起 理由
冥界3大法王 + 2 这个牛 !

查看全部评分

ufo0033 发表于 2021-3-3 14:29
不太会 python2   改成了python3    用的tk 简单写了下ui   pyinstaller 打包    windows10 测试运行没有问题。 其他没详细测试  https://wwa.lanzouj.com/idR83mf2mpg
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-26 07:40

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表