here’s a preview of a little helpfull GUI-tool to get some host infos:
-
#!/usr/bin/python
-
# -*- coding: iso8859-15 -*-
-
### under GPL
-
### (c) chaos — www.true-binary.com
-
#####################################
-
-
-
from Tkinter import *
-
from tkMessageBox import *
-
from tkColorChooser import askcolor
-
from tkFileDialog import *
-
import socket
-
import urllib
-
import os
-
import httplib
-
import string
-
-
-
###global vars:
-
###############
-
-
def about():
-
showinfo(‘ABOUT’, "Thanks for using this little tool… \n\n…it’s brought you by chaos\n\n www.true-binary.com")
-
-
def file_save():
-
file=asksaveasfile(mode=‘w’)
-
text2save = str(textfenster.get(0.0,END))
-
file.write(text2save)
-
file.close()
-
-
###textbox, scrollbar, entry-field and menubar:
-
###############################################
-
-
root = Tk()
-
root.title(‘hostinfo – www.true-binary.com’)
-
menubar = Menu(root)
-
root.config(menu=menubar)
-
file_menu = Menu(menubar)
-
menubar.add_cascade(label="File", underline=1, menu=file_menu)
-
file_menu.add_command(label="Save as", command=file_save)
-
file_menu.add_separator()
-
file_menu.add_command(label="Exit", command=root.quit)
-
help_menu = Menu(menubar)
-
menubar.add_cascade(label="Help", underline=1, menu=help_menu)
-
help_menu.add_command(label="About", command=about)
-
scrollbar = Scrollbar(root)
-
scrollbar.pack(side=RIGHT, fill=Y)
-
textfenster = Text(root,width=100,background="#FAF0E6", yscrollcommand=scrollbar.set)
-
textfenster.pack()
-
textfenster.config(yscrollcommand=scrollbar.set)
-
scrollbar.config(command=textfenster.yview)
-
eingabe = Entry(root,background="#FAEBD7",width=40)
-
eingabe.pack(side=LEFT)
-
-
line="################################################ \n################################################ \n################################################\n"
-
-
###definitions:
-
###############
-
-
###getip:
-
#########
-
-
def hole():
-
c=eingabe.get()
-
d=socket.gethostbyaddr(c)
-
d2=d[2]
-
d2=str(d2)
-
d2=d2[:-2][2:]
-
e="IP-Adresse:\t"+str(d2)
-
textfenster.insert(END, ‘\n‘ + e)
-
textfenster.insert(END, ‘\n\n‘ + line)
-
-
###whois:
-
#########
-
-
def whois():
-
geteingabe=eingabe.get()
-
d=socket.gethostbyaddr(geteingabe)
-
d2=d[2]
-
d2=str(d2)
-
d2=d2[:-2][2:]
-
e=os.popen("whois "+str(d2)+" 2>&1")
-
file.close
-
for i in e:
-
textfenster.insert(END, "\n " + str(i))
-
textfenster.insert(END, ‘\n\n‘ + line)
-
-
###ping host:
-
#############
-
-
def ping():
-
geteingabe=eingabe.get()
-
ping = os.popen(‘ping -c 3 -i 1 ‘+geteingabe+‘ 2>&1′)
-
data = ping.read()
-
textfenster.insert(END, "\n" + data)
-
textfenster.insert(END, ‘\n\n‘ + line)
-
-
###get HTTP header:
-
###################
-
-
def header():
-
geteingabe=eingabe.get()
-
h=httplib.HTTP(geteingabe)
-
h.putrequest(‘HEAD’, ‘/ HTTP/1.0′)
-
h.endheaders()
-
errcode, errmsg, headers = h.getreply()
-
f = h.getfile()
-
data = f.read()
-
f.close()
-
textfenster.insert(END, "\n" + str(headers))
-
textfenster.insert(END, ‘\n\n‘ + line)
-
-
###traceroute:
-
##############
-
-
def traceroute():
-
geteingabe=eingabe.get()
-
trace=os.popen(‘traceroute -n -m 15 ‘+geteingabe+‘ 2>&1′)
-
data=trace.read()
-
textfenster.insert(END, "\n" + data)
-
textfenster.insert(END, ‘\n\n‘ + line)
-
-
###nmap(ports:21,22,23,80,443,3306,3389:
-
########################################
-
-
def nmap():
-
showinfo(‘nmap info’, "If you are not running this program as root, you have to change the SUID flags to 4751\n\ndebian/*buntu:\tsudo chmod 4751 /usr/bin/nmap")
-
geteingabe=eingabe.get()
-
mapit=os.popen(‘nmap -sT -p 21,22,23,80,443,3306,3389 -R ‘+geteingabe+‘ 2>&1′)
-
data=mapit.read()
-
textfenster.insert(END, "\n" + data)
-
textfenster.insert(END, ‘\n\n‘ + line)
-
-
###clear:
-
#########
-
def clear():
-
textfenster.delete("1.0", END)
-
-
-
###buttons:
-
###########
-
-
butGetIP = Button(root,background="green",text=‘getIP’, command = hole)
-
butGetIP.pack(side = LEFT)
-
butWhois = Button(root,background="green",text="whois",command = whois)
-
butWhois.pack(side = LEFT)
-
butTrace = Button(root,background="green",text="traceroute",command = traceroute)
-
butTrace.pack(side = LEFT)
-
butPing = Button(root,background="green",text="ping",command = ping)
-
butPing.pack(side = LEFT)
-
butNmap = Button(root,background="green",text="nmap",command = nmap)
-
butNmap.pack(side = LEFT)
-
butHeader = Button(root,background="green",text="header",command = header)
-
butHeader.pack(side = LEFT)
-
butClear = Button(root,background="white",text="clear",command = clear)
-
butClear.pack(side = LEFT)
-
-
root.mainloop()
DOWNLOAD
MD5: eaec3043e17bf24e7aeca75675fa36c8
what you can do with this script:
- URL to IP
- whois
- traceroute
- ping
- nmap
- get HTTP header
- save the content
what you need for this script:
- httplib2
- Tkinter
- whois
- nmap
- traceroute
- ping
- nc(netcat)
how to install:
- sudo apt-get update && apt-get install nmap netcat whois python-tk python-httplib2
normaly ping and traceroute is installed.

much fun with it =]
EDIT:
first of all, thanks to ap0calypse for the feedback!
i had a look at the source and i changed it(yes, you are right)
as you can see, i changed the lines 64-69 from:
-
d2=d[2]
-
d3=str(d2)
-
d4=d3[:-2]
-
d5=d4[2:]
-
ip=str(d5)
-
e="IP-Adresse:\t"+ip
to:
-
d2=d[2]
-
d2=str(d2)
-
d2=d2[:-2][2:]
-
e="IP-Adresse:\t"+str(d2)
and the lines 79-90 from:
-
d2=d[2]
-
d3=str(d2)
-
d4=d3[:-2]
-
d5=d4[2:]
-
ip=str(d5)
-
e=os.system("whois "+ip+" >> ip.txt")
-
file=open("ip.txt","r")
-
f=file.readlines()
-
file.close
-
for i in f:
-
textfenster.insert(END, "\n " + str(i))
-
os.system("rm -r ip.txt")
to:
-
d2=d[2]
-
d2=str(d2)
-
d2=d2[:-2][2:]
-
e=os.popen("whois "+str(d2)+" 2>&1")
-
file.close
-
for i in e:
-
textfenster.insert(END, "\n " + str(i))
also the MD5 checksum has changed, upload complete.
greetz chaos