portune 0.1.0__tar.gz → 0.1.2__tar.gz

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.

Potentially problematic release.


This version of portune might be problematic. Click here for more details.

@@ -169,4 +169,4 @@ cython_debug/
169
169
 
170
170
  # PyPI configuration file
171
171
  .pypirc
172
- re_port/version.py
172
+ portune/version.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portune
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Author: Franck Jouvanceau
6
6
  Maintainer: Franck Jouvanceau
@@ -52,4 +52,14 @@ Description-Content-Type: text/markdown
52
52
  License-File: LICENSE
53
53
  Dynamic: license-file
54
54
 
55
- # re-port
55
+ # portune
56
+
57
+ Multitreaded port scanner
58
+
59
+ # features
60
+
61
+ * parallel check of port availability against server/ports
62
+ * console output result / summary
63
+ * html full report / dns domain summary / vlan timeout summary
64
+ * mail with html summary / report attachment (mailhost relay)
65
+
@@ -0,0 +1,11 @@
1
+ # portune
2
+
3
+ Multitreaded port scanner
4
+
5
+ # features
6
+
7
+ * parallel check of port availability against server/ports
8
+ * console output result / summary
9
+ * html full report / dns domain summary / vlan timeout summary
10
+ * mail with html summary / report attachment (mailhost relay)
11
+
@@ -1,3 +1,3 @@
1
- """ package re-port """
1
+ """ package portune """
2
2
 
3
3
  __author__ = "Franck Jouvanceau"
@@ -906,6 +906,29 @@ def format_percent(value: int, total: int) -> Tuple[str, str]:
906
906
  return "0/0", "0.0%"
907
907
  return f"{value}/{total}", f"{(value/total*100):.1f}%"
908
908
 
909
+ def get_vlan_base(ip: str, bits: int) -> str:
910
+ """Calculate VLAN base address with end padding 0."""
911
+ if ip == 'N/A':
912
+ return 'N/A'
913
+ try:
914
+ octets = ip.split('.')
915
+ if len(octets) != 4:
916
+ return 'invalid'
917
+
918
+ # Convert IP to 32-bit integer
919
+ ip_int = sum(int(octet) << (24 - 8 * i) for i, octet in enumerate(octets))
920
+
921
+ # Apply mask
922
+ mask = ((1 << bits) - 1) << (32 - bits)
923
+ masked_ip = ip_int & mask
924
+
925
+ # Convert back to dotted notation
926
+ result_octets = [(masked_ip >> (24 - 8 * i)) & 255 for i in range(4)]
927
+ return '.'.join(map(str, result_octets))
928
+ except:
929
+ return 'N/A'
930
+
931
+
909
932
  def compute_stats(
910
933
  results: List[Tuple[str, str, int, str, bool]],
911
934
  start_time: float,
@@ -954,25 +977,6 @@ def compute_stats(
954
977
  }
955
978
 
956
979
 
957
- def get_vlan_base(ip: str, bits: int) -> str:
958
- """Calculate VLAN base address with end padding 0."""
959
- try:
960
- octets = ip.split('.')
961
- if len(octets) != 4:
962
- return 'invalid'
963
-
964
- # Convert IP to 32-bit integer
965
- ip_int = sum(int(octet) << (24 - 8 * i) for i, octet in enumerate(octets))
966
-
967
- # Apply mask
968
- mask = ((1 << bits) - 1) << (32 - bits)
969
- masked_ip = ip_int & mask
970
-
971
- # Convert back to dotted notation
972
- result_octets = [(masked_ip >> (24 - 8 * i)) & 255 for i in range(4)]
973
- return '.'.join(map(str, result_octets))
974
- except:
975
- return 'invalid'
976
980
 
977
981
  # Collect VLAN statistics for timeouts
978
982
  for hostname, ip, port, status, _ in results:
@@ -1179,13 +1183,14 @@ def generate_html_report(
1179
1183
  f.write(f'<h3 class="icon">Port Accessibility Report from {HOSTNAME} ({MY_IP}) to {os.path.basename(input_file)} - {time.strftime("%Y-%m-%d %H:%M:%S", scan_time)}</h3>\n')
1180
1184
 
1181
1185
  # Write detailed results table
1182
- f.write('''
1186
+ f.write(f'''
1183
1187
  <div class="table-container" id="result-container">
1184
1188
  <table id="commandTable">
1185
1189
  <thead>
1186
1190
  <tr>
1187
1191
  <th>Hostname</th>
1188
1192
  <th>IP</th>
1193
+ <th>VLAN/{stats['vlan_bits']}</th>
1189
1194
  <th>Port</th>
1190
1195
  <th>Status</th>
1191
1196
  <th>Ping</th>
@@ -1203,6 +1208,7 @@ def generate_html_report(
1203
1208
  <tr>
1204
1209
  <td>{escape(str(hostname))}</td>
1205
1210
  <td>{escape(str(ip))}</td>
1211
+ <td>{str(get_vlan_base(ip, stats['vlan_bits']))}</td>
1206
1212
  <td style="text-align: right;">{port}</td>
1207
1213
  <td style="text-align: center;"><span class="{status_class} status">{escape(status)}</span></td>
1208
1214
  <td style="text-align: center;"><span class="{ping_class} ping">{ping_status}</span></td>
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.1.0'
21
- __version_tuple__ = version_tuple = (0, 1, 0)
20
+ __version__ = version = '0.1.2'
21
+ __version_tuple__ = version_tuple = (0, 1, 2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portune
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Author: Franck Jouvanceau
6
6
  Maintainer: Franck Jouvanceau
@@ -52,4 +52,14 @@ Description-Content-Type: text/markdown
52
52
  License-File: LICENSE
53
53
  Dynamic: license-file
54
54
 
55
- # re-port
55
+ # portune
56
+
57
+ Multitreaded port scanner
58
+
59
+ # features
60
+
61
+ * parallel check of port availability against server/ports
62
+ * console output result / summary
63
+ * html full report / dns domain summary / vlan timeout summary
64
+ * mail with html summary / report attachment (mailhost relay)
65
+
@@ -4,7 +4,7 @@ README.md
4
4
  pyproject.toml
5
5
  .github/workflows/python-publish.yml
6
6
  portune/__init__.py
7
- portune/re_port.py
7
+ portune/portune.py
8
8
  portune/version.py
9
9
  portune.egg-info/PKG-INFO
10
10
  portune.egg-info/SOURCES.txt
portune-0.1.0/README.md DELETED
@@ -1 +0,0 @@
1
- # re-port
File without changes
File without changes
File without changes