Already working malware!
This commit is contained in:
parent
8ea13a43b6
commit
77798402e5
7 changed files with 195 additions and 51 deletions
|
|
@ -1,50 +1,48 @@
|
|||
// Malware.cpp<70>: d<>finit le point d'entr<74>e pour l'application console.
|
||||
//
|
||||
#pragma clang diagnostic ignored "-Wwritable-strings"
|
||||
|
||||
#include "stdafx.h" // IWYU pragma: keep
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include "tree.h"
|
||||
|
||||
char* this_is_useful_fr_dont_miss_it(){ // it's not, pure red herring
|
||||
char* useful = (char*) malloc(sizeof(char)*100);
|
||||
|
||||
for (int i = 0; i < 99; i++){
|
||||
useful[i] ^= useful[i+1] + 'c';
|
||||
}
|
||||
return useful;
|
||||
}
|
||||
|
||||
int _tmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
char* a = "bdgs";
|
||||
char* b = "\x00\x01\x02\x03";
|
||||
char* c = (char*) malloc(sizeof(char)*5);
|
||||
c = this_is_useful_fr_dont_miss_it();
|
||||
for(int i = 0; i < 4; i ++){
|
||||
c[i] = a[i] ^ b[i];
|
||||
}
|
||||
c[4] = '\0';
|
||||
if (argc > 1){
|
||||
char* d = (char*)malloc(sizeof(char)*9);
|
||||
char* e = (char*)malloc(sizeof(char)*9);
|
||||
for(int i = 0; i < 8; i++){
|
||||
e[i] = (char)argv[1][i]^'\x00';
|
||||
}
|
||||
e[8] = '\0';
|
||||
sprintf(d, "%s%s%s", c, gen_boop(), "\0baap"); // ça fait le string beep boop
|
||||
d[9] = '\0'; // pure bait
|
||||
if (!strcmp(d, e)) { // argument copié = "beepboop"?
|
||||
printf("Gagne!\n");
|
||||
} else {
|
||||
printf("%S\n",argv[1]);
|
||||
}
|
||||
} else {
|
||||
printf("Et il est où l'argv???????");
|
||||
}
|
||||
while(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Malware.cpp<70>: d<>finit le point d'entr<74>e pour l'application console.
|
||||
//
|
||||
#pragma clang diagnostic ignored "-Wwritable-strings"
|
||||
|
||||
#include "stdafx.h" // IWYU pragma: keep
|
||||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
#include "encryption.h"
|
||||
|
||||
char* this_is_useful_fr_dont_miss_it(){ // it's not, pure red herring
|
||||
char* useful = (char*) malloc(sizeof(char)*100);
|
||||
|
||||
for (int i = 0; i < 99; i++){
|
||||
useful[i] ^= useful[i+1] + 'c';
|
||||
}
|
||||
return useful;
|
||||
}
|
||||
|
||||
int _tmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
if(argc <= 1){
|
||||
printf("Il est où l'argv??????");
|
||||
exit(0);
|
||||
}
|
||||
// char* encoded = "Salut a tous les amis, gg pour avoir dechiffre ce string";
|
||||
char* encoded = "\x64\x55\x58\x41\x43\x14\x56\x13\x46\x5b\x47\x40\x14\x5e\x52\x47\x13\x56\x5e\x5d\x40\x1f\x13\x53\x54\x14\x42\x5b\x41\x40\x13\x53\x47\x58\x5d\x46\x14\x53\x51\x54\x5b\x5b\x52\x54\x41\x51\x12\x54\x51\x13\x44\x47\x46\x5a\x5d\x54";
|
||||
char* key = (char*) malloc(sizeof(char)*9);
|
||||
for(int i = 0; argv[1][i] != '\0'; ++i) {
|
||||
key[i] = (char) argv[1][i];
|
||||
}
|
||||
key[8]='\0';
|
||||
// printf("Key: %s\n", key);
|
||||
encrypt_decrypt(key,encoded);
|
||||
int sum = 0;
|
||||
for(int i = 0; encoded[i] != '\0'; i++){
|
||||
sum += (int) encoded[i];
|
||||
}
|
||||
if(sum == 5187){
|
||||
printf("%s", encoded);
|
||||
} else {
|
||||
printf("%S", argv[1]);
|
||||
}
|
||||
while (true) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,11 +129,13 @@
|
|||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="encryption.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="tree.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="encryption.cpp" />
|
||||
<ClCompile Include="Malware.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
<ClInclude Include="tree.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="encryption.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
@ -38,5 +41,8 @@
|
|||
<ClCompile Include="tree.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="encryption.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
89
Malware/Malware/encryption.cpp
Normal file
89
Malware/Malware/encryption.cpp
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#include "stdafx.h" // IWYU pragma: keep
|
||||
#include "encryption.h"
|
||||
#include "tree.h"
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <windows.h>
|
||||
|
||||
// 1re étape: chaque bit de la clé d'entrée est un gauche ou droite dans l'arbre
|
||||
// l'arbre est de profondeur inégale et random
|
||||
|
||||
Node* gen_tree(){
|
||||
Node* r = (Node*) malloc(sizeof(Node)); // root
|
||||
r->value = '1';
|
||||
Node* a = (Node*) malloc(sizeof(Node)); // left
|
||||
a->value = '8';
|
||||
Node* aa = (Node*) malloc(sizeof(Node)); // left left
|
||||
aa->value = '3';
|
||||
Node* ab = (Node*) malloc(sizeof(Node));
|
||||
ab->value = '7';
|
||||
Node* b = (Node*) malloc(sizeof(Node));
|
||||
b->value = '5';
|
||||
Node* ba = (Node*) malloc(sizeof(Node));
|
||||
ba->value = '4';
|
||||
Node* bb = (Node*) malloc(sizeof(Node));
|
||||
bb->value = '2';
|
||||
// defining tree links
|
||||
r->left = a;
|
||||
r->right = b;
|
||||
a->left = aa;
|
||||
a->right = ab;
|
||||
b->left = ba;
|
||||
b->right = bb;
|
||||
ab->left = NULL;
|
||||
bb->left = NULL;
|
||||
aa->left = NULL;
|
||||
ba->left = NULL;
|
||||
ab->right = NULL;
|
||||
bb->right = NULL;
|
||||
aa->right = NULL;
|
||||
ba->right = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
char* derive_key_from_tree(char* key){
|
||||
char* res = (char*) malloc(sizeof(char)*9*8);
|
||||
Node* root = gen_tree();
|
||||
Node* current = root;
|
||||
int i_key = 0;
|
||||
int i_res = 0;
|
||||
while(key[i_key] != '\0'){
|
||||
char character = key[i_key];
|
||||
for (int j = 0; j < 8; j++){
|
||||
int bit = ((character >> j) & 0x01); // gets byte number j
|
||||
if(bit){ // right
|
||||
current = current->r();
|
||||
} else { // left
|
||||
current = current->l();
|
||||
}
|
||||
if(current->is_leaf()){
|
||||
res[i_res] = current->v();
|
||||
current = root;
|
||||
i_res ++;
|
||||
}
|
||||
}
|
||||
i_key++;
|
||||
}
|
||||
res[i_res] = current->v();
|
||||
res[i_res+1] = '\0';
|
||||
return res;
|
||||
}
|
||||
|
||||
void encrypt_decrypt(char* key, char* msg){
|
||||
DWORD old;
|
||||
VirtualProtect(msg, 0x100, PAGE_EXECUTE_READWRITE, &old);
|
||||
char* newkey = derive_key_from_tree(key);
|
||||
// printf("%s\n",newkey);
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
while (msg[i] != '\0'){
|
||||
msg[i] ^= newkey[j];
|
||||
// printf("\\x%x",msg[i]);
|
||||
j++;
|
||||
if (newkey[j] == '\0'){
|
||||
j = 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
// printf("%s\n",msg);
|
||||
}
|
||||
1
Malware/Malware/encryption.h
Normal file
1
Malware/Malware/encryption.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
void encrypt_decrypt(char* key, char* msg);
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h" // IWYU pragma: keep
|
||||
#include "tree.h"
|
||||
|
||||
|
||||
char* gen_boop(){ // generates the "boop" string
|
||||
Node b;
|
||||
b.value = 'b';
|
||||
|
|
|
|||
49
backup/Malware_bak.cpp
Normal file
49
backup/Malware_bak.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// Malware.cpp<70>: d<>finit le point d'entr<74>e pour l'application console.
|
||||
//
|
||||
#pragma clang diagnostic ignored "-Wwritable-strings"
|
||||
|
||||
#include "stdafx.h" // IWYU pragma: keep
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
|
||||
char* this_is_useful_fr_dont_miss_it(){ // it's not, pure red herring
|
||||
char* useful = (char*) malloc(sizeof(char)*100);
|
||||
|
||||
for (int i = 0; i < 99; i++){
|
||||
useful[i] ^= useful[i+1] + 'c';
|
||||
}
|
||||
return useful;
|
||||
}
|
||||
|
||||
int _tmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
char* a = "bdgs";
|
||||
char* b = "\x00\x01\x02\x03";
|
||||
char* c = (char*) malloc(sizeof(char)*5);
|
||||
c = this_is_useful_fr_dont_miss_it();
|
||||
for(int i = 0; i < 4; i ++){
|
||||
c[i] = a[i] ^ b[i];
|
||||
}
|
||||
c[4] = '\0';
|
||||
if (argc > 1){
|
||||
char* d = (char*)malloc(sizeof(char)*9);
|
||||
char* e = (char*)malloc(sizeof(char)*9);
|
||||
for(int i = 0; i < 8; i++){
|
||||
e[i] = (char)argv[1][i]^'\x00';
|
||||
}
|
||||
e[8] = '\0';
|
||||
sprintf(d, "%s%s%s", c, gen_boop(), "\0baap"); // ça fait le string beep boop
|
||||
d[9] = '\0'; // pure bait
|
||||
if (!strcmp(d, e)) { // argument copié = "beepboop"?
|
||||
printf("Gagne!\n");
|
||||
} else {
|
||||
printf("%S\n",argv[1]);
|
||||
}
|
||||
} else {
|
||||
printf("Et il est où l'argv???????");
|
||||
}
|
||||
while(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue