|
7 | 7 | This module is intended for general purpose functions that can be used |
8 | 8 | thoughout the qiling framework |
9 | 9 | """ |
10 | | -import importlib, os, copy, re, pefile, logging, sys |
| 10 | + |
| 11 | +import importlib, os, copy, re, pefile, logging, sys, yaml |
| 12 | + |
11 | 13 | from configparser import ConfigParser |
12 | 14 | from logging import LogRecord |
13 | 15 | from typing import Any, Container, Optional, Sequence, Tuple, Type |
@@ -476,15 +478,18 @@ def profile_setup(ql): |
476 | 478 | _profile = ql.profile |
477 | 479 | debugmsg = "Profile: %s" % _profile |
478 | 480 |
|
479 | | - os_profile = os.path.join(os.path.dirname(os.path.abspath(__file__)), "profiles", ostype_convert_str(ql.ostype).lower() + ".ql") |
| 481 | + if ql.baremetal: |
| 482 | + config = {} |
| 483 | + if ql.profile: |
| 484 | + with open(ql.profile) as f: |
| 485 | + config = yaml.load(f, Loader=yaml.Loader) |
480 | 486 |
|
481 | | - if ql.profile: |
482 | | - profiles = [os_profile, ql.profile] |
483 | 487 | else: |
484 | | - profiles = [os_profile] |
| 488 | + profile_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "profiles", ostype_convert_str(ql.ostype).lower() + ".ql") |
| 489 | + profiles = [profile_path, ql.profile] if ql.profile else [profile_path] |
485 | 490 |
|
486 | | - config = ConfigParser() |
487 | | - config.read(profiles) |
| 491 | + config = ConfigParser() |
| 492 | + config.read(profiles) |
488 | 493 |
|
489 | 494 | return config, debugmsg |
490 | 495 |
|
|
0 commit comments