能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
[ReverseMe挑战赛]有没有2等级??
5楼的应该没问题了,好累。。
TreadStone这个引擎果然强大,实现了一种更复杂的加密手段,强度大大超过了VMProtect,杜绝了VMProtect一些脆弱性的地方,值得推荐
|
能力值:
(RANK:1130 )
|
-
-
[ReverseMe挑战赛]有没有2等级??
你的程序,BYTE和char是一样的,超过0x7F是无法输入的
DWORD __fastcall fn(BYTE* pbuf, int len)
{
DWORD result = 0;
if(len >= 8)
{
for(int i = 0; i < len; i++)
{
result = _lrotl(((((~(_lrotl(result, 3) + pbuf[i])) ^ 0x20141001) + 0x20141007) * 0xCEBEA6DA), 7);
}
result = ~result;
{
BYTE a[10] = {0x15, 0x30, 0x26, 0x25, 0x21, 0x15, 0x33, 0x27, 0x27, 0x2F};
BYTE b[10] = {0x83, 0x97, 0xA9, 0x99, 0xA7, 0xA9, 0x9C, 0x85, 0x9E, 0x5B};
for(int i = 0; i < 10; i ++)
{
result = (~(((~_lrotl(result, 5)) ^ a[i] ^ (0x41 + i)) + b[i])) + (0x31 + i);
}
}
result ^= 0x19810304;
}
return result;
}
|
能力值:
(RANK:1130 )
|
-
-
[ReverseMe挑战赛]有没有2等级??
第二版
DWORD __fastcall fn(char* pbuf, int len)
{
DWORD result = 0;
if(len >= 8)
{
for(int i = 0; i < len; i++)
{
result = _lrotl(((((~(_lrotl(result, 3) + pbuf[i])) ^ 0x20141001) + 0x20141007) * 0xCEBEA6DA), 7);
}
result = ~result;
{
BYTE a[10] = {0x15, 0x30, 0x26, 0x25, 0x21, 0x15, 0x33, 0x27, 0x27, 0x2F};
BYTE b[10] = {0x83, 0x97, 0xA9, 0x99, 0xA7, 0xA9, 0x9C, 0x85, 0x9E, 0x5B};
for(int i = 0; i < 10; i ++)
{
result = (~(((~_lrotl(result, 5)) ^ a[i] ^ (0x41 + i)) + b[i])) + (0x31 + i);
}
}
result ^= 0x19810304;
}
return result;
}
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
[原创]利用StrongOD漏洞反调试
Ollydbg,无法在RVA=0的地方下CC断点
AddressOfEntryPoint =0这个问题,基本上很难处理
不过,对于PE里面AddressOfEntryPoint = 0,这个配置,实在太特殊了,反过来说,也很好解决啊
另外,如果DLL的AddressOfEntryPoint = 0,DllMain无法执行
所以感觉关系不大,就没去处理这个
处理方法也有,不过感觉没啥意义,就是在RVA=0的地方下硬件执行断点,就可以断下来了
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
[原创]原创读写锁,求测试
个人认为还不错的共享锁架构
可以解决31楼说的空转问题,依然不建议重入
// 读写锁
#if !defined(_WIN32) && !defined(_WIN64)
# include <pthread.h>
typedef pthread_mutex_t Lock_type;
typedef pthread_cond_t WaitCondition;
typedef pthread_t ThreadHandle;
# define lock_init(x) pthread_mutex_init(&(x), NULL)
# define lock_grab(x) pthread_mutex_lock(&(x))
# define lock_release(x) pthread_mutex_unlock(&(x))
# define lock_destroy(x) pthread_mutex_destroy(&(x))
# define cond_init(x) pthread_cond_init(&(x), NULL)
# define cond_destroy(x) pthread_cond_destroy(&(x))
# define cond_signal(x) pthread_cond_signal(&(x))
# define cond_timedwait(x,y,z) pthread_cond_timedwait(&(x),&(y),z)
# define cond_wait(x,y) pthread_cond_wait(&(x),&(y))
# define sem_init(x) pthread_cond_init(&(x), NULL)
# define sem_destroy(x) pthread_cond_destroy(&(x))
# define sem_signal_one(x) pthread_cond_signal(&(x))
# define sem_signal_all(x) pthread_cond_broadcast(&(x))
# define sem_timedwait(x,y,z) pthread_cond_timedwait(&(x),&(y),z)
# define sem_wait(x,y) pthread_cond_wait(&(x),&(y))
# define thread_create(x,f,id) !pthread_create(&(x),NULL,(void* (*)(void*))f,&(id))
# define thread_join(x) pthread_join(x, NULL)
#else
#include <Windows.h>
#include <limits.h>
typedef CRITICAL_SECTION Lock_type;
typedef HANDLE WaitCondition;
typedef HANDLE ThreadHandle;
#define lock_init(x) InitializeCriticalSection(&(x))
#define lock_grab(x) EnterCriticalSection(&(x))
#define lock_release(x) LeaveCriticalSection(&(x))
#define lock_destroy(x) DeleteCriticalSection(&(x))
#define cond_init(x) { x = CreateEvent(0, FALSE, FALSE, 0); }
#define cond_destroy(x) CloseHandle(x)
#define cond_signal(x) SetEvent(x)
#define cond_timedwait(x,y,z) { lock_release(y); WaitForSingleObject(x,z); lock_grab(y); }
#define cond_wait(x,y) { cond_timedwait((x), (y), INFINITE); }
#define sem_init(x) { x = CreateSemaphore(0, 0, LONG_MAX, 0); }
#define sem_destroy(x) { CloseHandle((x)); }
#define sem_signal(x,y) { ReleaseSemaphore((x), (y), 0); }
#define sem_signal_one(x) { sem_signal((x), 1); }
#define sem_signal_all(x) { sem_signal((x), LONG_MAX); }
#define sem_timedwait(x,y,z) { lock_release((y)); WaitForSingleObject((x), (z));lock_grab((y)); }
#define sem_wait(x,y) { sem_timedwait((x), (y), INFINITE); }
#define thread_create(x,f,t) (x = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)f,(&t),0,NULL), x != NULL)
#define thread_join(x) { WaitForSingleObject(x, INFINITE); CloseHandle(x); }
#endif
typedef struct _swrlock_type
{
// 互斥锁
Lock_type lock;
// 共享等待信号量
WaitCondition shared_cond;
// 独占等待信号量
WaitCondition exclusive_cond;
// 共享锁数目
int shared_count;
// 独占锁等待数目
int exclusive_wait_count;
// 是否独占状态
bool exclusive;
}swrlock_type;
static void srwlock_init(swrlock_type* swrlock)
{
lock_init(swrlock->lock);
sem_init(swrlock->shared_cond);
sem_init(swrlock->exclusive_cond);
swrlock->shared_count = 0;
swrlock->exclusive_wait_count = 0;
swrlock->exclusive = false;
}
static void srwlock_destroy(swrlock_type* swrlock)
{
sem_destroy(swrlock->exclusive_cond);
sem_destroy(swrlock->shared_cond);
lock_destroy(swrlock->lock);
}
static void srwlock_shared_grab(swrlock_type* swrlock)
{
lock_grab(swrlock->lock);
while(swrlock->exclusive || swrlock->exclusive_wait_count)
{
sem_wait(swrlock->shared_cond, swrlock->lock);
}
swrlock->shared_count ++;
lock_release(swrlock->lock);
}
static void srwlock_shared_release(swrlock_type* swrlock)
{
bool noshared;
lock_grab(swrlock->lock);
noshared = !(-- swrlock->shared_count);
if(noshared)
{
sem_signal_one(swrlock->exclusive_cond);
sem_signal_all(swrlock->shared_cond);
}
lock_release(swrlock->lock);
}
static void srwlock_exclusive_grab(swrlock_type* swrlock)
{
lock_grab(swrlock->lock);
swrlock->exclusive_wait_count ++;
while(swrlock->exclusive || swrlock->shared_count)
{
sem_wait(swrlock->exclusive_cond, swrlock->lock);
}
swrlock->exclusive_wait_count --;
swrlock->exclusive = true;
lock_release(swrlock->lock);
}
static void srwlock_exclusive_release(swrlock_type* swrlock)
{
lock_grab(swrlock->lock);
swrlock->exclusive = false;
sem_signal_one(swrlock->exclusive_cond);
sem_signal_all(swrlock->shared_cond);
lock_release(swrlock->lock);
}
|
能力值:
(RANK:1130 )
|
-
-
[原创]原创读写锁,求测试
读写锁的应用情景本来就是读的频率远远大于写的频率,为了保证读的效率,而设计出来的
写的时候,浪费一点点CPU,不是什么大问题
当然,设计成信号量也不复杂
|
能力值:
(RANK:1130 )
|
-
-
|
能力值:
(RANK:1130 )
|
-
-
[原创]原创读写锁,求测试
我给个我写的windows平台下精简版的SRWLock
不支持重入
#pragma pack(push, 8)
typedef struct _MYSRWLOCK
{
CRITICAL_SECTION csWriter;
void* pSharedCount;
} MYSRWLOCK;
typedef MYSRWLOCK *PMYSRWLOCK;
#pragma pack(pop)
static void MyInitializeSRWLock(PMYSRWLOCK srwlock)
{
InitializeCriticalSectionAndSpinCount(&srwlock->csWriter, 0xFA0);
srwlock->pSharedCount = _aligned_malloc(sizeof(LONG), MEMORY_ALLOCATION_ALIGNMENT);
_InterlockedExchange((volatile LONG*)srwlock->pSharedCount, 0);
}
static void MyFreeSRWLock(PMYSRWLOCK srwlock)
{
DeleteCriticalSection(&srwlock->csWriter);
_aligned_free(srwlock->pSharedCount);
}
class SRWLockShared
{
public:
static void Acquire(PMYSRWLOCK srwlock)
{
EnterCriticalSection(&srwlock->csWriter);
_InterlockedIncrement((volatile LONG*)srwlock->pSharedCount);
LeaveCriticalSection(&srwlock->csWriter);
}
static void Release(PMYSRWLOCK srwlock)
{
_InterlockedDecrement((volatile LONG*)srwlock->pSharedCount);
}
SRWLockShared(PMYSRWLOCK srwlock) : m_srwlock(srwlock)
{
Acquire(m_srwlock);
}
~SRWLockShared()
{
Release(m_srwlock);
}
private:
PMYSRWLOCK m_srwlock;
};
class SRWLockExclusive
{
public:
static void Acquire(PMYSRWLOCK srwlock)
{
EnterCriticalSection(&srwlock->csWriter);
while(_InterlockedCompareExchange((volatile LONG*)srwlock->pSharedCount, -1, 0) != 0);
}
static void Release(PMYSRWLOCK srwlock)
{
_InterlockedIncrement((volatile LONG*)srwlock->pSharedCount);
LeaveCriticalSection(&srwlock->csWriter);
}
SRWLockExclusive(PMYSRWLOCK srwlock) : m_srwlock(srwlock)
{
Acquire(m_srwlock);
}
~SRWLockExclusive()
{
Release(m_srwlock);
}
private:
PMYSRWLOCK m_srwlock;
};
用法:
MYSRWLOCK m_lock;
初始化
MyInitializeSRWLock(&m_lock);
销毁
MyFreeSRWLock(&m_lock);
共享锁
{
SRWLockShared lock(&m_lock);
}
互斥锁
{
SRWLockExclusive lock(&m_lock);
}
|