-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
81 lines (55 loc) · 1.94 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import wxpyhton_taslak_2
import wx
import ip_scanner
import socket
aa=[(s.connect(("8.8.8.8", 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]]
aa1=aa[0][1]
###############################################################
iptaban=aa1.split(".")
class araYuzDeneme(wxpyhton_taslak_2.MyFrame2):
def __init__(self,parent):
wxpyhton_taslak_2.MyFrame2.__init__(self,parent)
self.baslangic_ip_Txt=iptaban[0]+"."+iptaban[1]+"."+iptaban[2]+"."+"0"
self.son_ip_Txt=iptaban[0]+"."+iptaban[1]+"."+iptaban[2]+"."+"255"
self.m_textCtrl2.SetLabel(self.baslangic_ip_Txt)
self.m_textCtrl3.SetLabel(self.son_ip_Txt)
self.satirSayisi=255
self.satirisim()
def portTara(self,event):
ip_scanner.iplist=[]
self.m_grid3.DeleteRows(0,self.m_grid3.GetNumberRows(),True)
self.m_button2.SetLabel("Scanning")
c1=self.baslangic_ip_Txt.split(".")
c2=int(c1[3])
d1=self.son_ip_Txt.split(".")
d2=int(d1[3])
aaa = ip_scanner.ip_scan(c2,d2)
if len(aaa)!=0:
self.m_grid3.AppendRows(len(aaa))
for bbb in range(0,len(aaa)):
self.m_grid3.SetCellValue(bbb,0,aaa[bbb])
else:
self.m_grid3.SetCellValue(0,0,"cihaz bulunamadi")
self.m_button2.SetLabel("Start Scan")
def satirEkle(self):
self.m_grid3.AppendRows()
def satirisim(self):
for i in range(0,self.satirSayisi):
isim=str(i+1)+". "+"device IP"
self.m_grid3.SetRowLabelValue(i,isim)
#print dir(self.m_grid3)
#print dir(wx.TextCtrl)
def baslangic_ip(self,event):
self.baslangic_ip_Txt=event.GetString()
def son_ip(self,event):
self.son_ip_Txt=event.GetString()
#https://stackoverflow.com/questions/2269827/how-to-convert-an-int-to-a-hex-string
# direkt cmd deki komutu simule ediyor C:\Windows\system32>ping -n 1 -w 300 172.16.215.146
def main():
app = wx.App(False)
frame = araYuzDeneme(None)
frame.Show(True)
app.MainLoop()
#start the applications
if __name__ == '__main__':
main()