Skip to content

Commit 165f482

Browse files
author
ORCA
authored
Add files via upload
0 parents  commit 165f482

25 files changed

+1647
-0
lines changed

HellShell.sln

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.32228.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HellShell", "HellShell\HellShell.vcxproj", "{F8F595CB-677C-46C0-9C13-F5108859A204}"
7+
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MacFuscation", "MacFuscation\MacFuscation.vcxproj", "{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}"
9+
EndProject
10+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IPv6Fuscation", "IPv6Fuscation\IPv6Fuscation.vcxproj", "{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}"
11+
EndProject
12+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IPv4Fuscation", "IPv4Fuscation\IPv4Fuscation.vcxproj", "{C235317F-60B3-4E0C-B4F1-D8925B0812B4}"
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|x64 = Debug|x64
17+
Debug|x86 = Debug|x86
18+
Release|x64 = Release|x64
19+
Release|x86 = Release|x86
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Debug|x64.ActiveCfg = Debug|x64
23+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Debug|x64.Build.0 = Debug|x64
24+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Debug|x86.ActiveCfg = Debug|Win32
25+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Debug|x86.Build.0 = Debug|Win32
26+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Release|x64.ActiveCfg = Release|x64
27+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Release|x64.Build.0 = Release|x64
28+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Release|x86.ActiveCfg = Release|Win32
29+
{F8F595CB-677C-46C0-9C13-F5108859A204}.Release|x86.Build.0 = Release|Win32
30+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Debug|x64.ActiveCfg = Debug|x64
31+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Debug|x64.Build.0 = Debug|x64
32+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Debug|x86.ActiveCfg = Debug|Win32
33+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Debug|x86.Build.0 = Debug|Win32
34+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Release|x64.ActiveCfg = Release|x64
35+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Release|x64.Build.0 = Release|x64
36+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Release|x86.ActiveCfg = Release|Win32
37+
{9EE52AA5-A7BC-4CAE-BCCC-9434B4B15921}.Release|x86.Build.0 = Release|Win32
38+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Debug|x64.ActiveCfg = Debug|x64
39+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Debug|x64.Build.0 = Debug|x64
40+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Debug|x86.ActiveCfg = Debug|Win32
41+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Debug|x86.Build.0 = Debug|Win32
42+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Release|x64.ActiveCfg = Release|x64
43+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Release|x64.Build.0 = Release|x64
44+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Release|x86.ActiveCfg = Release|Win32
45+
{F4CB3F0F-F502-4796-8E8B-9F9618895BFF}.Release|x86.Build.0 = Release|Win32
46+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Debug|x64.ActiveCfg = Debug|x64
47+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Debug|x64.Build.0 = Debug|x64
48+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Debug|x86.ActiveCfg = Debug|Win32
49+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Debug|x86.Build.0 = Debug|Win32
50+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Release|x64.ActiveCfg = Release|x64
51+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Release|x64.Build.0 = Release|x64
52+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Release|x86.ActiveCfg = Release|Win32
53+
{C235317F-60B3-4E0C-B4F1-D8925B0812B4}.Release|x86.Build.0 = Release|Win32
54+
EndGlobalSection
55+
GlobalSection(SolutionProperties) = preSolution
56+
HideSolutionNode = FALSE
57+
EndGlobalSection
58+
GlobalSection(ExtensibilityGlobals) = postSolution
59+
SolutionGuid = {07901455-13FE-40A7-9D8F-0FBC00B97FB7}
60+
EndGlobalSection
61+
EndGlobal

HellShell/Common.h

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#pragma once
2+
3+
#include <Windows.h>
4+
#include <stdio.h>
5+
6+
7+
typedef struct MyStruct {
8+
SIZE_T BytesNumber; // number of bytes read from the file
9+
PVOID pShell; // pointer to the shellcode read (here it is not appended)
10+
PVOID pNewShell; // pointer to the shellcode (appended)
11+
SIZE_T FinalSize; // the size of the new appended shellcode
12+
HANDLE hFile; // handle to the file created
13+
};
14+
15+
struct MyStruct PayloadData = { 0 };
16+
17+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
18+
// Function Used To Read The Shellcode.bin File, Save the size of the shellcode and the Pointer To its Buffer in our struct.
19+
BOOL ReadBinFile(char* FileInput) {
20+
HANDLE hFile;
21+
DWORD FileSize, lpNumberOfBytesRead;
22+
BOOL Succ;
23+
PVOID DllBytes;
24+
hFile = CreateFileA(FileInput, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
25+
if (hFile == INVALID_HANDLE_VALUE) {
26+
printf("[!] CreateFileA Failed With Error: [%d]\n", GetLastError());
27+
return FALSE;
28+
}
29+
FileSize = GetFileSize(hFile, NULL);
30+
DllBytes = malloc((SIZE_T)FileSize);
31+
Succ = ReadFile(hFile, DllBytes, FileSize, &lpNumberOfBytesRead, NULL);
32+
if (!Succ) {
33+
printf("[!] ReadFile Failed With Error:\n", GetLastError());
34+
return FALSE;
35+
}
36+
PayloadData.BytesNumber = (SIZE_T)lpNumberOfBytesRead;
37+
PayloadData.pShell = DllBytes;
38+
CloseHandle(hFile);
39+
return TRUE;
40+
}
41+
42+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
43+
// used to round up 'numToRound' to be multiple of 'multiple'
44+
// in ipv4 : multiple = 4
45+
// in ipv6 : multiple = 16
46+
// in Mac : multiple = 6
47+
int roundUp(int numToRound, int multiple) {
48+
if (multiple == 0) {
49+
return numToRound;
50+
}
51+
int remainder = numToRound % multiple;
52+
if (remainder == 0) {
53+
return numToRound;
54+
}
55+
return numToRound + multiple - remainder;
56+
}
57+
58+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
59+
// used to appened the shellcode with nops ant the end, the nops are added of size 'n'
60+
void AppendShellcode(int n) {
61+
unsigned char Nop[1] = { 0x90 };
62+
int MultipleByn, HowManyToAdd;
63+
PVOID NewPaddedShellcode;
64+
65+
MultipleByn = roundUp(PayloadData.BytesNumber, n);
66+
printf("[+] Constructing the Shellcode To Be Multiple Of %d, Target Size: %d \n", n, MultipleByn);
67+
HowManyToAdd = MultipleByn - PayloadData.BytesNumber;
68+
NewPaddedShellcode = malloc((SIZE_T)PayloadData.BytesNumber + HowManyToAdd + 1);
69+
memcpy(NewPaddedShellcode, PayloadData.pShell, PayloadData.BytesNumber);
70+
int i = 0;
71+
while (i != HowManyToAdd) {
72+
memcpy(PVOID((ULONG_PTR)NewPaddedShellcode + PayloadData.BytesNumber + i), Nop, 1);
73+
i++;
74+
}
75+
printf("[+] Added : %d \n", i);
76+
PayloadData.FinalSize = PayloadData.BytesNumber + HowManyToAdd;
77+
PayloadData.pNewShell = NewPaddedShellcode;
78+
}
79+
80+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
81+
// createfile of name 'FileName' to write the shellcode to
82+
BOOL WriteShellCodeFile( char * FileName, PBOOL Success) {
83+
HANDLE hFile;
84+
hFile = CreateFileA(FileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
85+
if (hFile == INVALID_HANDLE_VALUE) {
86+
printf("[!] CreateFileA Failed With Error: [%d]\n", GetLastError());
87+
*Success = FALSE;
88+
return FALSE;
89+
}
90+
PayloadData.hFile = hFile;
91+
*Success = TRUE;
92+
return TRUE;
93+
}

HellShell/HellShell.cpp

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#include <Windows.h>
2+
#include <stdio.h>
3+
#include <iostream>
4+
5+
#include "Common.h"
6+
#include "ipv4fuscation.h"
7+
#include "ipv6fuscation.h"
8+
#include "MacFuscation.h"
9+
10+
11+
#define IPv4Fuscation 1000
12+
#define MacFuscation 2000
13+
#define IPv6Fuscation 3000
14+
15+
16+
17+
int printUsage(char * MeLocation) {
18+
printf("[!] Usage: %s <payload file path> [Option*]\n", MeLocation);
19+
printf("[i] Option Can Be : \n");
20+
printf("\t[1] \"MacFuscation\" || \"mac\" ::: Output The Shellcode As A Array Of Mac Addresses [FC-48-83-E4-F0-E8]\n");
21+
printf("\t[2] \"Ipv4Fuscation\" || \"ipv4\" ::: Output The Shellcode As A Array Of ipv4 Addresses [252.72.131.228]\n");
22+
printf("\t[3] \"Ipv6Fuscation\" || \"ipv6\" ::: Output The Shellcode As A Array Of ipv6 Addresses [FC48:83E4:F0E8:C000:0000:4151:4150:5251]\n");
23+
printf("[i] ");
24+
system("PAUSE");
25+
return -1;
26+
}
27+
28+
void Logo() {
29+
30+
// it probably wont be printed like that but ehh
31+
std::cout << R"(
32+
33+
▄█ █▄ ▄████████ ▄█ ▄█ ▄████████ ▄█ █▄ ▄████████ ▄█ ▄█
34+
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███
35+
███ ███ ███ █▀ ███ ███ ███ █▀ ███ ███ ███ █▀ ███ ███
36+
▄███▄▄▄▄███▄▄ ▄███▄▄▄ ███ ███ ███ ▄███▄▄▄▄███▄▄ ▄███▄▄▄ ███ ███
37+
▀▀███▀▀▀▀███▀ ▀▀███▀▀▀ ███ ███ ▀███████████ ▀▀███▀▀▀▀███▀ ▀▀███▀▀▀ ███ ███
38+
███ ███ ███ █▄ ███ ███ ███ ███ ███ ███ █▄ ███ ███
39+
███ ███ ███ ███ ███▌ ▄ ███▌ ▄ ▄█ ███ ███ ███ ███ ███ ███▌ ▄ ███▌ ▄
40+
███ █▀ ██████████ █████▄▄██ █████▄▄██ ▄████████▀ ███ █▀ ██████████ █████▄▄██ █████▄▄██
41+
▀ ▀ ▀ ▀
42+
)" << "\t\t\t\t\t\t\t\t\t\t\t\tBY ORCA10K \n";
43+
}
44+
45+
46+
int main(int argc, char* argv[]) {
47+
int Type = 0;
48+
BOOL Success = FALSE;
49+
char OutputShellFileName[32];
50+
Logo();
51+
52+
// args check:
53+
if (argc != 3) {
54+
return printUsage(argv[0]);
55+
}
56+
57+
// checking if we can read the payload
58+
if ((!ReadBinFile(argv[1])) || PayloadData.pShell == NULL || PayloadData.BytesNumber == NULL) {
59+
system("PAUSE");
60+
return -1;
61+
}
62+
printf("[i] Size Of Shellcode: %ld \n", (unsigned int) PayloadData.BytesNumber);
63+
64+
// checking the format of the shellcode to output
65+
66+
if (strcmp(argv[2], "MacFuscation") == 0 || strcmp(argv[2], "macfuscation") == 0 || strcmp(argv[2], "mac") == 0 || strcmp(argv[2], "MAC") == 0){
67+
if (PayloadData.BytesNumber % 6 == 0) {
68+
printf("[i] The Shellcode is Already multiple of 6, No Need To Append Nops ... \n");
69+
PayloadData.pNewShell = malloc((SIZE_T)PayloadData.BytesNumber);
70+
memcpy(PayloadData.pNewShell, PayloadData.pShell, PayloadData.BytesNumber);
71+
PayloadData.FinalSize = PayloadData.BytesNumber;
72+
}
73+
else {
74+
printf("[i] The Shellcode is Not multiple of 6\n");
75+
AppendShellcode(6);
76+
}
77+
Type = MacFuscation;
78+
}
79+
80+
else if (strcmp(argv[2], "Ipv4Fuscation") == 0 || strcmp(argv[2], "ipv4fuscation") == 0 || strcmp(argv[2], "ipv4") == 0 || strcmp(argv[2], "IPV4") == 0) {
81+
if (PayloadData.BytesNumber % 4 == 0) {
82+
printf("[i] The Shellcode is Already multiple of 4, No Need To Append Nops ... \n");
83+
PayloadData.pNewShell = malloc((SIZE_T)PayloadData.BytesNumber);
84+
memcpy(PayloadData.pNewShell, PayloadData.pShell, PayloadData.BytesNumber);
85+
PayloadData.FinalSize = PayloadData.BytesNumber;
86+
}
87+
else {
88+
printf("[i] The Shellcode is Not multiple of 4\n");
89+
AppendShellcode(4);
90+
}
91+
Type = IPv4Fuscation;
92+
}
93+
94+
else if (strcmp(argv[2], "Ipv6Fuscation") == 0 || strcmp(argv[2], "ipv6fuscation") == 0 || strcmp(argv[2], "ipv6") == 0 || strcmp(argv[2], "IPV6") == 0) {
95+
if (PayloadData.BytesNumber % 16 == 0) {
96+
printf("[i] The Shellcode is Already multiple of 16, No Need To Append Nops ... \n");
97+
PayloadData.pNewShell = malloc((SIZE_T)PayloadData.BytesNumber);
98+
memcpy(PayloadData.pNewShell, PayloadData.pShell, PayloadData.BytesNumber);
99+
PayloadData.FinalSize = PayloadData.BytesNumber;
100+
}
101+
else {
102+
printf("[i] The Shellcode is Not multiple of 16\n");
103+
AppendShellcode(16);
104+
}
105+
Type = IPv6Fuscation;
106+
}
107+
108+
else {
109+
printf("[!] Unkown Input : %s \n", argv[2]);
110+
return printUsage(argv[0]);
111+
}
112+
113+
printf("[i] Final Shellcode Size : %ld\n", (unsigned int)PayloadData.FinalSize);
114+
unsigned char* FinallShell = (unsigned char*)malloc(PayloadData.FinalSize);
115+
memcpy(FinallShell, PayloadData.pNewShell, (SIZE_T)PayloadData.FinalSize);
116+
117+
// writing the decoder functions and the shellcode
118+
switch (Type){
119+
case IPv4Fuscation:
120+
strcpy(OutputShellFileName, "IPv4Fuscation.cpp");
121+
WriteShellCodeFile(OutputShellFileName, &Success);
122+
Generateipv4Output(PayloadData.FinalSize, FinallShell, &Success);
123+
break;
124+
case MacFuscation:
125+
strcpy(OutputShellFileName, "MacFuscation.cpp");
126+
WriteShellCodeFile(OutputShellFileName , &Success);
127+
GenerateMacOutput(PayloadData.FinalSize, FinallShell, &Success);
128+
break;
129+
case IPv6Fuscation:
130+
strcpy(OutputShellFileName, "IPv6Fuscation.cpp");
131+
WriteShellCodeFile(OutputShellFileName, &Success);
132+
Generateipv6Output(PayloadData.FinalSize, FinallShell, &Success);
133+
break;
134+
default:
135+
printf("[!] Unkown Error Occured %d \n", GetLastError());
136+
break;
137+
}
138+
139+
if (Success){
140+
printf("[+] Wrote The Shellcode And The Decoder To : %s \n", OutputShellFileName);
141+
}
142+
else{
143+
printf("[!] Failed To Write The Shellcode; Returned Error : %d \n", GetLastError());
144+
}
145+
146+
free(PayloadData.pNewShell);
147+
free(FinallShell);
148+
//printf("[#] Hit Enter To Exit ... \n");
149+
//getchar();
150+
return 0;
151+
}

0 commit comments

Comments
 (0)