portune 0.1.1__py3-none-any.whl → 0.1.2__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.

Potentially problematic release.


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

portune/portune.py CHANGED
@@ -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>
portune/version.py CHANGED
@@ -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.1'
21
- __version_tuple__ = version_tuple = (0, 1, 1)
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.1
3
+ Version: 0.1.2
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Author: Franck Jouvanceau
6
6
  Maintainer: Franck Jouvanceau
@@ -0,0 +1,9 @@
1
+ portune/__init__.py,sha256=RfXuNfHBqfRt_z4IukwN1a0oeCXahuMOO8_eBt4T8NM,58
2
+ portune/portune.py,sha256=ODPpO7E9-pXoFRxKavyn22_b9dhVjxUp-aIxKhnxamY,61908
3
+ portune/version.py,sha256=bSmADqydH8nBu-J4lG8UVuR7hnU_zcwhnSav2oQ0W0A,511
4
+ portune-0.1.2.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
5
+ portune-0.1.2.dist-info/METADATA,sha256=qEkffZiY8znnWihHuYtJlzf7t4bRPFTPvCcajLqmYBs,2837
6
+ portune-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ portune-0.1.2.dist-info/entry_points.txt,sha256=6j7jAf5fOZrLPbVIs3z92R1tT891WyY9YxQ6OVnPKG0,80
8
+ portune-0.1.2.dist-info/top_level.txt,sha256=CITDikHhRKAsSOGmNJzD-xSp6D5iBhSr9ZS1qy8-SL0,8
9
+ portune-0.1.2.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- portune/__init__.py,sha256=RfXuNfHBqfRt_z4IukwN1a0oeCXahuMOO8_eBt4T8NM,58
2
- portune/portune.py,sha256=fB3UrmIOg8UnwF5dTio_p-e-9KjP6w1Y2V_XkfmPnzM,61799
3
- portune/version.py,sha256=Mmxse1R0ki5tjz9qzU8AQyqUsLt8nTyCAbYQp8R87PU,511
4
- portune-0.1.1.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
5
- portune-0.1.1.dist-info/METADATA,sha256=MpHha4A721qziGCuDDwsNDvwSBxnbb0PVn7UzjgwPp0,2837
6
- portune-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- portune-0.1.1.dist-info/entry_points.txt,sha256=6j7jAf5fOZrLPbVIs3z92R1tT891WyY9YxQ6OVnPKG0,80
8
- portune-0.1.1.dist-info/top_level.txt,sha256=CITDikHhRKAsSOGmNJzD-xSp6D5iBhSr9ZS1qy8-SL0,8
9
- portune-0.1.1.dist-info/RECORD,,