Code:
#!/usr/bin/python
############################################################################################
## JSSnifferGUI.py with log file code by:bl00dy_c0d3z ##
## <die[dot]z[dot]666[at]gmail[dot]com> or c0mr4d3[at]yahoo[dot]com ##
## thanks to core source author: $Id: sniff.py,v 1.4 2003/10/27 17:36:56 jkohen Exp $ ##
## - Maximiliano Caceres <[email protected]> ##
## - Javier Kohen <[email protected]> ##
## Multiplatform simple sniffer with logfile ##
## include modules: ##
## pcapy ##
## ##
############################################################################################
import pcapy, os, time
from Tkinter import *
from pcapy import *
def main():
view_config()
dev = strDEVICE.get()
protocolSET = strPROTOCOL.get()
if protocolSET == "All":
varprotocol = ""
elif protocolSET == "TCP":
varprotocol = "tcp"
elif protocolSET == "UDP":
varprotocol = "udp"
elif protocolSET == "ICMP":
varprotocol = "icmp"
elif protocolSET == "ARP":
varprotocol = "arp"
else:
pass
port = strPORT.get()
if port == "HTTP:80":
varport = "port 80"
elif port == "HTTPS:443":
varport = "port 443"
elif port == "SSH:22":
varport = "port 22"
elif port == "FTP:21":
varport = "port 21"
elif port == "DOMAIN:53":
varport = "port 53"
elif port == "All":
varport = ""
p = open_live(dev, 2000, 0, 100)
result.insert(END,"=============================================\n")
result.insert(END,"TCPdump rules:\n")
result.insert(END,"%s %s" %(varprotocol,varport))
configLOG = open("conf","w")
configLOG.write(dev+"\n")
configLOG.write("%s %s" %(varprotocol,varport))
configLOG.close()
result.insert(END,"\n\n\nConfiguration has been set and save...")
p.setfilter("%s %s" %(varprotocol,varport))
root.update()
def help():
windowhelp = Toplevel()
windowhelp.wm_maxsize(width='400',height='360')
windowhelp.wm_minsize(width='400',height='360')
windowhelp.title("About")
helpFrame = Frame(windowhelp)
txtSB = Scrollbar(helpFrame)
nLtxt = Text(helpFrame, fg="green", bg="black", width=540, height=48, wrap=WORD)
txtSB.config(command=nLtxt.yview)
txtSB.pack(side=RIGHT, fill=Y)
nLtxt.pack(fill=Y)
helpFrame.pack(side=RIGHT, fill=Y)
helptxt = '''========================JSSnifferGUI.py========================
JSSnifferGUI.py ALPHA version
just publish in Jasakom Forum
it comes of course with no warrant of function and we cant take
responseabilities for eventual damages caused by this tools.
if you like this tool, found a bug or just looking for place to learn
some scripting yourself visit: http://www.jasakom.com/forum
or mail me at <die[dot]z[dot]666[at]gmail[dot]com> or <c0mr4d3[at]yahoo[dot]com>
special thanks to:
- Maximiliano Caceres <[email protected]>
- Javier Kohen <[email protected]>
(thanks for impacket.. i luv it ;p)
- S'to
- PIRUS
- Tomahawk
- Coolkid
- Redebian
- P1t4qh
- and all jasakom members
'''
nLtxt.insert(END, helptxt)
window2 = Label(windowhelp)
def view_config():
result.delete(1.0,END)
iface = strDEVICE.get()
protocol = strPROTOCOL.get()
p = pcapy.open_live(iface, 1500, 0, 100)
netmask = p.getnet()
broadcast = p.getmask()
result.insert(END,"Your Packet Monitoring Configuration:\n")
result.insert(END,"=============================================\n")
result.insert(END,"NetID\t\t: "+netmask+"\n")
result.insert(END,"SubnetMask\t: "+broadcast+"\n")
result.insert(END,"Protocol\t\t: "+protocol+"\n")
result.insert(END,"Port\t\t: "+strPORT.get()+"\n")
root.update()
def runservice():
os.system("python monitor.py")
#def clockPulse():
#clockVar.set(1 + clockVar.get())
#root.after(1000, clockPulse)
interface = findalldevs()
protolist = ["All", "TCP", "UDP", "ICMP", "ARP"]
portlist = ("All", "HTTP:80", "HTTPS:443", "FTP:21", "SSH:22", "DOMAIN:53")
#---The GUI---#
root=Tk()
clockVar = IntVar()
#---image---#
imageFile = "JS.gif"
logo = PhotoImage(file=imageFile)
can = Canvas(root)
can.config(width=logo.width(), height=logo.height())
can.place_configure(x=396,y=282)
can.create_image(50, 20, image=logo)
MNU = Menu(master=root)
root.config(menu=MNU, bg="black")
m1 = Menu(master=MNU, tearoff=0, bg="black", fg="grey")
MNU.add_cascade(label='Option', menu=m1)
m1.add_command(label='About',command=help)
m1.add_command(label='Exit',command=root.destroy)
#---Device----#
DEVICEtext = Label(root,text="Interface\t:")
DEVICEtext.config(bg="black",fg="grey")
DEVICEtext.place_configure(x=10,y=222)
strDEVICE = StringVar(root)
strDEVICE.set(interface[0])
start_DEVICE_e = OptionMenu(root, strDEVICE, *interface)
start_DEVICE_e.config(bg="black",fg="grey",width=len(interface[0]))
start_DEVICE_e.place_configure(x=70,y=218)
#---Protocol---#
PROTOtext = Label(root,text="Protocol\t:")
PROTOtext.config(bg="black",fg="grey")
PROTOtext.place_configure(x=10,y=262)
strPROTOCOL = StringVar(root)
strPROTOCOL.set(protolist[0])
start_PROTOCOL_e = OptionMenu(root, strPROTOCOL, *protolist)
start_PROTOCOL_e.config(bg="black",fg="grey",width=6)
start_PROTOCOL_e.place_configure(x=70,y=258)
#---Port select---#
PORTtext = Label(root,text="Port \t:")
PORTtext.config(bg="black",fg="grey")
PORTtext.place_configure(x=10,y=300)
strPORT = Spinbox(root, values=portlist, bg="black", fg="grey")
strPORT.config(width=10)
strPORT.place_configure(x=73,y=300)
####button view#####
view = Button(root,text="view details",command=view_config)
view.config(width=10,bg="black", fg="green")
view.place_configure(x=420,y=220)
#########set button###########
start=Button(root,text="Set",command=main)
start.config(width=10, bg="black", fg="green")
start.place_configure(x=225,y=325)
#########Stop button##########
clear=Button(root,text="Start Sniff",command=runservice)
clear.config(width=10, bg="black", fg="green")
clear.place_configure(x=300,y=325)
#########Banner###########
banner=Label(root,text="By :bl00dyc0dez", bg="black", fg="red", width=19, height=1)
banner.place_configure(x=383,y=331)
#root.after(1000, clockPulse)
tambal1=Label(root, bg="black", width=19, height=1)
tambal1.place_configure(x=380,y=266)
tambal2=Label(root, bg="black", width=1, height=4)
tambal2.place_configure(x=386,y=278)
tambal3=Label(root, bg="black", width=58, height=1)
tambal3.place_configure(x=62,y=242)
tambal4=Label(root, bg="black", width=58, height=1)
tambal4.place_configure(x=62,y=202)
tambal5=Label(root, bg="black", width=15, height=1)
tambal5.place_configure(x=60,y=282)
##########result text##########
result=Text(root, bg="black", fg="green", width=80, height=15)
result.place_configure(x=5,y=5)
root.wm_maxsize(width='495',height='350')
root.wm_minsize(width='495',height='350')
root.title("JSSnifferGUI")
root.mainloop()
Share This Thread