Skip to content
Snippets Groups Projects
Commit ede5fbd8 authored by Timmy Chan's avatar Timmy Chan
Browse files

Fix manual config bug

parent 8252e873
No related branches found
No related tags found
1 merge request!5Feat/cve linux kernel
......@@ -110,7 +110,7 @@ def setup(**kwargs):
except subprocess.CalledProcessError:
verbose_log("Failed to boot QEMU, trying again with another port...")
log("Booted VM image on QEMU", f"(PID: {pid})")
log("Booted VM image on QEMU", f"(PID: {pid.strip()})")
def derive_input_kwargs(**kwargs):
......
......@@ -33,12 +33,17 @@ def qemu_vm_setup(vuln, app_path, vuln_type):
if re.findall(r'<|>|before|after|earlier|later|through|till|until|greater than', description):
print("It looks like the vulnerability depends on the following kernel versions, or any version between "
"them.")
for version in version_list:
print(version.ljust(8))
# TODO: Suggest using the oldest version closest to 4.x in the list.
valid_version_number = get_kernel_release_number(version_list[0])
user_input = input(f"Is it okay to use version {valid_version_number}? ([yes]/no)").lower()
else:
print("It looks like the vulnerability depends on one of the following kernel versions")
# TODO: Suggest using the oldest version closest to 4.x in the list.
valid_version_number = get_kernel_release_number(version_list[1])
for version in version_list:
print(version.rjust(8))
user_input = input(f"Is it okay to use kernel version {valid_version_number}? ([yes]/no)").lower()
if user_input in ["y", "yes", ""]:
kernel_version = valid_version_number
......@@ -59,6 +64,7 @@ def qemu_vm_setup(vuln, app_path, vuln_type):
# Run full automatic qemu vm setup
setup(arch=arch, kernel_version=kernel_version)
else:
print("Cannot run auto")
user_input = input(f"Do you want to manually enter specifications? ([yes]/no)").lower()
if user_input in ["y", "yes", ""]:
qemu_manual_setup()
......@@ -74,12 +80,16 @@ def qemu_manual_setup():
# If the use inputs any falsy value (press enter), use the default value
user_input = input(f"Specify a kernel version (default {DEFAULT_KERNEL_VERSION}): ").lower()
kernel_version = DEFAULT_KERNEL_VERSION or user_input
kernel_version = user_input or DEFAULT_KERNEL_VERSION
user_input = input(f"Specify an architecture (default {DEFAULT_ARCH}): ").lower()
arch = DEFAULT_ARCH or user_input
arch = user_input or DEFAULT_ARCH
setup(arch=arch, kernel_version=kernel_version)
user_input = input(f"Specify a gcc version (default _derived_): ").lower()
# None means it will be derived
gcc_version = user_input or None
setup(arch=arch, kernel_version=kernel_version, gcc_version=gcc_version)
def regex_find_all_version_strings(input_text):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment