fix: PyarmorAssert bytes marshal type as new module
This commit is contained in:
@@ -101,7 +101,9 @@ PycRef<ASTNode> PyarmorMixStrDecrypt(const std::string &inputString, PycModule *
|
|||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
PycBuffer buf(result.data(), (int)result.length());
|
PycBuffer buf(result.data(), (int)result.length());
|
||||||
return new ASTObject(LoadObject(&buf, mod));
|
PycModule temp_mod;
|
||||||
|
temp_mod.copyFrom(*mod);
|
||||||
|
return new ASTObject(LoadObject(&buf, &temp_mod));
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
@@ -112,7 +114,9 @@ PycRef<ASTNode> PyarmorMixStrDecrypt(const std::string &inputString, PycModule *
|
|||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
PycBuffer buf(result.data(), (int)result.length());
|
PycBuffer buf(result.data(), (int)result.length());
|
||||||
auto obj = new ASTObject(LoadObject(&buf, mod));
|
PycModule temp_mod;
|
||||||
|
temp_mod.copyFrom(*mod);
|
||||||
|
auto obj = new ASTObject(LoadObject(&buf, &temp_mod));
|
||||||
// (pyarmor__1, pyarmor__2, pyarmor__3) = ('builtins', ('enumerate', 'ImportError', 'hasattr'), 0)
|
// (pyarmor__1, pyarmor__2, pyarmor__3) = ('builtins', ('enumerate', 'ImportError', 'hasattr'), 0)
|
||||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
auto tuple = obj->object().try_cast<PycTuple>();
|
auto tuple = obj->object().try_cast<PycTuple>();
|
||||||
|
@@ -327,6 +327,17 @@ void PycModule::loadFromOneshotSequenceFile(const char *filename)
|
|||||||
m_code = LoadObject(&in, this).cast<PycCode>();
|
m_code = LoadObject(&in, this).cast<PycCode>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PycModule::copyFrom(const PycModule& mod)
|
||||||
|
{
|
||||||
|
this->m_maj = mod.m_maj;
|
||||||
|
this->m_min = mod.m_min;
|
||||||
|
this->m_unicode = mod.m_unicode;
|
||||||
|
std::memcpy(this->pyarmor_aes_key, mod.pyarmor_aes_key, 16);
|
||||||
|
std::memcpy(this->pyarmor_mix_str_aes_nonce, mod.pyarmor_mix_str_aes_nonce, 12);
|
||||||
|
this->pyarmor_co_code_aes_nonce_xor_enabled = mod.pyarmor_co_code_aes_nonce_xor_enabled;
|
||||||
|
std::memcpy(this->pyarmor_co_code_aes_nonce_xor_key, mod.pyarmor_co_code_aes_nonce_xor_key, 12);
|
||||||
|
}
|
||||||
|
|
||||||
#define GET_REAL_OPERAND_2_AND_ADD_CURRENT_PTR(CUR, REF) \
|
#define GET_REAL_OPERAND_2_AND_ADD_CURRENT_PTR(CUR, REF) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
@@ -47,6 +47,7 @@ public:
|
|||||||
void loadFromFile(const char* filename);
|
void loadFromFile(const char* filename);
|
||||||
void loadFromMarshalledFile(const char *filename, int major, int minor);
|
void loadFromMarshalledFile(const char *filename, int major, int minor);
|
||||||
void loadFromOneshotSequenceFile(const char* filename);
|
void loadFromOneshotSequenceFile(const char* filename);
|
||||||
|
void copyFrom(const PycModule& mod);
|
||||||
bool isValid() const { return (m_maj >= 0) && (m_min >= 0); }
|
bool isValid() const { return (m_maj >= 0) && (m_min >= 0); }
|
||||||
|
|
||||||
int majorVer() const { return m_maj; }
|
int majorVer() const { return m_maj; }
|
||||||
|
@@ -174,7 +174,7 @@ void PycString::dasPrintAndDecrypt(std::ostream &stream, PycModule *mod, bool tr
|
|||||||
16,
|
16,
|
||||||
&nonce);
|
&nonce);
|
||||||
|
|
||||||
PycString decrypted(TYPE_UNICODE);
|
PycString decrypted(m_value[0] & 1 ? TYPE_UNICODE : TYPE_STRING);
|
||||||
decrypted.setValue(result);
|
decrypted.setValue(result);
|
||||||
decrypted.print(stream, mod, triple, parent_f_string_quote);
|
decrypted.print(stream, mod, triple, parent_f_string_quote);
|
||||||
stream << " # ";
|
stream << " # ";
|
||||||
|
Reference in New Issue
Block a user