Author: gkruse Date: 2006-07-18 07:00:04 +0200 (Tue, 18 Jul 2006) New Revision: 154 Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib trunk/Resources/Nibs/English.lproj/MainMenu.nib/data.dependency trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib trunk/Resources/Nibs/English.lproj/MainMenu.nib/keyedobjects.nib trunk/Sources/Controller/InfoController.h trunk/Sources/Controller/InfoController.mm trunk/Sources/Controller/ScanController.h trunk/Sources/Controller/ScanController.m trunk/Sources/Controller/ScanControllerMenus.m trunk/Sources/Core/WaveNet.h trunk/Sources/Core/WaveNet.mm Log: Creepy but useful MIDI monitoring feature from themacuser Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Resources/Nibs/English.lproj/MainMenu.nib/classes.nib 2006-07-18 05:00:04 UTC (rev 154) @@ -128,6 +128,8 @@ importNetstumbler = id; injectPackets = id; joinNetwork = id; + monitorAllNetworks = id; + monitorSignal = id; openDonateURL = id; openWebsiteURL = id; restartGPS = id; @@ -158,6 +160,8 @@ "_mapButton" = NSButton; "_mapView" = NSView; "_mappingView" = MapView; + "_monitorAllMenu" = NSMenuItem; + "_monitorMenu" = NSMenuItem; "_netHierarchDrawer" = NSDrawer; "_networkTable" = ColoredRowTableView; "_networkView" = NSView; Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/data.dependency =================================================================== --- trunk/Resources/Nibs/English.lproj/MainMenu.nib/data.dependency 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Resources/Nibs/English.lproj/MainMenu.nib/data.dependency 2006-07-18 05:00:04 UTC (rev 154) @@ -4,8 +4,8 @@ <dict> <key>IBPaletteDependency</key> <array> + <string>RollOverButtonPalette</string> <string>ASKPalette</string> - <string>RollOverButtonPalette</string> </array> </dict> </plist> Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Resources/Nibs/English.lproj/MainMenu.nib/info.nib 2006-07-18 05:00:04 UTC (rev 154) @@ -26,7 +26,7 @@ <string>383 329 258 339 0 0 1024 746 </string> </dict> <key>IBFramework Version</key> - <string>443.0</string> + <string>446.1</string> <key>IBLockedObjects</key> <array> <integer>1353</integer> @@ -34,11 +34,11 @@ </array> <key>IBOpenObjects</key> <array> + <integer>29</integer> <integer>1446</integer> <integer>21</integer> - <integer>29</integer> </array> <key>IBSystem Version</key> - <string>8I127</string> + <string>8J135</string> </dict> </plist> Modified: trunk/Resources/Nibs/English.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Sources/Controller/InfoController.h =================================================================== --- trunk/Sources/Controller/InfoController.h 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Sources/Controller/InfoController.h 2006-07-18 05:00:04 UTC (rev 154) @@ -36,6 +36,7 @@ NSArray *aClientKeys; NSDictionary *aClients; NSString *_lastSorted; + NSString* selectedRow; IBOutlet NSTableView* aShortTable; IBOutlet NSTableView* aTable; @@ -47,4 +48,5 @@ - (IBAction)showNet:(id)sender; - (IBAction)commentChanged:(id)sender; - (void)reloadData; +- (NSString *) theRow; @end Modified: trunk/Sources/Controller/InfoController.mm =================================================================== --- trunk/Sources/Controller/InfoController.mm 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Sources/Controller/InfoController.mm 2006-07-18 05:00:04 UTC (rev 154) @@ -61,6 +61,7 @@ - (void)awakeFromNib { _clientCount = 0; [aShortTable setHeaderView:nil]; + [aClientTable setDoubleAction:@selector(trackClient:)]; } - (void)setDetails:(bool)visible { @@ -316,7 +317,6 @@ } } - #pragma mark - -(void) dealloc { @@ -325,4 +325,9 @@ if (_n!=nil) [_n release]; [super dealloc]; } + +- (NSString *) theRow { + return [aClientKeys objectAtIndex:[aClientTable selectedRow]]; +} + @end Modified: trunk/Sources/Controller/ScanController.h =================================================================== --- trunk/Sources/Controller/ScanController.h 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Sources/Controller/ScanController.h 2006-07-18 05:00:04 UTC (rev 154) @@ -136,6 +136,8 @@ IBOutlet NSMenuItem *_deauthMenu; IBOutlet NSMenuItem *_deauthAllMenu; IBOutlet NSMenuItem *_authFloodMenu; + IBOutlet NSMenuItem *_monitorMenu; + IBOutlet NSMenuItem *_monitorAllMenu; IBOutlet NSMenuItem *aInjPacketsMenu; IBOutlet NSMenuItem *_showNetInMap; IBOutlet NSMenuItem *_showAllNetsInMap; @@ -188,6 +190,8 @@ - (IBAction)deautheticateNetwork:(id)sender; - (IBAction)deautheticateAllNetworks:(id)sender; - (IBAction)authFloodNetwork:(id)sender; +- (IBAction)monitorSignal:(id)sender; +- (IBAction)monitorAllNetworks:(id)sender; - (IBAction)injectPackets:(id)sender; - (IBAction)restartGPS:(id)sender; @@ -205,7 +209,6 @@ - (IBAction)debugBeaconFlood:(id)sender; - (IBAction)debugTestWPAHashingFunction:(id)sender; - (IBAction)debugExportTrafficView:(id)sender; - void NotifySleep( void * refCon, io_service_t service, natural_t messageType, void * messageArgument ); Modified: trunk/Sources/Controller/ScanController.m =================================================================== --- trunk/Sources/Controller/ScanController.m 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Sources/Controller/ScanController.m 2006-07-18 05:00:04 UTC (rev 154) @@ -647,4 +647,17 @@ } } +- (void)trackClient:(id)sender { + [_monitorMenu setState:NSOnState]; + [_monitorAllMenu setState:NSOffState]; + NSString *bssid, *mac; + bssid = [_curNet BSSID]; + mac = [aInfoController theRow]; + NSLog(@"BSSID is %@ and MAC is %@", bssid, mac); + [_monitorMenu setTitle:[NSString stringWithFormat:@"%@ %@ - %@",NSLocalizedString(@"Monitoring ", "menu item"), bssid, mac]]; + [WaveNet setTrackString:bssid]; + [WaveNet setTrackStringClient:mac]; + +} + @end Modified: trunk/Sources/Controller/ScanControllerMenus.m =================================================================== --- trunk/Sources/Controller/ScanControllerMenus.m 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Sources/Controller/ScanControllerMenus.m 2006-07-18 05:00:04 UTC (rev 154) @@ -37,6 +37,7 @@ #import "MapView.h" #import "MapViewAreaView.h" #import "WaveStorageController.h" +#import "WaveNet.h" @implementation ScanController(MenuExtension) @@ -565,6 +566,42 @@ } } +- (IBAction)monitorSignal:(id)sender { + if ([_monitorMenu state]==NSOffState) { + [_monitorMenu setState:NSOnState]; + + [_monitorAllMenu setState:NSOffState]; + + [_monitorMenu setTitle:[NSLocalizedString(@"Monitoring ", "menu item") stringByAppendingString:[_curNet BSSID]]]; + + [WaveNet setTrackString:[_curNet BSSID]]; + [WaveNet setTrackStringClient:@"any"]; + } else { + [_monitorMenu setState:NSOffState]; + [_monitorMenu setTitle:NSLocalizedString(@"Monitor Signal Strength", "menu item")]; + + [WaveNet setTrackString:@""]; + [WaveNet setTrackStringClient:@""]; + } +} + +- (IBAction)monitorAllNetworks:(id)sender { + if ([_monitorAllMenu state]==NSOffState) { + [_monitorAllMenu setState:NSOnState]; + + [_monitorMenu setState:NSOffState]; + [_monitorMenu setTitle:NSLocalizedString(@"Monitor Signal Strength", "menu item")]; + + [WaveNet setTrackString:@"any"]; + [WaveNet setTrackStringClient:@"any"]; + } else { + [_monitorAllMenu setState:NSOffState]; + [_monitorAllMenu setTitle:NSLocalizedString(@"Monitor all signals", "menu item")]; + [WaveNet setTrackString:@""]; + [WaveNet setTrackStringClient:@""]; + } +} + #pragma mark - #pragma mark MAP MENU #pragma mark - Modified: trunk/Sources/Core/WaveNet.h =================================================================== --- trunk/Sources/Core/WaveNet.h 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Sources/Core/WaveNet.h 2006-07-18 05:00:04 UTC (rev 154) @@ -25,6 +25,7 @@ #import <Cocoa/Cocoa.h> #import <UnitKit/UnitKit.h> +#include <QuickTime/QuickTime.h> #import "WavePacket.h" #import "ImportController.h" #import "GrowlController.h" @@ -106,10 +107,9 @@ int curPacketData; // for setting graphData int curSignalData; // for setting graphData int _avgTime; // how many seconds are take for average? - ImportController *_im; - + } - (id)initWithID:(int)netID; @@ -197,4 +197,10 @@ - (NSString*)crackError; -@end +- (void)openChannel2:(int)note; +- (void)playChord:(int) note; +- (void)closeChannel; ++ (void)setTrackString:(NSString*)cs; ++ (void)setTrackStringClient:(NSString*)cs; + +@end \ No newline at end of file Modified: trunk/Sources/Core/WaveNet.mm =================================================================== --- trunk/Sources/Core/WaveNet.mm 2006-07-02 03:40:17 UTC (rev 153) +++ trunk/Sources/Core/WaveNet.mm 2006-07-18 05:00:04 UTC (rev 154) @@ -43,6 +43,14 @@ #define min(a, b) (a) < (b) ? a : b + +int _numMidi; +NoteAllocator na, na2; +NoteChannel nc, nc2; +NoteRequest nr, nr2; +NSString *trackString,*trackStringClient; + + struct graphStruct zeroGraphData; struct signalCoords { @@ -816,9 +824,56 @@ graphData->trafficData[graphLength] += [w length]; graphData->packetData[graphLength] += 1; curSignalData += _curSignal; + + // themacuser - sounds here + + if (([[w BSSIDString] isEqualToString:trackString] || [trackString isEqualToString:@"any"]) && ([[w clientFromID] isEqualToString:trackStringClient] || [trackStringClient isEqualToString:@"any"])) { + + if (_numMidi == 200) + { + [self openChannel2:7]; + } + + if (_numMidi == 255) + { + _numMidi = 0; + [self closeChannel]; + na = na2; + nc = nc2; + nr = nr2; + } + + if (!nc || !na) + { + ComponentResult thisError; + na = 0; + nc = 0; + // Open up the note allocator. + na = OpenDefaultComponent(kNoteAllocatorComponentType, 0); + if (!na) + NSLog(@"Error initializing QuickTime Component"); + + BigEndianShort s = (BigEndianShort){EndianS16_NtoB(8)}; + BigEndianFixed f = (BigEndianFixed){EndianS16_NtoB(0x00010000)}; + + // Fill out a NoteRequest using NAStuffToneDescription to help, and + // allocate a NoteChannel. + nr.info.flags = 0; + nr.info.polyphony = s; // simultaneous tones + nr.info.typicalPolyphony = f; // usually just one note + thisError = NAStuffToneDescription(na, 7, &nr.tone); // 1 is piano + thisError = NANewNoteChannel(na, &nr, &nc); + } + + [self playChord:_curSignal]; + _numMidi++; + // [self closeChannel]; + } + curPacketData++; curTrafficData += [w length]; } + if (_BSSID==Nil) { _BSSID=[[NSString stringWithString:[w BSSIDString]] retain]; @@ -942,8 +997,55 @@ _BSSID = [[NSString stringWithFormat:@"%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", _rawBSSID[0], _rawBSSID[1], _rawBSSID[2], _rawBSSID[3], _rawBSSID[4], _rawBSSID[5]] retain]; } - - _curSignal = [[info objectForKey:@"signal"] intValue] - [[info objectForKey:@"noise"] intValue]; + + if ([_BSSID isEqualToString:trackString] || [trackString isEqualToString:@"any"]) { + + if (_numMidi == 200) + { + [self openChannel2:7]; + } + + if (_numMidi == 255) + { + _numMidi = 0; + [self closeChannel]; + na = na2; + nc = nc2; + nr = nr2; + } + + if (!nc || !na) + { + ComponentResult thisError; + na = 0; + nc = 0; + // Open up the note allocator. + na = OpenDefaultComponent(kNoteAllocatorComponentType, 0); + if (!na) + NSLog(@"Error initializing QuickTime Component"); + + BigEndianShort s = (BigEndianShort){EndianS16_NtoB(8)}; + BigEndianFixed f = (BigEndianFixed){EndianS16_NtoB(0x00010000)}; + + // Fill out a NoteRequest using NAStuffToneDescription to help, and + // allocate a NoteChannel. + nr.info.flags = 0; + nr.info.polyphony = s; // simultaneous tones + nr.info.typicalPolyphony = f; // usually just one note + thisError = NAStuffToneDescription(na, 7, &nr.tone); // 1 is piano + thisError = NANewNoteChannel(na, &nr, &nc); + } + + [self playChord:_curSignal]; + _numMidi++; + // [self closeChannel]; + } + + + + + + _curSignal = [[info objectForKey:@"signal"] intValue] - [[info objectForKey:@"noise"] intValue]; if (_curSignal<0) _curSignal = 0; _primaryChannel = _channel = [[info objectForKey:@"channel"] intValue]; @@ -1693,6 +1795,8 @@ [NSThread detachNewThreadSelector:@selector(doReinjectWithScanner:) toTarget:self withObject:scanner]; } + + #pragma mark - - (void)dealloc { @@ -1734,4 +1838,57 @@ [super dealloc]; } +- (void)openChannel2:(int)note { + ComponentResult thisError; + na2 = 0; + nc2 = 0; + // Open up the note allocator. + na2 = OpenDefaultComponent(kNoteAllocatorComponentType, 0); + if (!na2) + NSLog(@"Error initializing QuickTime Component"); + + BigEndianShort s = (BigEndianShort){EndianS16_NtoB(8)}; + BigEndianFixed f = (BigEndianFixed){EndianS16_NtoB(0x00010000)}; + + // Fill out a NoteRequest using NAStuffToneDescription to help, and + // allocate a NoteChannel. + nr2.info.flags = 0; + nr2.info.polyphony = s; // simultaneous tones + nr2.info.typicalPolyphony = f; // usually just one note + thisError = NAStuffToneDescription(na2, note, &nr2.tone); // 1 is piano + thisError = NANewNoteChannel(na2, &nr2, &nc2); +} + + + +- (void) playChord:(int)note{ + int the_note = note; // middle C == 60 + NAPlayNote(na, nc, the_note, 127); // note at velocity 80 + [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]]; + the_note = 60 + 0 - 13; + NAPlayNote(na, nc, the_note, 0); // note at velocity 80 + +} + +- (void)closeChannel { + if (nc) + NADisposeNoteChannel(na, nc); + if (na) + CloseComponent(na); + +} + ++ (void)setTrackString:(NSString*)cs{ + [WaveHelper secureReplace:&trackString withObject:cs]; +} + ++ (void)setTrackStringClient:(NSString*)cs{ + [WaveHelper secureReplace:&trackStringClient withObject:cs]; +} + ++ (NSString*)trackString{ + return trackString; +} + + @end