xorstring lazım

normalde exe nin içine yazdığın tüm stringler düz okunabiliyor biri hex editörle açsa direkt görür api keyleri mesajları falan XorStr bunları derleme anında şifreliyor binary de sadece çöp byte görünüyo çalışırken çözüp kullanıyo sonra bellekten siliyo yani reverse engineer strings çektiğinde bişey bulamıyor
eyw
 
Bu kullanıcıyla herhangi bir iş veya ticaret yapmak istiyorsanız, forumdan uzaklaştırıldığını sakın unutmayın.
Buyur hocam temiz hali;

#pragma once
#include <cstdint>
#include <cstddef>
#include <atomic>
#ifdef _WIN32
#include <windows.h>
#endif
namespace xor_detail {
constexpr uint8_t key_at(uint64_t seed, size_t i) {
uint32_t h = static_cast<uint32_t>(i) ^ static_cast<uint32_t>(seed & 0xFFFFFFFF);
h ^= static_cast<uint32_t>(seed >> 32);
h = (h ^ (h >> 7)) * 0x45D9F3Bu;
h = (h ^ (h >> 13)) * 0x1315423u;
h = (h ^ (h >> 11)) * 0x27D4EB2Fu;
return static_cast<uint8_t>((h ^ (h >> 15)) & 0xFF);
}
constexpr uint64_t make_seed(uint64_t line, uint64_t counter) {
uint64_t s = line * 0x517CC1B727220A95ULL + counter * 0x6C62272E07BB0142ULL;
s ^= (s >> 33);
s *= 0xFF51AFD7ED558CCDULL;
s ^= (s >> 33);
return s;
}

inline void secure_wipe(void* ptr, size_t len) {
#ifdef _WIN32
SecureZeroMemory(ptr, len);
#else
volatile unsigned char* p = static_cast<volatile unsigned char*>(ptr);
for (size_t i = 0; i < len; ++i)
p = 0;
std::atomic_signal_fence(std::memory_order_seq_cst);
#endif
}
template<size_t N>
struct EncData {
char data[N];
constexpr EncData(const char(&str)[N], uint64_t seed) : data{} {
for (size_t i = 0; i < N; ++i)
data = static_cast<char>(str ^ key_at(seed, i));
}
};
template<size_t N>
struct SecureBuf {
char data[N];
bool active;
#ifdef _MSC_VER
__forceinline
#else
__attribute__((always_inline)) inline
#endif
void decrypt(const EncData<N>& enc, uint64_t seed) {
active = true;
for (size_t i = 0; i < N; ++i)
data = static_cast<char>(enc.data ^ key_at(seed, i));
}
#ifdef _MSC_VER
__declspec(noinline)
#else
__attribute__((noinline))
#endif
~SecureBuf() {
if (active) {
secure_wipe(data, N);
}
}
operator const char*() const { return data; }
SecureBuf(const SecureBuf&) = delete;
SecureBuf& operator=(const SecureBuf&) = delete;
};
}
#define XorStr(str) \
[&]() -> ::xor_detail::SecureBuf<sizeof(str)> { \
constexpr auto _seed = ::xor_detail::make_seed(__LINE__, __COUNTER__); \
static constexpr ::xor_detail::EncData _enc(str, _seed); \
::xor_detail::SecureBuf<sizeof(str)> _buf{}; \
_buf.decrypt(_enc, _seed); \
return _buf; \
}()
ram e gelince çözülürmü ?
 
Buyur hocam temiz hali;

#pragma once
#include <cstdint>
#include <cstddef>
#include <atomic>
#ifdef _WIN32
#include <windows.h>
#endif
namespace xor_detail {
constexpr uint8_t key_at(uint64_t seed, size_t i) {
uint32_t h = static_cast<uint32_t>(i) ^ static_cast<uint32_t>(seed & 0xFFFFFFFF);
h ^= static_cast<uint32_t>(seed >> 32);
h = (h ^ (h >> 7)) * 0x45D9F3Bu;
h = (h ^ (h >> 13)) * 0x1315423u;
h = (h ^ (h >> 11)) * 0x27D4EB2Fu;
return static_cast<uint8_t>((h ^ (h >> 15)) & 0xFF);
}
constexpr uint64_t make_seed(uint64_t line, uint64_t counter) {
uint64_t s = line * 0x517CC1B727220A95ULL + counter * 0x6C62272E07BB0142ULL;
s ^= (s >> 33);
s *= 0xFF51AFD7ED558CCDULL;
s ^= (s >> 33);
return s;
}

inline void secure_wipe(void* ptr, size_t len) {
#ifdef _WIN32
SecureZeroMemory(ptr, len);
#else
volatile unsigned char* p = static_cast<volatile unsigned char*>(ptr);
for (size_t i = 0; i < len; ++i)
p = 0;
std::atomic_signal_fence(std::memory_order_seq_cst);
#endif
}
template<size_t N>
struct EncData {
char data[N];
constexpr EncData(const char(&str)[N], uint64_t seed) : data{} {
for (size_t i = 0; i < N; ++i)
data = static_cast<char>(str ^ key_at(seed, i));
}
};
template<size_t N>
struct SecureBuf {
char data[N];
bool active;
#ifdef _MSC_VER
__forceinline
#else
__attribute__((always_inline)) inline
#endif
void decrypt(const EncData<N>& enc, uint64_t seed) {
active = true;
for (size_t i = 0; i < N; ++i)
data = static_cast<char>(enc.data ^ key_at(seed, i));
}
#ifdef _MSC_VER
__declspec(noinline)
#else
__attribute__((noinline))
#endif
~SecureBuf() {
if (active) {
secure_wipe(data, N);
}
}
operator const char*() const { return data; }
SecureBuf(const SecureBuf&) = delete;
SecureBuf& operator=(const SecureBuf&) = delete;
};
}
#define XorStr(str) \
[&]() -> ::xor_detail::SecureBuf<sizeof(str)> { \
constexpr auto _seed = ::xor_detail::make_seed(__LINE__, __COUNTER__); \
static constexpr ::xor_detail::EncData _enc(str, _seed); \
::xor_detail::SecureBuf<sizeof(str)> _buf{}; \
_buf.decrypt(_enc, _seed); \
return _buf; \
}()
bu işte tam aradığıma en yakın xorstr ellerinize vaktinize sağlık teşekkürler
tenor.gif
 

Şuanda konuyu görüntüleyen kullanıcılar

Geri
Üst Alt