Implemented check if interface is in wrong mode
This commit is contained in:
		
							parent
							
								
									ae389c8310
								
							
						
					
					
						commit
						7c5c37e9b5
					
				
							
								
								
									
										13
									
								
								src/main.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/main.js
									
									
									
									
									
								
							@ -82,9 +82,22 @@ if(errorMsg){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    logger.debug("Attaching error-logger..");
 | 
					    logger.debug("Attaching error-logger..");
 | 
				
			||||||
    const loggerTcpdump = logFactory("tcpdump");
 | 
					    const loggerTcpdump = logFactory("tcpdump");
 | 
				
			||||||
 | 
					    let linkTypeId;
 | 
				
			||||||
    proc.stderr.setEncoding("utf8").on("data", (data) => {
 | 
					    proc.stderr.setEncoding("utf8").on("data", (data) => {
 | 
				
			||||||
        if(!data.match(/^(tcpdump: )?listening on /i) || !data.match(/^\d+ packets captured/i)) {  // Catch start-error
 | 
					        if(!data.match(/^(tcpdump: )?listening on /i) || !data.match(/^\d+ packets captured/i)) {  // Catch start-error
 | 
				
			||||||
            loggerTcpdump.debug(data);
 | 
					            loggerTcpdump.debug(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(!linkTypeId && data.match(/^(tcpdump: )?listening on/i)){   // Grab first data containing listen-info if proper header was found
 | 
				
			||||||
 | 
					                const linkType = data.match(/((?<=link-type ))([a-z].*?) \(.*?\)(?=,)/i)[0];
 | 
				
			||||||
 | 
					                const linkTypeData = linkType.match(/(\S*) (.*)/i);
 | 
				
			||||||
 | 
					                const linkTypeId = linkTypeData[1];
 | 
				
			||||||
 | 
					                const linkTypeDetail = linkTypeData[2];
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					                if(linkTypeId !== "IEEE802_11_RADIO"){
 | 
				
			||||||
 | 
					                    logger.error(`Interface not in Monitor-mode! (Expected 'IEEE802_11_RADIO', but got '${linkTypeId}')`);
 | 
				
			||||||
 | 
					                    shutdown(1, "SIGKILL");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else loggerTcpdump.error(data);
 | 
					        else loggerTcpdump.error(data);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user