Skip to content

Commit dfbdb58

Browse files
committed
SendAnalyze
Added Windows API
1 parent 66cf18d commit dfbdb58

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

classes/Windows_X86_64.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from capstone import *
66
from qiling.const import QL_VERBOSE
77
from qiling.os.mapper import QlFsMappedObject
8+
from qiling.extensions import trace
89

910

1011
class Fake_Drive(QlFsMappedObject):
@@ -38,19 +39,17 @@ def stop(ql):
3839
ql.nprint("[+] Address found")
3940
ql.emu_stop()
4041

41-
def my_sandbox_nodebugger(path, rootfs = "examples/rootfs/x8664_windows"):
42-
ql = Qiling(path, r"" + rootfs, verbose=QL_VERBOSE.DEBUG)
42+
def my_sandbox_nodebugger(path, arch, rootfs = "examples/rootfs/x8664_windows"):
43+
ql = Qiling(path, r"" + rootfs, archtype=arch, ostype=QL_OS.WINDOWS, verbose=QL_VERBOSE.DEBUG)
4344
ql.run()
4445

45-
def my_sandbox(path, rootfs = "examples/rootfs/x8664_windows", debugger = "gdb"):
46-
ql = Qiling(path, r"" + rootfs, verbose=QL_VERBOSE.DEBUG)
46+
def my_sandbox(path, arch, rootfs = "examples/rootfs/x8664_windows", debugger = "gdb"):
47+
ql = Qiling(path, r"" + rootfs, archtype=arch, ostype=QL_OS.WINDOWS, verbose=QL_VERBOSE.DEBUG)
4748
ql.debugger = str(debugger)
48-
ql.run(timeout=5000)
4949

5050
def shellcode_sandbox(path, shellcode, rtfs = "examples/rootfs/x8664_windows", debugger = "gdb"):
5151
ql = Qiling(shellcoder=shellcode, rootfs=r"" + rtfs, verbose=QL_VERBOSE.DEBUG)
5252
ql.debugger = str(debugger)
53-
ql.run(timeout=5000)
5453

5554
def stopatkillerswtich(ql: Qiling):
5655
print("WannaCry Detected!")
@@ -90,26 +89,26 @@ def sandbox_analyze(exeloc, debugger):
9089
os.mkdir("examples/rootfs/x8664_windows/bin")
9190

9291
shutil.copyfile("exefiles/" + exeloc, "examples/rootfs/x8664_windows/bin/" + exeloc)
93-
QilingSandBox_Windows_x86_64.my_sandbox_nodebugger(["examples/rootfs/x8664_windows/bin/" + exeloc], "examples/rootfs/x8664_windows")
92+
QilingSandBox_Windows_x86_64.my_sandbox_nodebugger(["examples/rootfs/x8664_windows/bin/" + exeloc], QL_ARCH.X8664, "examples/rootfs/x8664_windows")
9493
else:
9594
# Create folder if was not created
9695
if os.path.exists("examples/rootfs/x86_windows/bin") is False:
9796
os.mkdir("examples/rootfs/x86_windows/bin")
9897

9998
shutil.copyfile("exefiles/" + exeloc, "examples/rootfs/x86_windows/bin/" + exeloc)
100-
QilingSandBox_Windows_x86_64.my_sandbox_nodebugger(["examples/rootfs/x86_windows/bin/" + exeloc], "examples/rootfs/x86_windows")
99+
QilingSandBox_Windows_x86_64.my_sandbox_nodebugger(["examples/rootfs/x86_windows/bin/" + exeloc], QL_ARCH.X86, "examples/rootfs/x86_windows")
101100
else:
102101
if(arch == "64"):
103102
# Create folder if was not created
104103
if os.path.exists("examples/rootfs/x8664_windows/bin") is False:
105104
os.mkdir("examples/rootfs/x8664_windows/bin")
106105

107106
shutil.copyfile("exefiles/" + exeloc, "examples/rootfs/x8664_windows/bin/" + exeloc)
108-
QilingSandBox_Windows_x86_64.my_sandbox(["examples/rootfs/x8664_windows/bin/" + exeloc], "examples/rootfs/x8664_windows", debugger)
107+
QilingSandBox_Windows_x86_64.my_sandbox(["examples/rootfs/x8664_windows/bin/" + exeloc], QL_ARCH.X8664, "examples/rootfs/x8664_windows", debugger)
109108
else:
110109
# Create folder if was not created
111110
if os.path.exists("examples/rootfs/x86_windows/bin") is False:
112111
os.mkdir("examples/rootfs/x86_windows/bin")
113112

114113
shutil.copyfile("exefiles/" + exeloc, "examples/rootfs/x86_windows/bin/" + exeloc)
115-
QilingSandBox_Windows_x86_64.my_sandbox(["examples/rootfs/x86_windows/bin/" + exeloc], "examples/rootfs/x86_windows", debugger)
114+
QilingSandBox_Windows_x86_64.my_sandbox(["examples/rootfs/x86_windows/bin/" + exeloc], QL_ARCH.X86, "examples/rootfs/x86_windows", debugger)

exefiles/example_regedit.exe

-8 KB
Binary file not shown.

0 commit comments

Comments
 (0)