Skip to content

Commit 799fd5f

Browse files
author
Znerox
committed
Make it possible to run in Docker
1 parent ede4c1a commit 799fd5f

36 files changed

+201
-143
lines changed

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
![](https://i.imgur.com/cbqbdQe.png)
22
[Live version](https://wifikart.net)
33

4-
54
![](https://i.imgur.com/fAeToNM.png)
65

7-
Makes data generated by WiGLE Android app searchable (with filters) and overlays it on Google Maps.
8-
9-
### About
10-
11-
I wanted to see the networks in my neighbourhood, but found the global map on wigle.net to be far from detailed enough. With this you can take the data generated by the WiGLE app, and overlay it on Google Maps. You also get filtering options based on encryption, SSID, BSSID, date seen and more.
12-
It is also possible to import data generated by airodump-ng on Linux, connect it with the data from WiGLE, and potentially see which clients that have probed or been connected to networks in your database.
6+
Put collected network data by the WiGLE Android app in a self-hosted database, overlay it on Google Maps with extensive filtering options.
7+
It's also possible to combine this with data captured by airodump-ng on Linux, connect it with the data from WiGLE, and potentially see which clients that have probed or been connected to networks in your database.
138

14-
For more info, take a look at the [Wiki](https://github.com/Znerox/wifimap/wiki)
9+
It's now possible to run in Docker, see [Wiki](https://github.com/Znerox/wifimap/wiki/Running-in-Docker-(recommended)) for details.

tools/index.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66

77
<link rel="icon" href="images/favicon.png" type="image/png" sizes="32x32">
88
<link type="text/css" rel="stylesheet" href="css/index.css" />
9-
<!--<script src="js/index.js"></script>-->
109

1110
</head>
1211

1312
<body>
1413
<div id="pagecontent">
15-
<h1>WiFi Tools</h1>
16-
1714
<h2 class="headline_text">Upload data</h2>
1815

1916
<div id="import" class="main">
@@ -45,7 +42,7 @@ <h3>Upload WiFi client file</h3>
4542
</div>
4643
</div>
4744

48-
<h2 class="headline_text">Database scripts</h2>
45+
<h2 class="headline_text">Update additional info</h2>
4946

5047
<div id="update_sql" class="main">
5148
<div id="sql" class="specific">
@@ -134,6 +131,14 @@ <h3>Upload old client file</h3>
134131
<p>aircrack-ng version 1.2-rc1. Replaced 10 April 2015</p>
135132
</div>
136133
</div>
134+
<p>Some of these scripts can take a very long time to finish. After pressing a button, wait until you see a status message.</p>
135+
<p>Create database first if this is the first time running.</p>
136+
137+
<div class="database_script_button">
138+
<form action="php/dbsetup.php" method="get">
139+
<input type="submit" value="Create Database" class="uploadButton">
140+
</form>
141+
</div>
137142

138143
</div>
139144
</body>

tools/js/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

tools/php/bluetooth_mac_lookup.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "dbinfo.php";
44

55
// Opens a connection to the MySQL server
6-
$connection = new mysqli("localhost", $username, $password, $database);
6+
$connection = new mysqli($server, $username, $password, $database);
77

88
if (!$connection) { die('Not connected : ' . $mysqli->connect_error);}
99

@@ -21,6 +21,7 @@
2121
echo "All devices matching a particular OUI will be updated at once<br>";
2222
echo "Press F5 to run script again";
2323
echo "<br>----------------------------------------------------------------<br>";
24+
echo "Found vendors:<br><br>";
2425

2526
$stopLoop = 0;
2627

@@ -40,23 +41,13 @@
4041

4142
if($response !== "No vendor") {
4243

43-
echo $mac_from_db_trimmed . " - " . $response;
44-
echo "<br><br>The following command has been run against database:<br><br>";
45-
echo "UPDATE bluetooth";
46-
echo "<br>SET vendor='$response'";
47-
echo "<br>WHERE bssid LIKE '" . $mac_from_db_trimmed . ":__:__:__';";
48-
echo "<br>----------------------------------------------------------------<br>";
44+
echo $mac_from_db_trimmed . " - " . $response . "<br>";
4945

5046
$query2 = 'UPDATE bluetooth SET vendor="' . $response . '" WHERE bssid LIKE "' . $mac_from_db_trimmed . ':__:__:__";';
5147
$result2 = $connection->query($query2);
5248

5349
} else {
54-
echo $mac_from_db_trimmed . " - UNKNOWN" ;
55-
echo "<br><br>MAC vendor is unknown. The following command has been run against database:<br><br>";
56-
echo "UPDATE bluetooth";
57-
echo "<br>SET vendor='UNKNOWN'<br>";
58-
echo "WHERE bssid LIKE '" . $mac_from_db_trimmed . ":__:__:__';";
59-
echo "<br>----------------------------------------------------------------<br>";
50+
echo $mac_from_db_trimmed . " - UNKNOWN<br>";
6051

6152
$query3 = "UPDATE bluetooth SET vendor='UNKNOWN' WHERE bssid LIKE '" . $mac_from_db_trimmed . ":__:__:__';";
6253
$result3 = $connection->query($query3);
@@ -68,7 +59,7 @@
6859

6960
if ($networksWithNullVendor == 0) {
7061
$stopLoop = 1;
71-
echo "No more devices left with missing vendor! Stopping loop<br>";
62+
echo "<br>No more devices left with missing vendor! Stopping loop<br>";
7263
}
7364

7465
$loopCount++;

tools/php/client_import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
require("dbinfo.php");
3535

3636
// Opens a connection to a MySQL server
37-
$mysqli = new mysqli("localhost", $username, $password, $database);
37+
$mysqli = new mysqli($server, $username, $password, $database);
3838

3939
// Change character set to utf8
4040
mysqli_set_charset($mysqli,"utf8");

tools/php/client_import_1.2-rc1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
require("dbinfo.php");
3535

3636
// Opens a connection to a MySQL server
37-
$mysqli = new mysqli("localhost", $username, $password, $database);
37+
$mysqli = new mysqli($server, $username, $password, $database);
3838

3939
// Change character set to utf8
4040
mysqli_set_charset($mysqli,"utf8");

tools/php/client_mac_lookup.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "dbinfo.php";
44

55
// Opens a connection to the MySQL server
6-
$connection = new mysqli("localhost", $username, $password, $database);
6+
$connection = new mysqli($server, $username, $password, $database);
77

88
if (!$connection) { die('Not connected : ' . $mysqli->connect_error);}
99

@@ -21,6 +21,7 @@
2121
echo "All clients matching a particular OUI will be updated at once<br>";
2222
echo "Press F5 to run script again";
2323
echo "<br>----------------------------------------------------------------<br>";
24+
echo "Found vendors:<br><br>";
2425

2526
$stopLoop = 0;
2627

@@ -40,23 +41,13 @@
4041

4142
if($response !== "No vendor") {
4243

43-
echo $mac_from_db_trimmed . " - " . $response;
44-
echo "<br><br>The following command has been run against database:<br><br>";
45-
echo "UPDATE clients";
46-
echo "<br>SET vendor='$response'";
47-
echo "<br>WHERE client_mac LIKE '" . $mac_from_db_trimmed . ":__:__:__';";
48-
echo "<br>----------------------------------------------------------------<br>";
44+
echo $mac_from_db_trimmed . " - " . $response . "<br>";
4945

5046
$query2 = 'UPDATE clients SET vendor="' . $response . '" WHERE client_mac LIKE "' . $mac_from_db_trimmed . ':__:__:__";';
5147
$result2 = $connection->query($query2);
5248

5349
} else {
54-
echo $mac_from_db_trimmed . " - UNKNOWN" ;
55-
echo "<br><br>MAC vendor is unknown. The following command has been run against database:<br><br>";
56-
echo "UPDATE clients";
57-
echo "<br>SET vendor='UNKNOWN'";
58-
echo "<br>WHERE client_mac LIKE '" . $mac_from_db_trimmed . ":__:__:__';";
59-
echo "<br>----------------------------------------------------------------<br>";
50+
echo $mac_from_db_trimmed . " - UNKNOWN<br>";
6051

6152
$query3 = "UPDATE clients SET vendor='UNKNOWN' WHERE client_mac LIKE '" . $mac_from_db_trimmed . ":__:__:__';";
6253
$result3 = $connection->query($query3);
@@ -67,9 +58,8 @@
6758
$clientsWithNullVendor = $endOfLoopResult->num_rows;
6859

6960
if ($clientsWithNullVendor == 0) {
70-
7161
$stopLoop = 1;
72-
echo "No more clients left with missing vendor! Stopping loop<br>";
62+
echo "<br>No more clients left with missing vendor! Stopping loop<br>";
7363
}
7464

7565
$loopCount++;

tools/php/dbinfo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
$username="MYSQL_USERNAME";
33
$password="MYSQL_PASSWORD";
4+
$server="localhost";
45
$database="wifimap";
56
?>

tools/php/dbsetup.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
require "dbinfo.php";
4+
5+
$connection_1 = new mysqli($server, $username, $password);
6+
mysqli_set_charset($connection_1,"utf8");
7+
8+
echo "'1' means command was successful<br>";
9+
echo "If the line is blank after 'created', it probably means the database already exists<br><br>";
10+
$create_database = "CREATE DATABASE wifimap";
11+
12+
$database_result = $connection_1->query($create_database);
13+
echo "Database created: $database_result<br>";
14+
15+
16+
$connection_2 = new mysqli($server, $username, $password, $database);
17+
mysqli_set_charset($connection_2,"utf8");
18+
19+
$create_table_network = "CREATE TABLE network(
20+
bssid varchar(27) PRIMARY KEY NOT NULL DEFAULT '',
21+
ssid varchar(32) NOT NULL DEFAULT '',
22+
frequency varchar(13) NOT NULL DEFAULT '',
23+
capabilities varchar(57) NOT NULL DEFAULT '',
24+
lasttime varchar(49) NOT NULL DEFAULT '',
25+
lastlat decimal(28,12),
26+
lastlon decimal(28,12),
27+
type varchar(8) DEFAULT '',
28+
bestlevel varchar(4) NOT NULL DEFAULT '',
29+
bestlat decimal(28,12),
30+
bestlon decimal(28,12),
31+
channel varchar(8) NOT NULL DEFAULT '',
32+
band varchar(64) NOT NULL DEFAULT '',
33+
vendor varchar(64) NOT NULL DEFAULT '',
34+
lastseen varchar(64) NOT NULL DEFAULT '',
35+
predefined_search varchar (256) NOT NULL DEFAULT '',
36+
icon varchar(128) NOT NULL DEFAULT '',
37+
connected_clients varchar(2048) NOT NULL DEFAULT '',
38+
probing_clients varchar(4096) NOT NULL DEFAULT '')";
39+
40+
$create_table_location = "CREATE TABLE location(
41+
id int AUTO_INCREMENT PRIMARY KEY,
42+
bssid varchar(64) NOT NULL DEFAULT '',
43+
level varchar(64) NOT NULL DEFAULT '',
44+
lat varchar(64) NOT NULL DEFAULT '',
45+
lon varchar(64) NOT NULL DEFAULT '',
46+
altitude varchar(64) NOT NULL DEFAULT '',
47+
accuracy decimal(64,0),
48+
time varchar(64) NOT NULL DEFAULT '',
49+
date varchar(64) NOT NULL DEFAULT '')";
50+
51+
$create_table_clients = "CREATE TABLE clients(
52+
client_mac varchar(17) PRIMARY KEY NOT NULL DEFAULT '',
53+
vendor varchar(256) NOT NULL DEFAULT '',
54+
connected_to_bssid varchar(1024) NOT NULL DEFAULT '',
55+
probed_essid varchar(1024) NOT NULL DEFAULT '',
56+
first_seen varchar(32) NOT NULL DEFAULT '',
57+
last_seen varchar(32) NOT NULL DEFAULT '')";
58+
59+
$create_table_bluetooth = "CREATE TABLE bluetooth(
60+
bssid varchar(27) PRIMARY KEY NOT NULL DEFAULT '',
61+
ssid varchar(32) NOT NULL DEFAULT '',
62+
frequency varchar(13) NOT NULL DEFAULT '',
63+
capabilities varchar(57) NOT NULL DEFAULT '',
64+
lasttime varchar(49) NOT NULL DEFAULT '',
65+
lastlat decimal(28,12),
66+
lastlon decimal(28,12),
67+
type varchar(8) DEFAULT '',
68+
bestlevel varchar(4) NOT NULL DEFAULT '',
69+
bestlat decimal(28,12),
70+
bestlon decimal(28,12),
71+
vendor varchar(64) NOT NULL DEFAULT '',
72+
lastseen varchar(64) NOT NULL DEFAULT '',
73+
predefined_search varchar (256) NOT NULL DEFAULT '',
74+
icon varchar(128) NOT NULL DEFAULT '')";
75+
76+
$network_result = $connection_2->query($create_table_network);
77+
echo "Network table created: $network_result<br>";
78+
79+
$location_result = $connection_2->query($create_table_location);
80+
echo "Location table created : $location_result<br>";
81+
82+
$clients_result = $connection_2->query($create_table_clients);
83+
echo "Clients table created: $clients_result<br>";
84+
85+
$bluetooth_result = $connection_2->query($create_table_bluetooth);
86+
echo "Bluetooth table created: $bluetooth_result<br>";
87+
?>

tools/php/location_import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
require("dbinfo.php");
3131

3232
// Opens a connection to a MySQL server
33-
$mysqli = new mysqli("localhost", $username, $password, $database);
33+
$mysqli = new mysqli($server, $username, $password, $database);
3434

3535
// Change character set to utf8
3636
mysqli_set_charset($mysqli,"utf8");

0 commit comments

Comments
 (0)