Skip to content

Commit

Permalink
Update audio sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoLezury committed Jan 26, 2022
1 parent 9a7288e commit 7cffcc4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/def.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <Windows.h>
#define PAYLOAD_TIME 10
#define AUDIO_NUM 5
#define AUDIO_NUM 10
typedef union _RGBQUAD {
COLORREF rgb;
struct {
Expand Down
15 changes: 10 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ int WinMain(
) {

AUDIO_SEQUENCE_PARAMS pAudioSequences[AUDIO_NUM] = {0};
pAudioSequences[0] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence1};
pAudioSequences[1] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence2};
pAudioSequences[2] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence3};
pAudioSequences[3] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence4};
pAudioSequences[4] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence5};
pAudioSequences[0] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence1 };
pAudioSequences[1] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence2 };
pAudioSequences[2] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence3 };
pAudioSequences[3] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence4 };
pAudioSequences[4] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence5 };
pAudioSequences[5] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence6 };
pAudioSequences[6] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence7 };
pAudioSequences[7] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence8 };
pAudioSequences[8] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence9 };
pAudioSequences[9] = { 8000, 8000 * PAYLOAD_TIME, AudioSequence10 };

SeedXorshift32((DWORD)__rdtsc());

Expand Down
42 changes: 39 additions & 3 deletions src/payloads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,42 @@ void AudioSequence5(int nSamplesPerSec, int nSampleCount, PSHORT psSamples) {
((BYTE*)psSamples)[t] = bFreq;
}
}

void AudioSequence6(int nSamplesPerSec, int nSampleCount, PSHORT psSamples) {
for (INT t = 0; t < nSampleCount * 2; t++) {
BYTE bFreq = (BYTE)(t >> 5 | (t >> 2) * (t >> 5));
((BYTE*)psSamples)[t] = bFreq;
}
}

void AudioSequence7(int nSamplesPerSec, int nSampleCount, PSHORT psSamples) {
for (INT t = 0; t < nSampleCount * 2; t++) {
BYTE bFreq = (BYTE)(100 * ((t << 2 | t >> 5 | t ^ 63) & (t << 10 | t >> 11)));
((BYTE*)psSamples)[t] = bFreq;
}
}

void AudioSequence8(int nSamplesPerSec, int nSampleCount, PSHORT psSamples) {
for (INT t = 0; t < nSampleCount * 2; t++) {
BYTE bFreq = (BYTE)(t / 8 >> (t >> 9) * t / ((t >> 14 & 3) + 4));
((BYTE*)psSamples)[t] = bFreq;
}
}

void AudioSequence9(int nSamplesPerSec, int nSampleCount, PSHORT psSamples) {
for (INT t = 0; t < nSampleCount * 2; t++) {
BYTE bFreq = (BYTE)(10 * (t & 5 * t | t >> 6 | (t & 32768 ? -6 * t / 7 : (t & 65536 ? -9 * t & 100 : -9 * (t & 100)) / 11)));
((BYTE*)psSamples)[t] = bFreq;
}
}

void AudioSequence10(int nSamplesPerSec, int nSampleCount, PSHORT psSamples) {
for (INT t = 0; t < nSampleCount * 2; t++) {
BYTE bFreq = (BYTE)(10 * (t >> 7 | 3 * t | t >> (t >> 15)) + (t >> 8 & 5));
((BYTE*)psSamples)[t] = bFreq;
}
}

void ExecutePayload(TROJAN_PAYLOAD payload, int nTime) {
int dwStartTime = Time;
for (int i = 0; Time < (dwStartTime + nTime); i++) {
Expand Down Expand Up @@ -186,10 +222,10 @@ void Payload4(int t, HDC hdcScreen) {
blf.AlphaFormat = 0;

AlphaBlend(hdcScreen, ptScreen.x + t % 200 + 10, ptScreen.y - t % 25, szScreen.cx, szScreen.cy, hcdc, ptScreen.x, ptScreen.y, szScreen.cx, szScreen.cy, blf);

DeleteObject(hcdc);
DeleteObject(hBitmap);

Sleep(20);
}

Expand Down Expand Up @@ -258,7 +294,7 @@ void Payload7(int t, HDC hdcScreen) {
SetTextColor(hdcScreen, RGB(random() % 256, random() % 256, random() % 256));

TextOut(hdcScreen, random() % szScreen.cx, random() % szScreen.cy, L"HYDROGEN", 8);

AlphaBlend(hdcScreen, 0, 0, szScreen.cx, szScreen.cy, hcdc, 0, 0, szScreen.cx, szScreen.cy, blf);

DeleteObject(hcdc);
Expand Down
5 changes: 5 additions & 0 deletions src/payloads.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ extern void AudioSequence2(int nSamplesPerSec, int nSampleCount, PSHORT psSample
extern void AudioSequence3(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);
extern void AudioSequence4(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);
extern void AudioSequence5(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);
extern void AudioSequence6(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);
extern void AudioSequence7(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);
extern void AudioSequence8(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);
extern void AudioSequence9(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);
extern void AudioSequence10(int nSamplesPerSec, int nSampleCount, PSHORT psSamples);

extern void Payload1(int t, HDC hdcScreen);
extern void Payload2(int t, HDC hdcScreen);
Expand Down

0 comments on commit 7cffcc4

Please sign in to comment.