Skip to content

Commit 9a7336f

Browse files
Merge pull request #26 from jaylikesbunda/main
v1.1.7 🎄
2 parents cabac46 + c1629c7 commit 9a7336f

File tree

6 files changed

+59
-48
lines changed

6 files changed

+59
-48
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
4+
## v1.1.7
5+
- added null checks before freeing resources
6+
- remove unused commands from menu.c and cleaned up command details
7+
- initialise uart in esp connection check if needed
8+
39
## v1.1.6
410
- sync files more frequently
511

manifest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Ghost ESP
22
id: ghost_esp_app
3-
author: Spooks4567
3+
author: @Spooks4567, @jaylikesbunda
44
icon: "ghost_esp.png"
55
version: 1.1.4
66
category: GPIO

src/main.c

+10
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@ int32_t ghost_esp_app(void* p) {
172172
// Initialize UART in background
173173
state->uart_context = uart_init(state);
174174

175+
// Check if ESP is connected, if not, try to initialize it
176+
if(!uart_is_esp_connected(state->uart_context)) {
177+
FURI_LOG_W("Ghost_ESP", "ESP not connected, trying to initialize...");
178+
if(uart_init(state) != NULL) {
179+
FURI_LOG_I("Ghost_ESP", "ESP initialized successfully");
180+
} else {
181+
FURI_LOG_E("Ghost_ESP", "Failed to initialize ESP");
182+
}
183+
}
184+
175185
// Set up and run GUI
176186
Gui* gui = furi_record_open("gui");
177187
if(gui && state->view_dispatcher) {

src/menu.c

+16-34
Original file line numberDiff line numberDiff line change
@@ -282,31 +282,14 @@ static const MenuCommand wifi_commands[] = {
282282
.confirm_text = NULL,
283283
.details_header = "Raw Packet Capture",
284284
.details_text = "Captures all WiFi\n"
285-
"traffic in range.\n"
286-
"Saves as PCAP.\n"
287-
"Range: ~50-100m\n",
288-
},
289-
{
290-
.label = "Sniff PMKID",
291-
.command = "capture -eapol\n",
292-
.capture_prefix = "pmkid_capture",
293-
.file_ext = "pcap",
294-
.folder = GHOST_ESP_APP_FOLDER_PCAPS,
295-
.needs_input = false,
296-
.input_text = NULL,
297-
.needs_confirmation = false,
298-
.confirm_header = NULL,
299-
.confirm_text = NULL,
300-
.details_header = "PMKID Capture",
301-
.details_text = "Captures PMKID and\n"
302-
"EAPOL handshakes.\n"
303-
"Saves as PCAP.\n"
285+
"traffic to a PCAP file\n"
286+
"for later analysis.\n"
304287
"Range: ~50-100m\n",
305288
},
306289
{
307290
.label = "Sniff Probes",
308-
.command = "capture -probe\n",
309-
.capture_prefix = "probes_capture",
291+
.command = "capture -p\n",
292+
.capture_prefix = "probe_capture",
310293
.file_ext = "pcap",
311294
.folder = GHOST_ESP_APP_FOLDER_PCAPS,
312295
.needs_input = false,
@@ -315,9 +298,9 @@ static const MenuCommand wifi_commands[] = {
315298
.confirm_header = NULL,
316299
.confirm_text = NULL,
317300
.details_header = "Probe Capture",
318-
.details_text = "Captures probe\n"
319-
"requests from clients.\n"
320-
"Saves to PCAP file.\n"
301+
.details_text = "Captures probe requests\n"
302+
"from client devices to\n"
303+
"a PCAP file.\n"
321304
"Range: ~50-100m\n",
322305
},
323306
{
@@ -332,9 +315,9 @@ static const MenuCommand wifi_commands[] = {
332315
.confirm_header = NULL,
333316
.confirm_text = NULL,
334317
.details_header = "WPS Capture",
335-
.details_text = "Captures WPS data\n"
336-
"exchanges & beacons.\n"
337-
"Saves to PCAP file.\n"
318+
.details_text = "Captures WPS traffic\n"
319+
"to a PCAP file for\n"
320+
"later analysis.\n"
338321
"Range: ~50-100m\n",
339322
},
340323
{
@@ -533,9 +516,9 @@ static const MenuCommand ble_commands[] = {
533516
"- Last seen time\n",
534517
},
535518
{
536-
.label = "Sniff Bluetooth",
537-
.command = "blescan -r\n",
538-
.capture_prefix = "btscan",
519+
.label = "Sniff BLE",
520+
.command = "blescan -s\n",
521+
.capture_prefix = "ble_capture",
539522
.file_ext = "pcap",
540523
.folder = GHOST_ESP_APP_FOLDER_PCAPS,
541524
.needs_input = false,
@@ -544,10 +527,9 @@ static const MenuCommand ble_commands[] = {
544527
.confirm_header = NULL,
545528
.confirm_text = NULL,
546529
.details_header = "BLE Sniffer",
547-
.details_text = "Captures Bluetooth LE\n"
548-
"packets & adv data.\n"
549-
"Saves to PCAP file.\n"
550-
"Range: ~50m\n",
530+
.details_text = "Captures Bluetooth Low\n"
531+
"Energy traffic.\n"
532+
"Range: ~10-30m\n",
551533
},
552534
{
553535
.label = "Stop BLE Scan",

src/settings_ui.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ bool settings_custom_event_callback(void* context, uint32_t event_id) {
401401
"Updated by: Jay Candel\n"
402402
"Built with <3";
403403

404-
confirmation_view_set_header(app_state->confirmation_view, "Ghost ESP v1.1.6");
404+
confirmation_view_set_header(app_state->confirmation_view, "Ghost ESP v1.1.7");
405405
confirmation_view_set_text(app_state->confirmation_view, info_text);
406406

407407
// Save current view before switching

src/uart_utils.c

+25-12
Original file line numberDiff line numberDiff line change
@@ -430,30 +430,43 @@ UartContext* uart_init(AppState* state) {
430430
void uart_free(UartContext *uart) {
431431
if(!uart) return;
432432

433-
if(uart->text_manager) {
434-
text_buffer_free(uart->text_manager);
435-
uart->text_manager = NULL;
436-
}
437-
438-
// Stop thread and wait for it to finish
433+
// Stop the worker thread
439434
if(uart->rx_thread) {
440435
furi_thread_flags_set(furi_thread_get_id(uart->rx_thread), WorkerEvtStop);
441436
furi_thread_join(uart->rx_thread);
442437
furi_thread_free(uart->rx_thread);
438+
uart->rx_thread = NULL;
443439
}
444440

445-
// Clean up serial after thread is stopped
441+
// Clean up serial
446442
if(uart->serial_handle) {
443+
furi_hal_serial_async_rx_stop(uart->serial_handle);
447444
furi_hal_serial_deinit(uart->serial_handle);
448445
furi_hal_serial_control_release(uart->serial_handle);
446+
uart->serial_handle = NULL;
449447
}
450448

451-
// Free streams after everything is stopped
452-
if(uart->rx_stream) furi_stream_buffer_free(uart->rx_stream);
453-
if(uart->pcap_stream) furi_stream_buffer_free(uart->pcap_stream);
449+
// Free streams
450+
if(uart->rx_stream) {
451+
furi_stream_buffer_free(uart->rx_stream);
452+
uart->rx_stream = NULL;
453+
}
454+
if(uart->pcap_stream) {
455+
furi_stream_buffer_free(uart->pcap_stream);
456+
uart->pcap_stream = NULL;
457+
}
454458

455-
// Clean up storage context last
456-
if(uart->storageContext) uart_storage_free(uart->storageContext);
459+
// Clean up storage context
460+
if(uart->storageContext) {
461+
uart_storage_free(uart->storageContext);
462+
uart->storageContext = NULL;
463+
}
464+
465+
// Free text manager
466+
if(uart->text_manager) {
467+
text_buffer_free(uart->text_manager);
468+
uart->text_manager = NULL;
469+
}
457470

458471
free(uart);
459472
}

0 commit comments

Comments
 (0)