*** bluedivingNG.pl.orig Sun May 14 16:13:49 2006 --- bluedivingNG.pl Thu May 18 12:45:36 2006 *************** *** 152,158 **** exit_program() if(($input eq "exit") || ($input eq "quit")); &{$last_menu} if $input eq ""; ! if(($input > scalar(@menu)-1) || ($input == 0)) { print "<<< ERROR! Undefined input.\n"; &{$last_menu}; --- 152,158 ---- exit_program() if(($input eq "exit") || ($input eq "quit")); &{$last_menu} if $input eq ""; ! if(($input > scalar(@menu)) || ($input == 0)) { print "<<< ERROR! Undefined input.\n"; &{$last_menu}; *************** *** 172,177 **** --- 172,178 ---- ['Scan', \&scan], ['Scan and attack', \&scan_and_attack], ['Scan and attack (endless loop)', \&loop_scan_and_attack], + ['Add Known Device', \&add_known_device], ['Info Menu', \&print_infomenu], ['Action Menu', \&print_actionmenu], ['Change preferences', \&change_preferences], *************** *** 241,246 **** --- 242,253 ---- { my @devices; + if (!%seen) { + print "No devices found yet!\n"; + print_mainmenu(); + return; + } + print "Want to see all devices? : "; my $input = ; chomp $input; *************** *** 270,282 **** # Check user input exit_program() if(($input eq "exit") || ($input eq "quit")); ! if(($input > scalar(@devices)-1) || ($input == 0)) { print "<<< ERROR! Undefined input.\n"; print_mainmenu(); } ! $target = $devices[$input]; &{$last_menu} unless $no_menu; } --- 277,289 ---- # Check user input exit_program() if(($input eq "exit") || ($input eq "quit")); ! if(($input > scalar(@devices)) || ($input == 0)) { print "<<< ERROR! Undefined input.\n"; print_mainmenu(); } ! $target = $devices[$input-1]; &{$last_menu} unless $no_menu; } *************** *** 418,423 **** --- 425,458 ---- } } + # rather than scanning, add an existing (known) address + sub add_known_device { + print "<<< Manually add a known bluetooth device...\n"; + + print "Enter device address: "; + my $addr = ; + chomp $addr; + + if($addr !~ /\w\w\:\w\w\:\w\w\:\w\w\:\w\w\:\w\w/) { + print "Invalid address format!\n"; + return; + } + + print "Enter a nickname for this device: "; + my $host= ; + chomp $host; + + $seen{$addr} = $host; + push @new_devices,$addr; + $target = $new_devices[0]; + + $devicedir = $preferences{'logdir'} . $addr; + unlink($devicedir) if -e $devicedir; + mkdir($devicedir); + + print "Device $host ($addr) registered.\n"; + } + # Show new devices sub show_new_devices {