()
| 541 | } |
| 542 | |
| 543 | public static void preloadServices(){ |
| 544 | if (!mServices.isEmpty()) |
| 545 | return; |
| 546 | |
| 547 | FileReader fr = null; |
| 548 | BufferedReader reader = null; |
| 549 | try{ |
| 550 | // preload network service and ports map |
| 551 | |
| 552 | fr = new FileReader(mContext.getFilesDir().getAbsolutePath() + "/tools/nmap/nmap-services"); |
| 553 | reader = new BufferedReader(fr); |
| 554 | String line; |
| 555 | Matcher matcher; |
| 556 | String port, proto; |
| 557 | |
| 558 | while ((line = reader.readLine()) != null) { |
| 559 | if ((matcher = SERVICE_PARSER.matcher(line)) != null && matcher.find()) { |
| 560 | proto = matcher.group(1); |
| 561 | port = matcher.group(2); |
| 562 | |
| 563 | mServices.put(proto, port); |
| 564 | mPorts.put(port, proto); |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | } catch (Exception e) { |
| 569 | mServices.clear(); |
| 570 | mPorts.clear(); |
| 571 | |
| 572 | errorLogging(e); |
| 573 | } finally { |
| 574 | IOUtils.closeQuietly(reader); |
| 575 | IOUtils.closeQuietly(fr); |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | private static void preloadVendors(){ |
| 580 | if(mVendors == null){ |
no test coverage detected