Blackhat Python: The IP Stalker

Ethical Hacking-Blackhat Python

Quickly see if Your Targets are Online with The IP Stalker

In this Blackhat Python project I have utilized the power of the ping command to monitor and quickly check if certain target systems are online. I then used TKinter to give the script a nice-looking and interactive GUI. This is my second and final version of this project as I feel it doesn’t need any more time spent on it, it does what it is supposed to and looks pretty cool.

The First Version

In the first version you were required to add a list of IPs to the targets.txt file in the IPS Directory. You run the script and if any targets are online, they would display in green, and if offline in red. This was very basic and required a little too much effort from the user in my opinion.

IP Stalker v2

The second version requires no previous input to the targets.txt file. Now you add all the IPs to in the GUI. It will remember the IPs until you input new IPs.

How to use The IP Stalker V2

  • Add the IPs to the GUI
  • Then select Add New IP List
  • Now select Save New IP List
  • Then just select the Scan button to begin stalking the IPs.


The Code:

from tkinter import *
from tkinter import messagebox
import tkinter as tk
from csv import *
import os
#This is the gui gui = tk.Tk() gui.title("IP-Stalker.v2") gui.geometry("510x300") ipList=[]

def Add(): lst=[IP1.get()] ipList.append(lst) lst=[IP2.get()] ipList.append(lst) lst=[IP3.get()] ipList.append(lst) lst=[IP4.get()] ipList.append(lst) lst=[IP5.get()] ipList.append(lst) lst=[IP6.get()] ipList.append(lst) messagebox.showinfo("Information","The data has been added successfully")

def Save(): with open("targets.txt","w") as file: Writer=writer(file) Writer.writerows(ipList) messagebox.showinfo("Information","Saved succesfully")

def Scanner(): master = Tk() master.title("Monitor") master.geometry("510x400") master.option_add('*Font', '19') master.configure(bg="black") master.resizable(False,False) master.attributes("-topmost", True) targs=open('targets.txt','r') list=targs.readlines() displayRow=0 for ip in list: on=ip+'Online' off=ip+'Offline' print ('Scanning',ip) response = os.system('ping -c 1 ' + ip) if response == 0: print('IP:',ip,'is up!') ONLabel = tk.Label(master, text=on, bg="black", fg="green", padx=70, pady=10) ONLabel.grid(row=displayRow, column=1) else: print (ip,' is down!') ONLabel = tk.Label(master, text=off, bg="black", fg="red", padx=70, pady=10) ONLabel.grid(row=displayRow, column=1) displayRow+=1
label1=Label(gui,text="IP Address: ",padx=20,pady=10) label2=Label(gui,text="IP Address: ",padx=20,pady=10) label3=Label(gui,text="IP Address: ",padx=20,pady=10) label4=Label(gui,text="IP Address: ",padx=20,pady=10) label5=Label(gui,text="IP Address: ",padx=20,pady=10) label6=Label(gui,text="IP Address: ",padx=20,pady=10) IP1 = Entry(gui, width=30,borderwidth=3) IP2 = Entry(gui, width=30,borderwidth=3) IP3 = Entry(gui, width=30,borderwidth=3) IP4 = Entry(gui, width=30,borderwidth=3) IP5 = Entry(gui, width=30,borderwidth=3) IP6 = Entry(gui, width=30,borderwidth=3)
#Select User inputs and submit and scan button positioning label1.grid(row=0, column=0) label2.grid(row=1, column=0) label3.grid(row=2, column=0) label4.grid(row=3, column=0) label5.grid(row=4, column=0) label6.grid(row=5, column=0) IP1.grid(row=0, column=1) IP2.grid(row=1, column=1) IP3.grid(row=2, column=1) IP4.grid(row=3, column=1) IP5.grid(row=4, column=1) IP6.grid(row=5, column=1) save=Button(gui,text="Save New IP List",padx=20,pady=10,command=Save) add=Button(gui,text="Add New IP List",padx=20,pady=10,command=Add) scan=Button(gui,text="Scan",padx=20,pady=10,command=Scanner),y=250), y=250),y=250) #save.grid(row=6,column=1) #add.grid(row=6,column=0) #scan.grid(row=6,column=2)


Tkinter program
Tkinter program


Anyone can ping any IP with the ping command, this project just allows you to ping multiple IPs at the same time. I had fun creating v2, and it was very helpful in my quest to learning the Python library Tkinter better. As Ethical Hackers, I don’t expect you to have a list of IPs to stalk, this was built for educational purposes and should be used responsibly.

Read more of our Python guides here: Python Guides


Basic Security Testing with Kali Linux:
ALFA Network Wi-Fi Adapter:

This Wi-Fi adapter is essential if you are to learn Wi-Fi Hacking.

Luke Barber

Hello, fellow tech enthusiasts! I'm Luke, a passionate learner and explorer in the vast realms of technology. Welcome to my digital space where I share the insights and adventures gained from my journey into the fascinating worlds of Arduino, Python, Linux, Ethical Hacking, and beyond. Armed with qualifications including CompTIA A+, Sec+, Cisco CCNA, Unix/Linux and Bash Shell Scripting, JavaScript Application Programming, Python Programming and Ethical Hacking, I thrive in the ever-evolving landscape of coding, computers, and networks. As a tech enthusiast, I'm on a mission to simplify the complexities of technology through my blogs, offering a glimpse into the marvels of Arduino, Python, Linux, and Ethical Hacking techniques. Whether you're a fellow coder or a curious mind, I invite you to join me on this journey of continuous learning and discovery.

Leave a Reply

Your email address will not be published. Required fields are marked *

Verified by MonsterInsights