generated from gdt050579/appcui-template
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Gheorghita Mutu <gheorghitamutu@gmail.com>
- Loading branch information
1 parent
f9fa077
commit 77717ba
Showing
8 changed files
with
112 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
target_sources(Dropper PRIVATE | ||
Dropper.cpp | ||
Dropper.cpp | ||
SpecialStrings/SpecialStrings.cpp | ||
SpecialStrings/EmailAddress.cpp | ||
SpecialStrings/Filepath.cpp | ||
SpecialStrings/IpAddress.cpp | ||
Executables/MZPE.cpp | ||
Multimedia/PNG.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "SpecialStrings.hpp" | ||
|
||
#include <string> | ||
|
||
namespace GView::GenericPlugins::Droppper::SpecialStrings | ||
{ | ||
static constexpr std::string_view PATH_REGEX_ASCII{ R"(^(([a-zA-Z]{1}\:\\[a-zA-Z0-9\\_\. ]+)|(((\/|\.\.)[a-zA-Z\/\.0-9]+\/[a-zA-Z\/\.0-9]+))))" }; | ||
static constexpr std::string_view PATH_REGEX_UNICODE{ | ||
R"(^((([a-zA-Z]\x00){1}\\x00:\x00\\x00\\x00([a-zA-Z0-9\\_\. ]\x00)+)|((((\/\x00)|\.\x00\.\x00)([a-zA-Z\/\.0-9]\x00)+\/\x00([a-zA-Z\/\.0-9]\x00)+))))" | ||
}; | ||
|
||
Filepath::Filepath(bool caseSensitive, bool unicode) | ||
{ | ||
this->unicode = unicode; | ||
this->caseSensitive = caseSensitive; | ||
this->matcherAscii.Init(PATH_REGEX_ASCII, unicode, caseSensitive); | ||
this->matcherUnicode.Init(PATH_REGEX_UNICODE, unicode, caseSensitive); | ||
} | ||
|
||
const char* Filepath::GetName() | ||
{ | ||
return "Filepath"; | ||
} | ||
|
||
const char* Filepath::GetOutputExtension() | ||
{ | ||
return "filepath"; | ||
} | ||
|
||
Result Filepath::Check(uint64 offset, DataCache& file, BufferView precachedBuffer, uint64& start, uint64& end) | ||
{ | ||
CHECK(precachedBuffer.GetLength() > 0, Result::NotFound, ""); | ||
CHECK(IsAsciiPrintable(precachedBuffer.GetData()[0]), Result::NotFound, ""); | ||
|
||
auto buffer = file.Get(offset, file.GetCacheSize() / 12, false); | ||
CHECK(buffer.GetLength() >= 4, Result::NotFound, ""); | ||
|
||
if (this->matcherAscii.Match(buffer, start, end)) { | ||
start += offset; | ||
end += offset; | ||
return Result::Ascii; | ||
} | ||
|
||
CHECK(unicode, Result::NotFound, ""); | ||
CHECK(precachedBuffer.GetData()[1] == 0, Result::NotFound, ""); // we already checked ascii printable | ||
|
||
if (this->matcherUnicode.Match(buffer, start, end)) { | ||
start += offset; | ||
end += offset; | ||
return Result::Unicode; | ||
} | ||
|
||
return Result::NotFound; | ||
} | ||
} // namespace GView::GenericPlugins::Droppper::SpecialStrings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
GenericPlugins/Dropper/src/SpecialStrings/SpecialStrings.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "SpecialStrings.hpp" | ||
|
||
#include <string> | ||
|
||
namespace GView::GenericPlugins::Droppper::SpecialStrings | ||
{ | ||
ObjectCategory SpecialStrings::GetGroup() | ||
{ | ||
return ObjectCategory::SpecialStrings; | ||
} | ||
|
||
Priority SpecialStrings::GetPriority() | ||
{ | ||
return Priority::Text; | ||
} | ||
|
||
bool SpecialStrings::ShouldGroupInOneFile() | ||
{ | ||
return true; | ||
} | ||
} // namespace GView::GenericPlugins::Droppper::SpecialStrings |