釣魚攻擊第一彈-釋放檔案
之后所有文章發至《熊貓安全》公眾號上
獲取當前路徑
#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;
}

釋放任意資源檔案
- 首先把需要釋放的檔案通過winhex打開,然后點擊編輯->復制所有->C原始碼(C)
- VS 創建代碼->Windows桌面向導->靜態庫(.lib)
- 把第一步獲得的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即為你需要釋放的檔案

結語
這玩意有什么用呢,回歸標題**釣魚 **和 偽裝,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/503015.html
標籤:訊息安全
上一篇:【面試題】如何去掉vue的url地址中的#號?及其原理?
下一篇:檔案上傳漏洞
