not1mm 24.11.10__py3-none-any.whl → 24.11.12.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
not1mm/__main__.py CHANGED
@@ -2024,8 +2024,19 @@ class MainWindow(QtWidgets.QMainWindow):
2024
2024
  Returns:
2025
2025
  -------
2026
2026
  None
2027
+
2028
+ Control
2029
+ QWRTYIOPSFGHJLBNM,./;'[]//-
2030
+
2031
+
2032
+ shift control
2033
+ ABCDEFGHIJKLMNOPQRSTUVWXY
2027
2034
  """
2028
2035
  modifier = event.modifiers()
2036
+ # the_key = event.key()
2037
+
2038
+ # print(f"Modifier is {modifier=} Key is {the_key=}")
2039
+
2029
2040
  if (
2030
2041
  event.key() == Qt.Key.Key_Equal
2031
2042
  and modifier == Qt.KeyboardModifier.ControlModifier
@@ -81,7 +81,11 @@ class CAT:
81
81
  }
82
82
 
83
83
  if self.interface == "flrig":
84
- target = f"http://{host}:{port}"
84
+ if not self.__check_sane_ip(self.host):
85
+ self.online = False
86
+ return
87
+
88
+ target = f"http://{self.host}:{self.port}"
85
89
  logger.debug("%s", target)
86
90
  self.server = xmlrpc.client.ServerProxy(target)
87
91
  self.online = True
@@ -91,15 +95,30 @@ class CAT:
91
95
  ConnectionRefusedError,
92
96
  xmlrpc.client.Fault,
93
97
  http.client.BadStatusLine,
98
+ socket.error,
99
+ socket.gaierror,
94
100
  ):
95
101
  self.online = False
96
102
  elif self.interface == "rigctld":
103
+ if not self.__check_sane_ip(self.host):
104
+ self.online = False
105
+ return
97
106
  self.__initialize_rigctrld()
98
107
  elif self.interface == "fake":
99
108
  self.online = True
100
109
  logger.debug("Using Fake Rig")
101
110
  return
102
111
 
112
+ def __check_sane_ip(self, ip: str) -> bool:
113
+ """check if IP address look normal"""
114
+ x = ip.split(".")
115
+ if len(x) != 4:
116
+ return False
117
+ for y in x:
118
+ if not y.isnumeric():
119
+ return False
120
+ return True
121
+
103
122
  def __initialize_rigctrld(self):
104
123
  try:
105
124
  self.rigctrlsocket = socket.socket()
@@ -107,7 +126,13 @@ class CAT:
107
126
  self.rigctrlsocket.connect((self.host, self.port))
108
127
  logger.debug("Connected to rigctrld")
109
128
  self.online = True
110
- except (ConnectionRefusedError, TimeoutError, OSError) as exception:
129
+ except (
130
+ ConnectionRefusedError,
131
+ TimeoutError,
132
+ OSError,
133
+ socket.error,
134
+ socket.gaierror,
135
+ ) as exception:
111
136
  self.rigctrlsocket = None
112
137
  self.online = False
113
138
  logger.debug("%s", f"{exception}")
@@ -233,6 +258,7 @@ class CAT:
233
258
  http.client.BadStatusLine,
234
259
  http.client.CannotSendRequest,
235
260
  http.client.ResponseNotReady,
261
+ AttributeError,
236
262
  ) as exception:
237
263
  self.online = False
238
264
  logger.debug(f"{exception=}")
@@ -280,6 +306,7 @@ class CAT:
280
306
  http.client.BadStatusLine,
281
307
  http.client.CannotSendRequest,
282
308
  http.client.ResponseNotReady,
309
+ AttributeError,
283
310
  ) as exception:
284
311
  self.online = False
285
312
  logger.debug("%s", f"{exception}")
@@ -329,6 +356,7 @@ class CAT:
329
356
  http.client.BadStatusLine,
330
357
  http.client.CannotSendRequest,
331
358
  http.client.ResponseNotReady,
359
+ AttributeError,
332
360
  ) as exception:
333
361
  self.online = False
334
362
  logger.debug("getbw_flrig: %s", f"{exception}")
@@ -453,6 +481,7 @@ class CAT:
453
481
  http.client.BadStatusLine,
454
482
  http.client.CannotSendRequest,
455
483
  http.client.ResponseNotReady,
484
+ AttributeError,
456
485
  ) as exception:
457
486
  self.online = False
458
487
  logger.debug("%s", f"{exception}")
@@ -502,6 +531,7 @@ class CAT:
502
531
  http.client.BadStatusLine,
503
532
  http.client.CannotSendRequest,
504
533
  http.client.ResponseNotReady,
534
+ AttributeError,
505
535
  ) as exception:
506
536
  self.online = False
507
537
  logger.debug("setvfo_flrig: %s", f"{exception}")
@@ -547,6 +577,7 @@ class CAT:
547
577
  http.client.BadStatusLine,
548
578
  http.client.CannotSendRequest,
549
579
  http.client.ResponseNotReady,
580
+ AttributeError,
550
581
  ) as exception:
551
582
  self.online = False
552
583
  logger.debug(f"{exception=}")
@@ -590,6 +621,7 @@ class CAT:
590
621
  http.client.BadStatusLine,
591
622
  http.client.CannotSendRequest,
592
623
  http.client.ResponseNotReady,
624
+ AttributeError,
593
625
  ) as exception:
594
626
  self.online = False
595
627
  logger.debug("setpower_flrig: %s", f"{exception}")
@@ -648,6 +680,7 @@ class CAT:
648
680
  http.client.BadStatusLine,
649
681
  http.client.CannotSendRequest,
650
682
  http.client.ResponseNotReady,
683
+ AttributeError,
651
684
  ) as exception:
652
685
  self.online = False
653
686
  logger.debug("%s", f"{exception}")
@@ -686,6 +719,7 @@ class CAT:
686
719
  http.client.BadStatusLine,
687
720
  http.client.CannotSendRequest,
688
721
  http.client.ResponseNotReady,
722
+ AttributeError,
689
723
  ) as exception:
690
724
  self.online = False
691
725
  logger.debug("%s", f"{exception}")
not1mm/lib/cwinterface.py CHANGED
@@ -31,6 +31,9 @@ class CW:
31
31
  self.speed = 20
32
32
  self.winkeyer_functions = []
33
33
  if self.servertype == 2:
34
+ if not self.__check_sane_ip(self.host):
35
+ logger.critical(f"Bad IP: {self.host}")
36
+ return
34
37
  with ServerProxy(f"http://{self.host}:{self.port}") as proxy:
35
38
  try:
36
39
  self.winkeyer_functions = proxy.system.listMethods()
@@ -47,6 +50,16 @@ class CW:
47
50
  "http://%s:%s, xmlrpc Connection Refused", self.host, self.port
48
51
  )
49
52
 
53
+ def __check_sane_ip(self, ip: str) -> bool:
54
+ """check if IP address look normal"""
55
+ x = ip.split(".")
56
+ if len(x) != 4:
57
+ return False
58
+ for y in x:
59
+ if not y.isnumeric():
60
+ return False
61
+ return True
62
+
50
63
  def sendcw(self, texttosend):
51
64
  """sends cw to k1el"""
52
65
  logger.debug(f"{texttosend=} {self.servertype=}")
@@ -61,7 +74,7 @@ class CW:
61
74
  def _sendcw_xmlrpc(self, texttosend):
62
75
  """sends cw to xmlrpc"""
63
76
  logger.debug("xmlrpc: %s", texttosend)
64
- if texttosend:
77
+ if texttosend and self.__check_sane_ip(self.host):
65
78
  with ServerProxy(f"http://{self.host}:{self.port}") as proxy:
66
79
  try:
67
80
  proxy.k1elsendstring(texttosend)
@@ -76,23 +89,35 @@ class CW:
76
89
  logger.debug(
77
90
  "http://%s:%s, xmlrpc Connection Refused", self.host, self.port
78
91
  )
92
+ else:
93
+ logger.critical(f"Bad IP: {self.host}")
79
94
 
80
95
  def _sendcw_udp(self, texttosend):
81
96
  """send cw to udp port"""
82
97
  logger.debug("UDP: %s", texttosend)
83
- if texttosend:
98
+ if texttosend and self.__check_sane_ip(self.host):
84
99
  server_address_port = (self.host, self.port)
85
100
  # bufferSize = 1024
86
101
  udp_client_socket = socket.socket(
87
102
  family=socket.AF_INET, type=socket.SOCK_DGRAM
88
103
  )
89
- udp_client_socket.sendto(bytes(texttosend, "utf-8"), server_address_port)
104
+ try:
105
+ udp_client_socket.sendto(
106
+ bytes(texttosend, "utf-8"), server_address_port
107
+ )
108
+ except socket.gaierror:
109
+ ...
110
+ else:
111
+ logger.critical(f"Bad IP: {self.host.encode()}")
90
112
 
91
113
  def _sendcwcat(self, texttosend):
92
114
  """..."""
93
115
 
94
116
  def set_winkeyer_speed(self, speed):
95
117
  """doc"""
118
+ if not self.__check_sane_ip(self.host):
119
+ logger.critical(f"Bad IP: {self.host}")
120
+ return
96
121
  with ServerProxy(f"http://{self.host}:{self.port}") as proxy:
97
122
  try:
98
123
  if "setspeed" in self.winkeyer_functions:
not1mm/lib/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """It's the version"""
2
2
 
3
- __version__ = "24.11.10"
3
+ __version__ = "24.11.12.1"
not1mm/test.py ADDED
@@ -0,0 +1,39 @@
1
+ class CW:
2
+ """
3
+
4
+ An interface to cwdaemon and PyWinkeyerSerial
5
+
6
+ servertype: int 1=cwdaemon, 2=pywinkeyer, 3=rigctld
7
+
8
+ """
9
+
10
+ def __init__(self, servertype: int, host: str, port: int) -> None:
11
+ self.servertype = servertype
12
+ self.cat = None
13
+ self.host = host
14
+ self.port = port
15
+ self.speed = 20
16
+ self.winkeyer_functions = []
17
+
18
+ def __check_sane_ip(self, ip: str) -> bool:
19
+ """check if IP address look normal"""
20
+ print(f"{type(self.host)} {self.host}")
21
+
22
+ x = ip.split(".")
23
+
24
+ print(f"{x=} {len(x)=}")
25
+
26
+ if len(x) != 4:
27
+ return False
28
+ for y in x:
29
+ if not y.isnumeric():
30
+ return False
31
+ return True
32
+
33
+ def test(self):
34
+ """"""
35
+ print(f"{self.__check_sane_ip(self.host)=}")
36
+
37
+
38
+ x = CW(1, "127.0.0.1", 6789)
39
+ x.test()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: not1mm
3
- Version: 24.11.10
3
+ Version: 24.11.12.1
4
4
  Summary: NOT1MM Logger
5
5
  Author-email: Michael Bridak <michael.bridak@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/mbridak/not1mm
@@ -236,6 +236,7 @@ generated, 'cause I'm lazy, list of those who've submitted PR's.
236
236
 
237
237
  ## Recent Changes (Polishing the Turd)
238
238
 
239
+ - [24-11-12] add check for ipv4 address for CAT.
239
240
  - [24-11-10] ReJiggered CAT/flrig interface to hopefull make it more workable.
240
241
  - [24-11-6] Added Call history to ARRL VHF, CQ160, CQWW, StewPerry, Weekly RTTY
241
242
  - [24-11-5] Fix crash with bad qrz credentials.
@@ -1,11 +1,12 @@
1
1
  not1mm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- not1mm/__main__.py,sha256=HJWo2CMZpp2kgFSXQ9za-2PnX12Ih3Un18V3zy3U6_U,141893
2
+ not1mm/__main__.py,sha256=8y8-omwssJQfuPTGEebpnXtLjxr4IAO7eG2_RfC-82A,142100
3
3
  not1mm/bandmap.py,sha256=X6mMHXS1kXBbUPZCaKgiVJ6Dz6DE6LEQqtEXfT3telg,30811
4
4
  not1mm/checkwindow.py,sha256=F6hNCbVSLG2PPY2afgmwlBWeqr1Uj4-n__AivDLVQ_0,9670
5
5
  not1mm/fsutils.py,sha256=ukHKxKTeNKxKwqRaJjtzRShL4X5Xl0jRBbADyy3Ifp8,1701
6
6
  not1mm/logwindow.py,sha256=TvpzQTNB92hISlUO3iWBqtlPmlebdhOkAArx0DNGcOs,43966
7
7
  not1mm/lookupservice.py,sha256=4c36x_1G3Sy69gQfJ6El7vHLIKTjLGH67ziPPoeYweM,2648
8
8
  not1mm/radio.py,sha256=khmyESHaXUDF2hGQ5v3atEOd1YACrOAsuoIA4XgNtlc,5340
9
+ not1mm/test.py,sha256=kTELpu6EFmMIgUrEIwFyvPAKoDokDDFq6U_9yJ7pnOs,865
9
10
  not1mm/vfo.py,sha256=ggPyWtxMbdSE5RwdK0nDRwDNqOxdpb_pvnzZdbzZVQE,11136
10
11
  not1mm/voice_keying.py,sha256=sA3gw5_k7kShTg2qhG7HkKDM5M6KheJVRkAc_C7mxDk,3006
11
12
  not1mm/data/JetBrainsMono-ExtraLight.ttf,sha256=g5Hn7BPounWMGDj1a8zZcyKMz03HSqW__pUluRR7Evg,274144
@@ -94,8 +95,8 @@ not1mm/data/phonetics/yourcall.wav,sha256=4kheHJmCiRDL2kjhlgXQ8_u_eEMgKxiNGu5UBk
94
95
  not1mm/data/phonetics/z.wav,sha256=arafCi7fwmBLdVDI-PRyaL4U-03PIQDhffwY5noJ_2c,51768
95
96
  not1mm/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
97
  not1mm/lib/about.py,sha256=sWycfGcruN3SaEe4JmaJ61K6D8Itq0WxpUYT-lEcmYM,416
97
- not1mm/lib/cat_interface.py,sha256=b6Y5a0WHawjI5kOalVdqq5_P7rhBqGKXYFMptSzyHXI,22985
98
- not1mm/lib/cwinterface.py,sha256=3H_Ur5qtZCg6AA-CBURdnS3IUcvs3YAcwYLO0S8SUBg,3621
98
+ not1mm/lib/cat_interface.py,sha256=ZSWXajCu38RI4d-VpGIUUjAMYSSMIPjaUrHkejJKmts,23908
99
+ not1mm/lib/cwinterface.py,sha256=yQL8Dif9oOIynaRItHgvcmu4mYv1TnTpqCHPtkeb09o,4472
99
100
  not1mm/lib/database.py,sha256=nqWp2eJ7JfUTqaQ9AVbx3XjgtlRnYY9ruTQCv2YRreY,48310
100
101
  not1mm/lib/edit_contact.py,sha256=Ki9bGPpqyQQBB1cU8VIBDCal3lbXeQ6qxhzklmhE2_w,353
101
102
  not1mm/lib/edit_macro.py,sha256=raKWBwsHInj5EUKmvyLQ6gqc3ZFDlstsD3xqoM4PC8E,517
@@ -113,7 +114,7 @@ not1mm/lib/plugin_common.py,sha256=TbFUbftjELFt4QRdsjSHbqnXSngZOlSwlCTClqosDXA,9
113
114
  not1mm/lib/select_contest.py,sha256=WsptLuwkouIHeocJL3oZ6-eUfEnhpwdc-x7eMZ_TIVM,359
114
115
  not1mm/lib/settings.py,sha256=Xt0WE2ro_kUYdugQ0Pe1SQX07MHrJ0jyQqDqAKKqxuU,13564
115
116
  not1mm/lib/super_check_partial.py,sha256=hwT2NRwobu0PLDyw6ltmbmcAtGBD02CKGFbgGWjXMqA,2334
116
- not1mm/lib/version.py,sha256=PxG5vkFNHXk38yhcpyOZ-pzC4v3doKTwaaEUaUP4mZk,49
117
+ not1mm/lib/version.py,sha256=-iSAzL-z5BgttDF8dYIz7xmh50rd4o4UomAp5Djzy90,51
117
118
  not1mm/lib/versiontest.py,sha256=8vDNptuBBunn-1IGkjNaquehqBYUJyjrPSF8Igmd4_Y,1286
118
119
  not1mm/plugins/10_10_fall_cw.py,sha256=gNgTnafjM99cFvZ-6qBfWoOvd5Zj2Ehx6XjJvrHjm40,11872
119
120
  not1mm/plugins/10_10_spring_cw.py,sha256=QME8LyLyTnHsA5sjGG19n_64-0gdgBMRRi9C8LpgQzs,11877
@@ -159,9 +160,9 @@ not1mm/plugins/ref_ssb.py,sha256=Z6ZqNInyGFwWNSHXrzCDlokMxZ6NQQ2Yi1c8CGfmNWE,209
159
160
  not1mm/plugins/stew_perry_topband.py,sha256=DXbJYLJ7JpPotdvax74d2YOX5HaMUc-Fk1XvBXMhl9I,11879
160
161
  not1mm/plugins/weekly_rtty.py,sha256=OLiLW3Xd-tylSy9onOXCxQwWfijx-O5PAgjHh7_vG1o,19496
161
162
  not1mm/plugins/winter_field_day.py,sha256=E4Rn7bOpN2LNoRi4_aRDHd_8p5lxn1vG_ubGdzn5zB0,14891
162
- not1mm-24.11.10.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
163
- not1mm-24.11.10.dist-info/METADATA,sha256=u5BKaU2XxtTzamvJpT3z_11UKrrxzOPENF_f4-0sTXs,34255
164
- not1mm-24.11.10.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
165
- not1mm-24.11.10.dist-info/entry_points.txt,sha256=pMcZk_0dxFgLkcUkF0Q874ojpwOmF3OL6EKw9LgvocM,47
166
- not1mm-24.11.10.dist-info/top_level.txt,sha256=0YmTxEcDzQlzXub-lXASvoLpg_mt1c2thb5cVkDf5J4,7
167
- not1mm-24.11.10.dist-info/RECORD,,
163
+ not1mm-24.11.12.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
164
+ not1mm-24.11.12.1.dist-info/METADATA,sha256=Fo3V88_JTL80XCoXagVEDBGDiKu3HxUxA3KZKeTsXR0,34306
165
+ not1mm-24.11.12.1.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
166
+ not1mm-24.11.12.1.dist-info/entry_points.txt,sha256=pMcZk_0dxFgLkcUkF0Q874ojpwOmF3OL6EKw9LgvocM,47
167
+ not1mm-24.11.12.1.dist-info/top_level.txt,sha256=0YmTxEcDzQlzXub-lXASvoLpg_mt1c2thb5cVkDf5J4,7
168
+ not1mm-24.11.12.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5