added banner

bugfixes
This commit is contained in:
Michael Clemens 2022-05-19 15:59:26 +02:00
parent 0eff320419
commit ec22e689fe
1 changed files with 33 additions and 6 deletions

View File

@ -1,4 +1,10 @@
#!/usr/bin/env python3
# Infos on colors: https://pypi.org/project/colored/
# Country list extracted from http://www.arrl.org/files/file/dxcclist.txt
import sys
import csv
import re
@ -9,6 +15,7 @@ from telnetlib import Telnet
from colored import fg, bg, attr
import configparser
from collections import defaultdict
import random
class ColorSpot():
@ -21,7 +28,24 @@ class ColorSpot():
self.qsl_countries = self.get_confirmed_countries()
self.print_banner()
@staticmethod
def rnd_col():
r = lambda: random.randint(0,255)
return'#%02X%02X%02X' % (r(),r(),r())
def print_banner(self):
"""print an awesome banner"""
ver = self.version
# print the banner
print(fg(self.rnd_col())+" ___ _ ___ _ ")
print(fg(self.rnd_col())+" / __|___| |___ _ _/ __|_ __ ___| |_ ")
print(fg(self.rnd_col())+" | (__/ _ \ / _ \ '_\__ \ '_ \/ _ \ _|")
print(fg(self.rnd_col())+" \___\___/_\___/_| |___/ .__/\___/\__|")
print(fg(self.rnd_col())+" -= DK1MI =- |_| ")
print(attr('reset'))
@staticmethod
def read_config(config, file_name):
@ -55,9 +79,9 @@ class ColorSpot():
'alert_fg': 'white',
'default_bg': 'black'}
config['cont_colors'] = {
"AF": "dark_orange_3b",
"AF": "light_salmon_3b",
"AN": "white",
"AS": "red",
"AS": "orange_red_1",
"EU": "cyan",
"NA": "steel_blue_3",
"OC": "orchid",
@ -68,8 +92,9 @@ class ColorSpot():
'alert_bg': 'indian_red_1a',
'alert_fg': 'white',
'default_bg': 'black'}
config['aliases'] = {
'fed. rep. of germany': 'federal republic of germany'}
config['alias']= {
'Asiatic Russia': 'Russia',
'European Russia': 'Russia'}
config['dxcc'] = {
"1A": "Sov. Mil. Order of Malta,EU",
"3A": "Monaco,EU",
@ -732,6 +757,8 @@ class ColorSpot():
for row in file:
if re.search("COUNTRY", row):
country = row.partition(">")[2].lower().rstrip()
if country in self.config['alias']:
country = self.config['alias'][country]
if country not in ret:
ret.append(country)
return ret
@ -814,7 +841,7 @@ class ColorSpot():
except AttributeError:
print(line)
elif "login: " in line:
print(line)
print(fg("grey_27") + line + attr("reset"))
#####################################################
# Main Routine #