Skip to content

Commit 3445ad2

Browse files
authored
Merge branch 'dev' into dev
2 parents 5ff21fb + 33a2b6d commit 3445ad2

Some content is hidden

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

114 files changed

+2826
-2336
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
1-
- [ ] Have you checked that there aren't other open [pull requests](https://github.com/qilingframework/qiling/pulls) for the same update/change?
2-
- [ ] Is this pull request for [dev](https://github.com/qilingframework/qiling/tree/dev) branch? (Do not pull request for **master** branch).
1+
<!--
2+
We highly appreciate your interest and contribution to our project.
3+
Before submiting your PR, please finish the checklist below.
4+
-->
5+
6+
## Checklist
7+
8+
### Which kind of PR do you create?
9+
10+
- [ ] This PR only contains minor fixes.
11+
- [ ] This PR contains major feature update.
12+
- [ ] This PR introduces a new function/api for Qiling Framework.
13+
14+
### Coding convention?
15+
16+
- [ ] The new code conforms to Qiling Framework naming convention.
17+
- [ ] The imports are arranged properly.
18+
- [ ] Essential comments are added.
19+
- [ ] The reference of the new code is pointed out.
20+
21+
### Extra tests?
22+
23+
- [ ] No extra tests are needed for this PR.
24+
- [ ] I have added enough tests for this PR.
25+
- [ ] Tests will be added after some discussion and review.
26+
27+
### Changelog?
28+
29+
- [ ] This PR doesn't need to update Changelog.
30+
- [ ] Changelog will be updated after some proper review.
31+
- [ ] Changelog has been updated in my PR.
32+
33+
### Target branch?
34+
35+
- [ ] The target branch is dev branch.
36+
37+
### One last thing
38+
39+
- [ ] I have read the [contribution guide](https://docs.qiling.io/en/latest/contribution/)
340

441
-----

ChangeLog

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

3+
------------------------------------
4+
BREAK CHANGE
5+
- ql.multithread can be only set during Qiling.__init__ now.
6+
- ql.nprint and ql.dpring is depreciated. Please use logging directly instead.
7+
- ql.filename is renamed to ql.argv.
8+
- ql.output and ql.verbose now has slightly different meanings and can be adjusted runtime. See their docstring for details.
9+
- ql.filter now accepts a regular expression.
10+
311
------------------------------------
412
[Version 1.2.1]: December [SOMETHING], 2020
513
-

examples/doogie_8086_crack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
# Built on top of Unicorn emulator (www.unicorn-engine.org)
55

6-
import sys, curses, math, struct, string, time
6+
import sys, curses, math, struct, string, time, logging
77
sys.path.append("..")
88
from qiling import *
99
from qiling.const import *
@@ -172,7 +172,7 @@ def read_until_zero(ql: Qiling, addr):
172172
return buf
173173

174174
def set_required_datetime(ql: Qiling):
175-
ql.nprint("Setting Feburary 06, 1990")
175+
logging.info("Setting Feburary 06, 1990")
176176
ql.reg.ch = BIN2BCD(19)
177177
ql.reg.cl = BIN2BCD(1990%100)
178178
ql.reg.dh = BIN2BCD(2)

examples/hello_arm_linux_custom_syscall.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ def my_syscall_write(ql, write_fd, write_buf, write_count, *args, **kw):
1414

1515
try:
1616
buf = ql.mem.read(write_buf, write_count)
17-
ql.nprint("\n+++++++++\nmy write(%d,%x,%i) = %d\n+++++++++" % (write_fd, write_buf, write_count, regreturn))
17+
logging.info("\n+++++++++\nmy write(%d,%x,%i) = %d\n+++++++++" % (write_fd, write_buf, write_count, regreturn))
1818
ql.os.fd[write_fd].write(buf)
1919
regreturn = write_count
2020
except:
2121
regreturn = -1
22-
ql.nprint("\n+++++++++\nmy write(%d,%x,%i) = %d\n+++++++++" % (write_fd, write_buf, write_count, regreturn))
22+
logging.info("\n+++++++++\nmy write(%d,%x,%i) = %d\n+++++++++" % (write_fd, write_buf, write_count, regreturn))
2323
if ql.output in (QL_OUTPUT.DEBUG, QL_OUTPUT.DUMP):
2424
raise
2525

examples/hello_x8664_windows_customapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
# Built on top of Unicorn emulator (www.unicorn-engine.org)
55

6-
import sys
6+
import sys, logging
77
sys.path.append("..")
88

99
from qiling import *
@@ -16,7 +16,7 @@
1616
@winsdkapi(cc=CDECL, replace_params={"str": STRING})
1717
def my_puts(ql, address, params):
1818
ret = 0
19-
ql.nprint("\n+++++++++\nmy random Windows API\n+++++++++\n")
19+
logging.info("\n+++++++++\nmy random Windows API\n+++++++++\n")
2020
string = params["str"]
2121
ret = len(string)
2222
return ret

examples/hfs_mbr_crack.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from qiling.const import QL_INTERCEPT
22
from qiling import Qiling
3-
import curses
3+
import curses, logging
44

55
def input_index(ql: Qiling):
66
return ql.unpack16(ql.mem.read(0x81ba, 2))
@@ -37,7 +37,7 @@ def find_next(ql: Qiling):
3737
ctx_succ = ql.save()
3838
ql.restore(ctx)
3939
if ctx_succ is None:
40-
ql.nprint("Can't find any suitbale result.")
40+
logging.info("Can't find any suitbale result.")
4141
return None
4242
ql.restore(ctx_succ)
4343
return results
@@ -65,11 +65,11 @@ def main():
6565
for i in range(9):
6666
r = find_next(ql)
6767
if r is None:
68-
ql.nprint("Fail to crack.")
68+
logging.info("Fail to crack.")
6969
return
7070
else:
7171
r = list(map(lambda x: chr(x), r))
72-
ql.nprint(f"Get {r}")
72+
logging.info(f"Get {r}")
7373
results.append(r)
7474
print_flags(results)
7575

examples/multithreading_arm64_linux.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
from qiling import *
99

1010
def my_sandbox(path, rootfs):
11-
ql = Qiling(path, rootfs, output = "debug")
12-
ql.multithread = True
11+
ql = Qiling(path, rootfs, output = "debug", multithread=True)
1312
ql.run()
1413

1514

examples/sality.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
# Built on top of Unicorn emulator (www.unicorn-engine.org)
55

6-
import struct, sys
6+
import struct, sys, logging
77

88
sys.path.append("..")
99
from qiling import *
@@ -105,6 +105,7 @@ def sality_WriteFile(ql, address, params):
105105
r, nNumberOfBytesToWrite = ql.amsint32_driver.os.io_Write(buffer)
106106
ql.mem.write(lpNumberOfBytesWritten, ql.pack32(nNumberOfBytesToWrite))
107107
except Exception as e:
108+
logging.exception("")
108109
print("Exception = %s" % str(e))
109110
r = 1
110111
if r:
@@ -143,6 +144,7 @@ def sality_StartServiceA(ql, address, params):
143144
else:
144145
return 1
145146
except Exception as e:
147+
logging.exception("")
146148
print (e)
147149

148150

@@ -169,7 +171,7 @@ def hook_stop_address(ql):
169171
ql.os.set_function_args([0])
170172
ql.hook_address(hook_stop_address, 0x4055FA)
171173
ql.run(0x4053B2)
172-
ql.nprint("[+] test kill thread")
174+
logging.info("[+] test kill thread")
173175
if ql.amsint32_driver:
174176
ql.amsint32_driver.os.io_Write(struct.pack("<I", 0xdeadbeef))
175177
ql.amsint32_driver.hook_address(hook_stop_address, 0x10423)

examples/tendaac1518_httpd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# notes: we are using rootfs in this example, so rootfs = squashfs-root
1414
#
1515

16-
import os, socket, sys, threading
16+
import os, socket, sys, threading, logging
1717
sys.path.append("..")
1818
from qiling import *
1919

@@ -54,7 +54,7 @@ def nvram_listener():
5454

5555
def myvfork(ql):
5656
regreturn = 0
57-
ql.nprint("vfork() = %d" % regreturn)
57+
logging.info("vfork() = %d" % regreturn)
5858
ql.os.definesyscall_return(regreturn)
5959

6060

qiling/arch/arm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
# Built on top of Unicorn emulator (www.unicorn-engine.org)
55

6+
import logging
7+
68
from unicorn import *
79
from unicorn.arm_const import *
810

@@ -77,7 +79,7 @@ def enable_vfp(self):
7779
#self.ql.reg.fpexc = 0x00000040
7880
else:
7981
self.ql.reg.fpexc = 0x40000000
80-
self.ql.dprint(D_INFO, "[+] Enable ARM VFP")
82+
logging.debug("[+] Enable ARM VFP")
8183

8284

8385
def check_thumb(self):
@@ -91,5 +93,5 @@ def check_thumb(self):
9193
mode = UC_MODE_ARM
9294
if (reg_cpsr & reg_cpsr_v) != 0:
9395
mode = UC_MODE_THUMB
94-
self.ql.dprint(D_INFO, "[+] Enable ARM THUMB")
96+
logging.debug("[+] Enable ARM THUMB")
9597
return mode

0 commit comments

Comments
 (0)