{"action":"created","issue":{"url":"https://api.github.com/repos/jas-/node-libnmap/issues/40","repository_url":"https://api.github.com/repos/jas-/node-libnmap","labels_url":"https://api.github.com/repos/jas-/node-libnmap/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/jas-/node-libnmap/issues/40/comments","events_url":"https://api.github.com/repos/jas-/node-libnmap/issues/40/events","html_url":"https://github.com/jas-/node-libnmap/issues/40","id":159725483,"number":40,"title":"New Version Error","user":{"login":"thxmike","id":2818218,"avatar_url":"https://avatars.githubusercontent.com/u/2818218?v=3","gravatar_id":"","url":"https://api.github.com/users/thxmike","html_url":"https://github.com/thxmike","followers_url":"https://api.github.com/users/thxmike/followers","following_url":"https://api.github.com/users/thxmike/following{/other_user}","gists_url":"https://api.github.com/users/thxmike/gists{/gist_id}","starred_url":"https://api.github.com/users/thxmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thxmike/subscriptions","organizations_url":"https://api.github.com/users/thxmike/orgs","repos_url":"https://api.github.com/users/thxmike/repos","events_url":"https://api.github.com/users/thxmike/events{/privacy}","received_events_url":"https://api.github.com/users/thxmike/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-10T21:18:10Z","updated_at":"2016-06-11T11:14:13Z","closed_at":null,"body":"Something has changed with the new release of libnmap. I am using version 0.2.32 and nmap version 7.01. There error is reported below. Looking at the source in libnmap.js, \r\nThere appears to be is an xml string returned from the reports function and it expects an array. \r\nNot sure what changed. Let me know if additional information is needed.\r\n\r\nD:\\blahblahblah\\node_modules\\libnmap\\lib\\libnmap.js\r\n:132\r\n                var xml = report.join('');\r\n                                 ^\r\n\r\nTypeError: report.join is not a function\r\n    at Object.reporting.reports (D:\\blahblahblah\\Node Collector\\no\r\nde_modules\\libnmap\\lib\\libnmap.js:132:34)\r\n    at exe (D:\\blahblahblah\\node_modules\\libnmap\\li\r\nb\\libnmap.js:248:50)\r\n    at ChildProcess.exithandler (child_process.js:214:5)\r\n    at emitTwo (events.js:106:13)\r\n    at ChildProcess.emit (events.js:191:7)\r\n    at maybeClose (internal/child_process.js:852:16)\r\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)\r\n\r\nAfter some debugging, it appears that the following error is being swallowed:\r\n\r\n{ Error: stdout maxBuffer exceeded\r\n    at Socket.<anonymous> (child_process.js:265:14)\r\n    at emitOne (events.js:101:20)\r\n    at Socket.emit (events.js:188:7)\r\n    at readableAddChunk (_stream_readable.js:172:18)\r\n    at Socket.Readable.push (_stream_readable.js:130:10)\r\n    at Pipe.onread (net.js:542:20)\r\n  cmd: 'nmap  --host-timeout=120s -T4 -O -oX - -p1-1024 192.168.41.65-128' }\r\n\r\nIt appears to be related to the following issue with child_process\r\nhttp://stackoverflow.com/questions/23429499/stdout-buffer-issue-using-node-child-process\r\n"},"comment":{"url":"https://api.github.com/repos/jas-/node-libnmap/issues/comments/225353520","html_url":"https://github.com/jas-/node-libnmap/issues/40#issuecomment-225353520","issue_url":"https://api.github.com/repos/jas-/node-libnmap/issues/40","id":225353520,"user":{"login":"thxmike","id":2818218,"avatar_url":"https://avatars.githubusercontent.com/u/2818218?v=3","gravatar_id":"","url":"https://api.github.com/users/thxmike","html_url":"https://github.com/thxmike","followers_url":"https://api.github.com/users/thxmike/followers","following_url":"https://api.github.com/users/thxmike/following{/other_user}","gists_url":"https://api.github.com/users/thxmike/gists{/gist_id}","starred_url":"https://api.github.com/users/thxmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thxmike/subscriptions","organizations_url":"https://api.github.com/users/thxmike/orgs","repos_url":"https://api.github.com/users/thxmike/repos","events_url":"https://api.github.com/users/thxmike/events{/privacy}","received_events_url":"https://api.github.com/users/thxmike/received_events","type":"User","site_admin":false},"created_at":"2016-06-11T11:14:13Z","updated_at":"2016-06-11T11:14:13Z","body":"I changed the following lines to correct the problem.\r\n#253 execute = proc(cmd, function exe(err, stdout, stderr) {\r\nto this: execute = proc(cmd, **{maxBuffer: 1024 * 500}**, function exe(err, stdout, stderr) {\r\n\r\nMaking the maxBuffer a configurable item in the nmap options may be desirable for a final solution\r\n\r\nIn addition, around line number #135 some defensive programing may be in order:\r\n#135 var xml = report.join('');\r\n\r\nTo maybe something like this:\r\nif(Array.isArray(report)){\r\n                \tvar xml = report.join('');\r\n\t\t}else{\r\n\t\t\tthrow report //maybe this\r\n\t\t\tvar xml = '' //maybe this\r\n\t\t}\r\n\r\nOr maybe changing:\r\n#132 if ((!/object/.test(typeof report)) || (report.hasOwnProperty('code')))\r\n#133        return cb(new Error(report));\r\n\r\nto something like:\r\nif ((!/object/.test(typeof report)) || (report.hasOwnProperty('code') || (!Array.isArray(report))))\r\n        return cb(new Error(report));\r\n\r\nI will let the author decide the final solution."}}
{"actor":{"display_login":"thxmike"}}