Comparing version 1.4.4 to 1.4.5
33
index.js
@@ -332,3 +332,3 @@ #!/usr/bin/env node | ||
, columnSpacing: 10 | ||
, columnWidth: [20, 48, 10, 10, 40, 30] | ||
, columnWidth: [20, 12, 48, 10, 10, 40, 30] | ||
}) | ||
@@ -341,8 +341,8 @@ table.focus() | ||
// cached host machine IP | ||
markers.push({ ...resp, color: 'red', char: 'X', app: '-' }) | ||
markers.push({ ...resp, color: 'red', char: 'X', app: '-', pid: NaN }) | ||
// putting this machine's location info onto table | ||
table.setData({ | ||
headers: ['App', 'Address', 'Longitude', 'Latitude', 'Region', 'Country'], | ||
data: markers.map(v => [v.app, v.ip, v.lon, v.lat, v.region, v.country]) | ||
headers: ['App', 'PID', 'Address', 'Longitude', 'Latitude', 'Region', 'Country'], | ||
data: markers.map(v => [v.app, v.pid, v.ip, v.lon, v.lat, v.region, v.country]) | ||
}) | ||
@@ -371,7 +371,7 @@ | ||
if (isIP(record[1])) { | ||
let resp = lookup(record[1]) | ||
if (isIP(record[2])) { | ||
let resp = lookup(record[2]) | ||
if (validateLookup(resp)) { | ||
// cached remote machine IP | ||
markers.push({ ...resp, color: 'magenta', char: 'o', app: record[0] }) | ||
markers.push({ ...resp, color: 'magenta', char: 'o', app: record[0], pid: record[1] }) | ||
// adding remote machine's location into map | ||
@@ -383,19 +383,19 @@ addMarkerAndRender(resp.lon, resp.lat, 'magenta', 'o', map, screen) | ||
table.setData({ | ||
headers: ['App', 'Address', 'Longitude', 'Latitude', 'Region', 'Country'], | ||
data: markers.map(v => [v.app, v.ip, v.lon, v.lat, v.region, v.country]) | ||
headers: ['App', 'PID', 'Address', 'Longitude', 'Latitude', 'Region', 'Country'], | ||
data: markers.map(v => [v.app, v.pid, v.ip, v.lon, v.lat, v.region, v.country]) | ||
}) | ||
} | ||
else if (isValidDomain(record[1])) { | ||
domainToIP(record[1]).then(v => { | ||
else if (isValidDomain(record[2])) { | ||
domainToIP(record[2]).then(v => { | ||
v.map(v => lookup(v)).filter(validateLookup).forEach(v => { | ||
// cached remote machine IP | ||
markers.push({ ...v, color: 'magenta', char: 'o', app: record[0] }) | ||
markers.push({ ...v, color: 'magenta', char: 'o', app: record[0], pid: record[1] }) | ||
// putting peer location info onto table | ||
table.setData({ | ||
headers: ['App', 'Address', 'Longitude', 'Latitude', 'Region', 'Country'], | ||
headers: ['App', 'PID', 'Address', 'Longitude', 'Latitude', 'Region', 'Country'], | ||
data: markers | ||
.filter((v, i, a) => i === a.findIndex(t => t.app === v.app && t.ip === v.ip)) | ||
.map(v => [v.app, v.ip, v.lon, v.lat, v.region, v.country]) | ||
.filter((v, i, a) => i === a.findIndex(t => t.pid === v.pid && t.ip === v.ip)) | ||
.map(v => [v.app, v.pid, v.ip, v.lon, v.lat, v.region, v.country]) | ||
}) | ||
@@ -430,3 +430,3 @@ | ||
console.log('\n') | ||
console.table(markers, ['app', 'ip', 'lon', 'lat', 'region', 'country']) | ||
console.table(markers, ['app', 'pid', 'ip', 'lon', 'lat', 'region', 'country']) | ||
console.log('\n') | ||
@@ -441,2 +441,3 @@ | ||
app: v.app, | ||
pid: v.pid, | ||
ip: v.ip, | ||
@@ -443,0 +444,0 @@ lon: v.lon, |
{ | ||
"name": "lenz", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"description": "Console based MAP πΊ, with lots of features packed in π", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,3 +12,3 @@ # lenz π€ | ||
- Can find all active TCP/UDP socket connections & marks their respective peers in console map π€© | ||
- This will be helpful in understanding which application is to talking to which machine & where is that located | ||
- This will be helpful in understanding which application _( using PID )_ is to talking to which machine & where is that located | ||
@@ -15,0 +15,0 @@ > Note: For π operation, auto refresh has been enabled |
@@ -29,3 +29,3 @@ const { spawn } = require('child_process') | ||
let buffer | ||
const awk = spawn('awk', ['{ print $1, $9 }']) | ||
const awk = spawn('awk', ['{ print $1, $2, $9 }']) | ||
@@ -52,3 +52,3 @@ awk.stdout.on('data', d => { | ||
let buffer | ||
const awk = spawn('awk', ['/.*->.*/{ print $1, $2 }']) | ||
const awk = spawn('awk', ['/.*->.*/{ print $0 }']) | ||
@@ -88,5 +88,6 @@ awk.stdout.on('data', d => { | ||
v[0], | ||
v[1].replace(/.*->/, '').split(':').slice(0, -1).join(':').replace(/\[|\]/g, '') | ||
parseInt(v[1], 10), | ||
v[2].replace(/.*->/, '').split(':').slice(0, -1).join(':').replace(/\[|\]/g, '') | ||
]) | ||
.filter((v, i, a) => i === a.findIndex(t => t[0] === v[0] && t[1] === v[1])))) | ||
.filter((v, i, a) => i === a.findIndex(t => t[1] === v[1] && t[2] === v[2])))) | ||
.catch(reject).catch(reject).catch(reject) | ||
@@ -93,0 +94,0 @@ }) |
39365
823