diff --git a/dcl-rdns-generate.py b/dcl-rdns-generate.py new file mode 100755 index 0000000..56e78b5 --- /dev/null +++ b/dcl-rdns-generate.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 + +import ipaddress +import sys + +def hexstr2int(string): + return int(string.replace(':', ''), 16) + +FIRST_MAC = hexstr2int('02:00:b3:39:79:4d') +FIRST_V4 = ipaddress.ip_address('185.203.112.2') +FIRST_V6 = "2a0a:e5c0:0:2:400:b3ff:fe39:794d" + +V6_NAT64_BASE = ipaddress.ip_address("2a0a:e5c0:0:1:0:1::") + +def v4_from_mac(mac): + """Calculates the IPv4 address from a MAC address. + + mac: string (the colon-separated representation) + returns: ipaddress.ip_address object with the v4 address + """ + return FIRST_V4 + (hexstr2int(mac) - FIRST_MAC) + +def v4_from_v6(ipv6ip): + """Calculates the IPv4 address from the IPv4 address + + ipv6ip: the ip + returns: ipaddress.ip_address object with the v4 address + """ + + return FIRST_V4 + (hexstr2int(ipv6ip) - (hexstr2int(FIRST_V6))) + +def v6_from_v4(ipv4): + v4addr = ipaddress.ip_address(ipv4) + return V6_NAT64_BASE + int(v4addr) + +if __name__ == "__main__": + first_addr = ipaddress.ip_address(sys.argv[1]) + last_addr = ipaddress.ip_address(sys.argv[2]) + + while True: + addr = first_addr.reverse_pointer + name = "{}.place5.ungleich.ch".format(str(first_addr).replace(":","")) + record = "{}. IN PTR {}.".format(addr, name) + record = "{}. IN AAAA {}".format(name, first_addr) + + print(record) + + if first_addr == last_addr: + break + + first_addr += 1 + + sys.exit(0) + + out = [] + + try: + out.append(v4_from_v6(addr)) + except: + pass + + try: + out.append(v6_from_v4(addr)) + except: + pass + + + print("{}".format(out)) + +# test.ch +# 2a0a:e5c0:0:1:0:1:504a:8a8c +# 80.74.138.140 +# 1347062412 +# diff --git a/hole_mails b/hole_mails index 06c2e05..abca28c 100755 --- a/hole_mails +++ b/hole_mails @@ -2,9 +2,10 @@ # Tue Jul 18 15:13:45 CEST 2017 securemail -#fetchmail mbsync -a +#fetchmail + # Disabled by Mon Jun 20 10:56:19 CEST 2016 -- using mu now # notmuch new diff --git a/lock-screen b/lock-screen index 7c53347..1a45b7a 100755 --- a/lock-screen +++ b/lock-screen @@ -9,6 +9,9 @@ # i3lock -i ~/.background.png --dpms --nofork # try to start - if it already runs it will just exit -xscreensaver & +if ! pgrep xscreensaver; then + xscreensaver -no-splash & + sleep 1 +fi xscreensaver-command -lock diff --git a/securemail b/securemail index e7c1068..e190f9c 100755 --- a/securemail +++ b/securemail @@ -33,24 +33,19 @@ if [ $# -ge 1 ]; then HOST=$1; shift fi -#ssh -T -f -C -N \ -# -L4241:mx.ungleich.ch:$SMTP \ # -R :4242:localhost:22 \ -# -D 3128 "$@" \ -# "$HOST" && sendmail -q -# + ssh -T -f -C -N \ - -L2323:mx.ungleich.ch:$IMAPS \ - -L4241:mx.ungleich.ch:$SMTP \ + -L[::1]:2323:localhost:$IMAPS \ + -L[::1]:4241:localhost:$SMTP \ -L2324:imap.googlemail.com:$IMAPS \ -L2325:mail.zhaw.ch:$IMAPS \ -L2326:imap.googlemail.com:$POP3S \ - -R :4242:localhost:22 \ - -D 3128 "$@" \ "$HOST" && sendmail -q # Fernzugriff # ssh -T -f -C -N -R4242:localhost:22 "$HOST" +# -D 3128 "$@" \ #ssh -T -f -C -N -L2342:mx2.schottelius.org:$SMTP 62.65.138.66 #ssh -T -f -C -N -L4242:imaps.schottelius.org:$IMAPS "$HOST" diff --git a/start-post-i3 b/start-post-i3 index b8a0597..d63c737 100755 --- a/start-post-i3 +++ b/start-post-i3 @@ -1,14 +1,12 @@ #!/bin/sh # Restore layouts -i3-msg 'workspace 1; append_layout /home/users/nico/.i3/workspace-1.json' -i3-msg 'workspace 2; append_layout /home/users/nico/.i3/workspace-2.json' -i3-msg 'workspace 10; append_layout /home/users/nico/.i3/workspace-10.json' +i3-msg 'workspace 1; append_layout ~/.i3/workspace-1.json' +i3-msg 'workspace 2; append_layout ~/.i3/workspace-2.json' +i3-msg 'workspace 10' # Start programs afterwards and watch matching chromium & # slack & -#firefox & -#choqok & ssh-add