Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions ip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
import platform

Check failure on line 2 in ip.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

ip.py:1:1: I001 Import block is un-sorted or un-formatted

def ping(ip):
param = '-n' if platform.system().lower() == 'windows' else '-c'
command = ['ping', param, '1', ip]
return os.system(' '.join(command)) == 0

Check failure on line 7 in ip.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (S605)

ip.py:7:12: S605 Starting a process with a shell, possible injection detected

def main():
print("=== Simple Network Ping Sweep ===")
subnet = input("Enter subnet (example: 192.168.1.): ")

print("\nScanning...\n")
alive = []

for i in range(1, 255):
ip = subnet + str(i)
if ping(ip):
print(f"[+] Reachable: {ip}")
alive.append(ip)

print("\n=== Scan Complete ===")
if alive:
print("Active Hosts:")
for host in alive:
print(host)
else:
print("No active hosts found.")

if __name__ == "__main__":
main()



Check failure on line 34 in ip.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W292)

ip.py:34:5: W292 No newline at end of file

Check failure on line 34 in ip.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W293)

ip.py:34:1: W293 Blank line contains whitespace
11 changes: 11 additions & 0 deletions readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This is a simple beginner-friendly Python project that sweeps a subnet and shows which IP addresses respond to a ping request.

## ✨ Features
- Works on Windows, Linux, and macOS
- Very easy for beginners to understand
- Scans IPs from `.1` to `.254`
- No external libraries required

## 🚀 How to Run
```bash
python ip.py
Loading