蛮力攻击项目
Bruteforce Attack Project
我正在为一个项目(与学校无关)创建一个简单的"暴力攻击"。谁能告诉我代码的哪一部分是错误的,得到这些错误。
代码:
#include <string>
using namespace std;
//Password array
std::string passwordArray;
//Lowercare character array
std::string lower = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
//Uppercase character array
std::string upper = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
//Digits array
std::string digits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
private void setupCharArray()
{
if (ckhLower.Checked)
{
characterArray.AddRange(lower);
}
if (chkUpper.Checked)
{
characterArray.AddRange(upper);
}
if (chkDigits.Checked)
{
characterArray.AddRange(digits);
}
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
brute();
}
所以我尝试使用MinGW
编译这段代码g++ bruteforce.cpp -o bruteforce.exe
我得到了这些错误信息c:UsersLotty PlayleDocuments>g++ bruteforce.cpp -o bruteforce.exe
bruteforce.cpp:7:66: error: in C++98 'lower' must be initialized by constructor,
not by '{...}'
bruteforce.cpp:7:66: error: could not convert '{"a", "b", "c", "d", "e", "f", "g
", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w
", "x", "y", "z"}' from '<brace-enclosed initializer list>' to 'std::string {aka
std::basic_string<char>}'
bruteforce.cpp:10:66: error: in C++98 'upper' must be initialized by constructor
, not by '{...}'
bruteforce.cpp:10:66: error: could not convert '{"A", "B", "C", "D", "E", "F", "
G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "
W", "X", "Y", "Z"}' from '<brace-enclosed initializer list>' to 'std::string {ak
a std::basic_string<char>}'
bruteforce.cpp:12:73: error: in C++98 'digits' must be initialized by constructo
r, not by '{...}'
bruteforce.cpp:12:73: error: could not convert '{"0", "1", "2", "3", "4", "5", "
6", "7", "8", "9"}' from '<brace-enclosed initializer list>' to 'std::string {ak
a std::basic_string<char>}'
bruteforce.cpp:14:1: error: expected unqualified-id before 'private'
如果有人知道我做错了什么,请告诉我。
L x字符串数组应该是这样的:(与[]
)
std::string lower[] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
字符的std::string
看起来像这样:
std::string lower = "abcdefghijklmnopqrstuvwxyz";
请注意,使用一堆std::string
s来表示字符是非常低效的。您应该使用字符数组,或者只使用ascii算术。
相关文章:
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 无法在 CLion 中构建 C++ 项目
- 运行同一解决方案的另一个项目的项目
- CMake-按正确顺序将项目与C运行时对象文件链接
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 欧拉项目#8答案是大以获得有效答案
- 从链接列表c++中删除一个项目
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 既然存在危险,为什么项目要使用-I include开关
- cmake在我的项目中所需的所有静态库都不成功
- QT通过C++添加映射QML项目
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 在linux上调试巨大的C++项目
- 在其他文件中创建类时在 c++ 项目中不起作用
- 使外部项目可用于find_package CMake
- 在子目录中使用target_sources()命令时用于单元测试(qtest)的项目结构
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- 如何维护资源管理器项目视图中当前可见的项目列表
- C++Brute Force攻击函数不会返回结果
- 蛮力攻击项目