Skip to content

Commit

Permalink
organized structure
Browse files Browse the repository at this point in the history
  • Loading branch information
lenonleite committed Oct 2, 2016
1 parent 54984d3 commit a0c5498
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 18 deletions.
32 changes: 32 additions & 0 deletions src/Mailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Aszone\Avenger;

class Mailer
{
private $transporterMail;

//function __construct(Swift_Mailer $swiftMailer, Swift_Message $swiftMessage)
public function __construct()
{
$config = parse_ini_file('config/data.ini', true);
$configMail = $config['email'];

$this->transporterMail = \Swift_SmtpTransport::newInstance($configMail['host'], $configMail['port'], $configMail['security'])
->setUsername($configMail['username'])
->setPassword($configMail['password']);
}

public function sendMessage($to, $body)
{
$mailer = \Swift_Mailer::newInstance($this->transporterMail);
$message = \Swift_Message::newInstance('Result of Avenger')
->setFrom($to)
->setTo($to)
->setBody(strip_tags($body))
->addPart($body, 'text/html');
$numSent = $mailer->send($message);

return $numSent;
}
}
56 changes: 38 additions & 18 deletions src/SearchHackingEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ protected function configure()
new InputOption(
'email',
null,
InputOption::VALUE_NONE,
'Set the mail for send result. Example: --email'),
InputOption::VALUE_REQUIRED,
'Set the mail for send result. Example: --email="lenonleite@gmail.com"'),
new InputOption(
'exploit',
null,
Expand Down Expand Up @@ -131,7 +131,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
'torl' => $this->torl,
'virginProxies' => $this->vp,
'check' => $this->check,
'exploit' => $this->exploit,
'email' => $this->email,

);
$dorks = explode('||',$commandData['dork']);
foreach($dorks as $dork){
Expand Down Expand Up @@ -198,9 +199,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->printResult($result, $output, 'Result list of Search:');
$this->printResumeResult($output, 'Patch File of Search:', $file);
if (!empty($this->check)) {
$this->checkVunerabilities($nameFile, $result, $commandData, $output);
$resultsOfCheck=$this->checkVunerabilities($nameFile, $result, $commandData, $output);
}
if (!empty($this->exploit)) {
$this->checkExploits($resultsOfCheck,$commandData,$output);
}



sleep(5);
}
}
Expand All @@ -227,7 +233,7 @@ protected function validParamns(InputInterface $input, OutputInterface $output)
$this->torl = $input->getOption('torl');
$this->check = $this->sanitazeValuesOfEnginers($input->getOption('check'));
$this->pl = $input->getOption('pl');
$this->exploit = $input->getOption('exploit');
$this->exploit = explode(",",$input->getOption('exploit'));
}

private function runHelp($output)
Expand Down Expand Up @@ -288,7 +294,7 @@ protected function sendMail($resultFinal)
$msg .= $keyResultEnginer.' '.$result.' <br>';
}
}
$mailer->sendMessage('you@example.com', $msg);
$mailer->sendMessage($this->email, $msg);
}
}

Expand Down Expand Up @@ -357,7 +363,8 @@ protected function checkVunerabilities($nameFile, $result, $commandData, OutputI
if (in_array('isAdmin', $this->check)) {
$resultFinal = array();
$nameFileIsAdmin = $nameFile.'_isAdmin';
$site = new Vulnerabilities\DefaultSite($commandData, $result);
$site = new DefaultSite($commandData, $result);
$resultFinal['isAdmin']="http://www.riojurua.com.br/wp-login.php";
$resultFinal['isAdmin'] = $site->check();
$this->saveTxt($resultFinal, $nameFileIsAdmin);
$this->printResult($resultFinal, $output, 'Result list of admin page:');
Expand All @@ -383,12 +390,19 @@ protected function checkVunerabilities($nameFile, $result, $commandData, OutputI
$this->printResumeResult($output, 'Patch File of Local File Inclusion:', $nameFileLfi);
}

if($this->exploit["lfd"]){
$this->runExploitLFD($resultFinal,$commandData,$output);
return $resultFinal;

}

protected function checkExploits($results,$commandData, OutputInterface $output){

if (in_array('lfd', $this->exploit)) {
$this->runExploitLFD($results,$commandData,$output);
}
if($this->exploit["btwp"]){
$this->runExploitBTWP($resultFinal,$commandData,$output);
if (in_array('btwp', $this->exploit)) {
$this->runExploitBTWP($results,$commandData,$output);
}

}

protected function runExploitLFD($result, $commandData, OutputInterface $output){
Expand Down Expand Up @@ -420,13 +434,19 @@ protected function runExploitBTWP($result, $commandData, OutputInterface $output
$output->writeln('');
$btwp=new Exploits\BruteForceWordPress($commandData);
foreach($result['isAdmin'] as $url){
$result=$btwp->execute($url);
}
$output->writeln('<info>********************Print Results***********************</info>');
foreach($result as $res){
$output->writeln("Site: ".$res['site']);
$output->writeln("User: ".$res['user']);
$output->writeln("Password: ".$res['password']);
$resBtwp['isAdmin']=$btwp->execute($url);
if($resBtwp){
$output->writeln('<info>********************Print Results***********************</info>');
$output->writeln("<info>Site: ".$resBtwp['isAdmin']['site']."</info>");
$output->writeln("<info>User: ".$resBtwp['isAdmin']['user']."</info>");
$output->writeln("<info><info>Password: ".$resBtwp['isAdmin']['password']."</info>");
$output->writeln('<info>********************************************************</info>');
if (!empty($this->email)) {
$this->sendMail($resBtwp, $this->email);
$this->printResumeResult($output, 'Email to send:', $this->email);
}
}
}

}
}

0 comments on commit a0c5498

Please sign in to comment.