[skip ci]
This commit is contained in:
DavidXanatos 2023-07-30 20:29:35 +02:00
parent c132b91a0d
commit ce3d30e231
7 changed files with 111 additions and 137 deletions

View File

@ -45,7 +45,7 @@
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>10</number>
</property> </property>
<widget class="QWidget" name="tabGeneral"> <widget class="QWidget" name="tabGeneral">
<attribute name="title"> <attribute name="title">
@ -3369,7 +3369,7 @@ The process match level has a higher priority than the specificity and describes
</font> </font>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="tabCompat"> <widget class="QWidget" name="tabCompat">
<attribute name="title"> <attribute name="title">
@ -4051,14 +4051,35 @@ Note: Forced Programs and Force Folders settings for a sandbox do not apply to
<layout class="QGridLayout" name="gridLayout_34"> <layout class="QGridLayout" name="gridLayout_34">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_32"> <layout class="QGridLayout" name="gridLayout_32">
<item row="13" column="1" colspan="4"> <item row="10" column="1" colspan="3">
<widget class="QCheckBox" name="chkApiTrace"> <widget class="QCheckBox" name="chkNetFwTrace">
<property name="text"> <property name="text">
<string>API call trace (requires LogAPI to be installed in the Sbie directory)</string> <string>Network Firewall</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="4"> <item row="1" column="1" colspan="4">
<widget class="QCheckBox" name="chkDisableMonitor">
<property name="text">
<string>Disable Resource Access Monitor</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lblMonitor">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Resource Access Monitor</string>
</property>
</widget>
</item>
<item row="13" column="4">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -4071,6 +4092,33 @@ Note: Forced Programs and Force Folders settings for a sandbox do not apply to
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkFileTrace">
<property name="text">
<string>File Trace</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="4">
<widget class="QCheckBox" name="chkCallTrace">
<property name="text">
<string>Ntdll syscall Trace (creates a lot of output)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_38">
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2"> <item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="chkPipeTrace"> <widget class="QCheckBox" name="chkPipeTrace">
<property name="text"> <property name="text">
@ -4078,27 +4126,7 @@ Note: Forced Programs and Force Folders settings for a sandbox do not apply to
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="0"> <item row="13" column="5">
<spacer name="verticalSpacer_19">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="2" colspan="3">
<widget class="QCheckBox" name="chkErrTrace">
<property name="text">
<string>Log all SetError's to Trace log (creates a lot of output)</string>
</property>
</widget>
</item>
<item row="14" column="5">
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -4138,26 +4166,32 @@ instead of &quot;*&quot;.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1" colspan="4"> <item row="6" column="1" colspan="2">
<widget class="QCheckBox" name="chkCallTrace"> <widget class="QCheckBox" name="chkKeyTrace">
<property name="text"> <property name="text">
<string>Ntdll syscall Trace (creates a lot of output)</string> <string>Key Trace</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1" colspan="2"> <item row="9" column="1" colspan="3">
<widget class="QCheckBox" name="chkFileTrace"> <widget class="QCheckBox" name="chkComTrace">
<property name="text"> <property name="text">
<string>File Trace</string> <string>COM Class Trace</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="4"> <item row="13" column="0">
<widget class="QCheckBox" name="chkDisableMonitor"> <spacer name="verticalSpacer_19">
<property name="text"> <property name="orientation">
<string>Disable Resource Access Monitor</string> <enum>Qt::Vertical</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
<item row="7" column="1" colspan="2"> <item row="7" column="1" colspan="2">
<widget class="QCheckBox" name="chkIpcTrace"> <widget class="QCheckBox" name="chkIpcTrace">
@ -4166,40 +4200,6 @@ instead of &quot;*&quot;.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="chkGuiTrace">
<property name="text">
<string>GUI Trace</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lblMonitor">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Resource Access Monitor</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_38">
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="lblTracing"> <widget class="QLabel" name="lblTracing">
<property name="font"> <property name="font">
@ -4214,24 +4214,17 @@ instead of &quot;*&quot;.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1" colspan="3"> <item row="12" column="2" colspan="3">
<widget class="QCheckBox" name="chkComTrace"> <widget class="QCheckBox" name="chkErrTrace">
<property name="text"> <property name="text">
<string>COM Class Trace</string> <string>Log all SetError's to Trace log (creates a lot of output)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1" colspan="2"> <item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="chkKeyTrace"> <widget class="QCheckBox" name="chkGuiTrace">
<property name="text"> <property name="text">
<string>Key Trace</string> <string>GUI Trace</string>
</property>
</widget>
</item>
<item row="10" column="1" colspan="3">
<widget class="QCheckBox" name="chkNetFwTrace">
<property name="text">
<string>Network Firewall</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -121,7 +121,6 @@ void CSbiePlusAPI::OnStartFinished()
CSandBoxPlus::CSandBoxPlus(const QString& BoxName, class CSbieAPI* pAPI) : CSandBox(BoxName, pAPI) CSandBoxPlus::CSandBoxPlus(const QString& BoxName, class CSbieAPI* pAPI) : CSandBox(BoxName, pAPI)
{ {
m_bLogApiFound = false;
m_bINetBlocked = false; m_bINetBlocked = false;
m_bINetExceptions = false; m_bINetExceptions = false;
m_bSharesAllowed = false; m_bSharesAllowed = false;
@ -321,16 +320,6 @@ SB_PROGRESS CSandBoxPlus::ImportBox(const QString& FileName)
void CSandBoxPlus::UpdateDetails() void CSandBoxPlus::UpdateDetails()
{ {
//m_bLogApiFound = GetTextList("OpenPipePath", false).contains("\\Device\\NamedPipe\\LogAPI");
m_bLogApiFound = false;
QStringList InjectDlls = GetTextList("InjectDll", false);
foreach(const QString & InjectDll, InjectDlls) {
if (InjectDll.contains("logapi", Qt::CaseInsensitive)) {
m_bLogApiFound = true;
break;
}
}
m_bINetBlocked = false; m_bINetBlocked = false;
foreach(const QString& Entry, GetTextList("ClosedFilePath", false)) { foreach(const QString& Entry, GetTextList("ClosedFilePath", false)) {
if (Entry == "!<InternetAccess>,InternetAccessDevices") { if (Entry == "!<InternetAccess>,InternetAccessDevices") {
@ -703,8 +692,6 @@ QString CSandBoxPlus::GetStatusStr() const
if(m_bPrivacyEnhanced) if(m_bPrivacyEnhanced)
Status.append(tr("Privacy Enhanced")); Status.append(tr("Privacy Enhanced"));
if (m_bLogApiFound)
Status.append(tr("API Log"));
if (m_bINetBlocked) { if (m_bINetBlocked) {
if(m_bINetExceptions) if(m_bINetExceptions)
Status.append(tr("No INet (with Exceptions)")); Status.append(tr("No INet (with Exceptions)"));
@ -747,29 +734,6 @@ CSandBoxPlus::EBoxTypes CSandBoxPlus::GetTypeImpl() const
return eDefault; return eDefault;
} }
void CSandBoxPlus::SetLogApi(bool bEnable)
{
if (bEnable)
{
//InsertText("OpenPipePath", "\\Device\\NamedPipe\\LogAPI");
InsertText("InjectDll", "\\LogAPI\\logapi32.dll");
InsertText("InjectDll64", "\\LogAPI\\logapi64.dll");
#ifdef _M_ARM64
InsertText("InjectDllARM64", "\\LogAPI\\logapi64a.dll");
#endif
}
else
{
//DelValue("OpenPipePath", "\\Device\\NamedPipe\\LogAPI");
DelValue("InjectDll", "\\LogAPI\\logapi32.dll");
DelValue("InjectDll64", "\\LogAPI\\logapi64.dll");
#ifdef _M_ARM64
DelValue("InjectDllARM64", "\\LogAPI\\logapi64a.dll");
#endif
}
m_bLogApiFound = bEnable;
}
void CSandBoxPlus::SetINetBlock(bool bEnable) void CSandBoxPlus::SetINetBlock(bool bEnable)
{ {
if (bEnable) { if (bEnable) {

View File

@ -95,8 +95,6 @@ public:
virtual QString GetStatusStr() const; virtual QString GetStatusStr() const;
virtual void SetLogApi(bool bEnable);
virtual bool HasLogApi() const { return m_bLogApiFound; }
virtual void SetINetBlock(bool bEnable); virtual void SetINetBlock(bool bEnable);
virtual bool IsINetBlocked() const { return m_bINetBlocked; } virtual bool IsINetBlocked() const { return m_bINetBlocked; }
@ -216,7 +214,6 @@ protected:
QList<QSharedPointer<CBoxJob>> m_JobQueue; QList<QSharedPointer<CBoxJob>> m_JobQueue;
bool m_bLogApiFound;
bool m_bINetBlocked; bool m_bINetBlocked;
bool m_bINetExceptions; bool m_bINetExceptions;
bool m_bSharesAllowed; bool m_bSharesAllowed;

View File

@ -76,7 +76,6 @@ void COptionsWindow::CreateAdvanced()
connect(ui.chkGuiTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkGuiTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged()));
connect(ui.chkComTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkComTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged()));
connect(ui.chkNetFwTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkNetFwTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged()));
connect(ui.chkApiTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged()));
connect(ui.chkDbgTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkDbgTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged()));
connect(ui.chkErrTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged())); connect(ui.chkErrTrace, SIGNAL(clicked(bool)), this, SLOT(OnAdvancedChanged()));
@ -154,12 +153,6 @@ void COptionsWindow::LoadAdvanced()
ReadAdvancedCheck("NetFwTrace", ui.chkNetFwTrace, "*"); ReadAdvancedCheck("NetFwTrace", ui.chkNetFwTrace, "*");
ui.chkDbgTrace->setChecked(m_pBox->GetBool("DebugTrace", false)); ui.chkDbgTrace->setChecked(m_pBox->GetBool("DebugTrace", false));
ui.chkErrTrace->setChecked(m_pBox->GetBool("ErrorTrace", false)); ui.chkErrTrace->setChecked(m_pBox->GetBool("ErrorTrace", false));
QSharedPointer<CSandBoxPlus> pBoxPlus = m_pBox.objectCast<CSandBoxPlus>();
if (pBoxPlus) {
QString logApiPath = theAPI->GetSbiePath() + "\\LogAPI\\logapi32.dll";
ui.chkApiTrace->setVisible(QFile::exists(logApiPath));
ui.chkApiTrace->setChecked(pBoxPlus->HasLogApi());
}
// triggers // triggers
ui.treeTriggers->clear(); ui.treeTriggers->clear();
@ -294,9 +287,6 @@ void COptionsWindow::SaveAdvanced()
WriteAdvancedCheck(ui.chkNetFwTrace, "NetFwTrace", "*"); WriteAdvancedCheck(ui.chkNetFwTrace, "NetFwTrace", "*");
WriteAdvancedCheck(ui.chkDbgTrace, "DebugTrace", "y"); WriteAdvancedCheck(ui.chkDbgTrace, "DebugTrace", "y");
WriteAdvancedCheck(ui.chkErrTrace, "ErrorTrace", "y"); WriteAdvancedCheck(ui.chkErrTrace, "ErrorTrace", "y");
QSharedPointer<CSandBoxPlus> pBoxPlus = m_pBox.objectCast<CSandBoxPlus>();
if (pBoxPlus && ui.chkApiTrace->isVisible())
pBoxPlus->SetLogApi(ui.chkApiTrace->isChecked());
// triggers // triggers
QStringList StartProgram; QStringList StartProgram;

View File

@ -88,6 +88,29 @@ std::wstring hexStr(unsigned char* data, int len)
return s; return s;
} }
std::wstring MkLower(std::wstring Str)
{
for(std::wstring::size_type i = 0; i < Str.size(); i++)
{
std::wstring::value_type &Char = Str.at(i);
if((Char >= L'A') && (Char <= L'Z'))
Char += 32;
}
return Str;
}
std::wstring MkUpper(std::wstring Str)
{
for(std::wstring::size_type i = 0; i < Str.size(); i++)
{
std::wstring::value_type &Char = Str.at(i);
if((Char >= L'a') && (Char <= L'z'))
Char -= 32;
}
return Str;
}
bool FileExists(const wchar_t* path) bool FileExists(const wchar_t* path)
{ {
if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND) if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND)

View File

@ -38,6 +38,8 @@ extern std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> g_str_conv;
bool ListDir(std::wstring Path, std::vector<std::wstring>& Entries); bool ListDir(std::wstring Path, std::vector<std::wstring>& Entries);
std::wstring hexStr(unsigned char* data, int len); std::wstring hexStr(unsigned char* data, int len);
std::wstring MkLower(std::wstring Str);
std::wstring MkUpper(std::wstring Str);
template <typename T> template <typename T>
T Trimmx(const T& String, const T& Blank) T Trimmx(const T& String, const T& Blank)

View File

@ -817,7 +817,7 @@ std::shared_ptr<TAddonMap> ReadAddons(const JSONObject& jsonObject, const std::w
std::shared_ptr<SAddon> pAddon = ReadAddon(addon, core_arch, agent_arch, framework); std::shared_ptr<SAddon> pAddon = ReadAddon(addon, core_arch, agent_arch, framework);
(*pAddons)[pAddon->Id] = pAddon; (*pAddons)[MkLower(pAddon->Id)] = pAddon;
} }
} }
@ -1470,7 +1470,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
for (auto I = add_addons.begin(); I != add_addons.end(); ++I) for (auto I = add_addons.begin(); I != add_addons.end(); ++I)
{ {
auto F = pAddons->find(*I); auto F = pAddons->find(MkLower(*I));
if (F != pAddons->end()) { if (F != pAddons->end()) {
std::wcout << L"Downloading addon " << *I << std::endl; std::wcout << L"Downloading addon " << *I << std::endl;
ret = DownloadAddon(F->second, step, temp_dir, base_dir); ret = DownloadAddon(F->second, step, temp_dir, base_dir);
@ -1482,7 +1482,12 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
if (ret >= 0 && (step.empty() || step == L"apply")) if (ret >= 0 && (step.empty() || step == L"apply"))
{ {
std::wcout << L"Installing addon " << *I << std::endl; std::shared_ptr<SAddon> pAddon = LoadAddon(base_dir, *I);
if (pAddon && !pAddon->InstallPath.empty()) {
std::wcout << L"Updating addon " << *I << std::endl;
RemoveAddon(pAddon, base_dir);
} else
std::wcout << L"Installing addon " << *I << std::endl;
ret = InstallAddon(F->second, temp_dir, base_dir); ret = InstallAddon(F->second, temp_dir, base_dir);
// register addon // register addon