diff --git a/HandshakeCrack/api/module.php b/HandshakeCrack/api/module.php new file mode 100644 index 0000000..32cae4d --- /dev/null +++ b/HandshakeCrack/api/module.php @@ -0,0 +1,171 @@ +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); + } + } +} \ No newline at end of file diff --git a/HandshakeCrack/js/module.js b/HandshakeCrack/js/module.js new file mode 100644 index 0000000..dac079b --- /dev/null +++ b/HandshakeCrack/js/module.js @@ -0,0 +1,244 @@ +registerController('HandshakeCrack_IsConnected', ['$api', '$scope', '$rootScope', '$interval', function ($api, $scope, $rootScope, $interval) { + $rootScope.isConnected = false; + $rootScope.noDependencies = false; + + var isConnected = function () {$api.request({ + module: "HandshakeCrack", + action: "isConnected" + }, function (response) { + if (!response.success) { + $rootScope.isConnected = true; + } else { + $rootScope.isConnected = false; + $rootScope.noDependencies = false; + } + })}; + + $api.request({ + module: "HandshakeCrack", + action: "getStatus" + }, function (response) { + if (response.install === 'Install') { + $rootScope.noDependencies = true; + } + }); + + isConnected(); + + var interval = $interval(function () { + if (!$rootScope.isConnected) { + $interval.cancel(interval); + } else { + isConnected(); + } + }, 5000); +}]); + +registerController('HandshakeCrack_Dependencies', ['$api', '$scope', '$rootScope', '$interval', function ($api, $scope, $rootScope, $interval) { + $scope.install = "Loading..."; + $scope.installLabel = "default"; + $scope.processing = false; + $rootScope.handshakeInfo = false; + + $rootScope.status = { + installed: false, + generated: false, + refreshOutput: false, + refreshKnownHosts: false + }; + + $scope.refreshStatus = (function () { + $api.request({ + module: "HandshakeCrack", + action: "getStatus" + }, function (response) { + $scope.status.installed = response.installed; + $scope.processing = response.processing; + $scope.install = response.install; + $scope.installLabel = response.installLabel; + + if ($scope.processing) { + $scope.statusDependencies(); + } + }) + }); + + $scope.statusDependencies = (function () { + var statusDependenciesInterval = $interval(function () { + $api.request({ + module: 'HandshakeCrack', + action: 'statusDependencies' + }, function (response) { + if (response.success === true) { + $scope.processing = false; + $scope.refreshStatus(); + $interval.cancel(statusDependenciesInterval); + } + }); + }, 2000); + }); + + $scope.managerDependencies = (function () { + if ($scope.status.installed) { + $scope.install = "Installing..."; + } else { + $scope.install = "Removing..."; + } + + $api.request({ + module: 'HandshakeCrack', + action: 'managerDependencies' + }, function (response) { + if (response.success === true) { + $scope.installLabel = "warning"; + $scope.processing = true; + $scope.statusDependencies(); + } + }); + }); + + $scope.refreshStatus(); +}]); + + +registerController('HandshakeCrack_Settings', ['$api', '$scope', function ($api, $scope) { + $scope.settings = { + email: "" + }; + + $scope.saveSettingsLabel = "success"; + $scope.saveSettings = "Save"; + $scope.saving = false; + + $scope.getSettings = function () { + $api.request({ + module: 'HandshakeCrack', + action: 'getSettings' + }, function (response) { + $scope.settings = response.settings; + }); + }; + + $scope.setSettings = function () { + $scope.saveSettingsLabel = "warning"; + $scope.saveSettings = "Saving..."; + $scope.saving = true; + + $api.request({ + module: 'HandshakeCrack', + action: 'setSettings', + settings: $scope.settings + }, function (response) { + setTimeout(function () { + $scope.getSettings(); + $scope.saveSettingsLabel = "success"; + $scope.saveSettings = "Save"; + $scope.saving = false; + }, 1000); + }); + }; + + $scope.getSettings(); +}]); + +registerController('HandshakeCrack_Files', ['$api', '$scope', '$rootScope', function ($api, $scope, $rootScope) { + $scope.files = []; + + $scope.getHandshakeFiles = (function () { + $api.request({ + module: 'HandshakeCrack', + action: 'getHandshakeFiles' + }, function (response) { + $scope.files = response.files; + $scope.fileHandshake = response.files[0]; + $scope.countHandshake = response.files.length; + $scope.refreshHandshakeInfo(); + }); + }); + + $scope.refreshHandshakeInfo = (function () { + $api.request({ + module: 'HandshakeCrack', + action: 'getHandshakeInfo', + path: $scope.fileHandshake + }, function (response) { + if (response.success) { + $rootScope.handshakeInfo = true; + $scope.bssid = response.bssid; + $scope.essid = response.essid; + } + }); + }); + + $scope.getHandshakeFiles(); +}]); + +registerController('HandshakeCrack_Crack', ['$api', '$scope', '$controller', function ($api, $scope, $controller) { + $controller('HandshakeCrack_Files', {$scope: $scope}); + + $scope.working = false; + $scope.btnClass = "default"; + $scope.btnText = "Send"; + $scope.output = 'Nothing here yet...'; + + $scope.sendHandhake = (function () { + $api.request({ + module: 'HandshakeCrack', + action: 'sendHandshake', + file: $scope.fileHandshake + }, function (response) { + $scope.output = response.output.join("\n"); + $scope.btnClass = "default"; + $scope.btnText = "Send"; + $scope.working = false; + }); + }); + + $scope.send = (function () { + $scope.btnText = "Loading..."; + $scope.btnClass = "warning"; + $scope.output = 'Nothing here yet...'; + $scope.working = true; + $scope.sendHandhake(); + }); +}]); + +registerController('HandshakeCrack_Convert', ['$api', '$scope', '$controller', function ($api, $scope) { + $scope.btnClass = "default"; + $scope.btnText = "Convert"; + $scope.massages = ''; + $scope.working = false; + + $scope.converter = (function () { + $api.request({ + module: 'HandshakeCrack', + action: 'converter', + file: $scope.fileHandshake + }, function (response) { + var data = JSON.parse(response.output); + + $scope.link = data.link; + $scope.massages = data.uploaded; + $scope.btnClass = "default"; + $scope.btnText = "Convert"; + $scope.working = false; + + setTimeout(function () { + $scope.massages = ''; + }, 2000) + }); + }); + + $scope.send = (function () { + $scope.btnText = "Loading..."; + $scope.btnClass = "warning"; + $scope.working = true; + $scope.converter(); + }); + + $scope.btnDownload = (function () { + setTimeout(function () { + $scope.link = ''; + }, 1000); + }); +}]); \ No newline at end of file diff --git a/HandshakeCrack/module.html b/HandshakeCrack/module.html new file mode 100644 index 0000000..e82e0cc --- /dev/null +++ b/HandshakeCrack/module.html @@ -0,0 +1,179 @@ +
+ +
+
+
+
+

Controls

+
+
+ + + + + +
Dependencies + +
+
+
+
+ +
+
+
+

Setting

+
+
+
+
+
+ Email + +
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+
+

Upload your WPA(2) capture file + {{countHandshake}} +
+

+
+ +
+
+
+
+
+ File + +
+
+
+ +
+
+
+ +
+
+ +
+

{{bssid}}

+
+
+ +
+ +
+

{{essid}}

+
+
+
+ +
+ Log +
+
{{output}}
+
+ + Dashboard +
+
+
+ +
+
+
+

Cap to hccapx Converter

+
+
+
+
+ +
+ +
+
+
+ File + +
+
+
+ +
+
+
+ Download +
+
+ +
+
+ Notes +
    +
  • Uploaded files (.cap) will be deleted immediately. We do NOT store your .cap files
  • +
  • Converted files (.hccapx) will be stored for 2 days before being deleted
  • +
  • This site is using the best-in-class tool hcxtools + to onvert cap files +
  • +
  • The goal of this page is to make it very easy to convert .cap files to .hccapx
  • +
+
+
+ How to use? +

More than easy, just select and upload your .(p)cap file. If valid, the file will be + converted + into a .hccapx file, which is readable by Hashcat.

+
+
+ Explanation of the format +

hccapx is a custom format, specifically developed for Hashcat, to be used for hash type -m + 2500 = + WPA/WPA2 + A nexhaustive description of this custom format can be found on their official wiki.

+
+
+
+
+
+
+
\ No newline at end of file diff --git a/HandshakeCrack/module.info b/HandshakeCrack/module.info new file mode 100644 index 0000000..d33001a --- /dev/null +++ b/HandshakeCrack/module.info @@ -0,0 +1,9 @@ +{ + "author": "n3d.b0y", + "description": "Web service www.onlinehashcrack.com in your pineapple", + "devices": [ + "tetra" + ], + "title": "Handshake Crack", + "version": "1.0" +} \ No newline at end of file diff --git a/HandshakeCrack/scripts/converter.sh b/HandshakeCrack/scripts/converter.sh new file mode 100755 index 0000000..e64ab8f --- /dev/null +++ b/HandshakeCrack/scripts/converter.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +[[ -f /tmp/HandshakeCrack.progress ]] && { + exit 0 +} + +FILE=$1 + +touch /tmp/HandshakeCrack.progress + +if [[ ! -f ${FILE} ]]; then + echo -e "File ${FILE} does not exist." +else + curl -s -v -F 0="cap2hccapx" -F file_data=@${FILE} https://www.onlinehashcrack.com/tools-upload.php +fi + +rm /tmp/HandshakeCrack.progress diff --git a/HandshakeCrack/scripts/dependencies.sh b/HandshakeCrack/scripts/dependencies.sh new file mode 100644 index 0000000..e44fb9e --- /dev/null +++ b/HandshakeCrack/scripts/dependencies.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +[[ -f /tmp/HandshakeCrack.progress ]] && { + exit 0 +} + +touch /tmp/HandshakeCrack.progress + +if [[ "$1" = "install" ]]; then + opkg update + opkg install curl + + touch /etc/config/handshakecrack + echo "config handshakecrack 'settings'" > /etc/config/handshakecrack + echo "config handshakecrack 'module'" >> /etc/config/handshakecrack + + uci set handshakecrack.module.installed=1 + uci commit handshakecrack.module.installed + +elif [[ "$1" = "remove" ]]; then + opkg remove curl + rm -rf /etc/config/handshakecrack +fi + +rm /tmp/HandshakeCrack.progress diff --git a/HandshakeCrack/scripts/handshake.sh b/HandshakeCrack/scripts/handshake.sh new file mode 100644 index 0000000..da8e942 --- /dev/null +++ b/HandshakeCrack/scripts/handshake.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +[[ -f /tmp/HandshakeCrack.progress ]] && { + exit 0 +} + +EMAIL=`uci get handshakecrack.settings.email` +FILE=$1 + +touch /tmp/HandshakeCrack.progress + +if [[ -n "$EMAIL" ]]; then + if [[ ! -f ${FILE} ]]; then + echo -e "File ${FILE} does not exist." + else + echo -e "Sent to www.onlinehashcrack.com web service successfully." + echo -e "Notification will be sent to ${EMAIL}" + echo -e "The following has been sent: ${FILE}" + + curl -s -v -F submit="Submit" -F emailTask="${EMAIL}" -F file=@${FILE} https://www.onlinehashcrack.com/addtask.php + fi +else + echo -e "Notification email not set in settings." +fi + +rm /tmp/HandshakeCrack.progress diff --git a/HandshakeCrack/scripts/parser_pcap.py b/HandshakeCrack/scripts/parser_pcap.py new file mode 100644 index 0000000..ec58fe8 --- /dev/null +++ b/HandshakeCrack/scripts/parser_pcap.py @@ -0,0 +1,54 @@ +import sys, getopt +import subprocess +import re + + +def usage(): + print "%s -i " % (__file__) + + +def main(argv): + try: + opts, args = getopt.getopt(argv, "hi:", ["ifile="]) + if not opts: + print 'No input file supplied' + usage() + sys.exit(2) + except getopt.GetoptError, e: + print e + usage() + sys.exit(2) + for opt, arg in opts: + if opt == '-h': + usage() + sys.exit() + elif opt in ("-i", "--ifile"): + filename = arg + return filename + + +if __name__ == "__main__": + filename = main(sys.argv[1:]) + list = [] + argv = ["-ennr", filename, "(type mgt subtype beacon) || (type mgt subtype probe-resp)"] + cmd = subprocess.Popen(["tcpdump"] + argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + for line in cmd.stdout: + if 'Beacon' in line: + bssid = re.search(r'(BSSID:)(\w+\:\w+\:\w+\:\w+\:\w+\:\w+)', line) + if bssid.group(2) not in list: + list.append(bssid.group(2)) + ssid = re.search(r'(Beacon\s\()(.+?(?=\)))', line) + if ssid: + print "%s %s" % (bssid.group(2), ssid.group(2)) + else: + print "%s " % (bssid.group(2)) + elif 'Probe Response' in line: + bssid = re.search(r'(BSSID:)(\w+\:\w+\:\w+\:\w+\:\w+\:\w+)', line) + if bssid.group(2) not in list: + list.append(bssid.group(2)) + ssid = re.search(r'(Probe Response\s\()(.+?(?=\)))', line) + if ssid: + print "%s %s" % (bssid.group(2), ssid.group(2)) + else: + print "%s " % (bssid.group(2))