update to my_apps
This commit is contained in:
parent
338c606bb1
commit
b6bc796e5d
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -4,6 +4,3 @@
|
|||||||
[submodule "pyrip"]
|
[submodule "pyrip"]
|
||||||
path = pyrip
|
path = pyrip
|
||||||
url = https://git.mount-mockery.de/application/pyrip.git
|
url = https://git.mount-mockery.de/application/pyrip.git
|
||||||
[submodule "pyrip.src"]
|
|
||||||
path = pyrip.src
|
|
||||||
url = https://git.mount-mockery.de/application/pyrip.git
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
~/my_apps/mqtt_sniffer/venv/bin/python ~/my_apps/mqtt_sniffer/mqtt_sniffer.py $*
|
~/my_apps/mqtt_sniffer/mqtt_sniffer $*
|
||||||
|
|
||||||
|
4
netst
4
netst
@ -1,6 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
BASEDIR=$(dirname $0)
|
~/my_apps/netst/netst $*
|
||||||
|
|
||||||
$BASEDIR/netst.src/venv/bin/python $BASEDIR/netst.src/netst.py $*
|
|
||||||
|
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
import dns.resolver
|
|
||||||
import ifcfg
|
|
||||||
import json
|
|
||||||
import socket
|
|
||||||
import struct
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
interfaces = ifcfg.interfaces()
|
|
||||||
|
|
||||||
def exit_device():
|
|
||||||
print("Possible devices:", ", ".join(interfaces.keys()))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def gateway(device):
|
|
||||||
with open("/proc/net/route") as fh:
|
|
||||||
# skip header
|
|
||||||
next(fh)
|
|
||||||
for line in fh:
|
|
||||||
routes = line.strip().split()
|
|
||||||
if routes[0] == device:
|
|
||||||
destination = socket.inet_ntoa(struct.pack("<L", int(routes[1], 16)))
|
|
||||||
if destination != "0.0.0.0":
|
|
||||||
continue
|
|
||||||
return socket.inet_ntoa(struct.pack("<L", int(routes[2], 16)))
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
DEVICE = sys.argv[1]
|
|
||||||
except IndexError:
|
|
||||||
print("You need to give the device name as first argument!\n")
|
|
||||||
exit_device()
|
|
||||||
|
|
||||||
HRN = { # Human Readable Name
|
|
||||||
'MAC': 'ether',
|
|
||||||
'MTU': 'mtu',
|
|
||||||
'IP': 'inet',
|
|
||||||
'Netmask': 'netmask',
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
info = interfaces[DEVICE]
|
|
||||||
except KeyError:
|
|
||||||
print("Unknown device:", DEVICE, "\n")
|
|
||||||
exit_device()
|
|
||||||
try:
|
|
||||||
dns_resolver = dns.resolver.Resolver()
|
|
||||||
except dns.resolver.NoResolverConfiguration:
|
|
||||||
dns_server = []
|
|
||||||
else:
|
|
||||||
dns_server = dns_resolver.nameservers
|
|
||||||
|
|
||||||
print('+' + 27 * '-' + '+')
|
|
||||||
print("|%9s: %s" % ('Device', DEVICE) + (16 - len(DEVICE)) * ' ' + '|')
|
|
||||||
print('+' + 27 * '-' + '+')
|
|
||||||
for name in HRN:
|
|
||||||
print("%10s: %s" % (name, info[HRN[name]]))
|
|
||||||
print("%10s: %s" % ('Gateway', gateway(DEVICE)))
|
|
||||||
|
|
||||||
try:
|
|
||||||
print("%10s: %s" % ("Domain", socket.getfqdn().split('.', 1)[1]))
|
|
||||||
except IndexError:
|
|
||||||
print("%10s: None" % "Domain")
|
|
||||||
for i, dns in enumerate(dns_server):
|
|
||||||
print("%10s: %s" % ("DNS_%d" % (i + 1), dns))
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
ifcfg
|
|
||||||
dnspython
|
|
||||||
|
|
4
pyrip
4
pyrip
@ -1,6 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
BASEDIR=$(dirname $0)
|
~/my_apps/pyrip/pyrip $*
|
||||||
|
|
||||||
$BASEDIR/pyrip.src/venv/bin/python $BASEDIR/pyrip.src/pyrip.py $*
|
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 64d42cdc57d03b323ebcbc8a29cf8f0aa2a96a58
|
|
Loading…
x
Reference in New Issue
Block a user