diff --git a/hyperdbg/libhyperdbg/code/debugger/core/interpreter.cpp b/hyperdbg/libhyperdbg/code/debugger/core/interpreter.cpp index 1d31af76..6075d480 100644 --- a/hyperdbg/libhyperdbg/code/debugger/core/interpreter.cpp +++ b/hyperdbg/libhyperdbg/code/debugger/core/interpreter.cpp @@ -127,16 +127,6 @@ public: { if (c == '"' && input[i - 1] != '\\' ) //&& !IdxBracket) { - if (input[i + 1] == ' ' || input[i + 1] == '\n') // handling " " and "\n" - { - i++; - - if (input[i + 1] == ' ' || input[i + 1] == '\n') - { - i++; - } - } - InQuotes = FALSE; // // if the quoted text is not within brackets, regard it as a StringLiteral token @@ -145,12 +135,12 @@ public: { AddStringToken(tokens, current, TRUE); // TRUE for StringLiteral type current.clear(); - continue; + continue; // dont add " char } else { current += c; - continue; + continue; // dont add " char } // // if we are indeed within brackets, we continue to add the '"' char to the current buffer @@ -160,7 +150,7 @@ public: if (IdxBracket) { - if (c == '}' && input[i - 1] != '\\' && IdxBracket) // not closing } + if (c == '}' && input[i - 1] != '\\' && IdxBracket && !InQuotes) // not closing } { IdxBracket--; } @@ -249,10 +239,6 @@ public: } current += c; - if (current == "and") - { - int x = 0; - } } if (!current.empty() && current != " ") @@ -260,15 +246,15 @@ public: AddToken(tokens, current); } - // if (IdxBracket) - //{ - // // error: script bracket not closed - // } + if (IdxBracket) + { + // error: script bracket not closed + } - // if (InQuotes) - //{ - // // error: Quote not closed - // } + if (InQuotes) + { + // error: Quote not closed + } return tokens; } diff --git a/hyperdbg/tests/command-parser/command-parser-testcases.txt b/hyperdbg/tests/command-parser/command-parser-testcases.txt index 163cf01f..a3caf1c9 100644 --- a/hyperdbg/tests/command-parser/command-parser-testcases.txt +++ b/hyperdbg/tests/command-parser/command-parser-testcases.txt @@ -769,7 +769,7 @@ memcpy(" { buffer content @0x%x\n", @rdx); _____________________________________________________________ !hook routine!KeWaitForSingleObject script { -if (condition) { { wait @timeout\n", @rcx); +if (condition) { { wait @timeout\n"," @rcx);}} } ---------------------------------- @@ -781,7 +781,7 @@ script ---------------------------------- -if (condition) { { wait @timeout\n", @rcx); +if (condition) { { wait @timeout\n"," @rcx);}} _____________________________________________________________ @@ -801,6 +801,7 @@ script DbgPrint(" { { system info: %p\n", @r8); + _____________________________________________________________ !monitor function!NtOpenProcess script { @@ -820,6 +821,7 @@ script log(" { { process opened: %d\n", @r9); + _____________________________________________________________ !filter nt!MmMapLockedPagesSpecifyCache script { @@ -837,10 +839,11 @@ script trace(" { { mapping pages @%p\n", @r10); + _____________________________________________________________ !watch kernel!ObReferenceObjectByHandle script { -check(" { { object handle: 0x%x\n", @r11); +check(" { { object handle: 0x%x\n","xxx" @r11); } ---------------------------------- @@ -852,7 +855,8 @@ script ---------------------------------- -check(" { { object handle: 0x%x\n", @r11); +check(" { { object handle: 0x%x\n","xxx" @r11); + _____________________________________________________________ !watch kernel!ObReferenceObjectByHandle script { }{ @@ -873,6 +877,7 @@ script check(" { { object handle: 0x%x\n", @r11); + _____________________________________________________________ !watch kernel!ObReferenceObjectByHandle script { }{ @@ -892,6 +897,7 @@ script check(" } object handle: 0x%x\n", @r11); + _____________________________________________________________ {block1}{block2}{block3} in sequence ---------------------------------- @@ -922,6 +928,7 @@ script printf(" { { hi2 ! :%llx\n", @rax); + _____________________________________________________________ !epthook nt!ExAllocatePoolWithTag script { @@ -940,4 +947,5 @@ script printf(" { { hi ! :%llx\n", @rax); + _____________________________________________________________ \ No newline at end of file