dotfiles/scripts/ping-sweep.py
rpriven 5b6af65def
Organize scripts and clean up dotfiles
Changes:
- Added 80+ scripts with organized structure
  - payloads/ for third-party pentesting tools
  - pentesting/ for custom security scripts
  - Daily drivers remain flat for fast access
- Converted wes() function to proper script
- Removed .sh extensions from pentesting scripts
- Cleaned up aliases (removed 31 redundant lines)
- Added kanata/, build artifacts to gitignore
- Removed old fre.sh scripts and empty a.out
- Updated configs: helix, tmux, zsh, ulauncher, redshift

Security: All sensitive data excluded via gitignore
2025-11-07 14:48:21 -07:00

43 lines
941 B
Python

#!/usr/bin/python3
import sys
import subprocess
def ping_sweep(network_prefix):
live_hosts = []
for i in range(1, 254):
ip = f'{network_prefix}.{i}'
print(f'Pinging {ip}...', end='')
result = subprocess.run(
['ping', '-c', '1', '-W', '1', ip],
stdout=subprocess.DEVNULL
)
if result.returncode == 0:
print('Host is up')
live_hosts.append(ip)
else:
print('No response')
return live_hosts
# Usage
# hosts = ping_sweep('192.168.1')
# print('\nLive hosts:')
# print('\n'.join(hosts))
# Entry point
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python3 pingsweep.py <network_prefix>")
print("Example: python3 pingsweep.py 192.168.1")
sys.exit(1)
prefix = sys.argv[1]
hosts = ping_sweep(prefix)
print("\nLive hosts:")
for host in hosts:
print(host)