Skip to content

Commit fd74c83

Browse files
authored
Merge pull request #1166 from qilingframework/dev
Getting ready for 1.4.3
2 parents 263ad9c + f9a2b8e commit fd74c83

File tree

272 files changed

+13237
-9269
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+13237
-9269
lines changed

.github/workflows/build-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
#os: [windows-2019, macos-10.15, ubuntu-18.04, ubuntu-20.04]
13-
os: [windows-2019, ubuntu-18.04, ubuntu-20.04]
13+
os: [windows-latest, ubuntu-18.04, ubuntu-20.04]
1414
python-version: [3.8, 3.9]
1515
exclude:
1616
- os: ubuntu-18.04

.github/workflows/giteesync.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
jobs:
66
deploy:
77
runs-on: ubuntu-latest
8+
if: github.repository_owner == 'qilingframework'
89
steps:
910
- uses: actions/checkout@v2
1011
with:

CREDITS.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33

44
#### Founder
55

6-
- LAU kaijern (xwings) <[email protected]>
6+
- LAU kaijern (xwings) <kj_at_qiling_io>
77

88

99
#### Advisor
1010

11-
- NGUYEN Anh Quynh <[email protected]>
11+
- NGUYEN Anh Quynh <aquynh_at_gmail_com>
1212

1313

1414
#### Core Developers Crew
1515

16-
- Earl MARCUS (klks84) [email protected]
17-
- WU chenxu (kabeor) <[email protected]>
18-
- KONG ziqiao (lazymio) <[email protected]>
19-
- YU zheng (dataisland) <[email protected]>
20-
- Eli Cohen Nehemia (elicn) <[email protected]>
16+
- Earl MARCUS (klks84) <klks84_at_gmail_com>
17+
- WU chenxu (kabeor) <kabeor_at_qiling_io>
18+
- KONG ziqiao (lazymio) <mio_at_lazym_io>
19+
- YU zheng (dataisland) <dataisland_at_outlook_com>
20+
- Eli Cohen Nehemia (elicn) <elichn_at_gmail_com>
2121

2222

2323
#### CI, Website,Documentations, Logo & Swags
2424

25-
- FOO Kevin (chfl4gs) <[email protected]>
26-
- SU muchen (Mirai Suu) <[email protected]>
25+
- FOO Kevin (chfl4gs) <chfl4gs_at_qiling_io>
26+
- SU muchen (miraisuu) <suu_at_iling_io>
2727

2828

2929
#### Key Contributors (in no particular order)
@@ -52,14 +52,17 @@
5252
- bambu
5353
- madprogrammer
5454
- danielmoos
55+
- sigeryang
56+
- bet4it
57+
- nullableVoidPtr
5558

5659

5760
#### Legacy Core Developers
5861

59-
- DING tianze (D1iv3) <[email protected]>
60-
- SUN bowen (w1tcher) <[email protected]>
61-
- CHEN huitao (null) <[email protected]>
62-
- YU tong (sp1ke) <[email protected]>
62+
- DING tianze (D1iv3)
63+
- SUN bowen (w1tcher)
64+
- CHEN huitao (null)
65+
- YU tong (sp1ke)
6366

6467

6568
#### Demigod team (https://groundx.io/demigod)

ChangeLog

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,58 @@
11
This file details the changelog of Qiling Framework.
22

3+
------------------------------------
4+
[Version 1.4.4]: July XX, 2022
5+
6+
7+
------------------------------------
8+
[Version 1.4.3]: June 1st, 2022
9+
10+
New features:
11+
- Introduce PowerPC architecture support (#1140)
12+
13+
Improvements:
14+
- Fix fuzzing for tendaac15 (#1096)
15+
- Update unicorn version to 2.0-rc6 (#1100)
16+
- Implemented a few more Windows msvcrt functions (#1102)
17+
- Minor PE Loader fix (#1104)
18+
- Minor quality changes (#1106)
19+
- Fix cacheflush syscall typo (#1115)
20+
- Improvements and fixes for Windows and PE (#1118)
21+
- Add vm_context to EVM hooks (#1119)
22+
- Load interpreter segments with correct perms and vaddr (#1120)
23+
- Fix mistakes in fuzz_x8664_linux binary (#1121)
24+
- Add EVM ABI helpers, fix EVM DBG stack view (#1123)
25+
- Fix regression caused by missing exception handling when opening socket (#1124)
26+
- CI improvement (#1128 #1134)
27+
- Add macho load command 'LC_LOAD_WEAK_DYLIB' support (#1133)
28+
- Fix breakage of non-Windows binary emulation on Windows host (#1143)
29+
- Remove misused region bound check of unmap_all (#1144)
30+
- Change deprecated interfaces of IDA (#1145)
31+
- Use importlib to retrieve package version (#1146)
32+
- New and improved gdbserver (#1148)
33+
- Rewrite package data reading (#1150)
34+
- Misc improvements (#1154)
35+
- Fix memory exhaustion problem caused by the logger (#1161)
36+
37+
Contributors:
38+
- wtdcode
39+
- aquynh
40+
- elicn
41+
- xwings
42+
- cq674350529
43+
- elicn
44+
- TheZ3ro
45+
- bet4it
46+
- chinggg
47+
- kabeor
48+
- chfl4gs
49+
- profiles
50+
- OlfillasOdikno
51+
- nmantan
52+
- machinewu
53+
- nullableVoidPtr
54+
- Phat3
55+
356

457
------------------------------------
558
[Version 1.4.2]: Feb 13th, 2022

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WORKDIR /qiling
2323
RUN apt-get update \
2424
&& apt-get install -y --no-install-recommends unzip apt-utils \
2525
&& rm -rf /var/lib/apt/lists/* \
26-
&& pip3 install wheels/*.whl \
26+
&& pip3 install --no-deps wheels/*.whl \
2727
&& rm -rf wheels
2828

2929
ENV HOME /qiling

MANIFEST.in

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
<img width="150" height="150" src="https://raw.githubusercontent.com/qilingframework/qiling/master/docs/qiling2_logo_small.png">
99
</p>
1010

11+
[Qiling's usecase, blog and related work](https://github.com/qilingframework/qiling/issues/134)
12+
1113
Qiling is an advanced binary emulation framework, with the following features:
1214

13-
- Emulate multi-platforms: Windows, MacOS, Linux, BSD, UEFI, DOS, MBR, Ethereum Virtual Machine
14-
- Emulate multi-architectures: X86, X86_64, Arm, Arm64, MIPS, 8086
15+
- Emulate multi-platforms: Windows, MacOS, Linux, Android, BSD, UEFI, DOS, MBR, Ethereum Virtual Machine
16+
- Emulate multi-architectures: 8086, X86, X86_64, ARM, ARM64, MIPS, RISCV, PowerPC
1517
- Support multiple file formats: PE, MachO, ELF, COM, MBR
1618
- Support Windows Driver (.sys), Linux Kernel Module (.ko) & MacOS Kernel (.kext) via [Demigod](https://groundx.io/demigod/)
1719
- Emulates & sandbox code in an isolated environment
@@ -88,55 +90,55 @@ Please see [setup guide](https://docs.qiling.io/en/latest/install/) file for how
8890

8991
#### Examples
9092

91-
- Below example shows how to use Qiling framework to emulate a Windows EXE on a Linux machine
93+
- The example below shows how to use Qiling framework in the most striaghtforward way to emulate a Windows executable.
9294

9395
```python
94-
from qiling import *
95-
96-
# sandbox to emulate the EXE
97-
def my_sandbox(path, rootfs):
98-
# setup Qiling engine
99-
ql = Qiling(path, rootfs)
100-
# now emulate the EXE
101-
ql.run()
96+
from qiling import Qiling
10297

10398
if __name__ == "__main__":
104-
# execute Windows EXE under our rootfs
105-
my_sandbox(["examples/rootfs/x86_windows/bin/x86_hello.exe"], "examples/rootfs/x86_windows")
99+
# initialize Qiling instance, specifying the executable to emulate and the emulated system root.
100+
# note that the current working directory is assumed to be Qiling home
101+
ql = Qiling([r'examples/rootfs/x86_windows/bin/x86_hello.exe'], r'examples/rootfs/x86_windows')
102+
103+
# start emulation
104+
ql.run()
106105
```
107106

108-
- Below example shows how to use Qiling framework to dynamically patch a Windows crackme, make it always display "Congratulation" dialog
107+
- The following example shows how a Windows crackme may be patched dynamically to make it always display the "Congratulation" dialog.
109108

110109
```python
111-
from qiling import *
110+
from qiling import Qiling
111+
112+
def force_call_dialog_func(ql: Qiling):
113+
# get DialogFunc address from current stack frame
114+
lpDialogFunc = ql.stack_read(-8)
112115

113-
def force_call_dialog_func(ql):
114-
# get DialogFunc address
115-
lpDialogFunc = ql.unpack32(ql.mem.read(ql.reg.esp - 0x8, 4))
116116
# setup stack memory for DialogFunc
117117
ql.stack_push(0)
118-
ql.stack_push(1001)
119-
ql.stack_push(273)
118+
ql.stack_push(1001) # IDS_APPNAME
119+
ql.stack_push(0x111) # WM_COMMAND
120120
ql.stack_push(0)
121+
122+
# push return address
121123
ql.stack_push(0x0401018)
122-
# force EIP to DialogFunc
123-
ql.reg.eip = lpDialogFunc
124+
125+
# resume emulation from DialogFunc address
126+
ql.arch.regs.eip = lpDialogFunc
124127

125128

126-
def my_sandbox(path, rootfs):
127-
ql = Qiling(path, rootfs)
129+
if __name__ == "__main__":
130+
# initialize Qiling instance
131+
ql = Qiling([r'rootfs/x86_windows/bin/Easy_CrackMe.exe'], r'rootfs/x86_windows')
132+
128133
# NOP out some code
129134
ql.patch(0x004010B5, b'\x90\x90')
130135
ql.patch(0x004010CD, b'\x90\x90')
131136
ql.patch(0x0040110B, b'\x90\x90')
132137
ql.patch(0x00401112, b'\x90\x90')
138+
133139
# hook at an address with a callback
134140
ql.hook_address(force_call_dialog_func, 0x00401016)
135141
ql.run()
136-
137-
138-
if __name__ == "__main__":
139-
my_sandbox(["rootfs/x86_windows/bin/Easy_CrackMe.exe"], "rootfs/x86_windows")
140142
```
141143

142144
The below Youtube video shows how the above example works.
@@ -221,6 +223,7 @@ Contact us at email [email protected], or via Twitter [@qiling_io](https://twitter.
221223

222224
Please refer to [CREDITS.md](https://github.com/qilingframework/qiling/blob/dev/CREDITS.md)
223225

226+
224227
---
225228

226229
#### This is an awesome project! Can I donate?

examples/crackme_x86_linux.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616

1717
class Solver:
1818
def __init__(self, invalid: bytes):
19-
mock_stdin = pipe.SimpleInStream(sys.stdin.fileno())
20-
mock_stdout = pipe.NullOutStream(sys.stdout.fileno())
21-
2219
# create a silent qiling instance
23-
self.ql = Qiling([rf"{ROOTFS}/bin/crackme_linux"], ROOTFS,
24-
verbose=QL_VERBOSE.OFF, # thwart qiling logger output
25-
stdin=mock_stdin, # take over the input to the program using a fake stdin
26-
stdout=mock_stdout) # disregard program output
20+
self.ql = Qiling([rf"{ROOTFS}/bin/crackme_linux"], ROOTFS, verbose=QL_VERBOSE.OFF)
21+
22+
self.ql.os.stdin = pipe.SimpleInStream(sys.stdin.fileno()) # take over the input to the program using a fake stdin
23+
self.ql.os.stdout = pipe.NullOutStream(sys.stdout.fileno()) # disregard program output
2724

2825
# execute program until it reaches the 'main' function
2926
self.ql.run(end=0x0804851b)
@@ -32,7 +29,7 @@ def __init__(self, invalid: bytes):
3229
#
3330
# since the emulation halted upon entering 'main', its return address is there on
3431
# the stack. we use it to limit the emulation till function returns
35-
self.replay_starts = self.ql.reg.arch_pc
32+
self.replay_starts = self.ql.arch.regs.arch_pc
3633
self.replay_ends = self.ql.stack_read(0)
3734

3835
# instead of restarting the whole program every time a new flag character is guessed,
@@ -92,21 +89,26 @@ def replay(self, input: bytes) -> bool:
9289

9390
return False
9491

92+
def progress(msg: str) -> None:
93+
print(msg, end='\r', file=sys.stderr, flush=True)
94+
9595
def main():
96-
idx_list = (1, 4, 2, 0, 3)
97-
flag = [0] * len(idx_list)
96+
flag = bytearray(b'*****')
97+
indices = (1, 4, 2, 0, 3)
9898

99-
solver = Solver(bytes(flag))
99+
# all possible flag characters (may be reduced to uppercase and digits to save time)
100+
charset = string.printable
100101

101-
for idx in idx_list:
102+
progress('Initializing...')
103+
solver = Solver(flag)
102104

103-
# bruteforce all possible flag characters
104-
for ch in string.printable:
105-
flag[idx] = ord(ch)
105+
for i in indices:
106+
for ch in charset:
107+
flag[i] = ord(ch)
106108

107-
print(f'Guessing... [{"".join(chr(ch) if ch else "_" for ch in flag)}]', end='\r', file=sys.stderr, flush=True)
109+
progress(f'Guessing... {flag.decode()}')
108110

109-
if solver.replay(bytes(flag)):
111+
if solver.replay(flag):
110112
break
111113

112114
else:
@@ -116,3 +118,5 @@ def main():
116118

117119
if __name__ == "__main__":
118120
main()
121+
122+
# expected flag: L1NUX

0 commit comments

Comments
 (0)