-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpyVerifyGenerator.py
More file actions
198 lines (159 loc) · 7.12 KB
/
Copy pathSimpyVerifyGenerator.py
File metadata and controls
198 lines (159 loc) · 7.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'main.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
import sys
import requests
import json
import cryptocode
import pyperclip
import subprocess
key = "<Put Key Here>"
crypted = "Nothing Yet"
version = 1.2
machine_id = str(subprocess.check_output('wmic csproduct get uuid').split(b'\n')[1].strip().decode("utf-8"))
class Ui_Dialog(object):
def setupUi(self, Dialog):
if not Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.setEnabled(True)
Dialog.resize(400, 300)
self.buttonBox = QDialogButtonBox(Dialog)
self.buttonBox.setObjectName(u"buttonBox")
self.buttonBox.setGeometry(QRect(300, 240, 71, 51))
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
self.buttonBox.setSizePolicy(sizePolicy)
self.buttonBox.setMinimumSize(QSize(0, 0))
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Close)
self.buttonBox.setCenterButtons(False)
self.formLayoutWidget = QWidget(Dialog)
self.formLayoutWidget.setObjectName(u"formLayoutWidget")
self.formLayoutWidget.setGeometry(QRect(10, 10, 371, 231))
self.formLayout = QFormLayout(self.formLayoutWidget)
self.formLayout.setObjectName(u"formLayout")
self.formLayout.setContentsMargins(0, 0, 0, 0)
"""
self.label_IP = QLabel(self.formLayoutWidget)
self.label_IP.setObjectName(u"label_IP")"""
#self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label_IP)
"""
self.textEdit_IP = QTextEdit(self.formLayoutWidget)
self.textEdit_IP.setObjectName(u"textEdit_IP")
self.textEdit_IP.setMaximumSize(QSize(16777215, 30))
self.textEdit_IP.setReadOnly(True)
self.textEdit_IP.setAcceptRichText(False)"""
ip = get_ip(1)
#self.textEdit_IP.setHtml()
#self.formLayout.setWidget(0, QFormLayout.FieldRole, self.textEdit_IP)
self.label_connection = QLabel(self.formLayoutWidget)
self.label_connection.setObjectName(u"label_connection")
self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_connection)
self.textEdit_connection = QTextEdit(self.formLayoutWidget)
self.textEdit_connection.setObjectName(u"textEdit_connection")
self.textEdit_connection.setMaximumSize(QSize(16777215, 90))
self.textEdit_connection.setReadOnly(True)
self.textEdit_connection.setAcceptRichText(False)
ipdata = get_ip(2)
rawdata = json.dumps({'IP':ip,'Organization': ipdata[0], 'ISP': ipdata[1], 'Region':ipdata[3],"HWID":machine_id}, separators=(',', ': '))
global crypted
crypted = encrypter(rawdata,key)
#crypted = rawdata;
#self.textEdit_connection.setHtml("Organization : "+ipdata[0]+"<br>ISP : "+ipdata[1]+"<br>Region : "+ipdata[3])
self.textEdit_connection.setHtml(crypted)
self.formLayout.setWidget(1, QFormLayout.FieldRole, self.textEdit_connection)
self.pushButton_copy = QPushButton(Dialog)
self.pushButton_copy.setObjectName(u"pushButton_copy")
self.pushButton_copy.setGeometry(QRect(20, 220, 261, 61))
#self.pushButton_copy.setCheckable(True)
#self.pushButton_copy.toggle()
self.pushButton_copy.clicked.connect(lambda:self.whichbtn(self.pushButton_copy))
self.pushButton_copy.clicked.connect(self.btnstate())
self.label = QLabel(Dialog)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(-4, 19, 401, 41))
self.labelV = QLabel(Dialog)
self.labelV.setObjectName(u"labelV")
self.labelV.setGeometry(QRect(360, 30, 401, 41))
font = QFont()
font.setPointSize(20)
font.setBold(True)
font.setWeight(75)
fontV = QFont()
fontV.setPointSize(16)
fontV.setBold(False)
fontV.setWeight(30)
self.labelV.setStyleSheet("color: #FF8800;font-weight: bold;");
self.labelV.setFont(fontV)
self.label.setFont(font)
self.label.setAlignment(Qt.AlignCenter)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept)
self.buttonBox.rejected.connect(Dialog.reject)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"SimpyVerify Generator", None))
#self.label_IP.setText(QCoreApplication.translate("Dialog", u"IP address", None))
self.label_connection.setText(QCoreApplication.translate("Dialog", u"Secret Magic Key", None))
self.pushButton_copy.setText(QCoreApplication.translate("Dialog", u"Copy", None))
self.label.setText(QCoreApplication.translate("Dialog", u"SimpyVerify Generator", None))
self.labelV.setText(QCoreApplication.translate("Dialog", str(version), None))
# retranslateUi
def whichbtn(self,b):
print ("clicked button is "+b.text())
if b.text()=="Copy":
global crypted
pyperclip.copy(crypted)
#self.pushButton_copy.setText(QCoreApplication.translate("Dialog", u"Copied", None))
msg = QMessageBox()
msg.setWindowTitle("Alert")
msg.setText("Secret Magic Key Copied")
msg.setIcon(QMessageBox.Information)
x = msg.exec_()
def btnstate(self):
if self.pushButton_copy.isChecked():
print ("button clicked")
else:
print ("button released")
def get_ip(mode):
try:
rdata = requests.get('http://ipwho.is/').text
except requests.exceptions.Timeout:
return "err01"
# Maybe set up for a retry, or continue in a retry loop
except requests.exceptions.TooManyRedirects:
return "err02"
# Tell the user their URL was bad and try a different one
except requests.exceptions.RequestException as e:
# catastrophic error. bail.
return "err03"
#raise SystemExit(e)
data = json.loads(rdata)
if mode==1:
return data["ip"]
if mode==2:
return data["connection"]["org"],data["connection"]["isp"],data["connection"]["isp"],data["region"]
def encrypter(data,key_e):
str_encoded = cryptocode.encrypt(data,key_e)
return str_encoded
def decrypter(data,key_e):
str_decoded = cryptocode.decrypt(data,key_e)
return str_decoded
if __name__ == '__main__':
app = QApplication(sys.argv)
window = QDialog()
ui = Ui_Dialog()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())