Skip to content

Commit

Permalink
HandshakeCrack v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
n3d-b0y committed Feb 20, 2019
0 parents commit be6b49f
Show file tree
Hide file tree
Showing 11 changed files with 1,426 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
.idea
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## HandshakeCrack
The module automates work with service https://www.onlinehashcrack.com

![alt text](https://i.ibb.co/dQSp27s/Handshake-Crack.png)

#### Functional:
- WIFI / WPA(2) password recover
- PCAP and CAP dump file to HCCAPX - instantly

**Device:** Tetra

**Official topics for discussions:**
```
https://forums.hak5.org/topic/45362-module-handshakecrack/
https://codeby.net/threads/5-wifi-pineapple-handshakecrack.66700/
```

## Install module

```
opkg update && opkg install git git-http
cd /pineapple/modules/
git clone https://github.com/n3d-b0y/HandshakeCrack.git HandshakeCrack
chmod +x -R /pineapple/modules/HandshakeCrack/scripts
```
171 changes: 171 additions & 0 deletions api/module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<?php
/**
* User: n3d.b0y
* Email: n3d.b0y@gmail.com
*/
namespace pineapple;

class HandshakeCrack extends Module
{
const LOG_FILE_SEND_HANDSHAKE = '/tmp/handshakesend.log';
const BASH_SCRIP_SEND_HANDSHAKE = '/pineapple/modules/HandshakeCrack/scripts/handshake.sh';
const BASH_SCRIP_CONVERTER = '/pineapple/modules/HandshakeCrack/scripts/converter.sh';
const PYTHON_SCRIPT_PARSEG_PCAP = '/pineapple/modules/HandshakeCrack/scripts/parser_pcap.py';

public function route()
{
switch ($this->request->action) {
case 'getInfo':
$this->getInfo();
break;
case 'getStatus':
$this->getStatus();
break;
case 'managerDependencies':
$this->managerDependencies();
break;
case 'statusDependencies':
$this->statusDependencies();
break;
case 'getSettings':
$this->getSettings();
break;
case 'setSettings':
$this->setSettings();
break;
case 'getHandshakeFiles':
$this->getHandshakeFiles();
break;
case 'getHandshakeInfo':
$this->getHandshakeInfo();
break;
case 'sendHandshake':
$this->sendHandshake();
break;
case 'converter':
$this->converter();
break;
case 'isConnected':
$this->isConnected();
break;
}
}

protected function getInfo()
{
$moduleInfo = @json_decode(file_get_contents("/pineapple/modules/HandshakeCrack/module.info"));
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
}

private function getStatus()
{
if (!file_exists('/tmp/HandshakeCrack.progress')) {
if ($this->checkDependencies()) {
$this->response = array(
"installed" => false, "install" => "Remove",
"installLabel" => "danger", "processing" => false
);
} else {
$this->response = array(
"installed" => true, "install" => "Install",
"installLabel" => "success", "processing" => false
);
}
} else {
$this->response = array(
"installed" => false, "install" => "Installing...",
"installLabel" => "warning", "processing" => true
);
}
}

protected function checkDependencies()
{
return ((exec("which curl") == '' ? false : true) && ($this->uciGet("handshakecrack.module.installed")));
}

private function managerDependencies()
{
if (!$this->checkDependencies()) {
$this->execBackground("/pineapple/modules/HandshakeCrack/scripts/dependencies.sh install");
$this->response = array('success' => true);
} else {
$this->execBackground("/pineapple/modules/HandshakeCrack/scripts/dependencies.sh remove");
$this->response = array('success' => true);
}
}

private function statusDependencies()
{
if (!file_exists('/tmp/HandshakeCrack.progress')) {
$this->response = array('success' => true);
} else {
$this->response = array('success' => false);
}
}

private function getSettings()
{
$settings = array(
'email' => $this->uciGet("handshakecrack.settings.email")
);
$this->response = array('settings' => $settings);
}

private function setSettings()
{
$settings = $this->request->settings;
$this->uciSet("handshakecrack.settings.email", $settings->email);
}

private function getHandshakeFiles()
{
exec("find -L /pineapple/modules/ -type f -name \"*.**cap\" 2>&1", $dir1);
exec("find -L /tmp/ -type f -name \"*.**cap\" 2>&1", $dir2);

$this->response = array("files" => array_merge($dir1, $dir2));
}

private function getHandshakeInfo()
{
if (!empty($this->request->path)) {
exec('python ' . self::PYTHON_SCRIPT_PARSEG_PCAP . ' -i ' . $this->request->path, $output);
$outputArr = preg_split('/\s+/', $output[0]);

if (!empty($outputArr)) {
$this->response = array(
'success' => true, 'bssid' => strtoupper($outputArr[0]),
'essid' => $outputArr[1]
);
} else {
$this->response = array('success' => false);
}
} else {
$this->response = array('success' => false);
}
}

private function sendHandshake()
{
exec(self::BASH_SCRIP_SEND_HANDSHAKE . " " . $this->request->file, $output);
$this->response = array('output' => $output);
}

private function converter()
{
exec(self::BASH_SCRIP_CONVERTER . " " . $this->request->file, $output);

$this->response = array('output' => $output[0]);
}

public function isConnected()
{
$connected = @fsockopen("google.com", 80);

if ($connected) {
$this->response = array('success' => true);
} else {
$this->response = array('success' => false);
}
}
}
Loading

0 comments on commit be6b49f

Please sign in to comment.