| 82 | } |
| 83 | |
| 84 | public static abstract class InspectionReceiver extends Child.EventReceiver |
| 85 | { |
| 86 | |
| 87 | public void onEnd( int exitCode ) { |
| 88 | if( exitCode != 0 ) |
| 89 | Logger.error( "nmap exited with code " + exitCode ); |
| 90 | } |
| 91 | |
| 92 | public void onDeath(int signal) { |
| 93 | Logger.error( "nmap killed by signal " + signal); |
| 94 | } |
| 95 | |
| 96 | public void onEvent(Event e) { |
| 97 | if(e instanceof Port) { |
| 98 | Port p = (Port)e; |
| 99 | if(p.service == null) { |
| 100 | onOpenPortFound(p.port, p.protocol); |
| 101 | } else { |
| 102 | onServiceFound(p.port, p.protocol, p.service, p.version); |
| 103 | } |
| 104 | } else if(e instanceof Os) { |
| 105 | Os os = (Os) e; |
| 106 | onOsFound(os.os); |
| 107 | onDeviceFound(os.type); |
| 108 | } else { |
| 109 | Logger.error("unknown event: " + e); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | public abstract void onOpenPortFound( int port, String protocol ); |
| 114 | public abstract void onServiceFound( int port, String protocol, String service, String version ); |
| 115 | public abstract void onOsFound( String os ); |
| 116 | public abstract void onDeviceFound( String device ); |
| 117 | } |
| 118 | |
| 119 | public NMap() { |
| 120 | mHandler = "nmap"; |
nothing calls this directly
no outgoing calls
no test coverage detected