Beispiel #1
0
function logit($mess)
{
    global $log;
    echo "{$mess}\n";
    file_put_contents($log, "{$mess}\n", FILE_APPEND);
}
$sql = 'SELECT net_id, bssid, HEX(nhash) AS nhash FROM nets';
$stmt = $mysql->stmt_init();
$stmt->prepare($sql);
$stmt->execute();
$data = array();
stmt_bind_assoc($stmt, $data);
$nets = array();
$i = 0;
while ($stmt->fetch()) {
    $nets[] = array($data['net_id'], long2mac($data['bssid']), strtolower($data['nhash']));
}
$stmt->close();
$mysql->close();
logit('Got ' . count($nets) . ' nets from db');
foreach ($nets as $net) {
    $net_id = $net[0];
    $bssid = $net[1];
    $nhash = $net[2];
    //put decompressed cap in SHM
    file_put_contents($tmpcap, gzinflate(substr(file_get_contents(MD5CAPS . substr($nhash, 0, 3) . "/{$nhash}.gz"), 10)));
    //check md5 hash vs nhash
    if ($nhash != md5_file($tmpcap)) {
        logit("Hash does not match! net_id: {$net_id} nhash:{$nhash}");
    }
    $pres = '';
Beispiel #2
0
function write_nets($stmt, $data)
{
    $has_input = false;
    echo '
<style>
td {padding-left: 7px; padding-right: 7px}
</style>
<script type="text/javascript">
function goWigle(bssid) {
    document.getElementById("netid").value = bssid;
    document.getElementById("wigle").submit();
}
</script>
<form method="POST" action="https://www.wigle.net/gps/gps/main/confirmquery" target="_blank" id="wigle" >
<input type="hidden" name="netid" id="netid" />
</form>
<form class="form" method="POST" action="?nets" enctype="multipart/form-data">
<table style="border: 1;">
<tr><th>BSSID</th><th>SSID</th><th>WPA key</th><th>Get works</th><th>Timestamp</th></tr>';
    while ($stmt->fetch()) {
        $bssid = long2mac($data['bssid']);
        $mic = $data['mic'];
        $ssid = htmlspecialchars($data['ssid']);
        if ($data['pass'] == '') {
            $pass = '******' . $mic . '" size="20"/>';
            $has_input = true;
        } else {
            $pass = htmlspecialchars($data['pass']);
        }
        echo "<tr><td style=\"font-family:monospace; font-size: 12px; cursor: pointer; \"><a title=\"Wigle geo query. You must be logged in.\" onclick=\"goWigle(this.text)\">{$bssid}</a></td><td>{$ssid}</td><td>{$pass}</td><td align=\"right\">{$data['hits']}</td><td>{$data['ts']}</td></tr>\n";
    }
    echo '</table>';
    if ($has_input) {
        echo '<input class="submitbutton" type="submit" value="Send WPA keys" />';
    }
    echo '</form>';
}
Beispiel #3
0
//get work
$sql = 'SELECT * FROM onets, get_dict LIMIT 1';
$stmt = $mysql->stmt_init();
$stmt->prepare($sql);
$data = array();
stmt_bind_assoc($stmt, $data);
$stmt->execute();
if ($stmt->fetch()) {
    $stmt->free_result();
    //return network data
    $usql = 'INSERT INTO n2d(net_id, d_id) VALUES(?, ?) ON DUPLICATE KEY UPDATE Hits=Hits+1, ts=NOW()';
    $ustmt = $mysql->stmt_init();
    $ustmt->prepare($usql);
    $ustmt->bind_param('ii', $data['net_id'], $data['d_id']);
    $ustmt->execute();
    $ustmt->close();
    $json = array();
    $json['mic'] = strtolower($data['mic']);
    $json['bssid'] = long2mac($data['bssid']);
    $json['dpath'] = $data['dpath'];
    $json['dhash'] = strtolower($data['dhash']);
    $json['cap'] = base64_encode($data['cap']);
    $json['hccap'] = base64_encode($data['hccap']);
    echo json_encode($json);
} else {
    echo 'No nets';
}
//release critical section
sem_release($sem1);
$stmt->close();
$mysql->close();