portune 0.1.3__py3-none-any.whl → 0.1.4__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
@@ -38,7 +38,9 @@ body {
38
38
  font-family: Arial, sans-serif;
39
39
  overflow: auto;
40
40
  }
41
-
41
+ .hidden {
42
+ display: none;
43
+ }
42
44
  .icon {
43
45
  border-radius: 25px;
44
46
  background-color: #444;
@@ -308,6 +310,7 @@ function toggleSort(table, colIndex, sortBtn) {
308
310
  }
309
311
 
310
312
  function applyFilters(table) {
313
+ table.classList.add('hidden');
311
314
  const rows = Array.from(table.querySelectorAll('tbody tr'));
312
315
  const filters = Array.from(table.querySelectorAll('.column-filter'))
313
316
  .map(filter => ({
@@ -322,10 +325,10 @@ function applyFilters(table) {
322
325
  // First apply filters
323
326
  const filteredRows = rows.filter(row => {
324
327
  // If no filters are active, show all rows
325
- if (filters.every(f => !f.value)) {
326
- row.style.display = '';
327
- return true;
328
- }
328
+ //if (filters.every(f => !f.value)) {
329
+ // row.classList.remove('hidden');
330
+ // return true;
331
+ //}
329
332
  const cells = row.cells;
330
333
  const shouldShow = !filters.some(filter => {
331
334
  if (!filter.value) return false;
@@ -333,7 +336,11 @@ function applyFilters(table) {
333
336
  if (filter.regexp) return !filter.regexp.test(cellText);
334
337
  return !cellText.toLowerCase().includes(filter.value);
335
338
  });
336
- row.style.display = shouldShow ? '' : 'none';
339
+ if (shouldShow) {
340
+ row.classList.remove('hidden');
341
+ } else {
342
+ row.classList.add('hidden');
343
+ }
337
344
  return shouldShow;
338
345
  });
339
346
 
@@ -371,6 +378,7 @@ function applyFilters(table) {
371
378
  const tbody = table.querySelector('tbody');
372
379
  filteredRows.forEach(row => tbody.appendChild(row));
373
380
  }
381
+ table.classList.remove('hidden');
374
382
  }
375
383
 
376
384
  function processHtmlContent(element) {
@@ -628,11 +636,11 @@ def parse_input_file(filename: str) -> List[Tuple[str, List[int]]]:
628
636
  host_dict = {}
629
637
  with open(filename, 'r') as f:
630
638
  for line in f:
631
- line = line.strip().lower()
639
+ line = line.strip()
632
640
  if not line or line.startswith('#'):
633
641
  continue
634
642
  words = line.split()
635
- fqdn = words[0]
643
+ fqdn = words[0].lower()
636
644
  ports = words[1] if len(words) > 1 else '22'
637
645
  port_list = [int(p) for p in ports.split(',')]
638
646
  desc = ' '.join(words[2:]).strip() if len(words) > 2 else ''
@@ -1158,7 +1166,8 @@ def generate_html_report(
1158
1166
  parallelism: int,
1159
1167
  noping: bool,
1160
1168
  stats: Dict[str, Any],
1161
- input_file: str = ''
1169
+ input_file: str = '',
1170
+ desc_titles: List[str] = [],
1162
1171
  ) -> None:
1163
1172
  """Generate a complete HTML report of the port scan results.
1164
1173
 
@@ -1203,6 +1212,9 @@ def generate_html_report(
1203
1212
  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')
1204
1213
 
1205
1214
  # Write detailed results table
1215
+ if not desc_titles:
1216
+ _, _, _, _, _, desc = results[0]
1217
+ desc_titles = ["Description" for d in desc.split("|")]
1206
1218
  f.write(f'''
1207
1219
  <div class="table-container" id="result-container">
1208
1220
  <table id="commandTable">
@@ -1214,7 +1226,7 @@ def generate_html_report(
1214
1226
  <th>Port</th>
1215
1227
  <th>Status</th>
1216
1228
  <th>Ping</th>
1217
- <th>Description</th>
1229
+ {"\n".join([f"<th>{d}</th>" for d in desc_titles])}
1218
1230
  </tr>
1219
1231
  </thead>
1220
1232
  <tbody>
@@ -1233,7 +1245,7 @@ def generate_html_report(
1233
1245
  <td style="text-align: right;">{port}</td>
1234
1246
  <td style="text-align: center;"><span class="{status_class} status">{escape(status)}</span></td>
1235
1247
  <td style="text-align: center;"><span class="{ping_class} ping">{ping_status}</span></td>
1236
- <td class="desc">{escape(str(desc))}</td>
1248
+ {"\n".join([f'<td class="desc">{escape(str(d))}</td>' for d in desc.split("|")])}
1237
1249
  </tr>
1238
1250
  ''')
1239
1251
 
@@ -1417,7 +1429,7 @@ def main():
1417
1429
  parser.add_argument('-n', '--noping', action="store_true", help='No ping check')
1418
1430
  parser.add_argument('-s', '--summary', action="store_true", help='Print scan summary information')
1419
1431
  parser.add_argument('-b', '--bits', type=int, default=16, help='VLAN bits for timeout summary (default: 16)')
1420
-
1432
+ parser.add_argument('-d', '--desc_titles', type=str, nargs='*', help='List of custom description titles for hosts (optional)')
1421
1433
  # Email related arguments
1422
1434
  email_group = parser.add_argument_group('Email Options')
1423
1435
  email_group.add_argument('--email-to', help='Comma-separated list of email recipients')
@@ -1475,7 +1487,17 @@ def main():
1475
1487
 
1476
1488
  # Generate report
1477
1489
  results.sort(key=lambda x: (x[0], x[2]))
1478
- generate_html_report(results, args.output, time.localtime(start_time), args.timeout, args.parallelism, args.noping, stats, args.input_file)
1490
+ generate_html_report(
1491
+ results,
1492
+ args.output,
1493
+ time.localtime(start_time),
1494
+ args.timeout,
1495
+ args.parallelism,
1496
+ args.noping,
1497
+ stats,
1498
+ args.input_file,
1499
+ args.desc_titles,
1500
+ )
1479
1501
 
1480
1502
  # Print summary
1481
1503
  # Display detailed results in table format
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.3'
21
- __version_tuple__ = version_tuple = (0, 1, 3)
20
+ __version__ = version = '0.1.4'
21
+ __version_tuple__ = version_tuple = (0, 1, 4)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portune
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Author: Franck Jouvanceau
6
6
  Maintainer: Franck Jouvanceau
@@ -58,7 +58,7 @@ Multitreaded port scanner
58
58
 
59
59
  # features
60
60
 
61
- * parallel check of port availability against server/ports
61
+ * parallel check of port availability against servers/ports
62
62
  * console output result / summary
63
63
  * html full report / dns domain summary / vlan timeout summary
64
64
  * mail with html summary / report attachment (mailhost relay)
@@ -0,0 +1,9 @@
1
+ portune/__init__.py,sha256=RfXuNfHBqfRt_z4IukwN1a0oeCXahuMOO8_eBt4T8NM,58
2
+ portune/portune.py,sha256=Ar5GLB8hCTV9C1NbFKRKoK2nlyRReiDz5uMK5yXmb28,63495
3
+ portune/version.py,sha256=hcPkC9vIGgfrKK6ft7ysLT7iOCjpFmCBmyKLmXiaZ1g,511
4
+ portune-0.1.4.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
5
+ portune-0.1.4.dist-info/METADATA,sha256=qtTM2_95cVJjfAELw9v7QP7hQijJUotJEGnC2SGq2hQ,2838
6
+ portune-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ portune-0.1.4.dist-info/entry_points.txt,sha256=6j7jAf5fOZrLPbVIs3z92R1tT891WyY9YxQ6OVnPKG0,80
8
+ portune-0.1.4.dist-info/top_level.txt,sha256=CITDikHhRKAsSOGmNJzD-xSp6D5iBhSr9ZS1qy8-SL0,8
9
+ portune-0.1.4.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- portune/__init__.py,sha256=RfXuNfHBqfRt_z4IukwN1a0oeCXahuMOO8_eBt4T8NM,58
2
- portune/portune.py,sha256=ZSZQlqJ7ebjSFJmO5cC5NHzNX6NwOHOEdEp0MG11B_g,62820
3
- portune/version.py,sha256=NIzzV8ZM0W-CSLuEs1weG4zPrn_-8yr1AwwI1iuS6yo,511
4
- portune-0.1.3.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
5
- portune-0.1.3.dist-info/METADATA,sha256=E5QlqZso2uL0VnLdldXI73x_wG0EkgJCnF2pgnvXseM,2837
6
- portune-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- portune-0.1.3.dist-info/entry_points.txt,sha256=6j7jAf5fOZrLPbVIs3z92R1tT891WyY9YxQ6OVnPKG0,80
8
- portune-0.1.3.dist-info/top_level.txt,sha256=CITDikHhRKAsSOGmNJzD-xSp6D5iBhSr9ZS1qy8-SL0,8
9
- portune-0.1.3.dist-info/RECORD,,